spvctrl.data.finalize.copy_transient#

copy_transient(data: TspvData, target_dirs: str | list[str]) → list[Exception][source]#

Copy the final files of a transient to the target directories, hierarchically.

All files of the data directory (hdf5, csv, plots, metadata.yaml) are copied to <target>/<hierarchy full file path>/. Per-pulse partial files (PART_*.h5) and the plain average file (data.h5) are not copied. If the .tspv file does not exist in the data directory yet, it is saved first.

When a group level (version/variant/mode) is set — i.e. one measurement of a parameter sweep with the same series and different variants — the per-measurement .tspv file is NOT copied into the hierarchy subdir. Instead, its version branches are merged losslessly into a single <target>/<series>/<series>.tspv file, so that the series directory holds exactly one .tspv file with all measured data. The log-subsampled branch is marked as the default version, so that the merged file stays loadable without explicit hierarchy arguments; no default entry is set at the variant level: variants must be loaded with an explicit hierarchy (e.g. via a hierarchy selector). Copying to a target directory that already contains the data is skipped entirely, including the merge.

Parameters:
  • data – TspvData to copy

  • target_dirs – Directory or list of directories to copy the data to

Returns:

List of exceptions that occurred (empty on success)