A Python and JAX wrapper to create a coronagraph object from a yield input package
Project description
yippy
A wrapper to create a coronagraph object from a yield input package (a "YIP").
A core feature is its ability to use Fourier interpolation to generate off axis
PSFs at arbitrary locations in the (x,y) plane efficiently.
yippy uses JAX to speed up
computation by default, with an optional Python backend.
Installation
pip install yippy
Use
Typical use will look like
from lod_unit import lod
from yippy import Coronagraph
# Create a coronagraph object by specifying the path to the yield input package
coro = Coronagraph("input/LUVOIR_VVC")
# Off-axis PSF at a given point source position in the (x,y) plane
x_pos = 2 * lod # 2 lambda/D
y_pos = 5 * lod # 5 lambda/D
offaxis_psf = coro.offax(x_pos, y_pos)
# On-axis intensity map with a stellar diameter
stellar_diameter = 1*lod
stellar_intensity = coro.stellar_intensity(stellar_diameter)
# Sky transmission map for extended sources
sky_trans = coro.sky_trans()
Units
Yield input packages use $\lambda / D$ units so yippy treats them
as the default and uses the lod_unit package to define the lod unit. However,
it can use three different astropy units: pixels (as defined by the yield
input package), angular separation (angle units), or apparent separation
(length units). If no units are provided it assumes the input is in $\lambda / D$.
import astropy.units as u
# pixels
x_pos = 2 * u.pix
y_pos = 5 * u.pix
offaxis_psf = aplc.offax(x_pos, y_pos)
# angular separation
telescope_diameter = 10 * u.m
wavelength = 500 * u.nm
offaxis_psf = aplc.offax(x_pos, y_pos, lam=wavelength, D=telescope_diameter)
# apparent separation
star_dist = 10 * u.pc
offaxis_psf = aplc.offax(x_pos, y_pos, lam=wavelength, D=telescope_diameter, dist=star_dist)
JAX
The default backend is JAX, which is a high-performance numerical computing library
that we use for JIT compilation and GPU/TPU support. By default, JAX uses 32-bit
floating point precision, which leads to faster computation and lower memory overhead
but results in lower precision (~1e-6 precision). If you need precision at the
1e-16 level, set use_x64=True.
Off-axis PSF options
use_jax: Use JAX for computation. Default isTrue.use_x64: Use 64-bit floating point precision. Default isFalse.x_symmetric: Off-axis PSF is symmetric about the x-axis. Default isTrue.y_symmetric: Off-axis PSF is symmetric about the y-axis. Default isFalse.cpu_cores: Number of CPU cores to use. Default is1.platform: Computing platform to use for JAX computation. Options arecpu,gpu,tpu. Default iscpu.
Parallel processing of off-axis PSFs
The base call of coronagraph.offax(x,y) is the most user-friendly, but is not
the most efficient. When generating many PSFs it is recommended to convert all
required (x,y) positions into arrays of floats (in $\lambda / D$) and use the
coronagraph.offax.create_psfs_parallel(x_arr, y_arr) function. This function
uses JAX's shard_map to distribute the computation across multiple devices or
CPU cores.
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 yippy-1.12.2.tar.gz.
File metadata
- Download URL: yippy-1.12.2.tar.gz
- Upload date:
- Size: 4.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61200d402586e925a6c112cee31611d872f951173718d860b4e860b0c273625d
|
|
| MD5 |
693a23c8344d5111d537cef225874228
|
|
| BLAKE2b-256 |
3caa077cffc6e6d970503a0e7cfc1b455ca447a3145b919e703de1345c4393cb
|
Provenance
The following attestation bundles were made for yippy-1.12.2.tar.gz:
Publisher:
publish-to-pypi.yml on CoreySpohn/yippy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yippy-1.12.2.tar.gz -
Subject digest:
61200d402586e925a6c112cee31611d872f951173718d860b4e860b0c273625d - Sigstore transparency entry: 757820950
- Sigstore integration time:
-
Permalink:
CoreySpohn/yippy@12c193c04a8aebc904a3f444d1cf606045e3b48f -
Branch / Tag:
refs/tags/v1.12.2 - Owner: https://github.com/CoreySpohn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@12c193c04a8aebc904a3f444d1cf606045e3b48f -
Trigger Event:
push
-
Statement type:
File details
Details for the file yippy-1.12.2-py3-none-any.whl.
File metadata
- Download URL: yippy-1.12.2-py3-none-any.whl
- Upload date:
- Size: 49.8 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 |
119b764bfa251a4e988ee3978bdfa9c9491a729cfd74a5d91ce4737adbb6ed81
|
|
| MD5 |
07ac489b5910c6aab7e22cc2b070cd2f
|
|
| BLAKE2b-256 |
a30d8bdc12366fae256b3daafe41d4c7d66721d29baace0a445f114589c49adb
|
Provenance
The following attestation bundles were made for yippy-1.12.2-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on CoreySpohn/yippy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yippy-1.12.2-py3-none-any.whl -
Subject digest:
119b764bfa251a4e988ee3978bdfa9c9491a729cfd74a5d91ce4737adbb6ed81 - Sigstore transparency entry: 757820953
- Sigstore integration time:
-
Permalink:
CoreySpohn/yippy@12c193c04a8aebc904a3f444d1cf606045e3b48f -
Branch / Tag:
refs/tags/v1.12.2 - Owner: https://github.com/CoreySpohn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@12c193c04a8aebc904a3f444d1cf606045e3b48f -
Trigger Event:
push
-
Statement type: