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.2.0.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.2.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: croissant_sim-5.2.0.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.2.0.tar.gz
Algorithm Hash digest
SHA256 f2284cef5cc1355dfa1c1f4e6bb0fc4bc56a3ba1491fa42dee486382cfa06021
MD5 13229fffd8ef4e335b27c85eb9d38602
BLAKE2b-256 9b1fb9e2b8be1cc505cb89748271c6072df37a65d7435db6aa6edda73add0fb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for croissant_sim-5.2.0.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: croissant_sim-5.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09f295ae0c32c46825db59835394fb7ac68a508a75efe7b1d1a2c11f07a9911d
MD5 901783763b8c395b2f9eb0d622db6ad3
BLAKE2b-256 7a1e9a2cfba52cbebd7f3a15d6afb1c5ca92eaf2be3fbd2a2bef9b1393cce307

See more details on using hashes here.

Provenance

The following attestation bundles were made for croissant_sim-5.2.0-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