Skip to main content

CROISSANT: A differentiable visibility simulator based on spherical harmonics

Project description

CROISSANT: spheriCal haRmOnics vISibility SimulAtor iN pyThon

codecov

CROISSANT is a rapid visiblity simulator in python based on spherical harmonics. Given an antenna design and a sky model, CROISSANT simulates the visbilities - that is, the perceived sky temperature.

CROISSANT uses spherical harmonics to decompose the sky and antenna beam to a set of coefficients. Since the spherical harmonics represents a complete, orthormal basis on the sphere, the visibility computation reduces nicely from a convolution to a dot product.

Moreover, the time evolution of the simulation is very natural in this representation. In the antenna reference frame, the sky rotates overhead with time. To account for this rotation, it is enough to rotate the spherical harmonics coefficients. In the right choice of coordinates (that is, one where the z-axis is aligned with the rotation axis of the earth or the moon), this rotation is simply achieved by multiplying the spherical coefficient by a phase.

New in version 5.0.0: CROISSANT is now fully based on JAX and legacy support for numpy/healpy code is dropped. Spherical harmonics transforms (built on s2fft), coordinate system transforms, rotations, and the simulator itself can now all be differentiated using JAX autograd.

Overall, this makes CROISSANT a very fast visibility simulator. CROISSANT can therefore be used to simulate a large combination of antenna models and sky models - allowing for the exploration of a range of propsed designs before choosing an antenna for an experiment.

Installation

To install the package for standard use, you can use your preferred Python package manager:

Using uv (Recommended)

uv pip install croissant-sim

Using pip

pip install croissant-sim

Note that croissant is only tested up to Python 3.12. Python 3.13 and newer versions are experimental.

Development

We recommend using uv to manage the development environment. It is exceptionally fast and handles virtual environments, dependencies, and lockfiles automatically. However, standard pip workflows are also fully supported.

1. Set Up the Environment

Option A: Using uv (Recommended)

uv will automatically read the pyproject.toml, create a virtual environment (.venv), and install all core and development dependencies.

# Clone the repository
git clone git@github.com:christianhbye/croissant.git
cd croissant

# Sync the project and install all dependencies
uv sync

Option B: Using pip

If you prefer standard Python tools, you will need to manually create the environment and install the package in editable mode.

# Clone the repository
git clone git@github.com:christianhbye/croissant.git
cd croissant

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate

# Install the package in editable mode with development dependencies
pip install -e .
pip install -r requirements-dev.txt

2. Install Pre-commit Hooks

We use pre-commit to automatically format and lint code before every commit. This ensures all code follows our style guidelines (enforced by ruff).

With uv:

uv run pre-commit install

With pip:

pre-commit install

3. Running Tests and Linters

We use pytest for testing and ruff for linting and formatting. Prepend these commands with uv run if using uv.

pytest                         # Run the test suite
ruff format                    # Auto-format code
ruff check --fix               # Run linter and fix auto-fixable errors

Demo

Jupyter Notebook: https://nbviewer.org/github/christianhbye/croissant/blob/main/notebooks/example_sim.ipynb

Contributing

Contributions are welcome - please see the contribution guidelines.

Project details


Download files

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

Source Distribution

croissant_sim-5.1.1.tar.gz (18.8 MB view details)

Uploaded Source

Built Distribution

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

croissant_sim-5.1.1-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file croissant_sim-5.1.1.tar.gz.

File metadata

  • Download URL: croissant_sim-5.1.1.tar.gz
  • Upload date:
  • Size: 18.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for croissant_sim-5.1.1.tar.gz
Algorithm Hash digest
SHA256 d417353ff1583d1e710ef40c6742839a24ec9840c512b53b403cb37a4b164fa5
MD5 9edf538b1958fa394a879b5fd65babe0
BLAKE2b-256 03b10fd7dfa3fe4329fb3772c6aa295d03d57576050085e1de0db72ccae847ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for croissant_sim-5.1.1.tar.gz:

Publisher: release.yml on christianhbye/croissant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file croissant_sim-5.1.1-py3-none-any.whl.

File metadata

  • Download URL: croissant_sim-5.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for croissant_sim-5.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96a7d70df325b5cb4e13bfb0fa21f27a53039f94819afc37ae3e627a45e608ea
MD5 b483d7c6697b9c80e3719d082ce16ff7
BLAKE2b-256 c261e8c6f6d51450cfeb4c062a9296eab6ff88e94b5c52efb85ebe4bed6fe9c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for croissant_sim-5.1.1-py3-none-any.whl:

Publisher: release.yml on christianhbye/croissant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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