pyFDN.td.TimeOperator#

class pyFDN.td.TimeOperator[source]#

Abstract class. Parent of all classes belonging to the td-graph group. A stateful (T, in_channels) -> (T, out_channels) time-domain block. Subclasses set in_channels / out_channels and implement process_block(). reset() returns the operator to its initial (zero) state.

__init__()#

Methods

__init__()

impulse_response(ir_len)

Impulse response from zero state, one Dirac per input channel.

process_block(block)

Process one block and advance internal state.

process_signal(signal, *[, squeeze])

Process a whole signal in one call, from the current state.

reset()

Clear internal state (no-op for stateless operators).

Attributes

impulse_response(ir_len)[source]#

Impulse response from zero state, one Dirac per input channel.

The operator is reset() before each channel, so it does not matter what it processed before; it is left in the state the last channel ends in. This is how a system with filters is rendered, e.g. pyFDN.dss_to_td(*dss, **filters).impulse_response(ir_len).

Returns:

Shape (ir_len, out_channels, in_channels).

Return type:

ndarray

in_channels: int#
out_channels: int#
abstractmethod process_block(block)[source]#

Process one block and advance internal state.

Return type:

ndarray

process_signal(signal, *, squeeze=False)[source]#

Process a whole signal in one call, from the current state.

Convenience wrapper around process_block() for the common case of rendering an operator tree offline. Operators that process in blocks internally (Recursion) do so regardless of how the signal is handed to them, so this gives the same result as streaming signal through process_block() block by block.

Parameters:
  • signal (ArrayLike) – Input of shape (num_samples,) or (num_samples, in_channels).

  • squeeze (bool) – Squeeze singleton output channels (default False).

Returns:

Output of shape (num_samples, out_channels).

Return type:

ndarray

reset()[source]#

Clear internal state (no-op for stateless operators).

Return type:

None