Composable, config-driven simulation of multi-aperture telescope PSFs, DMs, coronagraphs, and fiber coupling — built on HCIPy.
Project description
telescope-sim
Composable, config-driven simulation of multi-aperture telescope PSFs, deformable mirrors, coronagraphs, and fiber coupling — built on HCIPy.
telescope-sim provides a pluggable pipeline of optical stages (aperture,
correctors, coronagraph, focal plane, output taps, post-processing), a
YAML-driven configuration schema, and a fixture-based regression suite. Users
can register their own implementations of any stage without modifying the
package.
Status
v2.1.0. The pipeline is wired end-to-end and reproduces 10 reference fixtures spanning segmented/mini-ELF apertures, custom-pupil generators, Zernike-mode DMs, vortex and vector-vortex coronagraphs, angular and physical focal planes, and multi-mode-fiber dual outputs.
What's new since v2.0.0
- Actuator-grid DM — the
actuator_gridcorrector: an N×N influence-function deformable mirror (gaussian or xinetics actuator shapes) driven by raw per-actuator commands, with DM misalignment (rotation, mirrored command indexing) baked in at construction. - Atmosphere — pass any HCIPy atmosphere (or any wf→wf callable) as
sim.sample(atmos=...). Atmospheres that expose.phase_for(lam)couple automatically into fit-role correctors for cancellation. The reference PSF is atmosphere-free by construction. - Detector noise — the
noisy_detectorpost-processor wraps HCIPy'sNoisyDetector(read noise, dark current, flat-field, photon shot noise) with optionalint_phot_fluxphotometry. Per-sample overrides viasim.sample(output_overrides={...}). - Extended-source convolution — the
convolve_imagepost-processor convolves the PSF with a caller-supplied scene. Composes withnoisy_detectorfor noisy extended-source imaging. - Cumulative-OPD fit-role correctors —
wavefront_role="fit"withfit_source="cumulative_phase_pre_self"lets a DM auto-fit any upstream disturbance (atmosphere, imposed PTT, …) without bespoke wiring. - Strehl methods —
strehl_method: peak | matched_filter, with the matched-filter variant using a circular core mask of radiusstrehl_core_rad. - Extension tutorial —
docs/tutorials/05_custom_components.ipynbwalks through writing your ownCorrectorandPostProcessorvia the@register(...)registry.
Quick start
from telescope_sim import TelescopeSim
import numpy as np
# Bundled preset (mini-ELF, 15 segments, 2 filters)
sim = TelescopeSim.from_preset("elf_15seg")
# Or a custom YAML
sim = TelescopeSim.from_yaml("path/to/config.yaml")
# Sample at rest with Strehl ratios
out = sim.sample(meas_strehl=True)
out["images"]["psf"] # (H, W, n_filters)
out["strehls"] # {filter_name: ratio}
# Apply per-segment piston/tip/tilt actuations
ptt = np.random.normal(scale=0.1, size=(15, 3))
out = sim.sample(actuations={"segments": ptt}, meas_strehl=True)
See docs/tutorials/ for runnable notebooks that exercise the canonical mini-ELF, vortex coronagraph, custom-pupil + Zernike DM, and fiber MMF paths.
Architecture
The pipeline is a linear chain of pupil-plane stages (aperture → correctors →
optional coronagraph) followed by a controlled fan-out at the pupil → focal
boundary, where one or more named focal planes consume the same pupil-plane
wavefront. Each focal plane feeds one or more OutputTaps, whose outputs flow
through ordered post-processors. Every stage is a registered, pluggable
implementation of a small ABC. Configs are YAML, validated by pydantic v2.
[aperture] → [correctors: c1 → c2 → ... → cN] → [coronagraph?]
│
┌────────────┼────────────┐
▼ ▼ ▼
focal plane focal plane focal plane
│ │ │
tap(s) tap(s) tap(s)
│ │ │
post-proc post-proc post-proc
Corrector roles (actuate / impose / fit plus a target_strategy) express
the patterns observed across years of research code: model-driven DMs, imposed
atmospheres, fit-residual training targets, and stacked combinations of those.
See docs/concepts.rst for the full discussion.
Development
# Create dev environment
conda env create -f envs/env-dev.yaml
conda activate telescope-sim-dev
# If pip discovers a sibling hcipy/ clone (developers often keep one in
# ../external/hcipy/ for cross-reference), force-replace with the PyPI build:
pip uninstall -y hcipy && pip install "hcipy>=0.6"
# Install editable with dev extras
pip install -e ".[dev,doc]"
# Run tests
pytest # fast tests only
pytest --runslow # includes the full fixture regression suite
# Build docs
cd docs && make html
See CONTRIBUTING.md for the full development workflow.
License
MIT — see LICENSE.
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 telescope_sim-2.1.1.tar.gz.
File metadata
- Download URL: telescope_sim-2.1.1.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00111c6e48e42b4a72b7242007f2e03a41ae42ef9e30d27ac9a0f57607b66c32
|
|
| MD5 |
f14bb6b9a7d0f8a278612535fe86dd34
|
|
| BLAKE2b-256 |
35e7c94ff566105da0cfea77c445cc32e0265f31a612ae097af7d6616cdb4fc8
|
Provenance
The following attestation bundles were made for telescope_sim-2.1.1.tar.gz:
Publisher:
release.yml on icunnyngham/telescope-sim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telescope_sim-2.1.1.tar.gz -
Subject digest:
00111c6e48e42b4a72b7242007f2e03a41ae42ef9e30d27ac9a0f57607b66c32 - Sigstore transparency entry: 2123907208
- Sigstore integration time:
-
Permalink:
icunnyngham/telescope-sim@e762d3dd17af509fa468d051e5545475566f9e66 -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/icunnyngham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e762d3dd17af509fa468d051e5545475566f9e66 -
Trigger Event:
push
-
Statement type:
File details
Details for the file telescope_sim-2.1.1-py3-none-any.whl.
File metadata
- Download URL: telescope_sim-2.1.1-py3-none-any.whl
- Upload date:
- Size: 65.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cfff0267ddbe546b15d6e796d7c1aa4f4907edc93cff8152ade976ef80c8ea1
|
|
| MD5 |
6107dd97782e9957f07dcee7c243585d
|
|
| BLAKE2b-256 |
d7850c383ba99af6c848eca3472728c10abef885798c43d8b4047ced06714ca2
|
Provenance
The following attestation bundles were made for telescope_sim-2.1.1-py3-none-any.whl:
Publisher:
release.yml on icunnyngham/telescope-sim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telescope_sim-2.1.1-py3-none-any.whl -
Subject digest:
7cfff0267ddbe546b15d6e796d7c1aa4f4907edc93cff8152ade976ef80c8ea1 - Sigstore transparency entry: 2123907231
- Sigstore integration time:
-
Permalink:
icunnyngham/telescope-sim@e762d3dd17af509fa468d051e5545475566f9e66 -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/icunnyngham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e762d3dd17af509fa468d051e5545475566f9e66 -
Trigger Event:
push
-
Statement type: