pygwb.omega_spectra.reweight_spectral_object

pygwb.omega_spectra.reweight_spectral_object(spec, freqs, new_alpha, new_fref, old_alpha=0.0, old_fref=25.0)[source]

Reweight a spectrum or spectrogram object. Input spectrogram assumes a shape of: N_frequencies x N_times. This is meant to be a helper function used to change the spectral index of the stochastic results.

Parameters:
  • spec (array-like) – Spectrum or spectrogram (with shape N_frequencies x Ntimes).

  • freqs (array-like) – Frequencies associated with spec.

  • new_alpha (float) – New spectral index.

  • new_fref (float) – New reference frequency.

  • old_alpha (float, optional) – Spectral index of input spec array (i.e. weighting of spec). Defaults to zero (assumes unweighted).

  • old_fref (float, optional) – Reference frequency of current spec weighting (assumes 1 Hz). Defaults to 25 Hz.

Returns:
new_spec: array-like

Reweighted spectrum or spectrogram array.