The normal Calibration function fits a piecewise linear line to the anhysteretic field by taking the average between the upramp and the downramp, making the resulting field residual evenly distributed over the x-axis, meaning downramp and upramp have effectively the same “importance”.
We can fit the calibration function to the upramp only, and achieve a residual with a profile similar to

In this case we see significant hysteresis along the x-axis, especially as we approach 4800 A from left to right. However the downramp non-linearities still risk washing out the hysteresis features, so we apply a logarithm (plus a small shift to get rid of negative components), and see
In red we see a significantly improved hysteresis separation and dynamic effects on the upramp, with similar numerical range to the downramp.
New calibration function
The new calibration function is adapted from SPS_MB_I2B_CALIBRATION_FN_v7.csv.
Transformation
CALIBRATION_FN_PATH = pathlib.Path("~/cernbox/hysteresis/calibration_fn/SPS_MB_I2B_UPRAMP_CALIBRATION_FN_v1.csv").expanduser()
transforms = TransformCollection([
DiscreteFunctionTransform.from_csv(CALIBRATION_FN_PATH),
LogTransform(bias=0.0005)
])Example training
A TFT trained on Dipole datasets v4 with the feature engineering applied is trained with TFTMBI-47.