Skip to content

MDN filter

eitprocessing.filters.mdn.MDNFilter dataclass

MDNFilter(
    *,
    respiratory_rate: float,
    heart_rate: float,
    noise_frequency_limit: float = 220 / MINUTE,
    notch_distance: float = 10 / MINUTE,
    order: int = 10
)

Multiple Digital Notch filter.

This filter is used to remove heart rate noise from EIT data. A band stop filter removes heart rate ± the notch distance. This is repeated for every harmonic of the heart rate below the noise frequency limit. Lastly, a low pass filter removes noise above the noise frequency limit.

By default, the notch distance is set to 0.166... Hz (10 BPM), and the noise frequency limit is set to 3.66... Hz (220 BPM).

Warning

The respiratory and heart rate should be in provided Hz, not BPM. We recommend defining MINUTE = 60 and using, e.g., heart_rate=80 / MINUTE to manually set the heart rate to 80 BPM.

Warning

This filter was designed to remove heart rate noise from EIT data, and testing in a limited number of cases. The filter may not work as expected for other data types, different cohorts or non-traditional ventilation modes. Use at your own discretion.

PARAMETER DESCRIPTION
respiratory_rate

the respiratory rate of the subject in Hz

TYPE: float

heart_rate

the heart rate of the subject in Hz

TYPE: float

noise_frequency_limit

the highest frequency to filter in Hz

TYPE: float DEFAULT: 220 / MINUTE

notch_distance

the half width of the band stop filter's frequency range

TYPE: float DEFAULT: 10 / MINUTE

plotting property

plotting: FilterPlotting

Return the plotting class for this filter.

apply

apply(
    input_data: ndarray,
    sample_frequency: float,
    axis: int = 0,
    captures: dict | None = None,
) -> ndarray
apply(
    input_data: ContinuousData, captures: dict | None = None, **kwargs
) -> ContinuousData
apply(input_data: EITData, captures: dict | None = None, **kwargs) -> EITData
apply(
    input_data: T,
    sample_frequency: float | object = MISSING,
    axis: int | object = MISSING,
    captures: dict | None = None,
    **kwargs
) -> T

Filter data using multiple digital notch filters.

PARAMETER DESCRIPTION
input_data

The data to filter. Can be a numpy array, ContinuousData, or EITData.

TYPE: T

sample_frequency

The sample frequency of the data. Should be provided when using a numpy array. If using ContinuousData or EITData, this will be taken from the data object.

TYPE: float | object DEFAULT: MISSING

axis

The axis along which to apply the filter. Should only be provided when using a numpy array. Defaults to the first axis (0).

TYPE: int | object DEFAULT: MISSING

captures

A dictionary to capture intermediate results for debugging or analysis. If provided, it will store the number of harmonics and the frequency bands used for filtering.

TYPE: dict | None DEFAULT: None

**kwargs

Additional keyword arguments to pass to the ContinuousData or EITData object (e.g., label).

DEFAULT: {}