spvctrl.data.util.save_downsampled_pulse_hdf5#

save_downsampled_pulse_hdf5(file_path: str | Path, t_s: ndarray, U_spv_V: ndarray, U_diode_V: ndarray | None, sample_rate_Hz: float, n_pre_trigger: int, pulse_idx: int, compress: bool = False, compression_opts: int = 1, timestamp: str | None = None)[source]#

Save a log-downsampled pulse transient to a plain hdf5 file.

The time axis of downsampled data is non-uniform, so it is stored as a t_s dataset instead of being recalculated from the sample rate. The data is stored as float64 volt datasets U_spv_V/U_diode_V. sample_rate_Hz and n_pre_trigger of the underlying full-resolution data are recorded for reference.

Parameters:
  • file_path – Path of the hdf5 file to write

  • t_s – Non-uniform time axis in s, same length as the voltages

  • U_spv_V – SPV voltages, downsampled

  • U_diode_V – Diode voltages, downsampled, or None when the diode channel is not recorded (no diode dataset is written)

  • sample_rate_Hz – Sample rate in Hz of the full-resolution data (for reference)

  • n_pre_trigger – Number of pre-trigger samples of the full-resolution data (for reference)

  • pulse_idx – Pulse index, 0-based (-1 for averaged data)

  • compress – Whether to use gzip compression (with the byte-shuffle filter)

  • compression_opts – gzip compression level (1-9)

  • timestamp – Optional time of day string of the pulse