Skip to main content

Fast and differentiable implementations of operations needed for inference and analysis in cosmology. Powered by JAX

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosmax-0.0.7-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file cosmax-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: cosmax-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for cosmax-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 803800f8af3d48dc2cda2ad3c956210081f1296b9514fa38088ff9e5a2686b25
MD5 ac5251d87d34aef8a864ac6263d9beb9
BLAKE2b-256 4c7ce48f1d88d33e6a141c4c8a2dcca5aed747d2b9352c2022a53e72228c024d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page