Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions fgspectra/cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ def eval(self, sed_kwargs={}, cl_kwargs={}):
f_nu = self._sed(**sed_kwargs)
return np.einsum('k...i,n...j,...knl->...ijl',
f_nu, f_nu, self._cl(**cl_kwargs))

def eval_terms(self, sed_kwargs={}, cl_kwargs={}):
"""Compute the comp-comp contribution to the cross

The summation of this tensor over the components dimensions gives
the freq-freq cross spectrum (i.e. the result of `eval`

Parameters
----------
sed_args : list
Arguments for which the `sed` is evaluated.
cl_args : list
Arguments for which the `cl` is evaluated.

Returns
-------
cross : ndarray
Cross-spectrum.
The shape is ``(..., comp, comp, freq, freq, ell)``.
"""

f_nu = self._sed(**sed_kwargs)
return np.einsum('k...i,n...j,...knl->...knijl',
f_nu, f_nu, self._cl(**cl_kwargs))


class PowerLaw(FactorizedCrossSpectrum):
Expand Down