pygwb.postprocessing.combine_spectra_with_sigma_weights

pygwb.postprocessing.combine_spectra_with_sigma_weights(main_spectra, weights_spectra)[source]

Combine different statistically independent spectra \(S_i(f)\) using spectral weights \(w_i(f)\), as

\[S(f) = \frac{\sum_i \frac{S_i(f)}{w^2_i(f)}}{\sum_i \frac{1}{w^2_i(f)}},\,\,\,\, \sigma = \sqrt{\frac{1}{\sum_i \frac{1}{w^2_i(f)}}}.\]

If main_spectra is 2D and has dimensions N_1 x N_2, final spectrum has dimension N_2 (in contrast to calc_Y_sigma_from_Yf_sigmaf which combines across other dimension).

Parameters:
  • main_spectra (np.ndarray) – Array of arrays or FrequencySeries or OmegaSpectrum objects to be combined.

  • weights_spectra (np.ndarray) – Array of arrays or FrequencySeries or OmegaSpectrum objects to use as weights.

Returns:
combined_weighted_spectrum: array_like

Final spectrum obtained combining the original spectra with given weights.

combined_weights_spectrum: array_like

Variance associated to the final spectrum obtained combining the given weights.

See also

pygwb.omega_spectra.OmegaSpectrum
pygwb.util._check_omegaspectra