spvctrl.data.util.save_pulse_hdf5#
- save_pulse_hdf5(file_path: str | Path, U_spv: ndarray, U_diode: ndarray | None, sample_rate_Hz: float, n_pre_trigger: int, pulse_idx: int, compress: bool = False, compression_opts: int = 1, timestamp: str | None = None, conversion_spv: tuple[float, float] | None = None, conversion_diode: tuple[float, float] | None = None)[source]#
Save a full-resolution pulse transient to a plain hdf5 file.
The time axis is linear, so it is not stored: it is recalculated on load with
t_s = (np.arange(n) - n_pre_trigger) / sample_rate_Hz.If a conversion tuple
(gain_V_per_count, offset_V)is given for a channel, the data of that channel is stored as raw ADC counts (datasetsU_spv_raw/U_diode_raw, int16 for the Gage CompuScope) together with the conversion parameters in the file attributes. Otherwise the data is stored as float64 volt datasetsU_spv_V/U_diode_V. Either both or no conversion must be given.- Parameters:
file_path – Path of the hdf5 file to write
U_spv – SPV channel values of the full recorded segment, including pre-trigger samples (raw ADC counts if a conversion is given, voltages otherwise)
U_diode – Diode channel values of the full recorded segment, including pre-trigger samples, or None when the diode channel is not recorded (no diode dataset is written)
sample_rate_Hz – Sample rate in Hz
n_pre_trigger – Number of pre-trigger samples, i.e. samples recorded before the trigger
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
conversion_spv – (gain_V_per_count, offset_V) of the SPV channel, to store raw ADC counts
conversion_diode – (gain_V_per_count, offset_V) of the diode channel, to store raw ADC counts