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

Uploaded Python 3

File details

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

File metadata

  • Download URL: croissant_sim-5.2.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.2.1.tar.gz
Algorithm Hash digest
SHA256 a36f2a93e64c0d6c1a6036f6d5e32cc6935c7c8f156b657e152912cefcd580ca
MD5 a931fc85510eb1caba4596d683967e59
BLAKE2b-256 05da07136830000d1812674d8aed468a616fad2dbcf76e0dfcaf55e52ba38172

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: croissant_sim-5.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ece4d0de5a9fcaa60814758a55c51cf9239c0b34dbd8c7c8ef5f3f15d0a534f
MD5 45c2f63554e9e8e6f70d54577b86ac3a
BLAKE2b-256 b0fcadc45ee730a59b010fa901b5b77545dffcd501eb20dbee6c06313391c92d

See more details on using hashes here.

Provenance

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