spvctrl.data.finalize.save_measurement_to_tspv#

save_measurement_to_tspv(data_dir: str | Path, tspv_dir: str | Path, series: str, variant: str | None, metadata: dict, settings: TspvSettings, versions: set[str] | None = None) → TspvData[source]#

Assemble the .tspv data file from a finished measurement directory.

The averaged transient (data.h5) is stored as the part + and marked as the default part, so that loading without explicit hierarchy arguments resolves the average. The individual pulses (the PART_*.h5 files of the measurement directory) are stored as additional parts pulse0001, pulse0002, … when MeasurementParameters.store_individual_pulses is set. Each version key in versions is stored as its own version hierarchy branch of all parts (see TspvData._REPRESENTATIONS): ‘full’ pulse data (the raw-ADC int16 layout, or float64 voltages when the oscilloscope does not support raw ADC access) is stored in the raw branch (full record) and the log-sub branch (log-downsampled), ‘downsampled’ pulse data only in the log-sub branch.

Parameters:
  • data_dir – Measurement directory in the cache, containing data.h5 and the PART_ pulse files.

  • tspv_dir – Directory the .tspv file is stored in.

  • series – Series name of the hierarchy.

  • variant – Variant name of the hierarchy (e.g. wl=355nm), or None.

  • metadata – Metadata for the TspvData object of the averaged part.

  • settings – Measurement settings used for the measurement.

  • versions – Set of version keys to store (see TspvData._REPRESENTATIONS), or None to derive from the measurement data: log-sub, plus raw when the measurement stored full transients.

Returns:

The TspvData object of the averaged (‘+’) part of the default (log-subsampled) version.