Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ntessore committed Jan 24, 2025
1 parent b408d62 commit 6badbf2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
11 changes: 8 additions & 3 deletions docs/grf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,30 @@ Gaussian angular power spectra

.. autofunction:: solve

.. autofunction:: compute_generic


Transformations
---------------

.. class:: Transformation(Protocol)

.. automethod:: __call__
.. automethod:: inv
.. automethod:: der


Transformations
---------------

.. class:: Lognormal

Implements the :class:`Transformation` for lognormal fields.


.. class:: LognormalXNormal

Implements the :class:`Transformation` for the cross-correlation between
:class:`Lognormal` and Gaussian fields.


.. class:: SquaredNormal

Implements the :class:`Transformation` for squared normal fields.
18 changes: 17 additions & 1 deletion src/angst/grf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"LognormalXNormal",
"SquaredNormal",
"Transformation",
"compute_generic",
"solve",
]

Expand Down Expand Up @@ -218,7 +219,7 @@ def der(self, x: NDArray[Any], var: float) -> NDArray[Any]:
Alm = NDArray[np.complexfloating[Any, Any]]


def spectrum_from_sht(
def compute_generic(
cl: NDArray[Any],
tfm: Transformation,
sht: Callable[[NDArray[Any], int], Alm],
Expand All @@ -230,6 +231,21 @@ def spectrum_from_sht(
transform pair *sht* and *isht* to compute a simple band-limited
Gaussian power spectrum, without the full machinery of
:func:`solve`.
Examples
--------
Compute a Gaussian angular power spectrum for a lognormal
transformation using the *healpy* spherical harmonic transform.
>>> import healpy as hp
>>> tfm = angst.grf.Lognormal()
>>> gl = angst.grf.compute_sht(
... cl,
... tfm,
... lambda m, lmax: hp.map2alm(m, lmax=lmax, use_pixel_weights=True),
... lambda alm: hp.alm2map(alm, 2048),
... )
"""

xp = cl.__array_namespace__()
Expand Down

0 comments on commit 6badbf2

Please sign in to comment.