spvctrl.data.data.TspvData#

class TspvData(data_path: str | Path | None = None, data: dict | None = None, metadata: dict | None = None, file_mode: str = 'r', series: str | None = None, version: str | None = None, variant: str | None = None, mode: str | None = None, part: str | None = None, hierarchy: FullHierarchy | None = None)[source]#

Bases: TimeData

Transient surface photovoltage data container.

Can be initialized from data directly, or from a file or directory path.

The data is a dictionary with:

  • key: column key, e.g. “t_s”, “U_spv_V”, “U_diode_V”

  • value: 1D numpy array with the column values

The full-resolution raw data is stored separately in raw_data (a dictionary of the same shape) together with raw_attrs (“sample_rate_Hz”, “n_pre_trigger”). Only the downsampled data is loaded from file by default; the raw data is read on explicit request.

Initialize the TspvData object.

Can be initialized from data directly, or from a file or directory path.

Parameters:
  • data_path – Path to the data file or directory. Relative paths are made absolute. May be None in write-mode if the data is only saved with save_hdf5_in() or save_hdf5_at.

  • data – The data dictionary (column keys -> 1D arrays). In read-mode it must be None, so that data is loaded from data_path.

  • metadata – Metadata dictionary.

  • file_mode – Mode string containing “w” for write mode and/or “r” for read mode.

  • series – Name of the data series.

  • version – Version of the data hierarchy.

  • variant – Variant of the data hierarchy, e.g. the wavelength/power.

  • mode – Mode of the data hierarchy.

  • part – Part of the data hierarchy.

  • hierarchy – An already constructed hierarchy object.

Methods

get_column_color

get_column_label

get_column_label_with_unit

get_column_scale

get_column_tex_label

get_column_tex_label_with_unit

get_column_tex_label_with_unit_and_scale

get_column_tex_unit

get_column_unit

get_time_data

Return the transient data for the specified columns as numpy array.

load_data_from_hdf5

Load data and metadata from a HDF5 file.

load_data_from_open_hdf5

Load data and metadata from an opened HDF5 file.

load_individual_pulses

Load the individual pulse transients, either from the pulse parts of an opened .tspv file or from the PART_*.h5 pulse files next to it.

load_multiple

Load multiple data objects matching wildcard hierarchy levels.

load_raw_data

Load the full-resolution raw data from the raw version branch of the hdf5 file.

recalculate_downsampled

Recalculate the downsampled data from the raw data.

save_csv

Save the downsampled data as a csv file at <data_dir_path>/<series>.csv.

save_csv_at

Save the downsampled data as a csv file, with metadata as yaml csv comments only when include_metadata is set.

save_hdf5

Save data into the hdf5 at <series_dir_path>/<series>.<HDF5_FILE_EXT>.

save_hdf5_at

Save the data in the given HDF5 file.

save_hdf5_in

Save the data into an already opened HDF5 file or group.

set_raw_adc_data

Set full-resolution raw ADC data together with the ADC-to-volt conversion parameters.

set_raw_data

Set the full-resolution raw data and recalculate the downsampled data from it.

Attributes

DATA_FORMAT_VERSION

Format version of the .tspv layout written by this class: 0.2 stores the averaged transient as part + and optional individual pulses as parts pulse0001, .

DATA_TYPE_NAME

Canonical data type label, value of the root data_type attribute of .tspv files.

DEFAULT_TRANSIENT_COLUMNS

Default columns returned by get_time_data() on empty data

HDF5_FILE_EXT

HDF5_FULL_DATA_PATTERN

TRANSIENT_COLUMNS

The columns of a transient measurement, in order

VERSION_LOG_SUB

Version key for log-subsampled data (the default representation).

VERSION_RAW

Version key for the full-resolution raw representation.

WRITER_NAME

Name of the software module that writes this data, written to the root writer attribute of HDF5 files (see WRITER_ATTR), e.g. "prsctrl".

WRITER_VERSION

Version of WRITER_NAME, written to the root writer_version attribute of HDF5 files (see WRITER_VERSION_ATTR).

data_dir_path

Absolute path to the data directory.

data_path

Absolute path to the data file or directory.

full_name

series_dir_path

Absolute path to the series directory.

data

Downsampled data as column dict (column key -> 1D array)

raw_data

Full-resolution raw data as column dict, or None if not loaded/set

raw_attrs

Attributes of the raw data: sample_rate_Hz, n_pre_trigger and, for raw-ADC data, the per-channel conversion parameters (spv_gain_V_per_count etc.)

pulses

Individual pulse transients loaded by load_individual_pulses(): a list of column dicts (t_s, U_spv_V, U_diode_V plus the per-pulse attributes), sorted by pulse index, or None if not loaded

DATA_FORMAT_VERSION: str | None = '0.2'#

Format version of the .tspv layout written by this class: 0.2 stores the averaged transient as part + and optional individual pulses as parts pulse0001, … (0.1 had no part groups).

DATA_TYPE_NAME: str | None = 'tspv-full-hierarchical'#

Canonical data type label, value of the root data_type attribute of .tspv files.

DEFAULT_TRANSIENT_COLUMNS: list[str] = ['t_s', 'U_spv_V']#

Default columns returned by get_time_data() on empty data

HDF5_FILE_EXT = 'tspv'#
HDF5_FULL_DATA_PATTERN = '.*\\.tspv'#
TRANSIENT_COLUMNS: list[str] = ['t_s', 'U_spv_V', 'U_diode_V']#

The columns of a transient measurement, in order

VERSION_LOG_SUB = 'log-sub'#

Version key for log-subsampled data (the default representation).

VERSION_RAW = 'raw'#

Version key for the full-resolution raw representation.

WRITER_NAME: str | None = 'spvctrl'#

Name of the software module that writes this data, written to the root writer attribute of HDF5 files (see WRITER_ATTR), e.g. "prsctrl".

WRITER_VERSION: str | None = '0.0.1'#

Version of WRITER_NAME, written to the root writer_version attribute of HDF5 files (see WRITER_VERSION_ATTR).

_COLUMN_DATA = {'*': {'color': {'U_diode_V': '#ff7f0e', 'U_spv_V': '#2f88ff'}, 'label': {'U_diode_V': 'U_diode [V]', 'U_spv_V': 'U_spv [V]', 't_s': 't [s]'}, 'label-tex': {'U_diode_V': '$U_\\text{diode}$', 'U_spv_V': '$U_\\text{SPV}$', 't_s': '$t$'}, 'unit-tex': {'U_diode_V': 'V', 'U_spv_V': 'V', 't_s': 's'}}}#
_EQUALITY_CHECKS = {'endswith': <function Data.<lambda>>, 'equal': <function Data.<lambda>>, 'startswith': <function Data.<lambda>>}#
_REPRESENTATIONS: dict[str, _VersionRepresentation] = {'log-sub': <spvctrl.data.data._LogSubRepresentation object>, 'raw': <spvctrl.data.data._RawRepresentation object>}#

Registry of version key → storage representation. Adding a new subsampling algorithm means adding a key constant and one registry entry.

__abstractmethods__ = frozenset({})#
__annotations__ = {'DEFAULT_TRANSIENT_COLUMNS': list[str], 'TRANSIENT_COLUMNS': list[str], '_REPRESENTATIONS': dict[str, spvctrl.data.data._VersionRepresentation], '_group_path': 'Optional[str]', '_hdf5_file_path': 'Optional[Path]', 'data': 'dict', 'pulses': 'Optional[list[dict]]', 'raw_attrs': 'dict', 'raw_data': 'Optional[dict]'}#
__dict__ = mappingproxy({'__module__': 'spvctrl.data.data', '__firstlineno__': 138, '__annotations__': {'_REPRESENTATIONS': dict[str, spvctrl.data.data._VersionRepresentation], 'DEFAULT_TRANSIENT_COLUMNS': list[str], 'TRANSIENT_COLUMNS': list[str], 'data': 'dict', 'raw_data': 'Optional[dict]', 'raw_attrs': 'dict', 'pulses': 'Optional[list[dict]]', '_hdf5_file_path': 'Optional[Path]', '_group_path': 'Optional[str]'}, '__doc__': 'Transient surface photovoltage data container.\n\nCan be initialized from data directly, or from a file or directory path.\n\nThe data is a dictionary with:\n\n    - key: column key, e.g. "t_s", "U_spv_V", "U_diode_V"\n    - value: 1D numpy array with the column values\n\nThe full-resolution raw data is stored separately in ``raw_data`` (a dictionary of the same\nshape) together with ``raw_attrs`` ("sample_rate_Hz", "n_pre_trigger"). Only the downsampled\ndata is loaded from file by default; the raw data is read on explicit request.\n', 'DATA_TYPE_NAME': 'tspv-full-hierarchical', 'DATA_FORMAT_VERSION': '0.2', 'WRITER_NAME': 'spvctrl', 'WRITER_VERSION': '0.0.1', 'HDF5_FILE_EXT': 'tspv', 'HDF5_FULL_DATA_PATTERN': '.*\\.tspv', 'VERSION_LOG_SUB': 'log-sub', 'VERSION_RAW': 'raw', '_REPRESENTATIONS': {'log-sub': <spvctrl.data.data._LogSubRepresentation object>, 'raw': <spvctrl.data.data._RawRepresentation object>}, 'DEFAULT_TRANSIENT_COLUMNS': ['t_s', 'U_spv_V'], 'TRANSIENT_COLUMNS': ['t_s', 'U_spv_V', 'U_diode_V'], '__init__': <function TspvData.__init__>, '__repr__': <function TspvData.__repr__>, 'set_raw_data': <function TspvData.set_raw_data>, 'recalculate_downsampled': <function TspvData.recalculate_downsampled>, 'get_time_data': <function TspvData.get_time_data>, '_version_key': <function TspvData._version_key>, '_group_version_key': <classmethod(<function TspvData._group_version_key>)>, 'load_raw_data': <function TspvData.load_raw_data>, 'set_raw_adc_data': <function TspvData.set_raw_adc_data>, 'load_individual_pulses': <function TspvData.load_individual_pulses>, '_load_from_pulse_file': <function TspvData._load_from_pulse_file>, 'save_csv_at': <function TspvData.save_csv_at>, 'save_csv': <function TspvData.save_csv>, '_save_data_in_hdf5_group': <function TspvData._save_data_in_hdf5_group>, '_load_data_from_hdf5_group': <classmethod(<function TspvData._load_data_from_hdf5_group>)>, '_COLUMN_DATA': {'*': {'label': {'t_s': 't [s]', 'U_spv_V': 'U_spv [V]', 'U_diode_V': 'U_diode [V]'}, 'label-tex': {'t_s': '$t$', 'U_spv_V': '$U_\\text{SPV}$', 'U_diode_V': '$U_\\text{diode}$'}, 'unit-tex': {'t_s': 's', 'U_spv_V': 'V', 'U_diode_V': 'V'}, 'color': {'U_spv_V': '#2f88ff', 'U_diode_V': '#ff7f0e'}}}, '__static_attributes__': ('_group_path', '_hdf5_file_path', 'data', 'hierarchy', 'name', 'pulses', 'raw_attrs', 'raw_data', 'series_dir_path'), '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>})#
__firstlineno__ = 138#
__init__(data_path: str | Path | None = None, data: dict | None = None, metadata: dict | None = None, file_mode: str = 'r', series: str | None = None, version: str | None = None, variant: str | None = None, mode: str | None = None, part: str | None = None, hierarchy: FullHierarchy | None = None)[source]#

Initialize the TspvData object.

Can be initialized from data directly, or from a file or directory path.

Parameters:
  • data_path – Path to the data file or directory. Relative paths are made absolute. May be None in write-mode if the data is only saved with save_hdf5_in() or save_hdf5_at.

  • data – The data dictionary (column keys -> 1D arrays). In read-mode it must be None, so that data is loaded from data_path.

  • metadata – Metadata dictionary.

  • file_mode – Mode string containing “w” for write mode and/or “r” for read mode.

  • series – Name of the data series.

  • version – Version of the data hierarchy.

  • variant – Variant of the data hierarchy, e.g. the wavelength/power.

  • mode – Mode of the data hierarchy.

  • part – Part of the data hierarchy.

  • hierarchy – An already constructed hierarchy object.

classmethod __init_subclass__(**kwargs)#

Auto-register subclasses

__module__ = 'spvctrl.data.data'#
__repr__() → str[source]#

Return a multi-line summary of the data object.

__slots__ = ()#
__static_attributes__ = ('_group_path', '_hdf5_file_path', 'data', 'hierarchy', 'name', 'pulses', 'raw_attrs', 'raw_data', 'series_dir_path')#
__weakref__#

list of weak references to the object

_abc_impl = <_abc._abc_data object>#
_assert_read_mode()#
Raises:

RuntimeError – If instance was not initialized in read mode

_assert_write_mode()#
Raises:

RuntimeError – If instance was not initialized in write mode

_data_dir_path: Path | None#

Absolute path to the data directory, or None if not set.

_data_path: Path | None#

Absolute path to the data file or directory, or None if not set.

classmethod _get_column_data(key, column, default=None, mode='*', check_other_cls=True, instance=None)#

Search for column data in _COLUMN_DATA hierarchy

Searches for the specified key and column in the _COLUMN_DATA dictionary following a priority order: specific mode → wildcard mode → other subclasses → default.

Parameters:
  • key – Data key (e.g., ‘label’)

  • column – Column key to retrieve

  • default – Default value to return if no data is found

  • mode – Optional data mode to search in

  • check_other_cls – Whether to check other Data subclasses before returning default

  • instance – Optional Data subclass instance to auto-determine mode from .mode attribute

Returns:

The found column data or default value

classmethod _get_column_key(key, value, default=None, mode='*', check_other_modes=True, check_other_cls=True, equality_check='equal')#

Reverse search of column data: returns the column key for the given data key and value. First checks the calling class, then all other subclasses.

Parameters:
  • key – data key, e.g. ‘label’

  • value – the value of _COLUMN_DATA[mode][key][column] for which the column is returned

  • default – a default value to return of no value is found

  • mode – optional data mode

  • check_other_modes – whether to check if another mode in _COLUMN_DATA has the column data

  • check_other_cls – whether to check if other subclasses have the column data before returning the default

  • equality_check – How to check equality: ‘equal’, ‘startswith’ or ‘endswith’. The latter check if the searched value starts with the column data value

Returns:

The column key to given value from _COLUMN_DATA

classmethod _group_version_key(group: Group) → str | None[source]#

The version key of the hierarchy branch a group belongs to, or None when the file has no version level.

The version keys are the children of the group whose level attr is version; the walk starts at the given group and moves up to the file root.

classmethod _load_data_from_hdf5_group(group: Group) → dict[source]#

Load the data of the group’s version representation from a hierarchy group.

The version key is read from the version-level ancestor group of the given group; files without a version level (or with an unknown key) load as log-subsampled data. The raw data is not loaded here, see load_raw_data().

_load_from_pulse_file(pulse_path: Path)[source]#

Load data from a plain pulse-format hdf5 file (e.g. data.h5 written by the measurement) and recalculate the downsampled data from it. Also loads a metadata.yaml file next to it, if present.

Downsampled pulse files (data_encoding “downsampled”, written when only the log-downsampled data is stored) have a non-uniform time axis and no raw data: the downsampled data is used directly.

classmethod _load_metadata_from_hdf5_group(group: Group) → dict#

Load the data’s metadata dictionary from a HDF5 group’s “metadata” entry.

By default, loads the metadata using load_dict(). If a subclass overrides this method, it must also override _save_metadata_in_hdf5_group().

Parameters:

group – HDF5 group object. Must have a valid “metadata” entry.

Returns:

Metadata dictionary.

_save_data_in_hdf5_group(group: Group)[source]#

Save the data of this object’s version representation into the hierarchy group.

The representation is selected by the hierarchy version key (None resolves to the default log-subsampled representation, see _REPRESENTATIONS). Deletes all existing entries of the group first, so that saving overwrites cleanly. The metadata is re-saved afterwards by the base class.

_save_metadata_in_hdf5_group(group: Group)#

Save a data’s metadata in a HDF5 group’s “metadata” entry.

By default, saves the metadata using store_dict(). If a subclass overrides this method, it must also override _load_metadata_from_hdf5_group().

Parameters:

group – Group in which the metadata is to be stored under “metadata”.

_series_dir_path: Path | None#

Absolute path to the series directory, or None if not set.

_subclasses = {'TimeData': <class 'devctrl.data.time.data.TimeData'>, 'TspvData': <class 'spvctrl.data.data.TspvData'>}#
_version_key() → str[source]#

Normalized version key of the data’s hierarchy: None, missing-level placeholders and unknown keys resolve to the default log-subsampled representation.

data: dict#

Downsampled data as column dict (column key -> 1D array)

property data_dir_path: Path#

Absolute path to the data directory.

Raises:

TypeError – If no data directory is set.

property data_path: Path#

Absolute path to the data file or directory.

Raises:

TypeError – If no data path is set.

property full_name: str#
get_column_color(**kw)#
get_column_label(**kw)#
get_column_label_with_unit(**kw)#
get_column_scale(**kw)#
get_column_tex_label(**kw)#
get_column_tex_label_with_unit(**kw)#
get_column_tex_label_with_unit_and_scale(**kw)#
get_column_tex_unit(**kw)#
get_column_unit(**kw)#
get_time_data(columns: list[str] | None = None, transforms: list[Callable[[ndarray[tuple[Any, ...], dtype[_ScalarT]], list[str]], tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], list[str]]]] | None = None, ts: list[float] | tuple[float, float] | None = None, raw: bool = False) → tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], list[str]][source]#

Return the transient data for the specified columns as numpy array.

Parameters:
  • columns – List of column keys, or None to use all stored columns.

  • transforms – List of transformations to apply to the data

  • ts – Time range as (t_min, t_max) tuple. If None, defaults to (0, np.inf). Use (-np.inf, np.inf) to also include pre-trigger data

  • raw – Return the full-resolution raw data (raw_data) instead of the downsampled data. The raw data must be loaded first (load_raw_data()). Like the downsampled data, the pre-trigger samples are only included when include_pre_trigger is set.

Returns:

numpy.ndarray where the first index is the time and the second the column (t=0, <columns>…=1…), and list of columns.

Raises:

RuntimeError – If raw=True is given but no raw data is loaded.

classmethod load_data_from_hdf5(path: Path, hierarchy: GroupHierarchy, prefer_hierarchy: bool = False) → tuple[Any, dict, Path, str]#

Load data and metadata from a HDF5 file.

Group path contained in path takes precedence over hierarchy, unless prefer_hierarchy=True.

Parameters:
  • path – Path of the HDF5 file.

  • hierarchy – Hierarchy inside the HDF5 file to load from.

Returns:

data, metadata, path to hdf5 file, group path used to load data

classmethod load_data_from_open_hdf5(file: Group, hierarchy: GroupHierarchy | None | str) → tuple[Any, dict]#

Load data and metadata from an opened HDF5 file.

Use this functions when loading multiple datas from a single HDF file, otherwise use load_data_from_hdf5.

Parameters:
  • file – The HDF5 file. Must be closed by the caller.

  • group_path – Hierarchy or group path to load the data inside the file from.

Returns:

data, metadata

load_individual_pulses(downsample: int = 5000) → int[source]#

Load the individual pulse transients, either from the pulse parts of an opened .tspv file or from the PART_*.h5 pulse files next to it.

Only pulse parts of the same version/variant/mode branch as the loaded data are loaded — e.g. in a merged series file containing several variants, only the pulses of the loaded variant, and only of the same storage representation (version key). The pulses are loaded with their full record including the pre-trigger samples. Full-resolution pulses are log-downsampled with the split pre-trigger/post-trigger distribution (see util.log_downsample_split_indices()) for display; pulses that already store downsampled data are used as-is. The result is stored in pulses.

Parameters:

downsample – Target number of points per pulse for display.

Returns:

The number of pulses loaded (0 if none are available).

classmethod load_multiple(p: str | Path, *, version: str | None = None, variant: str | None = None, mode: str | None = None, part: str | None = None, **kwargs) → dict[str, Data] | Data#

Load multiple data objects matching wildcard hierarchy levels.

The non-"*" level arguments filter strictly, the "*" arguments are enumerated. For levels left at None the default-descent (single child or the file’s default-entry attribute) is used; if the file has no default entry at that level, the match’s own value is kept instead.

Parameters:
  • p – Path to the HDF5 file, a data directory inside it, or an opened h5py file.

  • version – Hierarchy version to load, or "*" to enumerate all versions.

  • variant – Hierarchy variant to load, or "*" to enumerate all variants.

  • mode – Hierarchy mode to load, or "*" to enumerate all modes.

  • part – Hierarchy part to load, or "*" to enumerate all parts.

  • kwargs – Forwarded to the data subclass constructor.

Returns:

A single data object if no "*" wildcard is given, otherwise a dict nested by the wildcard levels (in version, variant, mode, part order) of data objects.

load_raw_data() → dict[source]#

Load the full-resolution raw data from the raw version branch of the hdf5 file.

For an object loaded from the log-subsampled branch, the raw data is read from the sibling raw version branch of the same variant/mode/part. For an object whose hierarchy version is raw, the own group is read. The raw time axis is recalculated from the stored sample rate and pre-trigger count. Sets and returns raw_data.

Raises:
  • RuntimeError – If data was not loaded from an hdf5 file.

  • KeyError – If the file does not contain a raw version branch.

pulses: list[dict] | None#

Individual pulse transients loaded by load_individual_pulses(): a list of column dicts (t_s, U_spv_V, U_diode_V plus the per-pulse attributes), sorted by pulse index, or None if not loaded

raw_attrs: dict#

Attributes of the raw data: sample_rate_Hz, n_pre_trigger and, for raw-ADC data, the per-channel conversion parameters (spv_gain_V_per_count etc.)

raw_data: dict | None#

Full-resolution raw data as column dict, or None if not loaded/set

recalculate_downsampled(N: int = 5000)[source]#

Recalculate the downsampled data from the raw data.

Uses the same split pre-trigger/post-trigger log-downsampling as the measurement (see util.log_downsample_split_indices()), so recalculated views match stored downsampled files.

Parameters:

N – Target number of points of the post-trigger part of the downsampled data

save_csv()[source]#

Save the downsampled data as a csv file at <data_dir_path>/<series>.csv.

save_csv_at(file_path: str | Path, include_metadata: bool = False)[source]#

Save the downsampled data as a csv file, with metadata as yaml csv comments only when include_metadata is set.

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

  • include_metadata – Whether to include the metadata as yaml csv comments

save_hdf5()#

Save data into the hdf5 at <series_dir_path>/<series>.<HDF5_FILE_EXT>.

save_hdf5_at(file_path: Path, hierarchy: GroupHierarchy | None = None)#

Save the data in the given HDF5 file.

Parameters:
  • file_path – Path to the hdf5 file.

  • hierarchy – Hierarchy inside the hdf5 file. If not given, the data’s hierarchy is used.

save_hdf5_in(file: Group, hierarchy: GroupHierarchy)#

Save the data into an already opened HDF5 file or group.

Saves the internal data and the metadata into the group addressed by hierarchy and stamps the unified root file attributes (DATA_TYPE_ATTR, DATA_VERSION_ATTR, provenance and timestamps) idempotently: an already stored time_created is kept, time_modified is refreshed. If hierarchy is a FullHierarchy with a real series name (not “Unknown”), the series is stored as root series attribute (see SERIES_ATTR).

Parameters:
  • file – Open h5py.File or group of the file to save in.

  • hierarchy – Hierarchy addressing the group to save the data in.

property series_dir_path: Path#

Absolute path to the series directory.

Raises:

TypeError – If no series directory is set.

set_raw_adc_data(U_spv_raw: ndarray[tuple[Any, ...], dtype[_ScalarT]], U_diode_raw: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None, conversion_spv: tuple[float, float], conversion_diode: tuple[float, float] | None, sample_rate_Hz: float, n_pre_trigger: int, N: int = 5000)[source]#

Set full-resolution raw ADC data together with the ADC-to-volt conversion parameters.

The raw data is stored as int16 ADC counts (column keys U_spv_raw/U_diode_raw) with the conversion parameters in raw_attrs, so that saving keeps the raw-ADC layout; the downsampled data is recalculated from the converted voltages with the measurement-side split log-downsampling (see util.log_downsample_split_indices()).

Parameters:
  • U_spv_raw – SPV raw ADC counts of the full recorded segment, including pre-trigger samples

  • U_diode_raw – Diode raw ADC counts, same length as U_spv_raw, or None when the diode channel is not recorded

  • conversion_spv – (gain_V_per_count, offset_V) of the SPV channel, U = raw * gain + offset

  • conversion_diode – (gain_V_per_count, offset_V) of the diode channel, None if no diode data

  • sample_rate_Hz – Sample rate in Hz

  • n_pre_trigger – Number of pre-trigger samples, i.e. samples recorded before the trigger

  • N – Target number of points of the post-trigger part of the downsampled data

set_raw_data(U_spv_V: ndarray[tuple[Any, ...], dtype[_ScalarT]], U_diode_V: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None, sample_rate_Hz: float, n_pre_trigger: int, recalculate: bool = True, N: int = 5000)[source]#

Set the full-resolution raw data and recalculate the downsampled data from it.

Parameters:
  • U_spv_V – SPV voltages of the full recorded segment, including pre-trigger samples

  • U_diode_V – Diode voltages of the full recorded segment, same length as U_spv_V, or None when the diode channel is not recorded

  • sample_rate_Hz – Sample rate in Hz

  • n_pre_trigger – Number of pre-trigger samples, i.e. samples recorded before the trigger

  • recalculate – Whether to recalculate the downsampled data from the raw data

  • N – Number of points of the recalculated downsampled data