pysp2.io.read_sp2xr#

pysp2.io.read_sp2xr(file_name, debug=False)[source]#

Loads a binary SP2-XR raw data file and returns all of the waveforms into an xarray Dataset.

The SP2-XR file format differs from the original SP2: each record carries its own (rows, cols) header instead of a single file-level header, the waveform samples are stored as 4-byte integers (rather than 2-byte) and only two detector channels are written (ch0 = scattering, ch1 = incandescence). The time encoding is the same as the SP2 (TimeDiv10000 * 10000 + TimeRemainder, in seconds since 1904-01-01).

Parameters:
  • file_name (str) – The name of the .sp2b file (or a .zip containing the .sp2b) to read.

  • debug (bool) – Set to true for verbose output.

Returns:

dataset (xarray.Dataset) – The xarray Dataset containing the raw SP2-XR waveforms for each particle. Variable names mirror read_sp2() (Data_ch0, Data_ch1, Flag, EventIndex, time, …).