spvctrl.data.util.convert_pulse_cache_dir#

convert_pulse_cache_dir(data_dir: str | Path) → dict[str, tuple[int, int]][source]#

Convert a measurement cache directory from the legacy float64 volt format to the new format with raw ADC counts and gzip compression.

The original directory is renamed to <name>-original. A new directory is created at the original path, containing all non-data files and the converted data files. Per-pulse PART_*.h5 files in float64 volts are converted back to int16 ADC data, with parameters required for the conversion back to volts being stored in the file attributes. The conversion parameters are read from the oscilloscope_raw_config entry of the metadata.yaml in the directory.

Note: Converting voltages back to counts may be off by ±1 ADC count, since the rounding of the original conversion can not be undone.

The modification time of the original directory is preserved on the new directory.

Parameters:

data_dir – Measurement directory in the cache.

Returns:

Dict mapping each converted file path (in the new directory) to its (old, new) size in bytes.