Skip to content

Commit

Permalink
gh-3: support for Gaussian random fields (#4)
Browse files Browse the repository at this point in the history
Adds the functionality for Gaussian random fields from `transformcl` and
`gaussiancl`.

Closes: #3
  • Loading branch information
ntessore authored Jan 24, 2025
1 parent 2f14bf0 commit 81e0c80
Show file tree
Hide file tree
Showing 13 changed files with 528 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 3 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.286
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Nicolas Tessore
Copyright (c) 2023-2024 Nicolas Tessore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from angst import __version__ as angst_version

project = "angst"
copyright = "2023, Nicolas Tessore"
copyright = "2023-2024, Nicolas Tessore"
author = "Nicolas Tessore"
version = angst_version.partition("+")[0]
release = version
Expand Down
39 changes: 39 additions & 0 deletions docs/grf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
:mod:`angst.grf` --- Gaussian random fields
===========================================

.. currentmodule:: angst.grf
.. module:: angst.grf


Gaussian angular power spectra
------------------------------

.. autofunction:: solve

.. autofunction:: compute_generic


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

.. class:: Transformation(Protocol)

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


.. 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.
10 changes: 8 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@

.. toctree::
:maxdepth: 2
:caption: Contents:
:caption: Contents

points
spectra
twopoint
core
glossary

.. toctree::
:maxdepth: 2
:caption: Modules

grf


Indices and tables
==================
Expand Down
32 changes: 20 additions & 12 deletions docs/spectra.rst → docs/twopoint.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
Angular power spectra
=====================
Two-point functions
===================

.. currentmodule:: angst


Sets of angular power spectra
-----------------------------
Spectra and correlation functions
---------------------------------

.. autofunction:: spectra_indices
.. autofunction:: enumerate_spectra
.. autofunction:: cl2corr
.. autofunction:: corr2cl

.. autofunction:: cl2var

.. _spectra_order:

Sets of two-point functions
---------------------------

.. autofunction:: indices2
.. autofunction:: enumerate2


.. _twopoint_order:

Standard order
--------------

All functions that process sets of angular power spectra expect them as a
All functions that process sets of two-point functions expect them as a
sequence using the following "Christmas tree" ordering:

.. raw:: html
Expand All @@ -32,9 +41,8 @@ In other words, the sequence begins as such:
* index 5 describes the cross-correlation of field 2 and field 0,
* etc.

In particular, cross-correlations for the first :math:`n` fields are contained
In particular, two-point functions for the first :math:`n` fields are contained
in the first :math:`T_n = n \, (n + 1) / 2` entries of the sequence.

To easily generate or iterate over sequences of angular power spectra in
standard order, see the :func:`enumerate_spectra` and :func:`spectra_indices`
functions.
To easily generate or iterate over sequences of two-point functions in standard
order, see the :func:`enumerate2` and :func:`indices2` functions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"numpy>=1.20.0",
"flt>=2022.7.27",
]
dynamic = ["version"]

Expand Down
26 changes: 19 additions & 7 deletions src/angst/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
"""angst -- angular statistics"""

__all__ = [
"__version__",
"__version_tuple__",
"cl2corr",
"cl2var",
"corr2cl",
"displace",
"displacement",
"enumerate_spectra",
"enumerate2",
"grf",
"inv_triangle_number",
"spectra_indices",
"__version__",
"__version_tuple__",
"indices2",
]

from . import grf

from ._core import (
inv_triangle_number,
)

from ._points import (
displace,
displacement,
)
from ._spectra import (
enumerate_spectra,
spectra_indices,

from ._twopoint import (
cl2corr,
cl2var,
corr2cl,
enumerate2,
indices2,
)

from ._version import (
__version__,
__version_tuple__,
Expand Down
43 changes: 0 additions & 43 deletions src/angst/_spectra.py

This file was deleted.

Loading

0 comments on commit 81e0c80

Please sign in to comment.