NeuroKit
NeuroKit copied to clipboard
nk.ecg_quality loop #ECG
Question and context
I have 48 hours ECG data; there are many motion artifacts. I planned nk.ecg_quality loop, long term calculation can not detect motion artifact. So I tried to make sliding window approach. window size is 7 * frequency.
-
len_ecg=len(ecg_cleaned) step_half=int(f/2) # f is 256 f_7=int(7*f)
-
x=deque() for i in islice(range(len_ecg), 0, len_ecg, step_half): x.append(i)
-
idx=[] y=[]
while x: if nk.ecg_quality(ecg_cleaned[x.popleft():f_7+x.popleft()], sampling_rate=f, method="zhao2018", approach="fuzzy")=='Excellent': y.append(1) idx.append(x.popleft()) else: y.append(0) idx.append(x.popleft())
when I runned at 1st,
IndexError: index 0 is out of bounds for axis 0 with size 0 and len(y)=8814
so I set range [x[8814]:f_7+x[8814]]
and run nk.ecg_quality(ecg_cleaned[x[8814]:f_7+x[8814]] , sampling_rate=f, method="zhao2018", approach="fuzzy") its result was 'Excellent' [x[8815]:f_7+x[8815]] was also
it means IndexError was not real...
I reset the whole ipynb and run the code again.
IndexError: index 0 is out of bounds for axis 0 with size 0 and len(y)=5410
I don't know why this error happen
Hi 👋 Thanks for reaching out and opening your first issue here! We'll try to come back to you as soon as possible. ❤️
I have been working with this function with an other approach, but got the same error when the lower level function _ecg_quality_zhao2018 used in ecg_quality, couldnt detect any R peaks in a time-window. If I remember right _ecg_quality_zhao2018 uses the default neurokit peak-detection method without artifact correction. Run the default peakfinder in those segments and see if any peaks are detected. Hope this helps.
I have been working with this function with an other approach, but got the same error when the lower level function _ecg_quality_zhao2018 used in ecg_quality, couldnt detect any R peaks in a time-window. If I remember right _ecg_quality_zhao2018 uses the default neurokit peak-detection method without artifact correction. Run the default peakfinder in those segments and see if any peaks are detected. Hope this helps.
can you upload the example coding???
This issue has been automatically marked as inactive because it has not had recent activity. It will eventually be closed if no further activity occurs.
without any rep!????????!
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.