paulvangentcom / heartrate_analysis_python

Python Heart Rate Analysis Package, for both PPG and ECG signals
MIT License
947 stars 321 forks source link

Only working fine on the 14500:20500, #63

Closed Jaswanth-Devarinti closed 3 years ago

Jaswanth-Devarinti commented 3 years ago

It's only working on the range given, for other ranges, it's not working.

image

paulvangentcom commented 3 years ago

Please provide the full code and data set you're using. There's little I can do with just this info

-Paul

Jaswanth-Devarinti commented 3 years ago

Same dataset and same code, I will share the code 5 min

On Sat, Mar 20, 2021, 14:47 Paul van Gent @.***> wrote:

Please provide the full code and data set you're using. There's little I can do with just this info

-Paul

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#issuecomment-803277242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4EHTOVNVV5RWW5PBRLTERR3NANCNFSM4ZQHPIVA .

Jaswanth-Devarinti commented 3 years ago

[image: image.png] [image: image.png] [image: image.png] [image: image.png] [image: image.png]

These are the snippets in the code.

On Sat, Mar 20, 2021 at 3:08 PM Jaswanth D @.***> wrote:

Same dataset and same code, I will share the code 5 min

On Sat, Mar 20, 2021, 14:47 Paul van Gent @.***> wrote:

Please provide the full code and data set you're using. There's little I can do with just this info

-Paul

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#issuecomment-803277242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4EHTOVNVV5RWW5PBRLTERR3NANCNFSM4ZQHPIVA .

paulvangentcom commented 3 years ago

Can you share the .py file? I cannot see the images. Don't know what set the 'same dataset' is

Jaswanth-Devarinti commented 3 years ago

Sure, here it is.

https://colab.research.google.com/drive/15A_98W1lsyXFiDZJt6ojfSg9iVz_KfnG?usp=sharing this is ,pynb file

On Sat, Mar 20, 2021 at 3:15 PM Paul van Gent @.***> wrote:

Can you share the .py file? I cannot see the images. Don't know what set the 'same dataset' is

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#issuecomment-803280716, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4FZS6QJET6DNJAXE53TERVBZANCNFSM4ZQHPIVA .

Jaswanth-Devarinti commented 3 years ago

Did you get it?

On Sat, Mar 20, 2021, 15:17 Jaswanth D @.***> wrote:

Sure, here it is.

https://colab.research.google.com/drive/15A_98W1lsyXFiDZJt6ojfSg9iVz_KfnG?usp=sharing this is ,pynb file

On Sat, Mar 20, 2021 at 3:15 PM Paul van Gent @.***> wrote:

Can you share the .py file? I cannot see the images. Don't know what set the 'same dataset' is

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#issuecomment-803280716, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4FZS6QJET6DNJAXE53TERVBZANCNFSM4ZQHPIVA .

paulvangentcom commented 3 years ago

Thanks, will have a look over the weekend.

-Paul

Jaswanth-Devarinti commented 3 years ago

Ok, thanks. Actually we are using heartpy for a small mini project and cane across this. If you can do it early, it'll be a lot helpful as we did all the work till this part. 😅😅 Thank you, I'm Jaswanth

On Sat, Mar 20, 2021, 16:22 Paul van Gent @.***> wrote:

Thanks, will have a look over the weekend.

-Paul

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#issuecomment-803289659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4GDTE3MJSSTU662NXTTER463ANCNFSM4ZQHPIVA .

paulvangentcom commented 3 years ago

Ah you're using that example smartwatch dataset. Be aware that the data is very intermittent (some sections contain data, some do not), see the whole plot here:

smartwatchppg

You would need to write some code to exclude sections where no signal is present, and only run the analysis on sections where there's a signal present (the exception you're getting is telling you there's no signal). There's an example of how you might approach this task at the end of that same notebook, but by no means is that the only approach possible.

Alternative is collecting some of your own data using a smartwatch or ppg sensor.

Cheers, Paul

Jaswanth-Devarinti commented 3 years ago

Thanks, I'll check it out. 😁😁

On Sat, Mar 20, 2021, 17:25 Paul van Gent @.***> wrote:

Ah you're using that example smartwatch dataset. Be aware that the data is very intermittent (some sections contain data, some do not), see the whole plot here:

[image: smartwatchppg] https://user-images.githubusercontent.com/15799488/111868596-29311f80-897b-11eb-89ee-57d242081fb1.png

You would need to write some code to exclude sections where no signal is present, and only run the analysis on sections where there's a signal present (the exception you're getting is telling you there's no signal). There's an example of how you might approach this task at the end of that same notebook https://github.com/paulvangentcom/heartrate_analysis_python/blob/master/examples/3_smartwatch_data/Analysing_Smartwatch_Data.ipynb, but by no means is that the only approach possible.

Alternative is collecting some of your own data using a smartwatch or ppg sensor.

Cheers, Paul

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#issuecomment-803297516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4HYAIAAJR2RB4VFBQTTESEMBANCNFSM4ZQHPIVA .

paulvangentcom commented 3 years ago

Good luck, let me know if you need further assistance. Closing this for now.

Cheers, Paul

Jaswanth-Devarinti commented 3 years ago

Hello, https://colab.research.google.com/drive/1OCnzXzQbcPkwE_AfCgGbpye0G7tgtfOw?usp=sharing I gave editable axis and I did the same thing as you did in the last function I am getting error as "BadSignalWarning: ---------------- Could not determine best fit for given signal. Please check the source signal. Probable causes: - detected heart rate falls outside of bpmmin<->bpmmax constraints - no detectable heart rate present in signal - very noisy signal (consider filtering and scaling) If you're sure the signal contains heartrate data, consider filtering and/or scaling first. ----------------"

Kindly solve it. Thank you.

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sat, Mar 20, 2021 at 8:27 PM Paul van Gent @.***> wrote:

Closed #63 https://github.com/paulvangentcom/heartrate_analysis_python/issues/63.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#event-4485687605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4FVJLOYMQV4HL7QYVTTESZT5ANCNFSM4ZQHPIVA .

paulvangentcom commented 3 years ago

It looks like you're still running the whole signal through heartpy, while large parts contain nothing. The exception is telling you what's going on: there's no (detectable) heart rate signal in the first portion passed to it.

You still need to expand the example code from the notebook a bit to also exclude the parts with no signal, right now it's only setting it to 0.

Alternatively you step over all exceptions and keep running the loop, those sections with sufficient heart rate signal present will then still return results.

Yet alternatively you can find plenty of free ppg datasets online.

Good luck! Paul

Jaswanth-Devarinti commented 3 years ago

Sorry, but I did try removing things, but it's not working. Please help me out.

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Mar 22, 2021 at 12:34 PM Paul van Gent @.***> wrote:

It looks like you're still running the whole signal through heartpy, while large parts contain nothing. The exception is telling you what's going on: there's no (detectable) heart rate signal in the first portion passed to it.

You still need to expand the example code from the notebook a bit to also exclude the parts with no signal, right now it's only setting it to 0.

Alternatively you step over all exceptions and keep running the loop, those sections with sufficient heart rate signal present will then still return results.

Yet alternatively you can find plenty of free ppg datasets online.

Good luck! Paul

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/paulvangentcom/heartrate_analysis_python/issues/63#issuecomment-803816465, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNBG4HSDPE2UWR4NVGDSQTTE3TXZANCNFSM4ZQHPIVA .

paulvangentcom commented 3 years ago

As I mentioned, you need to handle the exception somehow for the cases where no heart rate signal is present in the example data. If you pass a signal segment without heart rate signal in it heartpy will complain, and that's what the exception is telling you in detail.

You can use a try except loop for handling exceptions, see the Python docs here for more info

Cheers, Paul