PyLossless Configuration Classes

This is the docstring for the Lossless Config class. The methods and attributes detailed below are used to parse the YAML config file that is read by the Lossless Pipeline, and which contains the parameters to use for the pipeline.

PyLossless Config Class

class pylossless.config.Config

Representation of configuration file for running the pipeline.

Methods

load_default([kind])

Get the default pylossless config file.

load_default(kind='adults')

Get the default pylossless config file.

Parameters:
kindstr | pathlib.Path

Can be either ‘adults’ or ‘infants’. Default to ‘adults’.

Rejection Config Class

class pylossless.config.RejectionPolicy(*, config_fname=None, ch_flags_to_reject='all', ic_flags_to_reject='all', ic_rejection_threshold=0.3, ch_cleaning_mode=None, interpolate_bads_kwargs=None, remove_flagged_ics=True)

Class used to implement a rejection policy for a pipeline output.

Parameters:
config_fnamepathlib.Path

path to config file specifying the parameters to be used in for the rejection policy.

ch_flags_to_rejectlist of str

List of channel flags to apply. “all” is the same as ["noisy", "uncorrelated", "bridged"], meaning that any channels that have been flagged "noisy", "uncorrelated", or "bridged" will be applied. Defaults to “all”.

ic_flags_to_rejectlist of str

List of IC flags to apply. “all” is the same as ["muscle", "heart", "eye", "channel noise", "line noise"], meaning that any ICs that have been flagged "muscle", "ecg", "eog" "channel_noise", or "line_noise" will be applied, if their label confidence is greater than ic_rejection_threshold. Note this list does NOT include "brain" and "other". Defaults to “all”.

ic_rejection_thresholdfloat

threshold (between 0 and 1), representing the minimum confidence percentage in a given label (i.e., .30 is 30% confidence). For any labels passed to ic_flags_to_reject (i.e. "ecg", "eog", etc.), ICs with that label and a confidence percentage greater than this threshold will be rejected. Defaults to 0.3.

ch_cleaning_modestr

Must be one of None, "drop", or "interpolate". None adds the channels to raw.info["bads"]. "drop" drops the channels from the Raw object. "interpolate" interpolates the bad channels. Defaults to None.

interpolate_bads_kwargsNone | dict

If ch_cleaning_mode is "interpolate", these keyword arguments will be passed to raw.interpolate_bads(**interpolate_bads_kwargs). Must be a dictionary of valid keyword arguments for interpolate_bads(). Defaults to None, which means no keyword arguments will be passed.

remove_flagged_icsbool

If True, subtracts the signal accounted for by the flagged ICs from the raw object, via apply(). If False, does nothing. Defaults to True.

Methods

apply(pipeline[, return_ica, version_mismatch])

Return a cleaned new raw object based on the rejection policy.

apply(pipeline, return_ica=False, version_mismatch='raise')

Return a cleaned new raw object based on the rejection policy.

Parameters:
pipelineLosslessPipeline

An instance of LosslessPipeline with after the pipeline has been ran.

return_icabool

If True, returns the ica object used to clean the Raw object. Defaults to False.

Returns:
mne.io.Raw

An Raw instance with the appropriate channels and ICs added to mne bads, interpolated, or dropped.