PIA-Group / BioSPPy

Biosignal Processing in Python
Other
569 stars 273 forks source link

sampling rate ? #91

Closed saranzeb closed 2 years ago

saranzeb commented 2 years ago

I have two simple questions 1) if we are going to find the bpm for ppg instead of ecg then we have to just change the to ppg right ? like this from biosppy.signals import ppg out = ppg.ppg(signal=signal, sampling rate=1000., show=True)

2) secondly how we are going to find the sampling rate if we have our own file of ppg how we will calculate the sampling rate for it ? what timing information we needed for it ? will it be giving the heart rate in bpm (beats per minute)

afonsocraposo commented 2 years ago

Hi @saranzeb , thank you for reaching out. Regarding your questions:

  1. Yes, doing:

    out = ppg.ppg(signal=signal, sampling rate=1000., show=True)

    Will process your PPG signal instead of ECG, providing you peak detection for your signal.

  2. The sampling rate is defined when recording your signal, it corresponds to the number of samples per second. For example, the typical sampling rate of a camera is 30 Hz (30 frames per second). It is important to define the sampling rate so the algorithms can know the time interval between the samples of your signal, which is required for computing the heart rate later. If you don't know the sampling rate of your signal, but have the corresponding timestamps for each sample, you can count the number of samples in one second and that will correspond to its sampling rate.

saranzeb commented 2 years ago

OK Sir thank you Got it, but in Case of PPG and ECG, the number of samples(cycles) is not depending upon the number of cycles samples(cycles) of hearts beat which can be 1 to 2 per second(according to normal bpm 60 to 100), so how we can relate the number of heartbeats or the number of samples(cycles ) of PPG or ECG signal per second to sampling rate ?