macro_eeg_model.config.parser#
Classes#
The Parser class is responsible for parsing the command line arguments and setting |
Module Contents#
- class macro_eeg_model.config.parser.Parser(parser)[source]#
The Parser class is responsible for parsing the command line arguments and setting default values.
- parser#
The argument parser instance used to parse command line arguments.
- Type:
argparse.ArgumentParser
- _default_n#
The default number of simulations to run.
- Type:
int
- _default_model_name#
The default name of the model.
- Type:
str
- _default_nodes#
The default brain areas where the nodes are placed.
- Type:
str
- _default_relay_station#
The default brain area to use as a relay station.
- Type:
str
- _default_custom_connectivity#
Indicates whether to use custom connectivity by default.
- Type:
bool
- _default_t_lags#
The default lagged time in milliseconds.
- Type:
int
- _default_sample_rate#
The default sample rate in Hz.
- Type:
int
- _default_t_secs#
The default simulation time in seconds.
- Type:
int
- _default_t_burnit#
The default number of seconds (burn-in) to delete for model convergence.
- Type:
int
- _default_noise_color#
The default color of the noise.
- Type:
str
- _default_std_noise#
The default standard deviation of the noise.
- Type:
int
- _default_dist_shape#
The default shape parameter for the lag distributions.
- Type:
float
- _default_dist_scale#
The default scale parameter for the lag distributions.
- Type:
float
- _default_dist_location#
The default location parameter for the lag distributions.
- Type:
float
- _default_dist_trunc_percent#
The default truncation percentile for the lag distributions.
- Type:
float
- __init__(parser)[source]#
Initializes the Parser with an argparse parser and loads the default values from model_params.yml configuration file in the configs data path (see
src.utils.paths.Paths)- Parameters:
parser (argparse.ArgumentParser) – The argument parser instance used to parse command line arguments.
- static _load_yaml(file_path)[source]#
Loads a YAML file from the specified path.
- Parameters:
file_path (str or pathlib.Path) – The path to the YAML file to load.
- Returns:
The contents of the YAML file as a dictionary.
- Return type:
dict
- parse_args()[source]#
Parses known arguments from the command line, validates them, and returns them as an argparse Namespace object.
- Returns:
The parsed command line arguments.
- Return type:
argparse.Namespace
- _add_arguments()[source]#
Adds the command line arguments to the parser and sets their default values based on the loaded YAML configuration.
- static _validate_args(args)[source]#
Validates the parsed command line arguments.
- Parameters:
args (argparse.Namespace) – The parsed command line arguments.
- Raises:
ValueError – If the parsed arguments are invalid.
- static _parse_relay_station(relay_station_value: str)[source]#
Parses the relay station argument from the command line. If the provided value is “none”, it returns None; otherwise, it returns the string value.
- Parameters:
relay_station_value (str) – The relay station value provided from the command line.
- Returns:
The parsed relay station value, or None if “none” is provided.
- Return type:
str or None
- static _parse_nodes(nodes_str)[source]#
Parses a string into a list of nodes.
This method converts a semicolon-separated string of node names into a list of strings. For example: “node1; node2; node3” -> [“node1”, “node2”, “node3”].
- Parameters:
nodes_str (str) – The semicolon-separated string of node names.
- Returns:
A list of node names.
- Return type:
list
- Raises:
argparse.ArgumentTypeError – If the input string cannot be parsed into a valid list of nodes.