match_spectra#

hypercoil.neuro.synth.match_spectra(signal: Tensor, reference: Tensor, use_mean: bool = False, frequencies: bool = False) Tensor[source]#

Rescale the frequency components of an input signal to match the amplitude spectrum of a reference signal.

This operation assumes real-valued input and always returns real-valued output.

Dimension:
signal : \((D, N)\)

D denotes dimension of the multivariate signal and N denotes the number of observations per channel.

reference : \((D, N)\) or \((D, F)\)

As above. F denotes the frequency dimension of the signal, e.g., N / 2 + 1. Expected dimension depends on the Boolean value passed to frequencies.

Parameters:
signaltensor

Input signal.

referencetensor

Reference signal.

use_meanbool (default False)

Indicates that, instead of matching the spectrum of the corresponding channel in the reference signal, all channels are matched to the mean spectrum across all reference channels.

frequenciesbool (default False)

If True, indicates that the reference provided is a spectrum in the frequency domain. Otherwise, the spectrum is computed from the provided reference.