Coder Social home page Coder Social logo

Comments (11)

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Hi Francois,

Thanks for the kind words. Can you share the data behind the two plots you place with me? I am working on an extension to the enhance_peaks() function that will normalise locally rather than globally. This would give me a chance to test it.

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Additionally, take a look at the heartrate arduino repo here, especially the AVR simple logger with scaling: https://github.com/paulvangentcom/heartrate_analysis_Arduino/blob/master/implementations/AVR/SimpleLogger_Scaling_AVR/SimpleLogger_Scaling_AVR_USB/SimpleLogger_Scaling_AVR_USB.ino

Docs here: https://embedded-heart-rate-analysis-toolkit.readthedocs.io/en/latest/implementations.html#simple-logger

This is an implementation for a PPG sensor like the Pulse Sensor you use, plus Arduino. It auto-scales the data as it is recording. This might help you achieve what you need without using the enhance_peaks() in heartpy.

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Regarding the RR-intervals. I assume your sample rate is 50Hz. The module finds the nearest highest point as a peak location. This means the resolution is tied to the sampling rate for now. I'm working on a solver to interpolate each peak and find the maximum that way, which could be more accurate but I don't have an ETA for that.

For now I recommend upping your sample rate to 1000Hz for 1ms R-R accuracy. The linked Arduino sketch can reach those sampling speeds easily.

-Paul

from heartrate_analysis_python.

FrancoisCosta avatar FrancoisCosta commented on July 30, 2024

Hi Paul, thanks for the reply!

I've attached the csv file with the Pulse Sensor Data I've been using. It was sampled at 50Hz over a period of approximately 15mins.
Let me know if you would like longer datasets, I should have several hours in the next couple of weeks (I aim to collect data to analyse sleep).

PulseSensorData_vanGent.txt

The first graph is believe represents the [:15000] samples whereas the second graph represents [30000:]

Regarding the RR intervals - ah I see! I'll give that Arduino sketch a go tomorrow morning and let you know how it goes (I don't have access to the sensor today unfortunately).

Please let me know if/when the local enhance_peaks() function and the IBI interpolated solver get implemented :) would be of great help for my project.

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

I'll push the peak position interpolation step up my list then and hope to get to it this week. I'll keep you updated.

-Paul

from heartrate_analysis_python.

FrancoisCosta avatar FrancoisCosta commented on July 30, 2024

Perfect! Thanks :)

from heartrate_analysis_python.

FrancoisCosta avatar FrancoisCosta commented on July 30, 2024

Hi Paul, any update on this?

Thanks,
FB

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Hi Francois,

Not yet I'm afraid. I need to find the time to fit heartpy work in between my phd work so it doesn't always work out...

I hope this weekend I can have a look.

-Paul

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

update, I've finished the interpolation method, which upsamples and re-estimates peak position. On the first peak in your signal it looks like this:

highprecision2

Or, for the first 10 seconds of your signal you can go from 20ms accuracy (50Hz):
array([ 280., 1160., 2080., 2980., 3860., 4740., 5620., 6480., 7300., 8120., 8920., 9700.])

to peaks estimated to 1ms accuracy (1000Hz)
array([ 276., 1166., 2079., 2984., 3865., 4737., 5622., 6477., 7295., 8111., 8914., 9692.])
(or of course higher if you want, but I don't see why)

You can specify the precision you want and the method does the rest. I need to test the implementation and update the docs. I'll probably push the update to github today or tomorrow. Just wanted to keep you informed.

from heartrate_analysis_python.

FrancoisCosta avatar FrancoisCosta commented on July 30, 2024

Excellent work! Thanks Paul!
I look forward to giving it a go :)
Do you foresee any negative impact on the accuracy of the peak location when upsampling and re-estimating?

from heartrate_analysis_python.

paulvangentcom avatar paulvangentcom commented on July 30, 2024

Please pull the latest version, I've implemented the above described interpolation to the process() and process_segmentwise() functions. Usage is simple:

import heartpy as hp

data = hp.get_data('data.csv')

#the 'high_precision' flag sets the mode as active
#the 'high_precision_fs' variable sets the target sample rate to upsample to
#default is 1000.0 Hz, meaning 1-ms peak accuracy
wd, m = hp.process(data, sample_rate = 100.0, high_precision = True, high_precision_fs = 1000.0)

print(wd['RR_list'])

Gives

[1019. 982. 968. 998. 1051. 1092. 982. 909. 892. 952. 1085. 1157. 1130. 1023. 1041. 1067. 1046. 944. 963. 1035. 1094. 1012. 980.]

Good luck!

  • Paul

from heartrate_analysis_python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.