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

Spo2 and Hrcalc #4

Open
Aj12384 opened this issue Apr 7, 2020 · 13 comments
Open

Spo2 and Hrcalc #4

Aj12384 opened this issue Apr 7, 2020 · 13 comments

Comments

@Aj12384
Copy link

Aj12384 commented Apr 7, 2020

Hi, What do you mean after loading red and ir for the hrcalc code given in the readme?

@vrano714
Copy link
Owner

vrano714 commented Apr 8, 2020

Hi, Aj12384.

Did you mean this?

for i in range(37):
    print(hrcalc.calc_hr_and_spo2(ir[25*i:25*i+100], red[25*i:25*i+100]))

If so, the code is for getting HR/SpO2 by sliding 1 samples at an iteration.
For example, the top 3 output lines correspond to

(-999, False, -999, False) # <- using ir[25:125], red[25:125]
(107, True, 99.43662599999999, True) # <- using ir[26:126], red[26:126]
(88, True, 99.519096, True) # <- using ir[27:127], red[27:127]

As you can see, the output values fluctuate.
You may need to get average for more robust result.


If not, I could not get your question. Could you add some information?

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

No I mean that in the hrcalc, whenever I run the code, I do not seem so be getting any output. The code just runs.

@vrano714
Copy link
Owner

vrano714 commented Apr 8, 2020

You cannot see the output of hrcalc.calc_hr_and_spo2() in your environment, right?

Then, what happens if you use a variable, such as:
output_value = hrcalc.calc_hr_and_spo2(ir[:100], red[:100])
and print that value: print(output_value).

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

It’s working but I’m just getting the same values over and over again. How do I get the actual bpm and spo2?

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

Hi again, can you tell me how to display the actual BPM and SPO2 for the actual hrcalc.py? The code just runs and nothing happens... is there a variable I should define?

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020 via email

@vrano714
Copy link
Owner

vrano714 commented Apr 8, 2020

Okay, please tell me what you did and what you got in detail.
Paste your code or screenshot.

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

Here is what I did.

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

image

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

I want to be able to get the actual reading from the sensor continously

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

image

@Aj12384
Copy link
Author

Aj12384 commented Apr 8, 2020

When I try to use this code, it runs but nothing else happens

@vrano714
Copy link
Owner

vrano714 commented Apr 8, 2020

Actually, read_sequential does read values (to the amount given as argument), but it does not run continuously (the method name may be confusing, sorry).
If we want to read continuously, we have to run read_sequential many times.

Could you try the code below?

import max30102
import hrcalc

m = max30102.MAX30102()

for i in range(20): # try 20 times
    red, ir = m.read_sequential() # if nothing is passed, this reads 100 values
    print(hrcalc.calc_hr_and_spo2(ir, red))

I hope this works...

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

2 participants