Struct FrequencyMetrics

Source
pub struct FrequencyMetrics<T> {
    pub lf: T,
    pub hf: T,
    pub vlf: T,
}
Expand description

A struct representing frequency-domain heart rate variability (HRV) metrics.

The FrequencyMetrics struct holds key frequency-domain parameters that are calculated from heart rate variability (HRV) data. These metrics are derived by analyzing the power spectral density (PSD) of the RR intervals, which can provide insights into the autonomic nervous system’s regulation of the heart and overall cardiovascular health.

These frequency-domain metrics provide a deeper understanding of heart rate variability by focusing on the different frequency bands that reflect various physiological processes and autonomic nervous system regulation.

Fields§

§lf: T

Low Frequency (LF) power. Reflects sympathetic and parasympathetic balance, typically between 0.04 and 0.15 Hz.

§hf: T

High Frequency (HF) power. Primarily associated with parasympathetic nervous system activity, typically between 0.15 and 0.40 Hz.

§vlf: T

Very Low Frequency (VLF) power. Represents the power of frequencies below 0.04 Hz, associated with long-term regulatory processes.

Implementations§

Source§

impl<T: Float + Sum<T> + Copy + Debug + Signed + 'static + AddAssign + Send + Sync + FromPrimitive> FrequencyMetrics<T>

Source

pub fn compute_sampled(sampled_rr_intervals: &[T], rate: T) -> Self

Computes frequency-domain metrics (LF, HF, VLF) from sampled RR intervals.

The compute_sampled function computes the frequency-domain metrics of heart rate variability (HRV) using the Welch method for spectral density estimation. It requires a list of sampled RR intervals and a specified sampling rate to estimate the power spectral density (PSD) and extract the frequency components in the low-frequency (LF), high-frequency (HF), and very low-frequency (VLF) bands.

This method employs Welch’s periodogram to calculate the spectral density, with specified frequency bands for LF, HF, and VLF, and computes the total power in these bands using trapezoidal integration.

§Parameters
  • sampled_rr_intervals: A slice of sampled RR intervals, representing the time differences between successive heartbeats, after being adjusted for the mean interval.
  • rate: The sampling rate used to interpolate the RR intervals, expressed in Hz.
§Returns

A FrequencyMetrics struct containing the computed LF, HF, and VLF values, which represent the power in their respective frequency bands.

§Example
use cardio_rs::frequency_domain::FrequencyMetrics;
use cardio_rs::utils::test_data::RR_INTERVALS;

let rate = 4.0;
let frequency_metrics = FrequencyMetrics::compute_sampled(RR_INTERVALS, rate);
§Notes

The frequency bands for LF, HF, and VLF are typically:

  • LF: 0.04 - 0.15 Hz
  • HF: 0.15 - 0.40 Hz
  • VLF: 0.003 - 0.04 Hz
Source

pub fn compute(rr_intervals: &[T], rate: T) -> Self

Computes frequency-domain metrics (LF, HF, VLF) from raw RR intervals by first interpolating them.

The compute function computes the frequency-domain metrics of heart rate variability (HRV) based on raw RR intervals by first interpolating them to a uniform 4 Hz rate. It utilizes the compute_sampled function to estimate the spectral density of the interpolated RR intervals, providing the LF, HF, and VLF values.

§Parameters
  • rr_intervals: A slice of raw RR intervals, representing the time differences between successive heartbeats.
  • rate: The sampling rate used to interpolate the RR intervals, expressed in Hz.
§Returns

A FrequencyMetrics struct containing the computed LF, HF, and VLF values, which represent the power in their respective frequency bands.

§Example
use cardio_rs::frequency_domain::FrequencyMetrics;
use cardio_rs::utils::test_data::RR_INTERVALS;

let frequency_metrics = FrequencyMetrics::compute(RR_INTERVALS, 4.);
§Notes

This method interpolates the RR intervals using a specified rate (defaulted to 4 Hz) before passing them to the compute_sampled method for spectral analysis.

Trait Implementations§

Source§

impl<T: Clone> Clone for FrequencyMetrics<T>

Source§

fn clone(&self) -> FrequencyMetrics<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for FrequencyMetrics<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for FrequencyMetrics<T>

Source§

fn default() -> FrequencyMetrics<T>

Returns the “default value” for a type. Read more
Source§

impl<T: PartialEq> PartialEq for FrequencyMetrics<T>

Source§

fn eq(&self, other: &FrequencyMetrics<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Copy> Copy for FrequencyMetrics<T>

Source§

impl<T> StructuralPartialEq for FrequencyMetrics<T>

Auto Trait Implementations§

§

impl<T> Freeze for FrequencyMetrics<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for FrequencyMetrics<T>
where T: RefUnwindSafe,

§

impl<T> Send for FrequencyMetrics<T>
where T: Send,

§

impl<T> Sync for FrequencyMetrics<T>
where T: Sync,

§

impl<T> Unpin for FrequencyMetrics<T>
where T: Unpin,

§

impl<T> UnwindSafe for FrequencyMetrics<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V