macro_eeg_model.config.model_config#

Classes#

ModelConfig

A class to configure parameters and model the connectivity between brain nodes, including

Module Contents#

class macro_eeg_model.config.model_config.ModelConfig(nodes: list[str], relay_station: str | None, sample_rate: int, t_lags: int, t_secs: int, t_burnit: int, noise_color: str, std_noise: int, dist_shape: float, dist_scale: float, dist_location: float, dist_trunc_percent: float, custom_connectivity=False)[source]#

A class to configure parameters and model the connectivity between brain nodes, including the distances, connectivity weights, and the generation of delays.

nodes#

The list of processed nodes used in the model.

Type:

list[str]

nr_nodes#

The total number of nodes in the model.

Type:

int

relay_station#

The relay station node name, if any.

Type:

str, optional

sample_rate#

The sampling rate of the model, in Hz.

Type:

int

nr_lags#

The number of time lags calculated based on the sample rate and the total time (ms) in lags.

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.

Type:

str

std_noise#

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

Type:

int

distances#

A matrix containing the distances between the nodes.

Type:

numpy.ndarray

connectivity_weights#

A matrix containing the connectivity weights between the nodes.

Type:

numpy.ndarray

delay_calculator#

An instance of the src.simulation.delay_calculator.DelayCalculator class used to calculate delay distributions.

Type:

DelayCalculator

_dist_shape#

The shape parameter for the delay distribution (xi in GEV distribution).

Type:

float

_dist_scale#

The scale parameter for the delay distribution (sigma in GEV distribution).

Type:

float

_dist_location#

The location parameter for the delay distribution (mu in GEV distribution).

Type:

float

_truncation_percentile#

The percentile at which to truncate the delay distribution.

Type:

float

__init__(nodes: list[str], relay_station: str | None, sample_rate: int, t_lags: int, t_secs: int, t_burnit: int, noise_color: str, std_noise: int, dist_shape: float, dist_scale: float, dist_location: float, dist_trunc_percent: float, custom_connectivity=False)[source]#

Initializes the ModelConfig with specified parameters for nodes, connectivity, simulation, and delay distribution.

Parameters:
  • nodes (list[str]) – The list of nodes to be used in the connectivity model.

  • relay_station (str, optional) – The relay station name, if any.

  • sample_rate (int) – The sampling rate of the model, in Hz.

  • t_lags (int) – The total time in lags for 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.

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

  • dist_shape (float) – The shape parameter for the delay distribution (xi in GEV distribution).

  • dist_scale (float) – The scale parameter for the delay distribution (sigma in GEV distribution).

  • dist_location (float) – The location parameter for the delay distribution (mu in GEV distribution).

  • dist_trunc_percent (float) – The percentile at which to truncate the delay distribution.

  • custom_connectivity (bool, optional) – If True, use custom connectivity weights from a pre-specified file.

__str__()[source]#

Returns a string representation of the ModelConfig object, including details about the nodes, connectivity, simulation parameters, and GEV distribution parameters.

Returns:

A formatted string representation of the ModelConfig object.

Return type:

str

plot(plots_dir)[source]#

Plots (using _plot_properties()) the connectivity model’s distances (summed through the relay, if applicable) and normalized weights matrices using heatmaps.

Parameters:

plots_dir (pathlib.Path) – The directory where the plots are saved.

Raises:

AssertionError – If the plots directory does not exist.

_plot_properties(matrix, title, plots_dir, factor=1.0)[source]#

Helper method to plot a heatmap of a given matrix with specified properties.

Parameters:
  • matrix (numpy.ndarray) – The matrix to be plotted as a heatmap.

  • title (str) – The title for the plot, used to label the saved file.

  • plots_dir (pathlib.Path) – The directory where the plots are saved.

  • factor (float, optional) – A scaling factor applied to the matrix values (default is 1.0).