godamartonaron / GODA_pyPPG

pyPPG v01
HomePage
Other
28 stars 9 forks source link

get_ppgSQI() produces SQI for detected beats one less than the number of beats detected for fiducial points on the same PPG signal #22

Open darpitdavetamu opened 2 months ago

darpitdavetamu commented 2 months ago

On a PPG signal, I am trying to get the SQI for all the detected beats and also compute the corresponding fiducial points. However, when I am trying to filter out the good quality beats using get_ppgSQI(), I see that there is a match? I am thinking of appending a '0' at the beginning or end, but not sure what would be the right approach to take?

godamartonaron commented 2 months ago

I'm sorry, but it's not clear where and why you want to insert a 0.

darpitdavetamu commented 2 months ago

Thank you for your email. The number beats detected (and the corresponding fiducial points) is 1 more than what SQI is giving me. For example, number of beats being detected in a sample signal are 65. However get_SQI only gives me 64 values.

godamartonaron commented 2 months ago

Thank you for your clarification. In this case, you can insert the 0 at the end, because the SQI is calculated for the upcoming pulse wave.

darpitdavetamu commented 2 months ago

Thank you so much for informing me about the same. It really helps a lot.

darpitdavetamu commented 2 months ago

@godamartonaron @peterhcharlton Also in the same function there is 'param annotation: PPG annotation time(samples)'. From the example code, we provide the location of the 'systolic peaks (sp)'. However, if I supply other points like, 'onset (on)' or 'offset (off)' values, we get a different SQI for each beat (figure attached). Can you please help me understand more the impact of supplying different time annotations. SQI

godamartonaron commented 2 months ago

The SQI calculation is based on the similarity of upcoming pulse waves between two reference points of the selected fiducial point and other pulse waves. The lengths of the selected frames are not necessarily the same because the fiducial point detection algorithms are different. Therefore, the onset points have the same values, but they are shifted. In your case, I would check first the Tpi and Tpp biomarkers, as there are significant differences between them.