eegyolk.cnt module

Copyright 2022 Netherlands eScience Center and Utrecht University. Licensed under the Apache License, version 2.0. See LICENSE for details.

This file contains functions originally designed to reproduce work from 2021 to run on a Linux machine. The specific work was pre-processing of EEG files.

class eegyolk.cnt.CntReader(raw_data)

Bases: object

This is class that allows reading in of cnt files in a specific way.

baseline = (None, 0)
col_names_from_feautres(ch_names, extracted)
csv_h5_paths(processed_dir)
event_idx = (2, 3, 4, 5, 12, 13, 14, 15)
hpass = 40
known_channel_sets = {'30': ('O2', 'O1', 'OZ', 'PZ', 'P4', 'CP4', 'P8', 'C4', 'TP8', 'T8', 'P7', 'P3', 'CP3', 'CPZ', 'CZ', 'FC4', 'FT8', 'TP7', 'C3', 'FCZ', 'FZ', 'F4', 'F8', 'T7', 'FT7', 'FC3', 'F3', 'FP2', 'F7', 'FP1'), '62': ('O2', 'O1', 'OZ', 'PZ', 'P4', 'CP4', 'P8', 'C4', 'TP8', 'T8', 'P7', 'P3', 'CP3', 'CPZ', 'CZ', 'FC4', 'FT8', 'TP7', 'C3', 'FCZ', 'FZ', 'F4', 'F8', 'T7', 'FT7', 'FC3', 'F3', 'FP2', 'F7', 'FP1', 'AFZ', 'PO3', 'P1', 'POZ', 'P2', 'PO4', 'CP2', 'P6', 'M1', 'CP6', 'C6', 'PO8', 'PO7', 'P5', 'CP5', 'CP1', 'C1', 'C2', 'FC2', 'FC6', 'C5', 'FC1', 'F2', 'F6', 'FC5', 'F1', 'AF4', 'AF8', 'F5', 'AF7', 'AF3', 'FPZ')}
lpass = 0.5
max_bad_channels = 2
max_bad_fraction = 0.2
read(cnt, label_group, channel_set='30')

Historical function from previous work to read cnt files. Function to read cnt file. Run bandpass filter. Then detect and correct/remove bad channels and bad epochs. Store resulting epochs as arrays. Arguments include cnt: str Name of file to import. label_group: int Unique ID of specific group (must be > 0). channel_set: str Select among pre-defined channel sets. Here: ‘30’ or ‘62’

rms(data)

Root-mean squared value of the data (per channel). Parameters ———- data : ndarray, shape (n_channels, n_times) Returns ——- output : ndarray, shape (n_channels,) Notes —– Alias of the feature function: rms

save_preprocessed(processed_dir, limit=None, force=False)
save_preprocessed_row(row)
selected_features()
threshold = 5
tmax = 0.8
tmin = -0.2
eegyolk.cnt.preprocess(raw, meta, processed, limit=None, force=False)
eegyolk.cnt.select_bad_epochs_list(epochs, stimuli, threshold=5, max_bad_fraction=0.2)

Function to find suspect epochs and channels –> still might need manual inspection! Credit to Bjorn Bruns and Florian Huber. Arguments are as below epochs: epochs object (mne) stimuli: list of int/str Stimuli to pick epochs for. threshold: float/int Relative threshold. Anything channel with variance > threshold*mean OR < threshold*mean will be considered suspect. Default = 5. max_bad_fraction: float Maximum fraction of bad epochs. If number is higher for one channel, call it a ‘bad’ channel