pyFDN.MatchPhase#
- class pyFDN.MatchPhase(target, *, channels='none')[source]#
Circular distance of \(\angle H\) against a reference impulse response.
The per-bin distance is \(1 - \cos(\Delta\phi)\), circular so the \(\pm\pi\) wrap costs nothing extra.
- Parameters:
target (
Any) – Reference IR, shape(n_samples,),(n_samples, n_out)or(n_samples, n_out, n_in). Zero-padded or truncated to the model’snfft.channels (
Literal['sum','mean','none']) –"none"(default) compares each input/output pair on its own;"sum"and"mean"compare the phase of the summed output channels (both give the same phase).
Notes
The whole-response phase of a reverberant IR varies extremely fast with frequency and is undefined where \(|H|\) vanishes, yet every bin counts equally, so the loss landscape is very rough for long responses. Prefer it for short filters or the early part of a response, or use
MatchPhaseSpectrogram.Methods
__init__(target, *[, channels])check(model)Preflight against the model it will train, before the first step.
terms()Flatten into
(weight, loss)leaves.Attributes
nameShort label, used as the key in
pyFDN.TrainLog.loss_log.