spvctrl.spvctrl_interactive.finalize_measurement#

finalize_measurement(measurement_params: TspvSettings | None, data_dir: str | Path)[source]#

Finalize, archive and copy a finished measurement.

Builds a TspvData from the averaged transient (data.h5, including the pre-trigger baseline) with the hierarchy (series, variant, part) derived from the measurement settings, storing the average as part + and — when MeasurementParameters.store_individual_pulses is set — the individual pulses as parts pulse0001, …, then finalizes it (.tspv, csv and plots written into the data directory), archives the data directory (only if it contains at least archive_file_count_threshold per-pulse partial files) and copies the final files hierarchically to the final data directories (settings.data_dir). Errors are logged and do not raise, so that a failed copy does not lose the measurement.

Parameters:
  • measurement_params – Measurement settings used for the measurement.

  • data_dir – Measurement directory in the cache.