Skip to content

Ensemble functions

This module contains functions for computing simple fits and models.

antisymmetric_lorentz(H, dH, Hr, Vas)

Antisymmetric Lorentzian function.

Parameters:

Name Type Description Default
H

applied field in A/m

required
dH

half width at half maximum in A/m

required
Hr

resonance field in A/m

required
Source code in cmtj/models/ensemble.py
29
30
31
32
33
34
35
36
37
38
def antisymmetric_lorentz(H, dH, Hr, Vas):
    """
    Antisymmetric Lorentzian function.
    :param H: applied field in A/m
    :param dH: half width at half maximum in A/m
    :param Hr: resonance field in A/m
    """
    dH2 = dH**2
    dHr = H - Hr
    return Vas * dH * dHr / (np.power(dHr, 2) + dH2)

meinert_model(phi, V1, V2, phase_offset, offset)

Fits to Meinert model.

Parameters:

Name Type Description Default
phi

angle in degrees, given parameter

required
V1

(Hfl/Hext), fitting parameter

required
V2

(Va*Hdl/Heff), fitting parameter

required
phase_offset

phase offset in degrees, fitting parameter

required
offset

offset in V, fitting parameter V2omega = (Acos(2(phi - phase_offset)) - B)*cos(phi - phase_offset) + offset

required
Source code in cmtj/models/ensemble.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def meinert_model(phi, V1, V2, phase_offset, offset):
    """
    Fits to Meinert model.
    :param phi: angle in degrees, given parameter
    :param V1: (Hfl/Hext), fitting parameter
    :param V2: (Va*Hdl/Heff), fitting parameter
    :param phase_offset: phase offset in degrees, fitting parameter
    :param offset: offset in V, fitting parameter
    V2omega = (Acos(2(phi - phase_offset)) - B)*cos(phi - phase_offset) + offset
    """
    deg_rad = np.deg2rad(phi - phase_offset)
    return (V1 * np.cos(2 * (deg_rad)) - V2) * np.cos(deg_rad) + offset

mixed_lorentz(H, dH, Hr, Va, Vas)

Mixed Lorentzian function.

Parameters:

Name Type Description Default
H

applied field in A/m

required
dH

half width at half maximum in A/m

required
Hr

resonance field in A/m

required
Va

amplitude of symmetric Lorentzian

required
Vas

amplitude of antisymmetric Lorentzian

required
Source code in cmtj/models/ensemble.py
41
42
43
44
45
46
47
48
49
50
51
def mixed_lorentz(H, dH, Hr, Va, Vas):
    """
    Mixed Lorentzian function.
    :param H: applied field in A/m
    :param dH: half width at half maximum in A/m
    :param Hr: resonance field in A/m
    :param Va: amplitude of symmetric Lorentzian
    :param Vas: amplitude of antisymmetric Lorentzian
    """
    return symmetric_lorentz(H, dH, Hr, Va) + antisymmetric_lorentz(
        H, dH, Hr, Vas)

symmetric_lorentz(H, dH, Hr, Vs)

Symmetric Lorentzian function.

Parameters:

Name Type Description Default
H

applied field in A/m

required
dH

half width at half maximum in A/m

required
Hr

resonance field in A/m

required
Source code in cmtj/models/ensemble.py
18
19
20
21
22
23
24
25
26
def symmetric_lorentz(H, dH, Hr, Vs):
    """
    Symmetric Lorentzian function.
    :param H: applied field in A/m
    :param dH: half width at half maximum in A/m
    :param Hr: resonance field in A/m
    """
    dH2 = dH**2
    return Vs * dH2 / ((H - Hr)**2 + dH2)