Skip to main content

mapprojax

mapprojax is a differentiable JAX coordinate kernel for FITS TAN and SIN WCS projections, including SIP distortion. It provides a precision-explicit PyTree API, projection-domain validity, offset coordinate methods, and source-to-target pixel maps. It does not parse arbitrary FITS WCS or interpolate image data: use Astropy for general WCS support and reprojax for image resampling.

Install

The PyPI command becomes available once 0.3.0 is published; publication may still be pending:

pip install mapprojax

For a checkout, use pip install '.[test]'. Supported Python/JAX/NumPy minima are declared in pyproject.toml, based on the tested minimum environment. The rocm extra is for Linux ROCm installations with Python 3.12 or newer and version-matched JAX/jaxlib/ROCm plugins; it is not a generic GPU extra. See the manual.

Quick start

import jax
import jax.numpy as jnp
from mapprojax import Tan

jax.config.update("jax_enable_x64", True)
wcs = Tan(
    crpix=[512.0, 512.0],
    cd=[[-0.001, 0.0], [0.0, 0.001]],
    crval=[180.0, 30.0],  # degrees
    precision="mixed",
)
lon, lat = wcs.unproj(jnp.array([500.0, 520.0]), jnp.array([500.0, 530.0]))
x, y = wcs.proj(lon, lat)
jax.block_until_ready((x, y))
assert jnp.all(jnp.isfinite(x)) & jnp.all(jnp.isfinite(y))

Pixels and crpix are 0-based. crval is in degrees; proj and unproj use radians in (longitude, latitude) order. TAN is invalid at and behind the horizon; SIN is valid on the front hemisphere and inside its inverse unit disc. Invalid samples produce NaNs.

Precision modes

Mode Native/pixel path Absolute celestial rotation Requirement
"f32" float32 not available Use proj_offset / unproj_offset for offset-space work.
"mixed" float32 float64 JAX x64 enabled.
"f64" float64 float64 JAX x64 enabled.

Choose mixed for a lower-precision native path with absolute celestial coordinates, or f64 for a fully float64 path. Mixed forward regression caps span 0.17–17 mas across the reference fixtures, largest on the coarse 240 arcsec/px fields; these are not measured errors or an fp64-equivalence promise.

Coordinate operation Workload-specific precision evidence
WCS f32 Offset-only native path; no absolute proj/unproj. Independent accuracy and host composition.
WCS mixed / f64 Absolute paths with x64. Per-case Astropy agreement, separate from regression caps.
Reprojector f32 Sampled maxima 5.28e-4–8.44e-3 px across the 4096² plate-scale/separation cases, on Strix Halo CPU and ROCm, against the JAX f64 absolute path with typed coordinate inputs. Geometry, sampling and raw results.
Reprojector f64 Same cases: maximum agreement differences ≤4.75e-9 px on CPU and ≤3.88e-9 px on ROCm against that f64 path; not an independent astrometric bound. Results.

As a separate worked example, the real SPHEREx pair has f32 agreement maxima 2.49e-4 / 2.03e-4 px against Astropy on 1009/1090 forward / 320/1090 reverse overlapping samples, not every image pixel (frozen report). The synthetic envelope is not a universal guarantee; errors depend on geometry, plate scale and coordinate dtype. The August precision report is historical.

Batch compatible WCS objects by stacking their PyTrees and using jax.vmap; all entries must share projection, precision, SIP shapes, and inverse_steps. Reprojector(src, tgt) computes a coordinate map only, not image resampling. Reprojector.pixel_map(x, y, *, bounds_shape=None) additionally returns validity with finite zero stand-ins for invalid coordinates and optional half-open image bounds. See the user manual for grid/vmap examples and the differentiability contract.

Serialization and migration

Use the JSON-safe to_dict() and matching projection class's from_dict() methods. The contract preserves type, precision, reference dtype, and SIP state. ASDF integration and the old undocumented byte methods have been removed.

The old NumPy, *Array, *Jax, and *Mixed public class families have no compatibility aliases. Import Tan / Sin from mapprojax and specify a precision mode. Replace Array classes with stacked PyTrees and jax.vmap; replace Mixed classes with precision="mixed". See the user manual for offset composition, SIP use, batching, serialization, differentiability limits, and detailed migration notes.

Scope/backend comparison, checked against the linked package versions on 2026-11-07; no comparative speed or accuracy benchmark is implied:

Tool Scope and precision design
mapprojax 0.3.0 Coordinate-only TAN/SIN + SIP JAX kernel; explicit WCS precision and host-composed relative f32/f64 mapping. Image resampling belongs in reprojax.
JAX-GalSim 2026.7.0 GSFitsWCS WCS inside a JAX galaxy-simulation toolkit, with more projection families; its constructor uses JAX array conversion rather than mapprojax's explicit three-mode API.
dfreproject 1.3.1 TAN/SIP image reprojection and interpolation using PyTorch on CPU/GPU; tensor dtype/device policy, not this coordinate-only JAX API. See its methodology.
Astropy-affiliated reproject 0.21.0 General astronomical image reprojection with interpolation, adaptive and pixel-overlap methods in the NumPy/Astropy/SciPy ecosystem; different scope from a split-precision JAX coordinate kernel.

License

MIT; parts of the projection code derive from cds-mapproj-rust, used under its MIT option. Both copyright notices and permission texts are in LICENSE.

Metadata

Release files for mapprojax 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mapprojax 0.3.0
File Size Uploaded Provenance Actions
mapprojax-0.3.0.tar.gz 95.9 kB With provenance Details for mapprojax-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mapprojax 0.3.0
File Interpreter ABI Platform Actions
mapprojax-0.3.0-py3-none-any.whl Python 3 none any Details for mapprojax-0.3.0-py3-none-any.whl

Total release size: 127.2 kB

Release files / mapprojax-0.3.0.tar.gz

Download URL mapprojax-0.3.0.tar.gz
Size 95.9 kB
Tags Source
SHA-256 checksum
How to use checksums
61a8958d9796fe2154eb5a7f28b857335a5f829302d3e51b391eeb2be8b5bf9f
BLAKE2b-256 checksum
How to use checksums
5aaf571236784d4e703eb2ef17cc3c8a2c1df38aefc8fb1c567dce3b19643c84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / mapprojax-0.3.0-py3-none-any.whl

Download URL mapprojax-0.3.0-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
504296da0cea2c03cb1e058e5096310616fd92a2cafb3a20650bd0aa0b34aa8d
BLAKE2b-256 checksum
How to use checksums
9ba61c3c44acb43ba4a146229780a08bfcebc64600050b489d12f63ac78a906b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for mapprojax 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mapprojax-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page