Skip to content

filters

LATFilter

Bases: ScalarFilter

Extract LATs (local activation times) from the input scalars using a threshold.

Parameters:

Name Type Description Default
threshold float

Voltage threshold for activation. Defaults to -50.

-50.0
dtime float

Time between samples (ms). Defaults to 1.

1.0

dtime: float = dtime instance-attribute

threshold: float = threshold instance-attribute

__init__(threshold=-50.0, dtime=1.0)

Initialize the LATFilter with a voltage threshold and sample interval.

Parameters:

Name Type Description Default
threshold float

Voltage threshold for activation. Defaults to -50.0.

-50.0
dtime float

Time between samples in milliseconds. Defaults to 1.0.

1.0

apply(scalars)

Compute the local activation times (LATs) for each point.

Parameters:

Name Type Description Default
scalars ndarray

Input scalar array with shape (points, timepoints).

required

Returns:

Type Description
ndarray

np.ndarray: LAT array with shape (n_points, n_lats), NaN where no LAT detected.

MovingAverage

Bases: ScalarFilter

Apply a moving average filter to the input signal(s).

Parameters:

Name Type Description Default
window_length int

Length of the moving average window. Defaults to 5.

5
mode str

Convolution mode. Defaults to "same".

'same'

mode: str = mode instance-attribute

window_length: int = window_length instance-attribute

__init__(window_length=5, mode='same')

Initializes MovingAverage filter with a windowlenght and convolution mode.

Parameters:

Name Type Description Default
window_length int

Length of the moving average window. Defaults to 5.

5
mode str

Convolution mode. Defaults to "same".

'same'

apply(scalars)

Smooth the signal using a moving average.

Parameters:

Name Type Description Default
scalars ndarray

Input scalar array with shape (points, timepoints).

required

Returns:

Type Description
ndarray

np.ndarray: Filtered scalar array with the same shape.

Normalize

Bases: ScalarFilter

Normalize input scalar signal(s) to range [0, 1].

apply(scalars)

Normalize the scalar array to [0, 1].

Parameters:

Name Type Description Default
scalars ndarray

Input scalar array.

required

Returns:

Type Description
ndarray

np.ndarray: Normalized scalar array.

ScalarFilter

Bases: ABC

Abstract base class for scalar signal filters.

apply(scalars) abstractmethod

Apply the filter to the input scalars.

Parameters:

Name Type Description Default
scalars ndarray

Input scalar array of shape (n_points, n_timepoints).

required

Returns:

Type Description
ndarray

np.ndarray: Filtered scalar array of the same shape.