pymoto.Filter

class pymoto.Filter(*args, nonpadding=None, **kwargs)

Abstract base class for any linear filter with normalization

This module carries out the mathematical operation \(\mathbf{y} = \mathbf{S}^{-1} \mathbf{H}\mathbf{x}\) in which \(\mathbf{S}=\text{diag}(\mathbf{s})\) is a diagonal matrix. In index notation the same relation is written as \(y_i = \frac{\sum_j H_{ij} x_j}{ s_i }\).

The normalization vector is the row-wise sums of \(\mathbf{H}\), of which the entries are calculated as \(s_i = \sum_j H_{ij}\).

Input Signal:
  • x: The unfiltered field \(\mathbf{x}\)

Output Signal:
  • y: Filtered field \(\mathbf{y}\)

__init__(*args, nonpadding=None, **kwargs)

Initialize abstract base-class for linear filters

Parameters:

nonpadding (numpy.array[int], optional) – An array with indices at places where \(s_i = \max(\mathbf{s}) \: \forall\: i \notin \mathcal{N}\). For a density filter this mimics having values of 0 outside of the domain, thus emulating padding of the boundaries.

Methods

__init__(*args[, nonpadding])

Initialize abstract base-class for linear filters

connect(sig_in[, sig_out])

Connect without automatic adding to a function network

get_input_sensitivities([as_list])

get_input_states([as_list])

get_output_sensitivities([as_list])

get_output_states([as_list])

reset()

Reset the state of the sensitivities (they are set to zero or to None)

response()

Calculate the response from sig_in and output this to sig_out

sensitivity()

Calculate sensitivities using backpropagation

Attributes

n_in

Get the number of input signals

n_out

Get the number of output signals

sig_in

sig_out

connect(sig_in: Signal | Iterable[Signal], sig_out: Signal | Iterable[Signal] = None)

Connect without automatic adding to a function network

get_input_sensitivities(as_list=False)
get_input_states(as_list=False)
get_output_sensitivities(as_list=False)
get_output_states(as_list=False)
property n_in: int

Get the number of input signals

property n_out: int

Get the number of output signals

Note: Cannot be used in the initial __call__()

reset()

Reset the state of the sensitivities (they are set to zero or to None)

response()

Calculate the response from sig_in and output this to sig_out

sensitivity()

Calculate sensitivities using backpropagation

Based on the sensitivity we get from sig_out, reverse the process and output the new sensitivities to sig_in

sig_in: List = None
sig_out: List = None