franc.filtering.common

Shared functionality for all filtering techniques

Classes

FilterBase

common interface definition for Filter implementations

Functions

make_2d_array(A)

add a dimension to 1D arrays and leave 2D arrays as they are

handle_from_dict(init_func)

A decorator for the init functions of classes derived from FitlerInterface

Module Contents

franc.filtering.common.make_2d_array(A)

add a dimension to 1D arrays and leave 2D arrays as they are This is intended to allow 1D array input for single channel application

Parameters:

A (collections.abc.Sequence | collections.abc.Sequence[collections.abc.Sequence] | numpy.typing.NDArray) – input array

Returns:

extended array

Raises:

ValueError if the input shape is not compatible

Return type:

numpy.typing.NDArray

>>> import franc as fnc
>>> fnc.evaluation.make_2d_array([1, 2])
array([[1, 2]])
>>> import franc as fnc
>>> fnc.evaluation.make_2d_array([[1, 2], [3, 4]])
array([[1, 2],
       [3, 4]])
franc.filtering.common.handle_from_dict(init_func)

A decorator for the init functions of classes derived from FitlerInterface

If the _from_dict keyword argument is passed, the __init__() function is ignored and the class is initialized based on the passed dictionary. Otherwise, the constructor is called the usual way.

Parameters:

init_func (collections.abc.Callable) –

class franc.filtering.common.FilterBase(n_channel, n_filter, idx_target, _from_dict=None)

Bases: franc.evaluation.FilterInterface

common interface definition for Filter implementations

Parameters:
  • n_filter (int) – Length of the FIR filter (how many samples are in the input window per output sample)

  • idx_target (int) – Position of the prediction

  • n_channel (int) – Number of witness sensor channels

n_filter: int
idx_target: int
default_args = [None, None, None]
property method_filename_part: str

string that can be used in a file name

Return type:

str