macro_eeg_model.simulation.data_processor#

Classes#

DataProcessor

A class responsible for processing EEG data by filtering and segmenting it.

Module Contents#

class macro_eeg_model.simulation.data_processor.DataProcessor[source]#

A class responsible for processing EEG data by filtering and segmenting it.

static filter_data(data, sample_rate, pass_frequency, stop_frequency)[source]#

Filters the data using a high-pass Butterworth filter based on the specified passband and stopband frequencies.

Parameters:
  • data (numpy.ndarray) – The input data to be filtered (a 2D array where rows represent time points and columns represent channels/nodes).

  • sample_rate (int) – The sample rate of the data in Hz.

  • pass_frequency (float) – The passband edge frequency in Hz.

  • stop_frequency (float) – The stopband edge frequency in Hz.

Returns:

The filtered data with the same shape as the input data.

Return type:

numpy.ndarray

Raises:

AssertionError – If the frequency values are invalid.

static segment_data(data, sample_rate, nr_nodes)[source]#

Segments the data into epochs of 1 second each, evenly dividing the data based on the sample rate.

Parameters:
  • data (numpy.ndarray) – The input data to be segmented (a 2D array where rows represent time points and columns represent channels/nodes).

  • sample_rate (int) – The sample rate of the data in Hz.

  • nr_nodes (int) – The number of nodes (channels) in the data.

Returns:

A 3D array where each slice along the third dimension represents a 1-second epoch of the data. The shape of the array is (t_samples, nr_nodes, nr_epochs), where t_samples is the number of samples per second.

Return type:

numpy.ndarray