issue fixes
This commit is contained in:
@@ -172,6 +172,9 @@ L_TRANS_BANDWIDTH: float
|
||||
H_TRANS_BANDWIDTH: float
|
||||
|
||||
EPOCH_HANDLING: str
|
||||
MAX_SHIFT: int
|
||||
T_MIN: int
|
||||
T_MAX: int
|
||||
|
||||
RESAMPLE: bool
|
||||
RESAMPLE_FREQ: int
|
||||
@@ -235,6 +238,11 @@ REQUIRED_KEYS: dict[str, Any] = {
|
||||
"TIME_WINDOW_END": int,
|
||||
"L_FREQ": float,
|
||||
"H_FREQ": float,
|
||||
|
||||
"EPOCH_HANDLING": str,
|
||||
"MAX_SHIFT": int,
|
||||
"T_MIN": int,
|
||||
"T_MAX": int,
|
||||
|
||||
"TDDR": bool,
|
||||
"WAVELET": bool,
|
||||
@@ -1212,7 +1220,7 @@ def safe_create_epochs(raw, events, event_dict, tmin, tmax, baseline):
|
||||
"""
|
||||
shift_increment = 1.0 / raw.info['sfreq'] # The duration of exactly one sample
|
||||
|
||||
for attempt in range(10): # Limit attempts to avoid infinite loops
|
||||
for attempt in range(MAX_SHIFT): # Limit attempts to avoid infinite loops
|
||||
try:
|
||||
epochs = Epochs(
|
||||
raw, events, event_id=event_dict,
|
||||
@@ -1244,9 +1252,9 @@ def epochs_calculations(raw_haemo, events, event_dict):
|
||||
fig_epochs = [] # List to store figures
|
||||
|
||||
if EPOCH_HANDLING == 'shift':
|
||||
epochs = safe_create_epochs(raw=raw_haemo, events=events, event_dict=event_dict, tmin=-5, tmax=15, baseline=(None, 0))
|
||||
epochs = safe_create_epochs(raw=raw_haemo, events=events, event_dict=event_dict, tmin=T_MIN, tmax=T_MAX, baseline=(None, 0))
|
||||
else:
|
||||
epochs = Epochs(raw_haemo, events, event_id=event_dict, tmin=-5, tmax=15, baseline=(None, 0))
|
||||
epochs = Epochs(raw_haemo, events, event_id=event_dict, tmin=T_MIN, tmax=T_MAX, baseline=(None, 0))
|
||||
|
||||
# Make a copy of the epochs and drop bad ones
|
||||
epochs2 = epochs.copy()
|
||||
|
||||
Reference in New Issue
Block a user