hyloa.gui.correction_window module
Code to automize and incorporate in the gui a standard correction process for hystersis loops
- hyloa.gui.correction_window.correct_hysteresis_loop(app_instance)[source]
Opens a hysteresis loop correction window in a sub-MDI window. This window allows the user to set all parameters for the correction of a selected hysteresis loop and visualize the results.
Help guide:
Select the main data file and choose the four X/Y columns that define the Up and Down branches of the loop.
These selections must correspond to the same variables shown in the plotting window.
Optionally, you may select a second file where corrected data will be saved.
The corrected columns will be written in the corresponding positions of the destination grid, so the layout of the two 2x2 grids matches (Up/Down x X/Y). It is suggested to use a duplicate file to create the destination file, so that the original data are not overwritten. It is possible to save the corrected data after the drift correction step and after the symmetrization step. If the symmetrization step is performed, the symmetrized data will be saved otherwise the drift-corrected data will be saved.
You can shift and scale the field array. Remember that the first change that is applied is the shift and then the scaling.
These changes are not incremental, so you can safely change the value and press the button again.
Set the x_start / x_end limits for each branch. If the field is scaled, remember that
the fit ranges must be chosen according to the original, non-scaled data; the scaling will be applied later.
Configure the first fit block, which is used to correct possible drifts at the end of each branch.
You may use any polynomial or analytical function, but it is strongly recommended to avoid excessively high polynomial orders. The constant term MUST be the first parameter, exactly as shown in the example below. (e.g. ‘a + b*x + c*x**2’). To proceed with the fit of the physical quantities, you must first press the button to perform the drift correction.
There is also the option to replace one branch by duplicating the other. This operation can only be performed on the correct data.
Configure the second fit block. This works exactly like the ‘Quick Fit’ window and can be used
to extract properties such as coercive field or remanence. This second fit operates on the corrected data. So in this case the fit ranges must be chosen according to the scaled data. It is recommended to use simple low-order polynomials to fit coercivity or remanence regions. If there’s a significant discrepancy between the coercives, you can shift the field values and rerun the fit by pressing the appropriate button. Note that this time the shift is incremental, so a second shift will be applied to data already shifted by the first shift.
Cubic spline fitting and symmetrization:
After the drift correction, you may fit each branch using a cubic B-spline. This step is mainly intended for data symmetrization and for the estimation of the anisotropy field. The smoothing parameter controls how closely the spline follows the data: - s = 0 corresponds to an exact interpolation of the points; - s > 0 allows for smoothing and helps reduce the impact of noise. A reasonable value depends on the data quality and on the estimated experimental error.
- Parameters:
app_instance (MainApp) – The main application instance containing dataframes and logger.