Heart Rate Variability

time_domain()

Compute time-domain HRV metrics from RR intervals

frequency_domain()

Compute frequency-domain HRV metrics from RR intervals

poincare()

Compute Poincaré plot descriptors (SD1, SD2)

ecgdatakit.processing.time_domain(rr_ms)[source]

Compute time-domain HRV metrics from RR intervals.

Parameters:

rr_ms (ndarray[tuple[Any, ...], dtype[double]]) – RR intervals in milliseconds.

Returns:

Keys: mean_rr, sdnn, rmssd, sdsd, nn50_count, pnn50, nn20_count, pnn20, hr_mean, hr_std.

Return type:

dict

ecgdatakit.processing.frequency_domain(rr_ms, method='welch', interp_fs=4.0)[source]

Compute frequency-domain HRV metrics from RR intervals.

RR intervals are interpolated to a uniform time series at interp_fs Hz, then the power spectral density is estimated.

Parameters:
  • rr_ms (ndarray[tuple[Any, ...], dtype[double]]) – RR intervals in milliseconds.

  • method (str) – PSD method ("welch").

  • interp_fs (float) – Interpolation sampling rate in Hz (default 4.0).

Returns:

Keys: vlf_power, lf_power, hf_power, lf_hf_ratio, total_power.

Return type:

dict

ecgdatakit.processing.poincare(rr_ms)[source]

Compute Poincaré plot descriptors (SD1, SD2).

Parameters:

rr_ms (ndarray[tuple[Any, ...], dtype[double]]) – RR intervals in milliseconds.

Returns:

Keys: sd1, sd2, sd1_sd2_ratio.

Return type:

dict