pyFDN.train.features package#

Submodules#

pyFDN.train.features.spatial module#

Spatial features impulse response.

pyFDN.train.features.spatial.mimo_rir_eigenvalues_per_frequency(ir, n_fft=2048, dim=0)[source]#

Compute eigenvalues of a MIMO transfer matrix at each frequency bin.

The impulse response is transformed to the frequency domain using torch.fft.rfft(), and the eigenvalues of the resulting transfer matrix are computed independently at each frequency bin.

Parameters:
  • ir (Tensor) – MIMO impulse response with shape (n_samples, n_out, n_in) (time axis at dim). The system must be square, i.e. n_out == n_in.

  • n_fft (int) – DFT length. A response longer than n_fft is truncated, a shorter one zero-padded, as in torch.fft.rfft().

  • dim (int) – Temporal dimension of the impulse response; the two remaining axes are read as (n_out, n_in) in that order.

Returns:

Complex eigenvalues with shape (n_freqs, n_out), where n_freqs = n_fft // 2 + 1.

Return type:

Tensor

Notes

Eigenvalues are returned in the (unsorted) order of torch.linalg.eigvals(), which can change between neighbouring bins, and their gradient is ill-conditioned where eigenvalues are repeated.

Raises:

ValueError – If ir is not 3D or the MIMO system is not square.

pyFDN.train.features.temporal module#

Temporal feature representations and decay metrics.

pyFDN.train.features.temporal.energy_decay_curve(ir, dim=0, eps=1e-12, db=True, normalize=True)[source]#

Compute the Energy Decay Curve (EDC) via backward Schroeder integration.

Evaluates the energy decay profile across discrete time samples:

\[\text{EDC}[n] = \sum_{m=n}^{L-1} h^2[m]\]
Parameters:
  • ir (Tensor) – Discrete-time impulse response. The time axis must be the first dimension (dim=0), such as (n_samples,), (n_samples, channels), or (n_samples, n_out, n_in).

  • dim (int) – Temporal dimension.

  • eps (float) – Numerical stability constant.

  • db (bool) – If True, return the EDC in decibels.

  • normalize (bool) – If True, normalize the EDC by its initial energy.

Returns:

Energy decay curve with the same shape as ir.

Return type:

Tensor

Module contents#