RawDataModel

class RawDataModel(**kwargs)

Bases: MetaModel

Subclass of MetaModel for processing raw signal data.

Includes methods to compute PSDs and integrate noise.

Public Methods

RawDataModel.calculate_psd(psd_data: list, samplerate: float) tuple[list, list, ndarray | None, list[int]]

Calculate a psd for each dataset in the list, assuming a common samplerate

Parameters:
  • psd_data (list) – List of time-domain signal arrays for which PSD will be computed.

  • samplerate (float) – Sampling rate of the signal in Hz.

Returns:

Pxx_list, rms_list, the frequency axis, and the indices into psd_data that were successfully processed. A channel is skipped (and its index omitted) if it has too few samples, if welch() fails, or if the resulting frequency axis is too short to integrate noise over.

Return type:

tuple[list, list, Optional[np.ndarray], list[int]]

RawDataModel.integrate_noise(f: ndarray[tuple[int, ...], dtype[floating]], Pxx: ndarray[tuple[int, ...], dtype[floating]]) ndarray[tuple[int, ...], dtype[floating]]

Compute the integrated noise from a power spectral density.

This method integrates the power spectral density (PSD) over frequency to obtain the cumulative root-mean-square (RMS) noise as a function of frequency. It assumes evenly spaced frequency bins.

Parameters:
  • f (npt.NDArray[np.floating]) – Array of frequency values (Hz), evenly spaced.

  • Pxx (npt.NDArray[np.floating]) – Power spectral density values corresponding to f.

Returns:

Array of integrated RMS noise values for each frequency point.

Return type:

npt.NDArray[np.floating]

Private Methods

RawDataModel._init() None

Perform additional initialization specific to the algorithm being implemented. Must be implemented by subclasses.

This function is called at the end of the class constructor to perform additional initialization specific to the algorithm being implemented. kwargs provided to the base class constructor are available as class attributes.