agepy.mag.hysteresis.linear_correction
- linear_correction(*hysteresis, saturation_percentage=10)
Subtracts a linear fit to the saturation regions.
Linear fit is performed on the saturation region with respect to the magnetic field. The saturation region is defined by a percentage value relative to the number of data points of a single branch. A function
f(x) = fit_slope * xis then subtracted from the magnetization. Hysteresis data can be supplied either as one tuple containing the magntic field and magnetization repectively or as multiple tuples containing the two hysteresis branches.- Parameters:
- *hysteresis: ArrayLike
One or two 2-D arrays of shape (2, n) containing the magnetic field and magnetization of length n in the first axis.
- saturation_percentage: float, default 10
Percentage value of points in at the end of the hysteresis branches belonging to the saturation region.
- Returns:
NDArrayThe corrected magnetization values. If
hysteresisis supplied as whole sequence , then a 1-D array with the same length as the magnetization is returned. Ifhysteresisis two branches, a 2-D array is returned containing the two magnetization branches in the first axis.
- Return type:
ndarray[Any,dtype[TypeVar(_ScalarType_co, bound=generic, covariant=True)]]
Examples
Viable example inputs.
>>> linear_correction((H, M), saturation_percentage=10) array([<M-values>])
>>> linear_correction((H1, M1), (H2, M2), saturation_percentage=10) array([[<M1-values>], [<M2-values>]])
>>> hyst = array([H, M]) >>> linear_correction(hyst, saturation_percentage=10) array([<M-values>])
>>> hyst = array([[H1, M1], [H2, M2]]) >>> linear_correction(*hyst, saturation_percentage=10) array([[<M1-values>], [<M2-values>]])