BesselFilter

class BesselFilter(settings: Optional[dict] = None)

Bases: MetaFilter

Subclass for defining a low-pass Bessel filter to be applied to a dataset

Public Methods

BesselFilter.close_resources(channel=None)

Perform any actions necessary to gracefully close resources before app exit. If channel is not None, handle only that channel, else close all of them.

Parameters:

channel (int) – channel ID

BesselFilter.get_empty_settings(globally_available_plugins=None, standalone=False)

Get a dict populated with keys needed to initialize the filter if they are not set yet. This dict must have the following structure, but Min, Max, and Options can be skipped or explicitly set to None if they are not used. Value and Type are required. All values provided must be consistent with Type.

settings = {'Parameter 1': {'Type': <int, float, str, bool>,
                                 'Value': <value> or None,
                                 'Options': [<option_1>, <option_2>, ... ] or None,
                                 'Min': <min_value> or None,
                                 'Max': <max_value> or None
                                },
                ...
                }
Parameters:

globally_available_plugins (Dict[str, List[str]]) – a dict containing all data plugins that exist to date, keyes by metaclass

Returns:

the dict that must be filled in to initialize the filter

Return type:

Dict[str, Dict[str, Union[int, float, str, list[Union[int,float,str,None], None]]]]

BesselFilter.reset_channel(channel=None)

Perform any actions necessary to gracefully close resources before app exit. If channel is not None, handle only that channel, else close all of them.

Parameters:

channel (int) – channel ID

Private Methods

BesselFilter._apply_filter(data: ndarray[tuple[int, ...], dtype[float64]]) ndarray[tuple[int, ...], dtype[float64]]

Apply the specified filter to the data, callable only privately. Must be implemented by subclasses.

Parameters:

data (npt.NDArray[np.float64]) – The data to be filtered

Returns:

The filtered data

Return type:

npt.NDArray[np.float64]

BesselFilter._finalize_initialization()

Apply the provided filter paramters and intialize any internal structures needed by self.apply_filter(). Should Raise if initialization fails, but corner cases should be handled by _validate_settings already

Raises:
  • ValueError – If invalid cutoff frequency or order are provided

  • RuntimeError – If calculation of filter coefficients fails

BesselFilter._init() None

Perform additional initialization specific to the algorithm being implemented. Must be implemented by subclasses.

This function is called at the end of the class constructor to perform additional initialization specific to the algorithm being implemented. kwargs provided to the base class constructor are available as class attributes.

BesselFilter._validate_settings(settings: dict) None

Validate that the filter_params dict contains the correct information for use by the subclass. Must be implemented by subclasses.

Parameters:

settings (dict) – A dict specifying the parameters of the filter to be created. Required keys depend on subclass.

Raises:

ValueError – If the settings dict does not contain the correct information for the given subclass.