Skip to content

Rate Detection

eitprocessing.plotting.rate_detection.RateDetectionPlotting

RateDetectionPlotting(obj: RateDetection)

Utility class to plot the results of the RateDetection algorithm.

This class can be accessed through the plotting attribute of the RateDetection class.

Example:

>>> rd = RateDetection("adult")
>>> captures = {}
>>> rr, hr = rd.apply(eit_data, captures=captures)
>>> fig = rd.plotting(**captures)
>>> fig.savefig("rate_detection.png")  # Save the figure to a file

plot

plot(
    *,
    frequencies: ndarray,
    normalized_total_power: ndarray,
    average_normalized_pixel_power: ndarray,
    diff_total_averaged_power: ndarray,
    estimated_respiratory_rate: float,
    estimated_heart_rate: float,
    fig: None
) -> Figure
plot(
    *,
    frequencies: ndarray,
    normalized_total_power: ndarray,
    average_normalized_pixel_power: ndarray,
    diff_total_averaged_power: ndarray,
    estimated_respiratory_rate: float,
    estimated_heart_rate: float,
    fig: SubFigure
) -> SubFigure
plot(
    *,
    frequencies: ndarray,
    normalized_total_power: ndarray,
    average_normalized_pixel_power: ndarray,
    diff_total_averaged_power: ndarray,
    estimated_respiratory_rate: float,
    estimated_heart_rate: float,
    fig: Figure
) -> Figure
plot(
    *,
    frequencies: ndarray,
    normalized_total_power: ndarray,
    average_normalized_pixel_power: ndarray,
    diff_total_averaged_power: ndarray,
    estimated_respiratory_rate: float,
    estimated_heart_rate: float,
    fig: Figure | SubFigure | None = None
) -> Figure | SubFigure

Plot the results of the RateDetection algorithm.

This method is intended to be used after running the detect_respiratory_heart_rate method of the RateDetection class. It visualizes the frequency analysis results, including the normalized power spectrum, average normalized pixel spectrum, and the difference between the two.

NB: Although the frequencies, rate limits and estimated rates are provided in Hz, they are visualized in breaths/beats per minute (bpm).

PARAMETER DESCRIPTION
frequencies

Frequencies used in the analysis, in Hz.

TYPE: ndarray

normalized_total_power

Normalized total power spectrum.

TYPE: ndarray

average_normalized_pixel_power

Average normalized pixel power spectrum.

TYPE: ndarray

diff_total_averaged_power

Difference between the normalized summed power spectra and the normalized total power.

TYPE: ndarray

estimated_respiratory_rate

Estimated respiratory rate in Hz.

TYPE: float

estimated_heart_rate

Estimated heart rate in Hz.

TYPE: float

fig

Optional matplotlib Figure or SubFigure to plot on. If None, a new figure is created.

TYPE: Figure | SubFigure | None DEFAULT: None

RETURNS DESCRIPTION
Figure | SubFigure

A matplotlib figure or subfigure (if provided) containing the plots of the frequency analysis.