calamari.simulate.mpms3_lines#

calamari.simulate.mpms3_lines(*, title='synthetic', app='SQUID AC', sample_material='SyntheticSample', sample_mass_mg=10.0, sample_shape=None, sample_comment=None, date='1/29/2020', time_str='10:00 AM', unit_system='emu', temperature_K, field_oe, vsm_moment_emu=None, vsm_moment_err_emu=None, dc_moment_emu=None, dc_moment_err_emu=None, chi_real=None, chi_imag=None, ac_frequency_hz=None, ac_drive_oe=None, transport_action=None, extra_info=None, extra_columns=None)#

Build the lines of a synthetic MPMS3-dialect [Header]/[Data] file.

Reproduces the MPMS3 signature (the ; MPMS3 Data File comment and a BYAPP,SQUID ... line – see calamari.io.quantum_design.detect_format()) and, critically, the reversed INFO,<value>,<KEY> sample-metadata ordering (value first, KEY last) that distinguishes this dialect from key-before-value ordering.

Parameters:
  • title (str) – Free-form TITLE value. MPMS3’s TITLE is a descriptive run name, NOT the measurement type – that comes from app instead.

  • app (str) – BYAPP value, e.g. 'SQUID AC'/'SQUID DC'/'SQUID VSM'. Note MPMS3’s BYAPP is known to say “SQUID AC” even for DC runs in real files; pair app='SQUID AC' with only dc_moment_emu (no chi_real/chi_imag) to reproduce that trap in a test.

  • sample_material (str | None) – Written as reversed INFO lines when not None (sample_mass_mg as SAMPLE_MASS, sample_material as SAMPLE_MATERIAL, etc.) and omitted entirely when None, so a test can also exercise the “field absent from header” path.

  • sample_mass_mg (float | None) – Written as reversed INFO lines when not None (sample_mass_mg as SAMPLE_MASS, sample_material as SAMPLE_MATERIAL, etc.) and omitted entirely when None, so a test can also exercise the “field absent from header” path.

  • sample_shape (str | None) – Written as reversed INFO lines when not None (sample_mass_mg as SAMPLE_MASS, sample_material as SAMPLE_MATERIAL, etc.) and omitted entirely when None, so a test can also exercise the “field absent from header” path.

  • sample_comment (str | None) – Written as reversed INFO lines when not None (sample_mass_mg as SAMPLE_MASS, sample_material as SAMPLE_MATERIAL, etc.) and omitted entirely when None, so a test can also exercise the “field absent from header” path.

  • date (str) – Human-readable M/D/YYYY / H:MM AM/PM tokens embedded in the FILEOPENTIME line. The numeric epoch written alongside them is derived using a deliberate 1904-origin fixture offset (see _LABVIEW_UNIX_OFFSET_S). It tests that date parsing uses the readable token; it does not reproduce the empirically supported 1899-12-30 origin or instrument timezone handling.

  • time_str (str) – Human-readable M/D/YYYY / H:MM AM/PM tokens embedded in the FILEOPENTIME line. The numeric epoch written alongside them is derived using a deliberate 1904-origin fixture offset (see _LABVIEW_UNIX_OFFSET_S). It tests that date parsing uses the readable token; it does not reproduce the empirically supported 1899-12-30 origin or instrument timezone handling.

  • unit_system (str) –

    Which unit selection to reproduce in the column-name suffixes (see _MPMS3_UNIT_SUFFIXES). Default 'emu': field in (Oe), moment in (emu), susceptibility in (emu/Oe), drive in (Oe). With 'Am2' the same quantities are labelled (T), (Am2), (Am2/T) and (T).

    Note this changes only the labels: the arrays you pass are written verbatim. That is deliberate – it lets a test supply known numbers, label them A m^2, and assert that moment_emu returns them scaled to emu. The parameter names below keep their canonical-unit spellings for that reason.

  • extra_info (dict[str, str] | None) – Additional {KEY: value} header lines, written in the MPMS3 reversed form INFO,<value>,<KEY>. Values are written verbatim, so {"SAMPLE_MASS": ""} reproduces the blank-value line real files carry for every sample property the operator left unset, and {"MOTOR_SERIAL_NUMBER": "SYNTHETIC-MODULE"} reproduces an instrument key outside calamari’s known-key set.

  • extra_columns (dict[str, ArrayLike] | None) – Additional {column_name: values} written verbatim after the standard columns. For exercising parser behaviour against columns calamari does not read but real files carry – sibling columns like AC X' Std Err. (emu/Oe), near-miss names like Min. Temperature (K), an unused mode’s empty column alongside a populated one, or a column with an unrecognised unit.

  • temperature_K (ArrayLike) – Required. Always written as the first two [Data] columns (Temperature (K), Magnetic Field (Oe)).

  • field_oe (ArrayLike) – Required. Always written as the first two [Data] columns (Temperature (K), Magnetic Field (Oe)).

  • vsm_moment_emu (ArrayLike | None) – A VSM measurement: written as Moment (emu) and M. Std. Err. (emu), the VSM application’s columns.

  • vsm_moment_err_emu (ArrayLike | None) – A VSM measurement: written as Moment (emu) and M. Std. Err. (emu), the VSM application’s columns.

  • dc_moment_emu (ArrayLike | None) –

    A DC scan: written as DC Moment Free Ctr (emu) and DC Moment Err Free Ctr (emu), the DC-scan application’s columns.

    These are different measurements; choose the argument matching the instrument mode. Both are exposed by moment_emu, with explicit selection when a file contains both. For a combined run, supply both arrays with NaN where that mode has no measurement.

  • dc_moment_err_emu (ArrayLike | None) –

    A DC scan: written as DC Moment Free Ctr (emu) and DC Moment Err Free Ctr (emu), the DC-scan application’s columns.

    These are different measurements; choose the argument matching the instrument mode. Both are exposed by moment_emu, with explicit selection when a file contains both. For a combined run, supply both arrays with NaN where that mode has no measurement.

  • chi_real (ArrayLike | None) – Written as additional [Data] columns (AC X' (emu/Oe), AC X'' (emu/Oe), AC Frequency (Hz), AC Drive (Oe)) only when supplied. Real exports can also contain unused empty channels; use extra_columns to reproduce those shapes. AC Drive (Oe) is the MPMS3 spelling of the AC drive-field amplitude – pass e.g. ac_drive_oe=0.3 alongside chi_real/chi_imag so a test can round-trip calamari.measurement.Measurement.ac_drive_oe.

  • chi_imag (ArrayLike | None) – Written as additional [Data] columns (AC X' (emu/Oe), AC X'' (emu/Oe), AC Frequency (Hz), AC Drive (Oe)) only when supplied. Real exports can also contain unused empty channels; use extra_columns to reproduce those shapes. AC Drive (Oe) is the MPMS3 spelling of the AC drive-field amplitude – pass e.g. ac_drive_oe=0.3 alongside chi_real/chi_imag so a test can round-trip calamari.measurement.Measurement.ac_drive_oe.

  • ac_frequency_hz (ArrayLike | None) – Written as additional [Data] columns (AC X' (emu/Oe), AC X'' (emu/Oe), AC Frequency (Hz), AC Drive (Oe)) only when supplied. Real exports can also contain unused empty channels; use extra_columns to reproduce those shapes. AC Drive (Oe) is the MPMS3 spelling of the AC drive-field amplitude – pass e.g. ac_drive_oe=0.3 alongside chi_real/chi_imag so a test can round-trip calamari.measurement.Measurement.ac_drive_oe.

  • ac_drive_oe (ArrayLike | None) – Written as additional [Data] columns (AC X' (emu/Oe), AC X'' (emu/Oe), AC Frequency (Hz), AC Drive (Oe)) only when supplied. Real exports can also contain unused empty channels; use extra_columns to reproduce those shapes. AC Drive (Oe) is the MPMS3 spelling of the AC drive-field amplitude – pass e.g. ac_drive_oe=0.3 alongside chi_real/chi_imag so a test can round-trip calamari.measurement.Measurement.ac_drive_oe.

  • transport_action (ArrayLike | None) – The per-row Transport Action code: 1 VSM, 5 AC, 6 DC scan, and 2/3/4 instrument housekeeping. Real summary files carry housekeeping rows, so a fixture that needs one – a trailing locate scan, say – writes it here rather than through extra_columns.

Return type:

list[str]

Returns:

list[str] – File lines, ready for "\n".join(...) (see write_mpms3_file()).