CROISSANT: A differentiable visibility simulator based on spherical harmonics
Project description
CROISSANT: spheriCal haRmOnics vISibility SimulAtor iN pyThon
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file croissant_sim-5.1.4.tar.gz.
File metadata
- Download URL: croissant_sim-5.1.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c16eef724022789852eb604eedb5d79632ea41d5080e7346394dc9b88738291
|
|
| MD5 |
a0162427e7f900f6b5e199f81bc80823
|
|
| BLAKE2b-256 |
6ede07a5e565fe05a75b1d621922bf61447fc6c8a72809f07c38c8d37d4a810c
|
Provenance
The following attestation bundles were made for croissant_sim-5.1.4.tar.gz:
Publisher:
release.yml on christianhbye/croissant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
croissant_sim-5.1.4.tar.gz -
Subject digest:
5c16eef724022789852eb604eedb5d79632ea41d5080e7346394dc9b88738291 - Sigstore transparency entry: 1182492905
- Sigstore integration time:
-
Permalink:
christianhbye/croissant@efb02ee317d298942226488b946a969967840bc3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/christianhbye
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@efb02ee317d298942226488b946a969967840bc3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file croissant_sim-5.1.4-py3-none-any.whl.
File metadata
- Download URL: croissant_sim-5.1.4-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fff6f50bdbd4028b4c787f6e72d0c60bab2975406de5d00f19e38aab7eced3f6
|
|
| MD5 |
c8e9c2dbe26abeaf5942b41a1a4baf00
|
|
| BLAKE2b-256 |
6c071dc9a8a411847848dc898fc04471c67809d8c8146c19cd84774ac35a4a32
|
Provenance
The following attestation bundles were made for croissant_sim-5.1.4-py3-none-any.whl:
Publisher:
release.yml on christianhbye/croissant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
croissant_sim-5.1.4-py3-none-any.whl -
Subject digest:
fff6f50bdbd4028b4c787f6e72d0c60bab2975406de5d00f19e38aab7eced3f6 - Sigstore transparency entry: 1182493039
- Sigstore integration time:
-
Permalink:
christianhbye/croissant@efb02ee317d298942226488b946a969967840bc3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/christianhbye
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@efb02ee317d298942226488b946a969967840bc3 -
Trigger Event:
push
-
Statement type: