calamari.io.base#
Loader abstract base class and content-sniffing registry.
Unlike the extension-keyed registry in the asymmetry toolkit (from which
this design is adapted), calamari dispatches by file content, not file
extension. Quantum Design instruments write everything as .dat
regardless of dialect, instrument, or even whether the file is a
measurement at all (log/environment files share the extension too), so
an extension-based registry cannot distinguish MPMS3 from an
unrelated .dat. Instead every loader implements a cheap
BaseLoader.sniff() over the first few dozen header lines, and
LoaderRegistry.detect() reads those lines once and offers them to
each registered loader in turn.
This keeps the door open for other vendors: a new instrument format is
added by writing a loader with its own sniff and registering it; no
existing code changes.
Functions
Read exactly the leading lines a loader's |
Classes
Interface every file-format loader must implement. |
|
Central registry of available content-sniffing loaders. |