Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not understanding ecg_wave_detector and plot_events_in_signal? #102

Open
windowshopr opened this issue Oct 14, 2019 · 0 comments
Open

Not understanding ecg_wave_detector and plot_events_in_signal? #102

windowshopr opened this issue Oct 14, 2019 · 0 comments

Comments

@windowshopr
Copy link

Hey,

I'm having an issue with these two functions. I am using the below code:

        ecg = nk.ecg_preprocess(ecg=data, sampling_rate=sample_rate)
        rpeaks = ecg["ECG"]["R_Peaks"]
        ecg = ecg["df"]["ECG_Filtered"]
        ecg_waves = nk.ecg_wave_detector(ecg=ecg, rpeaks=rpeaks)
        nk.plot_events_in_signal(ecg, [ecg_waves["P_Waves"], ecg_waves["Q_Waves_Onsets"], ecg_waves["Q_Waves"], list(rpeaks), ecg_waves["S_Waves"], ecg_waves["T_Waves_Onsets"], ecg_waves["T_Waves"], ecg_waves["T_Waves_Ends"]], color=["green", "yellow", "orange", "red", "black", "brown", "blue", "purple"])

...where 'data' is the ecg signal array, and sample rate is 250. I kept receiving Key Errors for:

ecg_waves["Q_Waves_Onsets"]
ecg_waves["S_Waves"]
ecg_waves["T_Waves_Onsets"]
ecg_waves["T_Waves_Ends"]

...so I took them out of the above code, and removed 4 colours to compensate for their loss, but nothing plots? No images are created or anything. I put the missing 4 colours back in to see if that changed anything but still the same issue. The code runs through with no errors, but I don't see any plots or anything. What else could I try, and what is causing the key errors for those waves above? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant