Flag Classes

Classes to store information on artifactual channels, epochs, components.

class pylossless.flagging.FlaggedChs(*args, **kwargs)

Object for handling flagged channels in an instance of mne.io.Raw.

Attributes:
llLosslessPipeline

the LosslessPipeline object that is flagging artifactual channels.

Methods

add_flag_cat:

Add a list of one or more channel names that should be considered as artifactual.

rereference:

rereference instance of mne.io.Raw, using the mne.io.Raw.set_eeg_reference() method. Applicable only for EEG data.

save_tsv:

Save flagged channel annotations to a text file.

load_tsv:

Load previously saved channel annotations from a text file.

Notes

This class inherits from dict, and can use any valid attributes and methods for python dictionaries.

add_flag_cat(kind, bad_ch_names, *args)

Store channel names that have been flagged by pipeline.

Parameters:
kindstr

Should be one of the values in CH_LABELS.

bad_ch_nameslist | tuple

Channel names. Will be the values corresponding to the kind dictionary key.

Returns:
None
get_flagged()

Return a list of channels flagged by the lossless pipeline.

load_tsv(fname)

Load serialized channel annotations.

Parameters:
fnamestr

Filename of the tsv file with the annotation information to be loaded.

rereference(inst, **kwargs)

Re-reference the Raw object attached to the LosslessPipeline.

Parameters:
instmne.io.Raw

An instance of Raw that contains EEG channels.

kwargsdict

dictionary of valid keyword arguments for the set_eeg_reference() method.

save_tsv(fname)

Save flagged channel annotations to a text file.

Parameters:
fnamestr

Filename that the annotations will be saved to.

class pylossless.flagging.FlaggedEpochs(*args, **kwargs)

Object for handling flagged Epochs in an instance of mne.Epochs.

Methods

add_flag_cat:

Append a list of indices (corresponding to Epochs in an instance of mne.Epochs) to the 'manual' dictionary key.

load_from_raw:

Add any pylossless mne.Annotations in a loaded mne.io.Raw file to the FlaggedEpochs class.

Notes

This class inherits from dict, and can use any valid attributes and methods for python dictionaries.

add_flag_cat(kind, bad_epoch_inds, epochs)

Add information on time periods flagged by pyLossless.

Parameters:
kindstr

Should be one of the values in EPOCH_LABELS.

bad_epochs_indslist | tuple

Indices for the epochs in an mne.Epochs object. Will be the values for the kind dictionary key.

rawmne.io.Raw

The mne Raw object that is being assesssed by the LosslessPipeline

epochsmne.Epochs

The mne.Epochs object created from the Raw object that is being assessed by the LosslessPipeline.

load_from_raw(raw, events, config)

Load pylossless annotations from raw object.

class pylossless.flagging.FlaggedICs(*args, **kwargs)

Object for handling IC classification in an mne ICA object.

Attributes:
fnamepathlib.Path

Filepath to the derivatives/pylosssless folder in the bids_root directory.

icamne.preprocessing.ICA

An ICA object created by mne.preprocessing.ICA.

data_framepandas.DataFrame

A pandas DataFrame that contains the dictionary returned by mne_icalabel.label_components().

Methods

label_components(epochs, ica)

Classify components using mne_icalabel.

save_tsv(fname)

Save IC labels.

load_tsv(fname[, data_frame])

Load flagged ICs from file.

label_components(epochs, ica)

Classify components using mne_icalabel.

Parameters:
epochsmne.Epochs

instance of mne.Epochs to be passed into mne_icalabel.label_components().

icamne.ICA

instance of mne.ICA to be passed into mne_icalabel.label_components().

methodstr (default “iclabel”)

The proposed method for labeling components, to be passed into mne_icalabel.label_components(). Must be one of: ‘iclabel’.

load_tsv(fname, data_frame=None)

Load flagged ICs from file.

save_tsv(fname)

Save IC labels.

Parameters:
fnamestr | pathlib.Path

The output filename.