Skip to content

Commit

Permalink
add count of RRI used to compute HRV + standard error of the mean as …
Browse files Browse the repository at this point in the history
…metrics computed in compute_ecg_metrics
  • Loading branch information
ValentinGhibaudo committed Nov 30, 2023
1 parent 6b15b92 commit 71a78ed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions physio/ecg.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@ def compute_ecg_metrics(ecg_peaks, min_interval_ms=500., max_interval_ms=2000.,

metrics = pd.Series(dtype=float)

metrics['N_RRi'] = np.count_nonzero(~np.isnan(delta_ms))
metrics['HRV_Mean'] = np.nanmean(delta_ms)
metrics['HRV_SD'] = np.nanstd(delta_ms)
metrics['HRV_SEM'] = metrics['HRV_SD'] / np.sqrt(metrics['N_RRi'])
metrics['HRV_Median'], metrics['HRV_Mad'] = compute_median_mad(delta_ms[~np.isnan(delta_ms)])
metrics['HRV_CV'] = metrics['HRV_SD'] / metrics['HRV_Mean']
metrics['HRV_MCV'] = metrics['HRV_Mad'] / metrics['HRV_Median']
Expand Down

0 comments on commit 71a78ed

Please sign in to comment.