lw_pipeline.Config#

class lw_pipeline.Config(config_file_path=None, verbose=False)[source]#

Bases: object

A class representing the configuration settings.

__init__(config_file_path=None, verbose=False)[source]#

Initialize the Config object.

Parameters:
  • config_file_path (str, optional) – The path to the configuration file. If provided, the configuration settings will be updated based on the variables defined in the file.

  • verbose (bool, optional) – If True, print messages about the configuration file being used. Default is False.

Methods

__init__([config_file_path, verbose])

Initialize the Config object.

ask(message[, default])

Ask to do something, e.g. before potentially deleting data, etc.

check_steps_dir()

Make sure steps dir is absolute.

get_version()

Get a version of the pipeline by getting last commit hash from the git.

set_variable_and_write_to_config_file(...)

Set a variable in this class and write to config file, if not defined there.

Attributes

auto_response

Decide how questions are answered (off/y/n/default)

bids_acquisition

EEG information that should be included in the BIDS file

bids_datatype

BIDS datatype of the data created as derivatives in the pipeline

bids_extension

Extension of the BIDS files in the bids root directory

bids_root

Root directory for BIDS formatted data

config_file_path

The path to an external configuration file.

data_dir

Default data directory

deriv_root

Root directory for derivatives

eeg_path

Path to the eeg data which should be converted to BIDS

n_jobs

Number of parallel jobs to run

overwrite

Overwrite existing derivative files, if False they are skipped

sessions

List of sessions to include in the pipeline processing.

steps_dir

Steps directory relative to config file or current working directory if no

subjects

List of subjects to include in the pipeline processing.

tasks

List of tasks to include in the pipeline processing.

ask(message, default='n')[source]#

Ask to do something, e.g. before potentially deleting data, etc.

Make sure to specify options, e.g. (y/n), in the message.

auto_response = 'off'#

Decide how questions are answered (off/y/n/default)

bids_acquisition = None#

EEG information that should be included in the BIDS file

bids_datatype = 'eeg'#

BIDS datatype of the data created as derivatives in the pipeline

bids_extension = '.edf'#

Extension of the BIDS files in the bids root directory

bids_root = '/home/runner/data/bids'#

Root directory for BIDS formatted data

check_steps_dir()[source]#

Make sure steps dir is absolute.

Notes

  • If config_file_path is not None, the relative steps_dir is resolved relative to the directory containing the configuration file.

  • If config_file_path is None, the relative steps_dir is resolved relative to the current working directory.

Parameters:
  • steps_dir (str) – The directory path for steps, which will be converted to an absolute path.

  • config_file_path (str or None) – The path to the configuration file, used to resolve relative paths.

config_file_path = None#

The path to an external configuration file.

data_dir = '/home/runner/data'#

Default data directory

deriv_root = '/home/runner/data/derivatives'#

Root directory for derivatives

eeg_path = {}#

Path to the eeg data which should be converted to BIDS

Structure: subject -> condition -> task -> list of eeg files (runs) File names expected relative to data_dir

get_version()[source]#

Get a version of the pipeline by getting last commit hash from the git.

Cave: This only works if the pipeline is in a git repository. If not, it will return “unknown”.

n_jobs = 1#

Number of parallel jobs to run

overwrite = False#

Overwrite existing derivative files, if False they are skipped

sessions = []#

List of sessions to include in the pipeline processing. If empty list, include all sessions

set_variable_and_write_to_config_file(variable, value)[source]#

Set a variable in this class and write to config file, if not defined there.

For safety, only allow to write variables that are not already set.

Parameters:
  • variable (str) – The name of the variable to update.

  • value (mixed) – The value to set the variable to.

steps_dir = 'steps/'#

Steps directory relative to config file or current working directory if no

subjects = []#

List of subjects to include in the pipeline processing. If empty list, include all subjects

tasks = []#

List of tasks to include in the pipeline processing. If empty list, include all tasks