issue fixes

This commit is contained in:
2026-03-23 22:18:22 -07:00
parent 3afcb54b77
commit 9a32c8e301
3 changed files with 24 additions and 7 deletions
+11 -3
View File
@@ -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()