An app has been written for changing easily editing the calibration function I -> B both automatically and manually.
Repo: https://gitlab.cern.ch/dsb/hysteresis/calibration-fn-tuner
This package implements an editable plot for the magnet calibration functions (I -> B) where points can be dragged vertically and plots of the field vs time or current will be updated dynamically.
The calibration function can be loaded from a .csv file, and saved to a .csv file, with the paths specified on the command line.
The dataset that is shown in the plot is loaded from a .parquet file, and the path is also specified on the command line.
The package additionally includes a fit button that fits the calibration to the average of the magnetization and demagnetization lines, i.e. in the middle of the hysteresis loop. The fit is done using LHCPILOT cycles, as they go to the highest energy. This results in the calibration function being at the center of the observed hysteresis loops.
The plots are shown using Qt5 backend in matplotlib, and PyQt5 is therefore required.
Usage
python -m calibration_fn_tuner [-c CALIBRATION_FN_PATH] [-d DATASET_PATH] [-o OUTPUT_PATH]or simply
calibration_fn_tuner [-c CALIBRATION_FN_PATH] [-d DATASET_PATH] [-o OUTPUT_PATH]where:
CALIBRATION_FN_PATHis the path to the calibration function .csv fileDATASET_PATHis the path to the dataset .parquet fileOUTPUT_PATHis the path to save the calibration function .csv file