Here I assembled essential information on calibrating the electromagnet (EM) for the TIRF experiment. When I say calibration, I refer to the relationship between the applied voltages and the resulting magnetic field vector. In particular, we need to know what voltage values we need to apply in order to create a desired magnetic field. For the case of a linear relationship between the applied voltage and the created magnetic field, I’ve come up with an elegant calibration method requiring just a handful of data.
In the experiment, we use GMW 5204 Vector Projected Field electromagnet.
The company does not provide much information on the EM principle, but there is some information in this recent paper.
According to this paper, EM has three poles, each provided by a coil wrapped around a ferromagnetic core. The poles are located in the same plain at the same distance from the axis of symmetry, and their position vectors are at
The magnetic field is linear between -1000 and 1000 Oe, or -100 and 100 mT, and shows non-linearities at higher fields.
The EM manufacturer did not provide any information on calibrating the magnet, so we needed to figure it out ourselves. In the paper, they employed a simple artificial neural network trained on "300 000 current combinations” for the calibration. We don’t need strong magnetic fields for our experiment, so we might get by with the linear regime. In this case, the calibration does not require that much data and can be done neatly, as described below.
Before we start, I want to stress that the calibration is done for a specific point in space at a specific distance and orientation with respect to the magnet. If we want to know the magnetic field at a different point, we’ll need to recalibrate.
First, I’d like to provide some theoretical considerations that might help with the intuition of what is going on. At least, this is how I understand it.
In the linear case, each pole can be treated as a magnetic dipole, which creates the magnetic field according to
where r is the coordinate vector where the magnetic is calculated given with respect to the dipole position,
EM can be treated as three dipoles located in the same plain at the same distance from the axis of symmetry, and their position vectors are at
where each partial derivative in the matrix is just a fancy way to express the proportionality coefficient between the corresponding field component and the voltage and is the same as the slope of the B-vs-V plot. As a result, in order to produce field B, we need to apply the set of voltage values given by
We call
In the non-linear case, the above approach does not work, so the simplest solution is to use deep learning. We’ll need much data for training and validation, including the data where all voltages are applied simultaneously.
This is the model I ended up with:
For the linear case, we tested out our approach in real life and it works! For example, we can created a rotating magnetic field.
I decided to separate data generation calibration and testing into separate files as if it was a real experiment.
generate_field.ipynb generates a data set with corresponding voltage and magnetic field values.
linear_calibration.ipynb does linear regression of linear B_vs_V data and creates the calibration matrix.
nonlinear_calibration.ipynb applies deep learning to non-linear B_vs_V data.
test.ipynb tests both cases on creating a rotating field.
data/full_calibration_set.csv - full set for non-linear calibration via deep learning.
data/individual_calibration_set.csv - data set with only one voltage applied at a time.
data/lin_cal_mat.csv - calibration matrix obtained in the linear case.
data/model.h5 - neural network trained on the non-linear data.
data/validation_set.csv - validation set with non-linear data for deep learning