pub struct TimeMetrics<T> {
pub rmssd: T,
pub sdnn: T,
pub pnn50: T,
pub mean_hr: T,
pub sdsd: T,
pub avnn: T,
pub cvsd: T,
}Expand description
A struct representing various heart rate variability (HRV) time-domain metrics.
The TimeMetrics struct holds key HRV parameters computed from RR intervals.
These metrics are essential for assessing the short-term and long-term variability of heart rate, which can provide insights into the autonomic nervous system’s regulation of the heart.
Fields§
§rmssd: TRoot Mean Square of Successive Differences (RMSSD). A measure of short-term HRV derived from the differences between successive RR intervals.
sdnn: TStandard Deviation of NN Intervals (SDNN). A measure of overall HRV that reflects the variability in RR intervals over time.
pnn50: TPercentage of Successive RR Intervals > 50 ms (PNN50). This metric quantifies the proportion of intervals that differ by more than 50 ms, indicating parasympathetic nervous system activity.
mean_hr: TMean Heart Rate (mean_hr). The average heart rate calculated from the RR intervals over the recording period.
sdsd: TStandard Deviation of Successive Differences (SDSD). A short-term HRV metric that measures the standard deviation of the differences between successive RR intervals.
avnn: TAverage NN Interval (AVNN). The mean of the RR intervals, reflecting the average time between heartbeats.
cvsd: TCoefficient of Variation of Successive Differences (CVSD). A normalized measure of short-term HRV, calculated as the ratio of the standard deviation to the mean of the successive RR interval differences.
Implementations§
Source§impl<T: Float + Sum<T> + Copy + Debug> TimeMetrics<T>
impl<T: Float + Sum<T> + Copy + Debug> TimeMetrics<T>
Sourcepub fn compute(rr_intervals: &[T]) -> Self
pub fn compute(rr_intervals: &[T]) -> Self
Computes various time-domain HRV metrics from the given RR intervals.
The function calculates the following HRV metrics:
- SDNN (Standard Deviation of Normal-to-Normal intervals): A measure of overall HRV, indicating long-term variability.
- RMSSD (Root Mean Square of Successive Differences): A short-term HRV measure that reflects the variability between successive RR intervals.
- SDSD (Standard Deviation of Successive Differences): Another short-term HRV measure based on the standard deviation of successive RR interval differences.
- PNN50 (Percentage of Successive RR Interval Differences > 50 ms): A measure of parasympathetic nervous system activity.
- Mean HR (Mean Heart Rate): The average heart rate, derived from RR intervals.
- AVNN (Average NN Interval): The mean of all RR intervals.
- CVSD (Coefficient of Variation of Successive Differences): The ratio of RMSSD to the average RR interval, indicating relative variability.
§Arguments
rr_intervals- A slice ofRRintervals representing the time between successive heartbeats (in milliseconds).
§Returns
Returns a TimeMetrics struct containing the computed HRV metrics.
§Example
use cardio_rs::time_domain::TimeMetrics;
let rr_intervals = vec![800.0, 820.0, 810.0, 780.0, 790.0];
let metrics = TimeMetrics::compute(&rr_intervals);
println!("{:?}", metrics);Trait Implementations§
Source§impl<T: Clone> Clone for TimeMetrics<T>
impl<T: Clone> Clone for TimeMetrics<T>
Source§fn clone(&self) -> TimeMetrics<T>
fn clone(&self) -> TimeMetrics<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for TimeMetrics<T>
impl<T: Debug> Debug for TimeMetrics<T>
Source§impl<T: Default> Default for TimeMetrics<T>
impl<T: Default> Default for TimeMetrics<T>
Source§fn default() -> TimeMetrics<T>
fn default() -> TimeMetrics<T>
Source§impl<T: PartialEq> PartialEq for TimeMetrics<T>
impl<T: PartialEq> PartialEq for TimeMetrics<T>
impl<T: Copy> Copy for TimeMetrics<T>
impl<T> StructuralPartialEq for TimeMetrics<T>
Auto Trait Implementations§
impl<T> Freeze for TimeMetrics<T>where
T: Freeze,
impl<T> RefUnwindSafe for TimeMetrics<T>where
T: RefUnwindSafe,
impl<T> Send for TimeMetrics<T>where
T: Send,
impl<T> Sync for TimeMetrics<T>where
T: Sync,
impl<T> Unpin for TimeMetrics<T>where
T: Unpin,
impl<T> UnwindSafe for TimeMetrics<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more