Skip to content

Miscellaneous functions

MariusKlug edited this page May 19, 2022 · 2 revisions

The toolbox comes with a number of additional miscellaneous functions to be found in the misc subfolder, some of which are more relevant than others. Here, we describe a few of them:

Automatic rejection of epochs and continuous data

The function bemobil_reject_epochs automatically detects bad epochs using the mean of channel means (to detect general large shifts), mean of channel SDs (to detect large fluctuations in many channels, e.g. large muscle activity), SD of channel means (to detect phases where single channels went off), and SD of channel SDs (to detect large fluctuations in single channels, even when not going off in one direction) as features. The detection can then be based on a fixed percentage threshold or a knee-point detector. All info is stored in the etc field of the data, and bad epochs can be automatically rejected at last.

A plot is generated containing a concatenated version of the data, marking bad epochs in red, and the four quality measure including the threshold for removal (this example had a noisy movement part in the first half, and a more clean stationary part in the second half, N_epochs = 2144):

epoch rejection example

This automatic epoch rejection can also be used to reject continuous data automatically using the bemobil_reject_continuous function. This function first performs a high-pass filter to remove eye blinks (since they can easily be removed by ICA and should not be removed in this step), cuts the data into short overlapping epochs, detects bad epochs using bemobil_reject_epochs, and finds final rejection segments from the provided rejection indices. This can also be performed before AMICA in the complete processing analysis using the hidden bemobil_config.use_reject_continuous flag with associated flags (see the bemobil_process_all_AMICA function lines 119 and below), but it is not recommended, as we have found in our tests that AMICA autorejection performs better.

Extended signal decomposition options

The function bemobil_signal_decomposition_extended implements a set of spatial filters in addition to ICA that can be used for early fusion of data (e.g. CCA and SPOC), or semi-informed source separation (SSD). If you intend to use these decomposition options, please drop us a message in the discord!