macro_eeg_model.simulation.simulator#

Classes#

Simulator

The Simulator class is responsible for simulating EEG data using a vector autoregression (VAR) model.

Module Contents#

class macro_eeg_model.simulation.simulator.Simulator(lag_connectivity_weights, sample_rate, nr_lags, nr_nodes, t_secs, t_burnit, noise_color, std_noise)[source]#

The Simulator class is responsible for simulating EEG data using a vector autoregression (VAR) model. It generates synthetic EEG signals based on the provided lagged connectivity weights, noise characteristics, and other simulation parameters.

_lag_connectivity_weights#

The lagged connectivity weights matrix used for the VAR model.

Type:

numpy.ndarray

_sample_rate#

The sample rate of the simulation in Hz.

Type:

int

_nr_lags#

The number of lags (p) in the VAR(p) model.

Type:

int

_nr_nodes#

The number of nodes (channels) in the simulation.

Type:

int

_t_secs#

The total time of the simulation in seconds.

Type:

int

_t_burnit#

The burn-in time for the simulation in seconds.

Type:

int

_noise_color#

The color of the noise to be used in the simulation (‘white’ or ‘pink’).

Type:

str

_std_noise#

The standard deviation of the noise to be used in the simulation.

Type:

float

__init__(lag_connectivity_weights, sample_rate, nr_lags, nr_nodes, t_secs, t_burnit, noise_color, std_noise)[source]#

Initializes the Simulator with the provided parameters.

Parameters:
  • lag_connectivity_weights (numpy.ndarray) – The lagged connectivity weights matrix used for the VAR model.

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

  • nr_lags (int) – The number of lags (p) in the VAR(p) model.

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

  • t_secs (int) – The total time of the simulation in seconds.

  • t_burnit (int) – The burn-in time for the simulation in seconds.

  • noise_color (str) – The color of the noise to be used in the simulation (‘white’ or ‘pink’).

  • std_noise (float) – The standard deviation of the noise to be used in the simulation.

simulate(verbose=False)[source]#

The simulation generates synthetic EEG signals by applying the VAR model to the provided lagged connectivity weights and adding noise.

Parameters:

verbose (bool, optional) – If True, displays a progress bar during the simulation (default is False).

Returns:

A 2D array of shape (samples, nodes) containing the simulated EEG data.

Return type:

numpy.ndarray

Raises:
  • ValueError – If an invalid noise color is provided.

  • AssertionError – If any of the input parameters are invalid (e.g., non-positive values for number of lags, time, or std).