Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
assert len(train_cnt.ch_names) == 22
# lets convert to millvolt for numerical stability of next operations
train_cnt = mne_apply(lambda a: a * 1e6, train_cnt)
train_cnt = mne_apply(
lambda a: bandpass_cnt(
a,
low_cut_hz,
high_cut_hz,
train_cnt.info["sfreq"],
filt_order=3,
axis=1,
),
train_cnt,
)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(
a.T,
factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4,
).T,
train_cnt,
)
test_cnt = test_cnt.drop_channels(["EOG-left", "EOG-central", "EOG-right"])
assert len(test_cnt.ch_names) == 22
test_cnt = mne_apply(lambda a: a * 1e6, test_cnt)
test_cnt = mne_apply(
lambda a: bandpass_cnt(
a,
low_cut_hz,
test_label_filepath = test_filepath.replace('.gdf', '.mat')
train_loader = BCICompetition4Set2A(
train_filepath, labels_filename=train_label_filepath)
test_loader = BCICompetition4Set2A(
test_filepath, labels_filename=test_label_filepath)
train_cnt = train_loader.load()
test_cnt = test_loader.load()
# Preprocessing
train_cnt = train_cnt.drop_channels(['EOG-left',
'EOG-central', 'EOG-right'])
assert len(train_cnt.ch_names) == 22
# lets convert to millvolt for numerical stability of next operations
train_cnt = mne_apply(lambda a: a * 1e6, train_cnt)
train_cnt = mne_apply(
lambda a: bandpass_cnt(a, low_cut_hz, high_cut_hz, train_cnt.info['sfreq'],
filt_order=3,
axis=1), train_cnt)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(a.T, factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4).T,
train_cnt)
test_cnt = test_cnt.drop_channels(['EOG-left',
'EOG-central', 'EOG-right'])
assert len(test_cnt.ch_names) == 22
test_cnt = mne_apply(lambda a: a * 1e6, test_cnt)
test_cnt = mne_apply(
lambda a: bandpass_cnt(a, low_cut_hz, high_cut_hz, test_cnt.info['sfreq'],
axis=1), train_cnt)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(a.T, factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4).T,
train_cnt)
test_cnt = test_cnt.drop_channels(['EOG-left',
'EOG-central', 'EOG-right'])
assert len(test_cnt.ch_names) == 22
test_cnt = mne_apply(lambda a: a * 1e6, test_cnt)
test_cnt = mne_apply(
lambda a: bandpass_cnt(a, low_cut_hz, high_cut_hz, test_cnt.info['sfreq'],
filt_order=3,
axis=1), test_cnt)
test_cnt = mne_apply(
lambda a: exponential_running_standardize(a.T, factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4).T,
test_cnt)
marker_def = OrderedDict([('Left Hand', [1]), ('Right Hand', [2],),
('Foot', [3]), ('Tongue', [4])])
train_set = create_signal_target_from_raw_mne(train_cnt, marker_def, ival)
test_set = create_signal_target_from_raw_mne(test_cnt, marker_def, ival)
train_set, valid_set = split_into_two_sets(
train_set, first_set_fraction=1-valid_set_fraction)
set_random_seeds(seed=20190706, cuda=cuda)
train_filepath, labels_filename=train_label_filepath
)
test_loader = BCICompetition4Set2A(
test_filepath, labels_filename=test_label_filepath
)
train_cnt = train_loader.load()
test_cnt = test_loader.load()
# Preprocessing
train_cnt = train_cnt.drop_channels(
["EOG-left", "EOG-central", "EOG-right"]
)
assert len(train_cnt.ch_names) == 22
# lets convert to millvolt for numerical stability of next operations
train_cnt = mne_apply(lambda a: a * 1e6, train_cnt)
train_cnt = mne_apply(
lambda a: bandpass_cnt(
a,
low_cut_hz,
high_cut_hz,
train_cnt.info["sfreq"],
filt_order=3,
axis=1,
),
train_cnt,
)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(
a.T,
factor_new=factor_new,
init_block_size=init_block_size,
)
test_loader = BCICompetition4Set2A(
test_filepath, labels_filename=test_label_filepath
)
train_cnt = train_loader.load()
test_cnt = test_loader.load()
# Preprocessing
train_cnt = train_cnt.drop_channels(
["EOG-left", "EOG-central", "EOG-right"]
)
assert len(train_cnt.ch_names) == 22
# lets convert to millvolt for numerical stability of next operations
train_cnt = mne_apply(lambda a: a * 1e6, train_cnt)
train_cnt = mne_apply(
lambda a: bandpass_cnt(
a,
low_cut_hz,
high_cut_hz,
train_cnt.info["sfreq"],
filt_order=3,
axis=1,
),
train_cnt,
)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(
a.T,
factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4,
train_cnt = mne_apply(lambda a: a * 1e6, train_cnt)
train_cnt = mne_apply(
lambda a: bandpass_cnt(a, low_cut_hz, high_cut_hz, train_cnt.info['sfreq'],
filt_order=3,
axis=1), train_cnt)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(a.T, factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4).T,
train_cnt)
test_cnt = test_cnt.drop_channels(['EOG-left',
'EOG-central', 'EOG-right'])
assert len(test_cnt.ch_names) == 22
test_cnt = mne_apply(lambda a: a * 1e6, test_cnt)
test_cnt = mne_apply(
lambda a: bandpass_cnt(a, low_cut_hz, high_cut_hz, test_cnt.info['sfreq'],
filt_order=3,
axis=1), test_cnt)
test_cnt = mne_apply(
lambda a: exponential_running_standardize(a.T, factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4).T,
test_cnt)
marker_def = OrderedDict([('Left Hand', [1]), ('Right Hand', [2],),
('Foot', [3]), ('Tongue', [4])])
train_set = create_signal_target_from_raw_mne(train_cnt, marker_def, ival)
test_set = create_signal_target_from_raw_mne(test_cnt, marker_def, ival)
train_set, valid_set = split_into_two_sets(
train_cnt,
)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(
a.T,
factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4,
).T,
train_cnt,
)
test_cnt = test_cnt.drop_channels(["EOG-left", "EOG-central", "EOG-right"])
assert len(test_cnt.ch_names) == 22
test_cnt = mne_apply(lambda a: a * 1e6, test_cnt)
test_cnt = mne_apply(
lambda a: bandpass_cnt(
a,
low_cut_hz,
high_cut_hz,
test_cnt.info["sfreq"],
filt_order=3,
axis=1,
),
test_cnt,
)
test_cnt = mne_apply(
lambda a: exponential_running_standardize(
a.T,
factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4,
test_cnt = test_cnt.drop_channels(["EOG-left", "EOG-central", "EOG-right"])
assert len(test_cnt.ch_names) == 22
test_cnt = mne_apply(lambda a: a * 1e6, test_cnt)
test_cnt = mne_apply(
lambda a: bandpass_cnt(
a,
low_cut_hz,
high_cut_hz,
test_cnt.info["sfreq"],
filt_order=3,
axis=1,
),
test_cnt,
)
test_cnt = mne_apply(
lambda a: exponential_running_standardize(
a.T,
factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4,
).T,
test_cnt,
)
marker_def = OrderedDict(
[
("Left Hand", [1]),
("Right Hand", [2]),
("Foot", [3]),
("Tongue", [4]),
]
test_filepath, labels_filename=test_label_filepath)
train_cnt = train_loader.load()
test_cnt = test_loader.load()
# Preprocessing
train_cnt = train_cnt.drop_channels(['EOG-left',
'EOG-central', 'EOG-right'])
assert len(train_cnt.ch_names) == 22
# lets convert to millvolt for numerical stability of next operations
train_cnt = mne_apply(lambda a: a * 1e6, train_cnt)
train_cnt = mne_apply(
lambda a: bandpass_cnt(a, low_cut_hz, high_cut_hz, train_cnt.info['sfreq'],
filt_order=3,
axis=1), train_cnt)
train_cnt = mne_apply(
lambda a: exponential_running_standardize(a.T, factor_new=factor_new,
init_block_size=init_block_size,
eps=1e-4).T,
train_cnt)
test_cnt = test_cnt.drop_channels(['EOG-left',
'EOG-central', 'EOG-right'])
assert len(test_cnt.ch_names) == 22
test_cnt = mne_apply(lambda a: a * 1e6, test_cnt)
test_cnt = mne_apply(
lambda a: bandpass_cnt(a, low_cut_hz, high_cut_hz, test_cnt.info['sfreq'],
filt_order=3,
axis=1), test_cnt)
test_cnt = mne_apply(
lambda a: exponential_running_standardize(a.T, factor_new=factor_new,
init_block_size=init_block_size,