NeuroKit icon indicating copy to clipboard operation
NeuroKit copied to clipboard

Peaks detection Failed

Open purushottam22 opened this issue 2 years ago • 7 comments

I was trying detect all peaks ( P,Q, R, S, T) on an ecg data using this code

_, waves_peak = nk.ecg_delineate(ecg_signal, rpeaks, sampling_rate=3000, method="peak")

I encountered this error :

--> 831     Q = signal_findpeaks(-1 * segment["Signal"], height_min=0.05 * (segment["Signal"].max() - segment["Signal"].min()))
    832     if len(Q["Peaks"]) == 0:
    833         return np.nan, None

TypeError: unsupported operand type(s) for -: 'str' and 'str'

R- peaks detection was successful.

purushottam22 avatar Nov 24 '21 09:11 purushottam22

Hi 👋 Thanks for reaching out and opening your first issue here! We'll try to come back to you as soon as possible. ❤️ kenobi

welcome[bot] avatar Nov 24 '21 09:11 welcome[bot]

Hi @purushottam22 could you provide a sample of your ECG data so that we can try to reproduce the error for investigation? 😄

zen-juen avatar Nov 29 '21 02:11 zen-juen

Hey @zen-juen I ran into this issue while exploring the ecg_delineate.ipynb example. The repo at https://github.com/opsb/neurokit_examples is just the neurokit examples with poetry used for the deps. Using the deps pinned by poetry I saw the same error when running ecg_delineate.ipynb (the "Peak method" cell)

opsb avatar Feb 14 '22 23:02 opsb

It appears the issue is introduced at https://github.com/neuropsychology/NeuroKit/blob/master/neurokit2/epochs/epochs_create.py#L175. If I remove the sanitisation step then the ecg_delineate.ipynb example runs fine. Neither string nor int64 seem like appropriate datatypes here so I'm not sure what this sanitisation step is trying to achieve.

opsb avatar Feb 15 '22 08:02 opsb

@opsb could you try with the latest version (0.1.6)?

DominiqueMakowski avatar Feb 15 '22 08:02 DominiqueMakowski

Hey @DominiqueMakowski was trying to work out how I missed that but see it's just been released. I'm happy to report that the ecg_delineate.ipynb example runs fine against 0.1.6 :tada: I've updated https://github.com/opsb/neurokit_examples in case it's helpful to someone to have the dependencies pinned. The ecg_delineate looks great by the way, later on I'll try running some ECGs I've collected from apple watches through it. Many thanks for publishing the update!

opsb avatar Feb 15 '22 11:02 opsb

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.

stale[bot] avatar Aug 15 '22 21:08 stale[bot]

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.

stale[bot] avatar Oct 15 '22 15:10 stale[bot]