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
LosslessPipelineobject 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 themne.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.
- get_flagged()¶
Return a list of channels flagged by the lossless pipeline.
- load_tsv(fname)¶
Load serialized channel annotations.
- Parameters:
- fname
str Filename of the tsv file with the annotation information to be loaded.
- fname
- rereference(inst, **kwargs)¶
Re-reference the Raw object attached to the LosslessPipeline.
- Parameters:
- inst
mne.io.Raw An instance of
Rawthat contains EEG channels.- kwargs
dict dictionary of valid keyword arguments for the
set_eeg_reference()method.
- inst
- 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.Annotationsin a loadedmne.io.Rawfile 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:
- kind
str Should be one of the values in
EPOCH_LABELS.- bad_epochs_inds
list|tuple Indices for the epochs in an
mne.Epochsobject. Will be the values for thekinddictionary key.- raw
mne.io.Raw The mne Raw object that is being assesssed by the LosslessPipeline
- epochs
mne.Epochs The
mne.Epochsobject created from the Raw object that is being assessed by the LosslessPipeline.
- kind
- 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:
- fname
pathlib.Path Filepath to the
derivatives/pylossslessfolder in thebids_rootdirectory.- ica
mne.preprocessing.ICA An ICA object created by mne.preprocessing.ICA.
- data_frame
pandas.DataFrame A pandas DataFrame that contains the dictionary returned by
mne_icalabel.label_components().
- fname
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:
- epochs
mne.Epochs instance of mne.Epochs to be passed into
mne_icalabel.label_components().- ica
mne.ICA instance of mne.ICA to be passed into
mne_icalabel.label_components().- method
str(default “iclabel”) The proposed method for labeling components, to be passed into
mne_icalabel.label_components(). Must be one of: ‘iclabel’.
- epochs
- load_tsv(fname, data_frame=None)¶
Load flagged ICs from file.
- save_tsv(fname)¶
Save IC labels.
- Parameters:
- fname
str|pathlib.Path The output filename.
- fname