calamari.io.load#

calamari.io.load(path, fmt=None)#

Parse a magnetometry file into a Measurement.

The dialect is detected from file content (never the extension: every Quantum Design export is .dat). A file that no registered loader claims is an error – see the module docstring’s strictness table. Use is_supported_file() to probe without raising.

Parameters:
  • path (Path | str) – File to parse.

  • fmt (str | None) – Force a dialect, bypassing content sniffing. Accepts a registered loader’s format_name (e.g. 'MPMS3', case-insensitive). Useful for a file whose header is damaged enough to defeat sniffing but whose dialect the caller knows.

Return type:

Measurement

Returns:

calamari.measurement.Measurement – Always carrying a real dialect in data_format – the format_name of whichever loader parsed it.

Raises:
  • UnsupportedFileError – If the file was read but no registered loader recognises its content (auto-detection only – an explicit fmt skips sniffing).

  • UnknownFormatError – If fmt is given but names no registered loader. The file is not read in this case.

  • FileParseError – If a recognised export has malformed required sections or CSV structure.

  • OSError – If the file cannot be read (missing, a directory, no permission).