libICEpost.src.base.Filter

@author: <N. Surname> <e-mail> Last update: DD/MM/YYYY

Fliters for data pre-processing

Content of the package:
Filter (class)

Base class

Resample (class)

Resampling with constant discretization

LowPass (class)

Low-pass filter

Submodules

Classes

Filter

Class for filtering raw data

Resample

Resampling with constant delta x

LowPass

Apply low-pass filter

LowPassAndResample

Apply low-pass filter and resampling

UserDefinedFilter

User defined filter from body of "__call__(x,y)" method

Package Contents

class libICEpost.src.base.Filter.Filter[source]

Bases: libICEpost.src.base.BaseClass.BaseClass

Class for filtering raw data


Attributes:

abstractmethod __call__(x: list[float], y: list[float]) tuple[list[float], list[float]][source]

Filter an array of x,y data. Returns x sampling points and y coordinates

class libICEpost.src.base.Filter.Resample(delta: float)[source]

Bases: libICEpost.src.base.Filter.Filter.Filter

Resampling with constant delta x


delta

float Resampling interval

property delta: float

The discretization spacing

Returns:

float

classmethod fromDictionary(dictionary)[source]

Create from dictionary.

{

delta (float): the spacing

}

_delta
__call__(xp: list[float], yp: list[float]) tuple[list[float], list[float]][source]

Filter an array of x,y data with constant spacing

__repr__() str[source]
class libICEpost.src.base.Filter.LowPass(cutoff: float, *, order=5)[source]

Bases: libICEpost.src.base.Filter.Filter.Filter

Apply low-pass filter


cutoff

float Cutoff frequency

order

int Order of the filter

property cutoff: float

cutoff frequency

Returns:

float

property order: int

Order of the filter

Returns:

int

classmethod fromDictionary(dictionary)[source]

Create from dictionary.

{

cutoff (float): cutoff frequency order (int): order of the filter

}

_cutoff
_order = 5
__call__(xp: list[float], yp: list[float]) tuple[list[float], list[float]][source]

Filter an array of x,y data with low-pass filter

__repr__() str[source]
_butter_lowpass(cutoff: float, fs: float, order: int = 5)[source]
_butter_lowpass_filter(data: list[float], cutoff: float, fs: float, order: int = 5)[source]
_preProcess(xp: list[float], yp: list[float]) tuple[list[float], list[float], float][source]

Pre-process data to uniform time-step (equal to minimum time-step found in list).

Returns:

[resampled x, resampled y, delta]

Return type:

tuple[list[float],list[float],float]

plot(xp: list[float], yp: list[float], *, xName: str | None = None, yName: str | None = None, freqUnits: str | None = None, c='b', **kwargs) tuple[mpl.Figure, np.ndarray[mpl.axes.Axes]][source]

TODO

class libICEpost.src.base.Filter.LowPassAndResample(*, delta: float, cutoff: float, order=5)[source]

Bases: libICEpost.src.base.Filter.LowPass.LowPass, libICEpost.src.base.Filter.Resample.Resample

Apply low-pass filter and resampling


cutoff

Cutoff frequency

Type:

float

order

Order of the filter

Type:

int

delta

Resampling time-step

Type:

float

classmethod fromDictionary(dictionary)[source]

Create from dictionary.

{

delta (float): Resampling time-step cutoff (float): cutoff frequency order (int): order of the filter

}

__call__(xp: list[float], yp: list[float]) tuple[list[float], list[float]][source]

Filter an array of x,y data with low-pass filter and resampling

__repr__() str[source]
class libICEpost.src.base.Filter.UserDefinedFilter(function: types.FunctionType)[source]

Bases: libICEpost.src.base.Filter.Filter.Filter

User defined filter from body of “__call__(x,y)” method


Attributes:

property code

the code of the __call__(x,y) method

Returns:

str

classmethod fromDictionary(dictionary)[source]

Create from dictionary.

{

code (str): the code of the __call__(x,y) method

}

__call__[source]

Filter an array of x,y data. Returns x sampling points and y coordinates

__repr__() str[source]