Skip to main content

Cosmax

Fast and differentiable tools for analysis and inference on structured and unstructured data in cosmology. Powered by JAX.

Install with pip install cosmax.

What can I do with this package?

Classical Use Cases

Generate the Matter Power Spectrum from a 3D densitiy field:

drawing

Generate the ICs for a given matter power spectrum:

drawing

Cloud in a cell mass assignment scheme to convert unstructured particles to a 3D density field:

drawing

Optimization

With gradient optimization over the cic mass assignment scheme, we can find the particle positions that best fit an observed density field:

drawing

We can also use the power spectrum as a loss function to find a conditional IC density field :

drawing

What are the limitations?

  • The package is currently in development and the API is not stable.
  • The package generally ONLY works with 3D square boxes and periodic boundary conditions.
  • I am not a physicist, so the package may contain errors and inaccuracies.

Development

To develop, clone the repository and install the package in editable mode:

pip install -e .

To release as pip package, tests, docs and builds are handled automatically by github actions as defined in .github/workflows. To make a new release:

git tag v*.*.*
git push origin v*.*.*

and change the version number in pyproject.toml.

Test

pytest

Build

python -m build

Local Docs

With the pip package sphinx installed, run

sphinx-apidoc -o docs/source cosmax/
sphinx-build -b html docs/source docs/_build

to view locally

cd docs/_build
python -m http.server

Acknowledgements

  • PowerBox was used as a reference implementation the matter power spectrum.

  • Felix Köhlers implementation of Fourier Neural Operator was used as a guide to adapt the fno to jax and equinox.

  • The original NeuralOperator served as a reference for the fno implementation.

Metadata

Release files for cosmax 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for cosmax 0.0.7
File Interpreter ABI Platform
cosmax-0.0.7-py3-none-any.whl Python 3 none any Details

Release files / cosmax-0.0.7-py3-none-any.whl

Download URL cosmax-0.0.7-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
803800f8af3d48dc2cda2ad3c956210081f1296b9514fa38088ff9e5a2686b25
BLAKE2b-256 checksum
How to use checksums
4c7ce48f1d88d33e6a141c4c8a2dcca5aed747d2b9352c2022a53e72228c024d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.0.7 This release

1 release file

0.0.5

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page