Skip to content

dosy#

DOSY: invert Stejskal-Tanner decays for \(P(D)\), build a shift-vs-\(D\) map, estimate \(r_H\).

assess #

assess(
    b_values: ndarray,
    intensities: ndarray,
    min_snr: float = 10.0,
    min_decay_fraction: float = 0.2,
) -> ColumnQuality

Report SNR, decay fraction and whether a decay curve is worth inverting at all.

diffusion_grid #

diffusion_grid(
    d_min: float = 1e-12,
    d_max: float = 1e-08,
    n_points: int = 128,
) -> ndarray

Log-spaced grid of diffusion coefficients (m²/s) to invert onto.

fit_bi #

fit_bi(
    b_values: ndarray, intensities: ndarray
) -> tuple[float, float, float, float, float] | None

Two-component fit returning (I1, D1, I2, D2, residual_rms) with \(D_1 < D_2\), or None.

fit_mono #

fit_mono(
    b_values: ndarray, intensities: ndarray
) -> tuple[float, float, float] | None

Fast path: single-exponential fit returning (I0, D, residual_rms), or None.

hydrodynamic_radius #

hydrodynamic_radius(
    d: float, temperature_k: float, viscosity_pa_s: float
) -> float

Stokes-Einstein radius \(r_H = k_B T / (6\pi\eta D)\) in metres; NaN for non-physical input.

invert #

invert(
    b_values: ndarray,
    intensities: ndarray,
    method: Literal["contin", "maxent"] = "contin",
    alpha: float | None = None,
    d_min: float = 1e-12,
    d_max: float = 1e-08,
    n_points: int = 128,
    min_snr: float = 10.0,
    min_decay_fraction: float = 0.2,
) -> InversionResult

Invert one decay \(I(b) = \int P(D) e^{-bD}\,dD\) for \(P(D)\).

b_values are in s/m². method is "contin" (regularised non-negative inversion) or "maxent" (maximum entropy). alpha is the regularisation strength; it is chosen automatically when not given. A curve whose signal-to-noise ratio or decay is too low returns a zero distribution with quality.invertible false.

known_solvents #

known_solvents() -> list[str]

Names of the solvents with a tabulated viscosity.

map_from_spectrum #

map_from_spectrum(
    spec: Spectrum2D,
    method: Literal["contin", "maxent"] = "contin",
    d_min: float = 1e-12,
    d_max: float = 1e-08,
    n_points: int = 128,
    solvent: str | None = None,
    temperature_k: float | None = None,
    viscosity_pa_s: float | None = None,
) -> DosyMap

Build a chemical-shift vs \(D\) map from a pseudo-2D diffusion spectrum.

spec.f1 must carry the b-values (s/m²) the importer put there; spec.f2 is the chemical-shift axis. The returned map's d_axis replaces frequency on F1.

solvent_viscosity #

solvent_viscosity(
    solvent: str, temperature_k: float = 298.15
) -> float | None

Dynamic viscosity \(\eta\) (Pa·s) of a tabulated NMR solvent at temperature_k, or None.