calamari.sample#

Sample metadata and unit conversion between raw SQUID readings and physics units.

A Sample bundles the physical-sample facts (mass, molar mass, magnetic-ion count per formula unit, shape, orientation, …) that a raw moment reading (emu) needs to become a physically meaningful quantity (Bohr magnetons per formula unit / per ion, molar or mass susceptibility). Almost none of those facts can be inferred from a data file: the mass is the sole exception, and only because the operator may have typed one into the header. This module therefore never invents a molar mass, ion count, or mass default of its own. Every conversion either has the fact it needs or raises a ValueError naming exactly which Sample field is missing.

Because the mass can come from two places – the file or the caller – Sample records which, on Sample.mass_source. Normalised moments, susceptibilities and Curie constants scale inversely with the supplied mass; inferred effective moments scale with its inverse square root, so “where did this mass come from” is not bookkeeping: it is the difference between a result you can defend and one you cannot.

This mirrors the asymmetry toolkit’s “typed policy object, not dict” lesson: bundling the sample facts into one frozen, named, documented dataclass (rather than passing loose mass/molar_mass/… keyword arguments around, or hiding them in an untyped dict) makes every call site self-describing and catches missing/misspelled fields at construction time rather than deep inside a conversion.

Conventions#

See calamari.constants for the underlying CODATA factors and mu_eff_from_curie_constant() below for the effective-moment formula. All arithmetic is CGS-Gaussian (moments in emu, fields in Oe, masses in grams once converted from the header’s milligrams), matching the rest of calamari.

Functions

curie_constant_from_inverse_slope

Curie constant C from a straight-line fit to 1/chi vs T.

mu_eff_from_curie_constant

Estimate the Curie-Weiss effective moment from a Curie constant.

Classes

Sample

The physical-sample facts needed to convert raw readings to physics units.