|
@@ -77,10 +77,12 @@ def reref(raw, method='average'):
|
|
|
raise ValueError(f'Rereference method unacceptable, got {str(method)}, expect "monopolar" or "average" or "bipolar"')
|
|
|
|
|
|
|
|
|
-def preprocessing(raw, reref_method='monopolar'):
|
|
|
+def preprocessing(raw, reref_method='monopolar', keeptimes=None):
|
|
|
# cut by the first and last annotations
|
|
|
annotation_onset, annotation_offset = raw.annotations.onset[0], raw.annotations.onset[-1]
|
|
|
- tmin, tmax = max(annotation_onset - 5., raw.times[0]), min(annotation_offset + 5, raw.times[-1])
|
|
|
+ if keeptimes is None:
|
|
|
+ keeptimes = 10.
|
|
|
+ tmin, tmax = max(annotation_onset - keeptimes, raw.times[0]), min(annotation_offset + keeptimes, raw.times[-1])
|
|
|
# rebuilt the raw
|
|
|
# MNE的crop函数会导致annotation错乱,只能重建raw object
|
|
|
new_annotations = mne.Annotations(onset=raw.annotations.onset - tmin,
|