Metronix Calibration¶
Metronix calibration files are ASCII files with some metadata and calibration information for when the induction coil is operating with either the pre-amplifier chopper on or chopper off.
The units of metronix calibration files are interpreted to be:
Frequency in Hz
Magnitude in V/(nT*Hz)
Phase in degrees
Resistics will automatically convert these units to:
Frequency in Hz
Magnitude in mV/nT (including any static gain)
Phase in radians
Naming in the project environment¶
When using the project environment, resistics automatically searches for calibration files in the calData folder. Metronix files should be named according to the following specification:
Important
[*][SENSOR][SERIAL].TXT
where,
SENSOR is the sensor type
SERIAL is the serial number
[*] represents any general string
As an example, consider an induction coil with:
sensor type MFS06
sensor serial number 365
Then the file could be named:
MFS06365.TXT
Or could have any leading text such as: cal_MFS06365.TXT
Example¶
The class CalibrateIO
can be used to read in Metronix calibration files.
1 2 3 4 5 6 7 8 | from datapaths import calPath, calImages
from resistics.calibrate.io import CalibrationIO
# read metronix calibration data with chopper off
filepath = calPath / "Hz_MFS06307.TXT"
calIO = CalibrationIO(filepath, "metronix", chopper=False, extend=False)
calDataChopperOff = calIO.read()
calDataChopperOff.printInfo()
|
When using CalibrateIO
to read a calibration file, the filepath and calibration data format need to be defined. Further, the chopper to read in and extension rule can be optionally passed.
The method read()
returns a CalibrationData
object. Information about this can be printed to the terminal, giving:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 12:26:24 CalibrationData: ####################
12:26:24 CalibrationData: CALIBRATIONDATA INFO BEGIN
12:26:24 CalibrationData: ####################
12:26:24 CalibrationData: Filename = calData\Hz_MFS06307.TXT
12:26:24 CalibrationData: Serial = 307
12:26:24 CalibrationData: Sensor =
12:26:24 CalibrationData: Static gain = 1.00
12:26:24 CalibrationData: Chopper = False
12:26:24 CalibrationData: Number of frequency points = 25
12:26:24 CalibrationData: Calibration data:
12:26:24 CalibrationData: Frequency [Hz] Mag. [mv/nT] Phase [rad]
12:26:24 CalibrationData: 1.00000000 185.76 1.99
12:26:24 CalibrationData: 1.46780000 297.86 1.68
12:26:24 CalibrationData: 2.15440000 431.76 1.37
12:26:24 CalibrationData: 3.16230000 564.44 1.06
12:26:24 CalibrationData: 4.64160000 673.50 0.79
12:26:24 CalibrationData: 6.81300000 745.68 0.56
12:26:24 CalibrationData: 10.00000000 787.25 0.39
12:26:24 CalibrationData: 14.67800000 809.83 0.27
12:26:24 CalibrationData: 21.54400000 819.17 0.18
12:26:24 CalibrationData: 31.62300000 823.40 0.12
12:26:24 CalibrationData: 46.41600000 825.83 0.08
12:26:24 CalibrationData: 68.13000000 821.44 0.04
12:26:24 CalibrationData: 100.00000000 826.59 0.03
12:26:24 CalibrationData: 146.78000000 827.91 0.01
12:26:24 CalibrationData: 215.45000000 827.59 -0.01
12:26:24 CalibrationData: 316.23000000 827.04 -0.03
12:26:24 CalibrationData: 464.16000000 827.32 -0.05
12:26:24 CalibrationData: 681.30000000 828.12 -0.08
12:26:24 CalibrationData: 1000.00000000 829.22 -0.12
12:26:24 CalibrationData: 1467.80000000 828.29 -0.19
12:26:24 CalibrationData: 2154.50000000 816.08 -0.28
12:26:24 CalibrationData: 3162.30000000 797.63 -0.42
12:26:24 CalibrationData: 4641.70000000 720.48 -0.63
12:26:24 CalibrationData: 6813.00000000 619.91 -0.74
12:26:24 CalibrationData: 10000.00000000 571.23 -0.97
12:26:24 CalibrationData: ####################
12:26:24 CalibrationData: CALIBRATIONDATA INFO END
12:26:24 CalibrationData: ####################
|
Notice that the sensor information is blank. This is because Metronix files do not include information about the sensor type.
Once the calibration data file is read in, the calibration curve can be viewed by using the view()
method of CalibrationData
. By passing a matplotlib figure to this, the layout of the plot can be controlled.
10 11 12 13 14 15 16 17 | # plot
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8, 8))
calDataChopperOff.view(fig=fig, label="Chopper off", legend=True)
fig.tight_layout(rect=[0, 0.02, 1, 0.96])
plt.show()
fig.savefig(calImages / "calibrationMetronixChopperOff.png")
|
The same calibration file can be read again, but this time with extension of the data too. The parameters of CalibrationIO
can be reset by using the refresh()
method.
19 20 21 22 | # extend True
calIO.refresh(filepath, "metronix", chopper=False, extend=True)
calDataExtend = calIO.read()
calDataExtend.printInfo()
|
Now the extended calibration data can be plotted against the original, unextended version.
24 25 26 27 28 29 30 | # plot the two together
fig = plt.figure(figsize=(8, 8))
calDataExtend.view(fig=fig, label="Chopper off, Extend True", legend=True)
calDataChopperOff.view(fig=fig, label="Chopper off", legend=True)
fig.tight_layout(rect=[0, 0.02, 1, 0.96])
plt.show()
fig.savefig(calImages / "calibrationMetronixExtend.png")
|
Giving the possibly unexpected plot below.
Note
Remember that extension happens in the original units of the calibration data. For Metronix data files, this is in V/(nT*Hz). Then the data is converted to mV/nT. The fact that the original data is a frequency density gives the slopes in the magnitude extension.
The chopper on data in the Metronix calibration file can be read by specifying chopper=True
to CalibrationIO
as shown below.
32 33 34 35 36 37 38 39 40 41 42 43 44 | # read in the chopper on
calIO.refresh(filepath, "metronix", chopper=True, extend=False)
calDataChopperOn = calIO.read()
calDataChopperOn.printInfo()
# plot the three together
fig = plt.figure(figsize=(8, 8))
calDataChopperOff.view(fig=fig, label="Chopper off", legend=True)
calDataChopperOn.view(fig=fig, label="Chopper on", legend=True)
fig.tight_layout(rect=[0, 0.02, 1, 0.96])
plt.show()
fig.savefig(calImages / "calibrationMetronixChopperOn.png")
|
And the the chopper on data can be compared to the chopper off data in much the same way as the above comparison with the extended data. The comparison is shown in the following plot.
Finally, calibration data can be written out in a simple ASCII format.
45 46 | # write as the ASCII format
calIO.writeInternalFormat(calDataChopperOn, calPath / "metronix2ascii.TXT")
|
Giving the file below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | Serial = 307
Sensor =
Static gain = 1
Magnitude unit = mV/nT
Phase unit = radians
Chopper = True
CALIBRATION DATA
+1.0000e-01 +1.9967e+01 +1.5452e+00
+1.4678e-01 +2.9303e+01 +1.5339e+00
+2.1544e-01 +4.2933e+01 +1.5173e+00
+3.1623e-01 +6.2901e+01 +1.4931e+00
+4.6416e-01 +9.1945e+01 +1.4576e+00
+6.8130e-01 +1.3418e+02 +1.4051e+00
+1.0000e+00 +1.9404e+02 +1.3394e+00
+1.4678e+00 +2.7551e+02 +1.2296e+00
+2.1544e+00 +3.8111e+02 +1.0904e+00
+3.1623e+00 +5.0078e+02 +9.1815e-01
+4.6416e+00 +6.1636e+02 +7.2902e-01
+6.8130e+00 +7.0664e+02 +5.4810e-01
+1.0000e+01 +7.6400e+02 +3.9286e-01
+1.4678e+01 +7.9669e+02 +2.7489e-01
+2.1545e+01 +8.1231e+02 +1.8837e-01
+3.1623e+01 +8.2062e+02 +1.2735e-01
+4.6416e+01 +8.2453e+02 +8.4177e-02
+6.8130e+01 +8.2219e+02 +4.5146e-02
+1.0000e+02 +8.2609e+02 +2.8629e-02
+1.4678e+02 +8.2567e+02 +1.0910e-02
+2.1545e+02 +8.2660e+02 -7.6749e-03
+3.1623e+02 +8.2631e+02 -2.6356e-02
+4.6417e+02 +8.2636e+02 -4.8977e-02
+6.8130e+02 +8.2730e+02 -7.8009e-02
+1.0000e+03 +8.2795e+02 -1.2135e-01
+1.4678e+03 +8.2721e+02 -1.8637e-01
+2.1545e+03 +8.1548e+02 -2.8374e-01
+3.1623e+03 +7.9639e+02 -4.2317e-01
+4.6417e+03 +7.1928e+02 -6.2696e-01
+6.8130e+03 +6.1971e+02 -7.4339e-01
+1.0000e+04 +5.7145e+02 -9.7107e-01
|
The internal ascii calibration format writes out values in the following units:
Magnitude in mV/nT (without static gain applied)
Phase in radians
The magnitude is written out without static gain applied, though the static gain value is written out in the internally formatted calibration file. When this file is read in again, the static gain will be applied once more.
Chopper is True as the calibration data written out was for chopper on. There is no sensor information as Metronix calibration files do not include information about the sensor.
Complete example script¶
For the purposes of clarity, the example script in full.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | from datapaths import calPath, calImages
from resistics.calibrate.io import CalibrationIO
# read metronix calibration data with chopper off
filepath = calPath / "Hz_MFS06307.TXT"
calIO = CalibrationIO(filepath, "metronix", chopper=False, extend=False)
calDataChopperOff = calIO.read()
calDataChopperOff.printInfo()
# plot
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8, 8))
calDataChopperOff.view(fig=fig, label="Chopper off", legend=True)
fig.tight_layout(rect=[0, 0.02, 1, 0.96])
plt.show()
fig.savefig(calImages / "calibrationMetronixChopperOff.png")
# extend True
calIO.refresh(filepath, "metronix", chopper=False, extend=True)
calDataExtend = calIO.read()
calDataExtend.printInfo()
# plot the two together
fig = plt.figure(figsize=(8, 8))
calDataExtend.view(fig=fig, label="Chopper off, Extend True", legend=True)
calDataChopperOff.view(fig=fig, label="Chopper off", legend=True)
fig.tight_layout(rect=[0, 0.02, 1, 0.96])
plt.show()
fig.savefig(calImages / "calibrationMetronixExtend.png")
# read in the chopper on
calIO.refresh(filepath, "metronix", chopper=True, extend=False)
calDataChopperOn = calIO.read()
calDataChopperOn.printInfo()
# plot the three together
fig = plt.figure(figsize=(8, 8))
calDataChopperOff.view(fig=fig, label="Chopper off", legend=True)
calDataChopperOn.view(fig=fig, label="Chopper on", legend=True)
fig.tight_layout(rect=[0, 0.02, 1, 0.96])
plt.show()
fig.savefig(calImages / "calibrationMetronixChopperOn.png")
# write as the ASCII format
calIO.writeInternalFormat(calDataChopperOn, calPath / "metronix2ascii.TXT")
|
The calibration file the script is reading.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | Calibration measurement with Solartron
Metronix GmbH, Kocherstr. 3, 38120 Braunschweig
Magnetometer: 365 Date: 27/11/08 Time: 11:11:38
FREQUENCY MAGNITUDE PHASE
Hz deg
Chopper On
+1.0000E-01 +2.0043E-01 +8.8520E+01
+1.2589E-01 +2.0034E-01 +8.8161E+01
+1.5849E-01 +2.0017E-01 +8.7667E+01
+1.9953E-01 +2.0011E-01 +8.7117E+01
+2.5119E-01 +2.0016E-01 +8.6402E+01
+3.1623E-01 +2.0019E-01 +8.5552E+01
+3.9811E-01 +1.9947E-01 +8.4367E+01
+5.0119E-01 +1.9940E-01 +8.2918E+01
+6.3095E-01 +1.9849E-01 +8.1023E+01
+7.9430E-01 +1.9689E-01 +7.8954E+01
+1.0000E+00 +1.9510E-01 +7.6254E+01
+1.2589E+00 +1.9176E-01 +7.2912E+01
+1.5849E+00 +1.8711E-01 +6.8955E+01
+1.9952E+00 +1.8039E-01 +6.4078E+01
+2.5119E+00 +1.7102E-01 +5.8623E+01
+3.1623E+00 +1.5875E-01 +5.2421E+01
+3.9810E+00 +1.4449E-01 +4.6101E+01
+5.0118E+00 +1.2745E-01 +3.9381E+01
+6.3095E+00 +1.0974E-01 +3.3023E+01
+7.9430E+00 +9.2439E-02 +2.7481E+01
+1.0000E+01 +7.6461E-02 +2.2411E+01
+1.2589E+01 +6.2517E-02 +1.8156E+01
+1.5849E+01 +5.0509E-02 +1.4523E+01
+1.9952E+01 +4.0600E-02 +1.1539E+01
+2.5119E+01 +3.2444E-02 +9.1190E+00
+3.1622E+01 +2.5959E-02 +7.0988E+00
+3.9810E+01 +2.0616E-02 +5.5029E+00
+5.0118E+01 +1.6420E-02 +4.4471E+00
+6.3095E+01 +1.3146E-02 +3.3092E+00
+7.9430E+01 +1.0399E-02 +2.3841E+00
+1.0000E+02 +8.2636E-03 +1.5609E+00
+1.2589E+02 +6.5602E-03 +8.3949E-01
+1.5849E+02 +5.2332E-03 +2.3482E-01
+1.9952E+02 +4.1432E-03 -4.6963E-01
+2.5118E+02 +3.2917E-03 -1.0720E+00
+3.1622E+02 +2.6122E-03 -1.7975E+00
+3.9810E+02 +2.0748E-03 -2.5889E+00
+5.0118E+02 +1.6473E-03 -3.5470E+00
+6.3094E+02 +1.3067E-03 -4.6898E+00
+7.9430E+02 +1.0360E-03 -6.0646E+00
+1.0000E+03 +8.2162E-04 -7.7787E+00
+1.2589E+03 +6.5076E-04 -9.7948E+00
+1.5849E+03 +5.1474E-04 -1.2441E+01
+1.9952E+03 +4.0614E-04 -1.5666E+01
+2.5118E+03 +3.1859E-04 -2.0111E+01
+3.1622E+03 +2.4617E-04 -2.5492E+01
+3.9810E+03 +1.8636E-04 -3.2122E+01
+5.0117E+03 +1.3435E-04 -3.9112E+01
+6.3094E+03 +9.5229E-05 -4.2706E+01
+7.9430E+03 +7.2220E-05 -4.6970E+01
+9.9995E+03 +5.4496E-05 -5.4995E+01
+1.0000E+04 +5.4500E-05 -5.4988E+01
FREQUENCY MAGNITUDE PHASE
Hz deg
Chopper Off
+1.0000E+00 +1.8611E-01 +1.1410E+02
+1.2589E+00 +1.9840E-01 +1.0386E+02
+1.5849E+00 +2.0421E-01 +9.3422E+01
+1.9953E+00 +2.0263E-01 +8.2185E+01
+2.5119E+00 +1.9428E-01 +7.1237E+01
+3.1623E+00 +1.7901E-01 +6.0768E+01
+3.9811E+00 +1.5954E-01 +5.1025E+01
+5.0119E+00 +1.3766E-01 +4.2242E+01
+6.3095E+00 +1.1590E-01 +3.4394E+01
+7.9430E+00 +9.6266E-02 +2.7719E+01
+1.0000E+01 +7.8837E-02 +2.2634E+01
+1.2589E+01 +6.3878E-02 +1.7903E+01
+1.5849E+01 +5.1205E-02 +1.4319E+01
+1.9952E+01 +4.0978E-02 +1.1342E+01
+2.5119E+01 +3.2722E-02 +8.9618E+00
+3.1623E+01 +2.6096E-02 +7.1141E+00
+3.9810E+01 +2.0736E-02 +5.5471E+00
+5.0118E+01 +1.6447E-02 +4.2488E+00
+6.3095E+01 +1.3140E-02 +3.2258E+00
+7.9430E+01 +1.0422E-02 +2.2666E+00
+1.0000E+02 +8.2896E-03 +1.5141E+00
+1.2589E+02 +6.5791E-03 +8.4879E-01
+1.5849E+02 +5.2351E-03 +1.5632E-03
+1.9952E+02 +4.1479E-03 -4.3138E-01
+2.5119E+02 +3.2948E-03 -1.1863E+00
+3.1622E+02 +2.6164E-03 -1.8097E+00
+3.9810E+02 +2.0787E-03 -2.6202E+00
+5.0118E+02 +1.6486E-03 -3.4773E+00
+6.3095E+02 +1.3096E-03 -4.6120E+00
+7.9430E+02 +1.0388E-03 -5.9924E+00
+1.0000E+03 +8.2342E-04 -7.4157E+00
+1.2589E+03 +6.5300E-04 -9.6045E+00
+1.5849E+03 +5.1570E-04 -1.2194E+01
+1.9952E+03 +4.0744E-04 -1.5371E+01
+2.5118E+03 +3.1944E-04 -2.0146E+01
+3.1622E+03 +2.4673E-04 -2.5515E+01
+3.9810E+03 +1.8680E-04 -3.2187E+01
+5.0118E+03 +1.3456E-04 -3.9213E+01
+6.3094E+03 +9.5246E-05 -4.2806E+01
+7.9430E+03 +7.2206E-05 -4.7006E+01
+1.0000E+04 +5.4489E-05 -5.5006E+01
|