File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
mne_bids_pipeline/steps/preprocessing Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ def _mark_calibration_as_bad(raw):
3939 # marks recalibration beginnings and ends as one bad segment
4040 cur_idx = None
4141 cur_start_time = 0.
42+ last_status = None
4243 for annot in raw .annotations :
43- calib_match = re .match (".* Recalibration (start|end) \\ | (\\ d *)" , annot ["description" ])
44+ calib_match = re .match (".* Recalibration (start|end) \\ | (. *)" , annot ["description" ])
4445 if not calib_match : continue
45-
4646 calib_status , calib_idx = calib_match .group (1 ), calib_match .group (2 )
4747 if calib_idx == cur_idx and calib_status == "end" :
4848 duration = annot ["onset" ] - cur_start_time
@@ -51,8 +51,11 @@ def _mark_calibration_as_bad(raw):
5151 elif calib_status == "start" and cur_idx is None :
5252 cur_idx = calib_idx
5353 cur_start_time = annot ["onset" ]
54+ elif calib_status == last_status :
55+ logger .info (** gen_log_kwargs (message = f"Encountered apparent duplicate calibration event - skipping" ))
5456 elif calib_status == "start" and cur_idx is not None :
5557 raise ValueError (f"Annotation { annot ["description" ]} could not be assigned membership" )
58+ last_status = calib_status
5659
5760 return raw
5861
You can’t perform that action at this time.
0 commit comments