HR calculation for the MIT-BIH records
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 82
- Forks
- 21
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
I am working on the MIT-BIH records. The aim is to calculate the Heart Rate and find the maximum, minimum and the mean of the Heart rates. I extracted the ECG signal from the record, calculated the QRS peaks and calculated the Heart Rates using the compute_hr function from the wfdb package. Similarly extracted the QRS peaks from the annotation file and calculated the Heart Rates using the compute_hr function from the wfdb package. For the 101 record, the maximum Heart Rate from the annotations is 900.00bpm while the calculated qrs indices gave a maximum Heart rate of 111.3402bpm. I have this issue with many other records.
Python code:
record = wfdb.rdrecord(record_path, channels=[0])
ann_ref = wfdb.rdann(record_path,'atr')
qrs_inds = processing.gqrs_detect(sig=record.p_signal[:,0], fs=record.fs)
heart_rate_wfdb = processing.compute_hr(sig_len=record.p_signal.shape[0], qrs_inds=qrs_inds, fs=record.fs)
heart_rate_wfdb = heart_rate_wfdb[np.logical_not(np.isnan(heart_rate_wfdb))]
heart_rate_min = "{0:.4f}".format(np.amin(heart_rate_wfdb))
heart_rate_max = "{0:.4f}".format(np.amax(heart_rate_wfdb))
heart_rate_mean = "{0:.4f}".format(np.mean(heart_rate_wfdb))
ref_heart_rate_wfdb = processing.compute_hr(sig_len=record.p_signal.shape[0], qrs_inds=ann_ref.sample[1:], fs=record.fs)
ref_heart_rate_wfdb = ref_heart_rate_wfdb[np.logical_not(np.isnan(ref_heart_rate_wfdb))]
ref_heart_rate_min = "{0:.4f}".format(np.amin(ref_heart_rate_wfdb))
ref_heart_rate_max = "{0:.4f}".format(np.amax(ref_heart_rate_wfdb))
ref_heart_rate_mean = "{0:.4f}".format(np.mean(ref_heart_rate_wfdb))`
Could you please point out what is it that I am doing wrong?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the record 101 comparison using processing.compute_hr with qrs_inds from processing.gqrs_detect and ann_ref.sample[1:]. Compare the resulting maximum, minimum, and mean values, then check whether the same discrepancy occurs across the other MIT-BIH records named in the report. Done means the differing heart-rate results are explained and the expected calculation is established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100