agepy.mag.hysteresis.faraday_correction
- faraday_correction(*hysteresis, initial_guess, saturation_percentage=10, log_level=20)
Performs a correction of the Faraday-effect via analytic optimization method.
Note: It is recommended to use
optimzed_verdet_correctioninstead as it removes the additional guess of the cos amplitude.Performs optimization of a functional describing the difference between saturation region and analytic expression of the Faraday- effect. The correction might need to be combined with other correction methods (thermal drift, relative shifting, …) to obtain proper looking hysteresis curves. Note, that the optimized functional considers the linearly corrected data, but the function itself does not subtract the linear part. 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.
- initial_guess: Sequence[float, float, float]
Initial guess for verdet constant of the objective lens, amplitude and left shift of cos^2 function.
- saturation_percentage: float, default 10
Percentage value of points in at the end of the hysteresis branches belonging to the saturation region.
- log_level: int, default 10
log behavior of
python.loggingmodule for the optimization results.
- 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.
>>> faraday_correction((H, M), initial_guess=(0.01, 5, 100), saturation_percentage=10) array([<M-values>])
>>> faraday_correction((H1, M1), (H2, M2), initial_guess=(0.01, 5, 100), saturation_percentage=10) array([[<M1-values>], [<M2-values>]])
>>> hyst = array([H, M]) >>> faraday_correction(hyst, initial_guess=(0.01, 5, 100), saturation_percentage=10) array([<M-values>])
>>> hyst = array([[H1, M1], [H2, M2]]) >>> faraday_correction(*hyst, initial_guess=(0.01, 5, 100), saturation_percentage=10) array([[<M1-values>], [<M2-values>]])