for index, value in enumerate(loader):
if value == 0: #Anfall erkannt, allerdings nur wenn mindestens 10 sekunden lang!! also in dem Fall 2s Fenster = 5*0Epochen
#minDauerCounter += 1
#if minDauerChecker == 2:
SeizureEpoch = index + 1
print(SeizureEpoch)
seizure_present = True
onset = SeizureEpoch*2 #wegen Epochenlänge fix
# gibt den Beginn des Anfalls an (in Sekunden)
break
else: #Kein Anfall
seizure_present = False
#minDauerCounter = 0
This sounds like a reasonable approach to me. Be careful not to accidentally be off by one epoch because in the code snippet you shared, I believe you are off, but I might be mistaken.
for index, value in enumerate(loader):
if value == 0:
SeizureEpoch = index + 1
onset = SeizureEpoch*2
For a seizure that starts in the very first epoch already (index == 0), you’d assume its onset is at (index + 1) * 2 = 1 * 2 = 2 seconds – not at 0 seconds; which is clearly wrong.