models#
Ready-made model functions for fitting.fit(data, models.<name>).
Covers exponential/Gaussian/Lorentzian decay, power law, sigmoid, and CPMG relaxation dispersion models.
bi_exponential
#
bi_exponential(
x: ndarray,
a1: float,
tau1: float,
a2: float,
tau2: float,
offset: float,
) -> ndarray
Two-component (bi-exponential) decay, \(y = A_1\,e^{-x/\tau_1} + A_2\,e^{-x/\tau_2} + c\).
Components are exchangeable; use canonicalize_bi_exponential to fix their order.
cpmg_sdr
#
Static Dephasing Regime (SDR) model: a flat line independent of nu_cpmg.
\(R_2^{\text{eff}} = R_2^{0} + \tfrac{2}{3}\,\gamma^{2} G^{2} \tau_D\)
cpmg_three_site
#
cpmg_three_site(
nu_cpmg: ndarray,
r2_0: float,
d_omega_ab: float,
d_omega_ac: float,
d_omega_bc: float,
k_eff: float,
p_a: float,
p_b: float,
) -> ndarray
Three-site CPMG dispersion — an empirical approximation, not a physical model.
k_eff is a shape parameter only; do not interpret fitted k_eff or delta_omega as physical exchange parameters — fit a Bloch-McConnell model for those.
cpmg_tollinger
#
cpmg_tollinger(
nu_cpmg: ndarray,
r2_0: float,
delta_omega: float,
k_ex: float,
k_ba: float,
) -> ndarray
Two-site exchange dispersion for the slow-exchange limit (Tollinger).
\(R_2^{\text{eff}} = R_2^{0} + k_{AB}(1 - \operatorname{sinc}(\Delta\omega\,\tau_{cp}))\) with \(k_{AB} = k_{\text{ex}} - k_{BA}\).
cpmg_two_site
#
cpmg_two_site(
nu_cpmg: ndarray,
r2_0: float,
delta_omega: float,
k_ex: float,
p_a: float,
) -> ndarray
Two-site exchange CPMG relaxation dispersion — the general Carver–Richards closed form.
nu_cpmg in Hz; delta_omega and k_ex in rad/s; p_a must be the major population (> 0.5).
double_sigmoid
#
double_sigmoid(
x: ndarray,
a1: float,
c1: float,
w1: float,
a2: float,
c2: float,
w2: float,
offset: float,
) -> ndarray
Public API; see the signature for the input/output contract.
exponential_decay
#
Single-rate exponential decay \(y = A\,e^{-x/\tau} + c\).
exponential_plateau
#
exponential_plateau(
x: ndarray,
amplitude: float,
time_constant: float,
offset: float,
) -> ndarray
Exponential build-up to a plateau (saturation-recovery \(T_1\)), \(y = A(1 - e^{-x/\tau}) + c\).
gaussian_decay
#
Gaussian (bell-shaped) decay \(y = A\,e^{-(x/\tau)^{2}} + c\).
gaussian_lorentzian
#
gaussian_lorentzian(
x: ndarray,
a_gauss: float,
tau_gauss: float,
a_lorentz: float,
tau_lorentz: float,
offset: float,
) -> ndarray
Combined Gaussian + Lorentzian decay (Voigt-like).
\(y = A_g\,e^{-(x/\tau_g)^{2}} + A_l\,e^{-x/\tau_l} + c\)
lorentzian_decay
#
Lorentzian decay (exponential in time, Lorentzian in the spectrum), \(y = A\,e^{-x/\tau} + c\).
power_law
#
Power-law relationship \(y = A\,x^{p} + c\).
sigmoid
#
Sigmoid (S-shaped) transition \(y = \frac{A}{1 + e^{-(x - x_0)/w}} + c\).
stretched_exponential
#
stretched_exponential(
x: ndarray,
amplitude: float,
time_constant: float,
beta: float,
offset: float,
) -> ndarray
Stretched exponential (Kohlrausch–Williams–Watts), \(y = A\,e^{-(x/\tau)^{\beta}} + c\).