Home
These docs have not yet been verified by a human
The guides, examples and reference text for this first release were drafted with AI assistance. Automated tests run every code snippet and example, but no person has yet reviewed the prose, the numbers or the recommendations. Treat them as a draft, check results that matter, and report anything wrong.
torchsky does astronomy's sky-domain computations as PyTorch tensor code: coordinates and WCS, HEALPix and spherical geometry, catalog crossmatches, image coadds and HEALPix maps, spectra and synthetic photometry, and differentiable sky models. Inputs are tensors and header dicts, outputs are tensors on the same device (CPU, CUDA, or Apple MPS), and the autograd graph stays intact. The kernels batch, index, and stream, so the call that handles a hundred rows also handles a survey.
torchfits reads and writes the FITS
files; torchsky starts from the tensors it returns.
Real Data¶
Each example fetches a small public sample once, runs in seconds on a CPU, and prints quantitative checks of its result. Select a figure to open the example.
-
Gaia × 2MASS × AllWISE Best, one-to-one, error-radius, and group matches of three catalogs in M67.
-
Planck power spectrum An apodised Galactic mask and the angular power spectrum of a HEALPix map.
-
SDSS spectrum photometry Rest frame, dust correction, and ugriz magnitudes that match the SDSS pipeline.
-
MaNGA IFU cube Hα flux and velocity maps, and a flux-conserving reprojection of the cube.
-
Horsehead WCS tour A photographic plate: pixel to sky, footprint, MOC, and reprojection.
-
Chandra events on the sphere X-ray events near Sgr A* as a sparse HEALPix counts map and a MOC of the chips.
-
CFHT MegaPipe mosaic Four cutouts on four TAN projections, registered and coadded.
-
Cartwheel field fit One continuous sky model fitted to g, r, i, and z images at once.
-
Gaia forced photometry Fluxes of 143 Gaia stars in NGC 288, compared with the Legacy Surveys catalog.
Areas¶
-
Coordinates and WCS
Pixels to sky and back with FITS WCS, SIP and TPV distortions, celestial frames, proper motion, and observed place.
-
Celestial sphere
HEALPix indexing and queries, exact spherical regions, MOC coverage, sparse maps, and spherical harmonic transforms.
-
Catalogs
Catalogs as tensors with frame and epoch; cone and footprint selection; exact crossmatches from a few rows to billions.
-
Images and maps
Plan a target grid, resample with declared kernels or drizzle, and coadd images, spectral cubes, and HEALPix maps.
-
Spectra and photometry
Spectral axes, redshift and Doppler shifts, dust laws, passbands, synthetic magnitudes, and cosmological distances.
-
Models (experimental)
Forward models of the sky through each exposure's WCS, PSF, and bandpass, fitted by gradient descent with exact adjoints.
Start Here¶
-
New users
-
Examples and evidence
-
Reference
-
Project
Stable releases are on PyPI (pip install torchsky); release candidates are
GitHub pre-releases and are never uploaded to PyPI.
Install covers wheels and source builds.








