spvctrl.data.util#
Pulse file format utilities: saving, loading and converting per-pulse hdf5 files.
The per-pulse (PART_*.h5) and averaged (data.h5) files written by the measurement share one
plain hdf5 format, described here. The time axis of full-resolution data is linear, so it is
recalculated on load from attributes instead of being stored; downsampled data has a non-uniform
(log-spaced) time axis, which is stored as a t_s dataset.
File layout:
Unified root attributes written by
stamp_data_attrs():data_type="tspv-pulse",data_version="0.1",writer,writer_version,time_created/time_modified, and the storage sub-format asdata_encoding:DATA_TYPE_FULL_RAW,DATA_TYPE_FULL_VOLTSorDATA_TYPE_DOWNSAMPLED. Legacy files written before the attributes existed store float64 volt datasetsU_spv_V/U_diode_V(equivalent to"full-volts"); files of the intermediate scheme carry the sub-format in thedata_typeattribute instead ofdata_encodingand are loaded transparently as well."full-raw": datasetsU_spv_rawand optionallyU_diode_raw(absent in single-channel data) with the raw ADC counts as acquired from the oscilloscope (int16 for the Gage CompuScope), plus the attributes needed to load the data in volt and to recover the time axis: -spv_gain_V_per_count/spv_offset_Vanddiode_gain_V_per_count/diode_offset_V:U = raw * gain_V_per_count + offset_V-sample_rate_Hzandn_pre_trigger:t_s = (np.arange(n) - n_pre_trigger) / sample_rate_Hz"full-volts": datasetsU_spv_Vand optionallyU_diode_V(float64 volts), attributessample_rate_Hzandn_pre_trigger."downsampled": datasetsU_spv_V, optionallyU_diode_V, and the non-uniform time axist_s(float64, log-downsampled);sample_rate_Hzandn_pre_triggerare recorded for reference.Common attributes:
pulse_idx(0-based, -1 for averaged data),timestamp(time of day string, optional).
Module attributes
Value of the root |
|
Root |
|
Root |
|
Storage sub-format ( |
|
Storage sub-format ( |
|
Storage sub-format ( |
|
Default target number of points of log-downsampled data |
|
gzip compression level of the per-pulse files: the shuffle filter does the heavy lifting, a high level compresses the remaining noise-dominated bytes only marginally but much slower (measured: level 9 with shuffle is ~20x slower than level 1 for ~1.5% smaller files) |
|
gzip compression level of the averaged data.h5, which is only written once per measurement |
Functions
Compute the ADC-to-volt conversion parameters from a raw Gage CompuScope configuration dump. |
|
Convert a measurement cache directory from the legacy float64 volt format to the new format with raw ADC counts and gzip compression. |
|
Log-downsample a transient for plotting. |
|
Load a pulse file saved with |
|
Indices for log-downsampling a transient of length |
|
Indices for log-downsampling a recorded transient with a pre-trigger, splitting the record at the trigger. |
|
Convert raw ADC counts to voltages: |
|
Save a log-downsampled pulse transient to a plain hdf5 file. |
|
Save a full-resolution pulse transient to a plain hdf5 file. |
|
Convert voltages to raw ADC counts, the inverse of |