Fixed some smaller things
This commit is contained in:
@@ -70,8 +70,7 @@ def clean_data(raw, subject, dataset, cleaned=False):
|
||||
:return: the bad channels
|
||||
"""
|
||||
channels = None
|
||||
folder = "Dataset\\" + dataset + "\\sub-" + subject + "\\ses-" + dataset + "\\eeg\\"
|
||||
filepath = folder + "sub-" + subject + "_task-" + dataset
|
||||
filepath = "Dataset/preprocessed/sub-" + subject + "_task-" + dataset + "_badannotations.csv"
|
||||
|
||||
# If nothing was marked yet, plot the data to mark bad segments
|
||||
if not cleaned:
|
||||
@@ -80,15 +79,15 @@ def clean_data(raw, subject, dataset, cleaned=False):
|
||||
bad_idx = [idx for (idx, annot) in enumerate(raw.annotations) if annot['description'] == "BAD_"]
|
||||
# If bad intervals were found save
|
||||
if bad_idx:
|
||||
raw.annotations[bad_idx].save(filepath + "_badannotations.csv")
|
||||
raw.annotations[bad_idx].save(filepath)
|
||||
|
||||
if os.path.isfile(filepath + "_badannotations.csv"):
|
||||
annotations = mne.read_annotations(filepath + "_badannotations.csv")
|
||||
if os.path.isfile(filepath):
|
||||
annotations = mne.read_annotations(filepath)
|
||||
raw.annotations.append(annotations.onset, annotations.duration, annotations.description)
|
||||
|
||||
# Set the bad channels for each subject
|
||||
if subject == '001':
|
||||
channels = ['F8'] # Maybe also FP2?
|
||||
channels = ['F8']
|
||||
elif subject == '003':
|
||||
channels = []
|
||||
elif subject == '014':
|
||||
|
||||
Reference in New Issue
Block a user