Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.5.0 instead.
Reason given by maintainers: unsupported stray upload; use 0.5.0

torchsky

Wheels build CI status Docs License

Pre-release: 0.4.0 is the current development line and is not yet on PyPI. It ships when the correctness, performance, API, documentation, and harness goals in the roadmap are met.

torchsky is a high-performance, torch-native astronomy stack for survey-scale coordinates, spherical geometry, catalog indexing, mapmaking, observation operators, and joint modelling of sky observations.

FITS image and table I/O is provided by the focused torchfits package. The boundary is intentional: torchfits loads tensors and metadata; torchsky performs sky-domain computation without embedding a second FITS/CFITSIO engine. The supported integration baseline is torchfits 1.0.0 or newer. Torchsky does not expose alias namespaces for torchfits I/O, tables, caches, or datasets; import those directly from torchfits.


Table of Contents

  1. Key Features
  2. Performance Highlights
  3. Installation
  4. Quick Start
  5. Contributor Setup
  6. Documentation Directory
  7. License

Key Features

  • 🌌 Torch-Native WCS: FITS-WCS transforms (TAN, SIN, ARC, AIT, etc.) and polynomial distortions (SIP, TPV, TNX, ZPX) running directly on CPU, CUDA, and MPS.
  • 🌐 Spherical Geometry & HEALPix: Vectorized HEALPix primitives, Spherical Polygons, Multi-Order Coverage (MOC) maps, and high-performance Spherical Harmonic Transforms (SHT).
  • 🗺️ Scalable Mapmaking: Area-aware coadds, spectral-cube stacking, matrix-free observation operator bundles, and bounded-memory execution.
  • 🔭 Survey-Scale Catalog Geometry: Tensor-native crossmatch and spherical indexing primitives designed for candidate pruning and chunked execution.
  • 🧠 Continuous Field Models: Experimental continuous spectral neural fields ((F_\theta(\mathrm{RA}, \mathrm{Dec}, \lambda))) for implicit forward modeling.
  • 🔌 Explicit I/O Boundary: Tensor/header/table-batch interchange with torchfits and other readers.

Performance Highlights

Scientific performance claims, upstream parity campaigns, real-data evaluation, and scorecards are maintained in the sibling torchsky-harness repository. Torchsky retains bounded package tests and performance smoke checks for its own runtime paths. FITS image/table throughput belongs to torchfits. See the scientific evaluation guide for the ownership boundary.

Current release-candidate evidence (same-machine, reference comparisons):

  • WCS: 38 cases against astropy (30 projections plus reference-latitude-offset cases). Angular parity max 4.13e-5 asec (the AIR formula floor; every other case <=1.5e-8 asec), pole/seam-excluded round trip 4.13e-5 asec, pixel round trip 1.27e-6 px; forward 0.46–3.81x and inverse 0.97–6.01x astropy throughput.
  • HEALPix: 12 operations against healpy at nside 512, zero index/angle mismatches (max 1.14e-13 deg), throughput 1.02–2.19x.
  • Sphere and spin SHT: parity gates pass against healpy; throughput ratios are recorded, not gated.
  • Catalogs: crossmatch against astropy SkyCoord, max separation difference 1.13e-10 asec.
  • GPU: 17 WCS cases on CUDA (including the reference-offset cases) all OK at max 8.2e-3 asec angular parity.

Installation

torchsky is not yet published on PyPI; install the release wheel or build from source in the meantime:

# Wheel built from this repository (see docs/release.md)
pip install "torchsky @ file:///path/to/torchsky-0.4.0-cp*-*.whl"

Package metadata supports Python >=3.12, PyTorch >=2.13, and torchfits >=1.0.0 without upper caps. Native wheels fail closed on a mismatched compiled PyTorch ABI; build from source against a newer supported runtime when needed. Install torchfits alongside torchsky when a workflow reads or writes FITS files:

pip install torchfits

The integration baseline is torchfits 1.0.0 or newer. Dataset and DataLoader classes are provided by torchfits.data; torchsky does not alias them.

Optional Extras

  • viz: Browser sky viewer
    pip install "torchsky[viz]"
    
  • map: Extended mapmaking tools (e.g. SVO filter profiles)
    pip install "torchsky[map]"
    

Quick Start

1. Load Data With torchfits, Compute With torchsky

import torchfits
from torchsky.wcs import WCS

# File I/O belongs to torchfits.
data, header = torchfits.read(
    "science.fits",
    hdu="auto",
    device="cuda",
    return_header=True,
)

# Sky-coordinate computation belongs to torchsky.
wcs = WCS(header)
ra, dec = wcs.pixel_to_world(x, y)

2. Stream Catalog Batches

# torchfits owns FITS table projection and predicate pushdown.
for batch in torchfits.table.scan(
    "catalog.fits",
    hdu=1,
    columns=["RA", "DEC", "MAG_G"],
    where="MAG_G < 20",
    batch_size=100_000,
):
    process_catalog_batch(batch)

3. HEALPix Operations

import torch
import torchsky.sphere as sphere

lon = torch.tensor([10.0, 42.0])
lat = torch.tensor([-1.0, 5.0])

# Coordinate to HEALPix pixel mapping
pix = sphere.ang2pix(1024, lon, lat, lonlat=True, nest=True)
lon2, lat2 = sphere.pix2ang(1024, pix, lonlat=True, nest=True)

Contributor Setup

Contributors should use pixi for environment management:

git clone https://github.com/astroai/torchsky.git
cd torchsky
pixi install
pixi run dev            # Rebuild native extensions
pixi run verify         # Verify torchsky import smoke

Common Developer Commands

  • Run test suite: pixi run test
  • Fast syntax/lint check (git pre-push hook): pixi run preflight-push
  • Typecheck: pixi run typecheck
  • Optional local copy of GitHub build-test: pixi run ci-local

For more information, see the Contributing Guide.


Documentation Directory

Getting Started & Installation

API Reference

Core Modules

Advanced Modeling & Research

Platform & Tooling


License

torchsky is licensed under the MIT License.

Metadata

Release files for torchsky 0.4.0

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

Built distribution (wheel)

Table of built distributions (wheels) for torchsky 0.4.0
File Interpreter ABI Platform Actions
torchsky-0.4.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for torchsky-0.4.0-cp313-cp313-macosx_11_0_arm64.whl

Release files / torchsky-0.4.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL torchsky-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e0fb1580aa2df5296880afaf5451e07194b11a67f6270234d951167f4ba6a08e
BLAKE2b-256 checksum
How to use checksums
104b05c17902c4304e9483410b8baac040b09d2964fe6b54d5279c9511cf50f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Security for torchsky 0.4.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.4.0 This release

1 release file No provenance

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