Pipeline Functions¶
Classes and Functions for running the Lossless Pipeline.
- pylossless.pipeline.chan_neighbour_r(epochs, nneigbr, method)¶
Compute nearest Neighbor R.
- Parameters:
- epochs
mne.Epochs - nneigbr
int Number of neighbours to compare in open interval
- method
str One of ‘max’, ‘mean’, or ‘trimmean’. This is the function which aggregates the neighbours into one value.
- epochs
- Returns:
- Xarray
Xarray.DataArray An instance of Xarray.DataArray
- Xarray
- pylossless.pipeline.coregister(raw_edf, fiducials='estimated', show_coreg=False, verbose=False)¶
Coregister Raw object to ‘fsaverage’.
- Parameters:
- raw_edf
mne.Raw an instance of mne.Raw to coregister.
- fiducials
str(default ‘estimated’) fiducials to use for coregistration. if ‘estimated’, gets fiducials from fsaverage.
- show_coreg
bool(defaultFalse) If True, shows the coregistration result in a plot.
- verbose
bool|str(defaultFalse) sets the logging level for mne.Coregistration.
- raw_edf
- Returns:
coregistration|numpy.arraya numpy array containing the coregistration trans values.
- pylossless.pipeline.epochs_to_xr(epochs, kind='ch', ica=None)¶
Create an Xarray DataArray from an instance of mne.Epochs.
- Parameters:
- epochs
mne.Epochs an instance of mne.Epochs
- kind
str The name to be passed into the coords argument of xr.DataArray corresponding to the channel dimension of the epochs object. Must be
'ch'or'ic'.- ica
mne.preprocessing.ICA If not
None, should be an instance of mne.preprocessing.ICA from which to pull the names of the ICA components.
- epochs
- Returns:
xarray.DataArrayan instance of xarray.DataArray, with dimensions
'epochs','time'(samples), and either'ch'(channels) or'ic'(independent components).
- pylossless.pipeline.get_operate_dim(array, flag_dim)¶
Get the xarray.DataArray dimension to flag for a pipeline method.
- Parameters:
- array
xarray.DataArray An instance of Xarray.DataArray that was constructed from an
mne.Epochsobject, usingpylossless.pipeline.epochs_to_xr. Thearraymust be 2D.- flag_dim
str Name of the dimension to remove in
xarray.DataArray.dims. Must be one of'epoch','ch', or'ic'.
- array
- Returns:
- list
list a list of the dimensions of the xarray.DataArray, excluding the dimension that the pipeline will conduct flagging operations on.
- list