WaveletFilter

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

Bases: MetaFilter

Subclass for defining a Wavelete filter to be applied to a dataset

Public Methods

WaveletFilter.close_resources(channel: int | None = None) → 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 (Optional[int]) – channel ID

WaveletFilter.get_empty_settings(globally_available_plugins: Dict[str, List[str]] | None = None, standalone: bool = False) → Dict[str, Dict[str, Any]]

Declare the settings this filter exposes, on top of the base contract.

Called by poriscope when the plugin is instantiated or reconfigured, to build the settings dialog and to sanity-check whatever the user enters; the accepted values are then readable through self.settings. See get_empty_settings() for the structure of the dict and what Type, Value, Min, Max, Options and Units mean in it, and for the reserved keys the GUI builds file pickers from.

The keys this plugin adds:

  • Wavelet - the mother wavelet to decompose with. The options are restricted to the biorthogonal wavelets that suit nanopore step edges, bior1.3 and bior1.5; _validate_settings refuses anything else.

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

  • standalone (bool) – False if this is called as part of a GUI, True otherwise. Default False

Returns:

the dict that must be filled in to initialize the filter

Return type:

Dict[str, Dict[str, Any]]

WaveletFilter.reset_channel(channel: int | None = None) → None

Reset the state of a specific channel for a new operation or run. If channel is not None, handle only that channel, else reset all of them. No-op here, since this filter holds no persistent per-channel state between calls.

Parameters:

channel (Optional[int]) – channel ID

Private Methods

WaveletFilter._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]

WaveletFilter._finalize_initialization() → None

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

WaveletFilter._init() → None

called after parent class initialization

WaveletFilter._validate_settings(settings: dict) → None

Validate that the settings 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.