Skip to content

Examples

Curated, runnable scripts that show what torchsky does and how to use it. The first group works on real public data (Gaia, Planck, SDSS, Chandra, CFHT and more); each script fetches a small sample once into ~/.cache/torchsky/samples (TORCHSKY_SAMPLE_CACHE overrides it), is deterministic, uses only public torchsky APIs, prints a short quantitative result, saves at most one figure to a temporary directory (or --out), and finishes in under a minute on a CPU once its data is cached. Scripts that take --device run on CUDA when it is available. With TORCHSKY_EXAMPLE_FAST=1 (set under CI) downloads are forbidden and a script whose data is not cached exits with status 77, which pixi run examples reports as SKIP. The synthetic examples at the end isolate one mechanism and need no network.

pixi run fetch-example-samples            # cache every small sample
pixi run -e test -- python examples/planck_power_spectrum.py --out ./figures
pixi run -e test -- python examples/coadd_dithered_sip.py --device cuda

Scientific campaigns, large real-data runs, and parity scorecards live in torchsky-harness.

Gaia, 2MASS and AllWISE catalogues

Crossmatching public survey catalogues, fetched from TAP services.

Gaia DR3 x 2MASS x AllWISE in the field of M67

Gaia DR3 x 2MASS x AllWISE in the field of M67

Crossmatch Gaia DR3, 2MASS and AllWISE in the field of the open cluster M67. Runtime: about 2 s on CPU once the cones are cached.

Script: examples/crossmatch_gaia_2mass_allwise.py · site copy

cone r=0.25 deg at (132.825, 11.8): Gaia 2086, 2MASS 1330, AllWISE 2806 rows
Gaia x 2MASS within 2.0 arcsec: best1 1330 pairs (3 ms), mutual 1301 pairs (4 ms), median separation 0.083 arcsec
skyerr (3 x catalogue errors): 1275 pairs (2 ms), 1275 shared with the fixed radius
Gaia x AllWISE skyerr: 1249 pairs (2 ms), median separation 0.138 arcsec
brute-force check on 300 Gaia rows: 180 matches, identical = True
crossmatch_many group (2.5 arcsec, 7 ms): 3383 groups; groups with 1/2/3 catalogues: 1764/436/1183

Gaia DR3 astrometry and Galactic dust

Catalogue motion in other frames and epochs, and a dust map sampled at star positions.

Pleiades proper motions in the Galactic frame and back to J2000

Pleiades proper motions in the Galactic frame and back to J2000

Gaia DR3 proper motions of the Pleiades in the Galactic frame. Runtime: about 2 s on CPU once the sample is cached.

Script: examples/gaia_pleiades_motion.py · site copy

Gaia DR3 cone r=1 deg around the Pleiades: 2745 stars with G < 16
ICRS -> Galactic: |mu| preserved to 5.7e-14 mas/yr, round-trip position error 8.5e-04 uas
members: 265 of 2745; mean parallax 7.373 mas (135.6 pc)
cluster proper motion: ICRS (mu_a*, mu_d) = (19.97, -45.58) mas/yr; Galactic (mu_l*, mu_b) = (45.43, -20.32) mas/yr
published (Gaia DR2, Babusiaux et al. 2018): (20.00, -45.55) mas/yr, parallax 7.364 mas
tangential velocity 32.0 km/s; member proper-motion rms per axis 1.31 mas/yr = 0.85 km/s (internal motion, binaries and projection, not deconvolved)
J2016.0 -> J2000.0: members move 0.795 arcsec (median); angular vs rigorous space motion for 205 members with RV: max 8.68 uas

SFD dust at Gaia positions in Taurus, dereddened with G23

SFD dust at Gaia positions in Taurus, dereddened with G23

SFD dust sampled at Gaia star positions in Taurus, then dereddened with G23. Runtime: about 5 s on CPU once the samples are cached.

Script: examples/dust_extinction_taurus.py · site copy

SFD E(B-V): nside 512, 3145728 pixels, NESTED, Galactic; all-sky median 0.070 mag
4831 Gaia stars at l = 169.8, b = -16.7: E(B-V) 5/50/95% = 0.26 / 0.46 / 1.09 mag
G23, R_V = 3.1: A_G, A_BP, A_RP per E(B-V) = 2.681, 3.409, 1.916; E(BP-RP)/E(B-V) = 1.493
main-sequence colour width (NMAD) behind the clouds (4721 stars): 0.190 mag uncorrected, 0.104 with 0.86 x SFD, 0.080 with the fitted scale s = 0.60
fitted reddening is 0.60 x the Schlafly-Finkbeiner-scaled SFD (0.51 x raw SFD) for these stars

Survey footprints (HiPS MOCs)

Published survey coverage combined exactly as MOCs and as a sparse depth map.

SDSS, GALEX and eROSITA eFEDS footprints: areas and overlaps

SDSS, GALEX and eROSITA eFEDS footprints: areas and overlaps

Footprint algebra on real survey coverage: SDSS, GALEX and eROSITA eFEDS MOCs. Runtime: about 3 s on CPU once the samples are cached.

Script: examples/survey_footprints_moc.py · site copy

SDSS DR9        747497 cells, max order 12,   14693.1 deg^2 (35.6% of the sky)
GALEX AIS NUV    71384 cells, max order  8,   32839.7 deg^2 (79.6% of the sky)
eROSITA eFEDS      122 cells, max order  7,     159.7 deg^2 (0.4% of the sky)
SDSS n GALEX 12994.4 deg^2, SDSS u GALEX 34538.5 deg^2, SDSS - GALEX 1698.7 deg^2; inclusion-exclusion residual 0.0e+00 deg^2
eFEDS 159.7 deg^2: 99.8% in SDSS, 86.0% in GALEX AIS, 137.0 deg^2 in all three
1 deg cap at order 13: MOC 3.1886 deg^2 vs exact 3.1415 deg^2 (+1.50%, boundary cells)
order 8 depth >= 1:  662472 pixels =   34750.5 deg^2
order 8 depth >= 2:  261599 pixels =   13722.4 deg^2
order 8 depth >= 3:    2618 pixels =     137.3 deg^2
SDSS n GALEX at order 8: 13700.1 deg^2 vs exact 12994.4 deg^2 (+5.4% from boundary cells)

Planck

All-sky HEALPix maps, masks and power spectra.

Apodised-mask power spectrum of the Commander synchrotron map

Apodised-mask power spectrum of the Commander synchrotron map

Power spectrum of the Planck Commander synchrotron map with an apodised Galactic mask. Runtime: about 5 s on CPU once the map (9 MB) is cached.

Script: examples/planck_power_spectrum.py · site copy

COMP-MAP-Synchrotron: nside 256, 786432 pixels, unit uK_RJ, median 1.65e+07
mask |b| > 20 deg, 10 deg cosine taper: f_sky = 0.6576 (MOC area; analytic 0.6580), w2 = 0.5579
even/odd multipole ratio at ell 100-200: sharp cut, monopole kept 1.90; apodised, monopole+dipole removed 1.005
high-latitude spectrum: C_ell ~ ell^-2.91 over ell 10-50
band          |b|>20 / full sky   |b|>30 / |b|>20   simulation out / in
ell  10- 30         0.0326              0.761             1.184
ell  30- 60         0.0202              0.845             1.037
ell  60-150         0.0176              1.166             1.028

SDSS

Calibrated spectra and IFU cubes: rest frames, dust, emission-line maps and synthetic photometry.

A quasar spectrum: rest frame, dust and ugriz magnitudes

A quasar spectrum: rest frame, dust and ugriz magnitudes

Rest frame, dust correction and synthetic ugriz photometry of an SDSS spectrum. Runtime: about 2 s on CPU once the files are cached.

Script: examples/sdss_spectrum_photometry.py · site copy

plate 751 MJD 52251 fibre 160: class QSO, z = 0.04559 (v = 13356 km/s), 3840/3841 good pixels, 3799-9198 A
[OIII]4960: rest-frame centroid 4960.38 A -> +5 km/s from the pipeline redshift
[OIII]5008: rest-frame centroid 5008.47 A -> +14 km/s from the pipeline redshift
band  coverage  torchsky AB  SDSS synthetic  diff    dust-corrected  A_lambda(pivot)
  u     0.12      invalid         18.237
  g     1.00       17.470         17.496  -0.027          17.213         0.263
  r     1.00       16.776         16.764  +0.012          16.597         0.180
  i     1.00       16.370         16.374  -0.004          16.236         0.134
  z     0.69      invalid         16.125
rms difference to the SDSS synthetic magnitudes (griz): 0.017 mag; dust-corrected g-r = 0.616

A MaNGA IFU cube: Hα map, rotation and reprojection

A MaNGA IFU cube: Hα map, rotation and reprojection

Hα map, velocity field and spectrum of a MaNGA IFU cube. Runtime: about 5 s on CPU once the 39 MB cube is cached.

Script: examples/manga_ifu_cube.py · site copy

manga_8485_1901.fits.gz: 34 x 34 spaxels x 4563 channels, WAVE-LOG, 1E-17 erg/s/cm^2/Angstrom/spaxel
WAVE-LOG axis 3621.60-10353.81 Å; max |WCS - WAVE HDU| = 1.5e-04 Å
systemic redshift from central Hα: z = 0.04077 (cz = 12221 km/s)
Hα detected at 5 sigma in 254 spaxels; total Hα flux 1187 x 1e-17 erg/s/cm^2; velocity range -102 to +90 km/s
integrated [N II] 6585 / Hα = 0.41 (log -0.39: star formation, not AGN)
reprojected cube (16, 93, 93) at 0.25 arcsec, rotated 30 deg: Hα total 1194 vs 1194 (1.0000)

A MaNGA cube rebuilt from its 171 dithered fibre spectra

A MaNGA cube rebuilt from its 171 dithered fibre spectra

Build a MaNGA data cube from its 171 dithered fibre spectra with coadd_cube. Runtime: about 10 s on CPU once the 16 MB fibre file and the 39 MB cube are cached.

Script: examples/manga_rss_to_cube.py · site copy

8485-1901: 171 fibre spectra (9 exposures), 389 channels in 6400-7000 A; refraction moves the fibres by 0.037 arcsec across the window
cube (389, 17, 17) (wave, y, x) at 1 arcsec; 147 spaxels covered in every channel
total flux in the window over 147 spaxels: ours / DRP = 1.0116
image centroid ours - DRP: (+0.001, -0.008) spaxels
continuum image: 28 spaxels above 10 % of peak, correlation 0.998, ours / DRP median 1.005 (16-84 %: 0.963-1.037)
H-alpha   image: 40 spaxels above 10 % of peak, correlation 0.997, ours / DRP median 1.047 (16-84 %: 0.919-1.137)
integrated spectrum: ours / DRP median 1.0135, rms of the relative difference 0.0251

Photometric redshifts of 7145 galaxies with the experimental encoders

Photometric redshifts of 7145 galaxies with the experimental encoders

Photometric redshifts of SDSS galaxies with the experimental torchsky encoders. Runtime: about 35 s on CPU once the sample is cached.

Script: examples/sdss_photoz_encoder.py · site copy

SDSS DR17 spectroscopic galaxies: 7145; z_spec 10/50/90% = 0.067 / 0.307 / 0.600
median E(B-V) 0.023; A_u = 0.115 mag
epoch    1: train -log p(z) = -0.384
epoch  151: train -log p(z) = -1.740
epoch  300: train -log p(z) = -1.844
test set: 2144 galaxies (train 5001)
torchsky encoder : sigma_NMAD 0.0267, outliers 0.9%, bias -0.0019, mean log p(z_spec) 1.70
SDSS DR17 Photoz: sigma_NMAD 0.0181, outliers 0.6%, bias -0.0003 on 2139 galaxies with an estimate (reference; trained on a much larger spectroscopic set)

Legacy Surveys (DECam)

Multi-band DECam images: a continuous field fit and catalogue forced photometry.

One continuous field fitted to g/r/i/z images of the Cartwheel

One continuous field fitted to g/r/i/z images of the Cartwheel

Fit one continuous field to Legacy Surveys g/r/i/z images of the Cartwheel galaxy. Runtime: about 60 s on CPU once the 1 MB of cutouts and filter curves are cached.

Script: examples/legacy_field_fit.py · site copy

g 0.52"   (128, 128) px, passband 3835-5570 A, total   634.1 nmgy
r 0.52"   (128, 128) px, passband 5405-7290 A, total   829.0 nmgy
i 0.52"   (128, 128) px, passband 6775-8690 A, total   907.0 nmgy
z 0.52"   (128, 128) px, passband 8255-10140 A, total  1019.5 nmgy
g 0.35"   (160, 160) px, passband 3835-5570 A, total  1084.5 nmgy
z 0.35"   (160, 160) px, passband 8255-10140 A, total  1888.7 nmgy
fit: 240 steps, loss 0.0352 -> 0.0041
g 0.52"   model/data flux 0.942, variance explained 0.737
r 0.52"   model/data flux 0.976, variance explained 0.811
i 0.52"   model/data flux 1.018, variance explained 0.840
z 0.52"   model/data flux 1.085, variance explained 0.826
g 0.35"   model/data flux 0.963, variance explained 0.744

Forced photometry of 143 Gaia stars near NGC 288

Forced photometry of 143 Gaia stars near NGC 288

Forced photometry of Gaia stars on Legacy Surveys g/r/z images near NGC 288. Runtime: about 20 s on CPU once the 4 MB of samples are cached.

Script: examples/legacy_forced_photometry.py · site copy

384 x 384 px at 0.262 arcsec; 143 catalogue stars on the image
g: PSF sigma 2.09 px, FWHM 1.29 arcsec
r: PSF sigma 1.59 px, FWHM 0.98 arcsec
z: PSF sigma 1.39 px, FWHM 0.86 arcsec
blend groups: 71 for 143 stars
g: forced / Tractor flux, 143 stars at S/N > 50: median 0.817, robust scatter 0.034
r: forced / Tractor flux, 143 stars at S/N > 50: median 0.856, robust scatter 0.028
z: forced / Tractor flux, 143 stars at S/N > 50: median 0.858, robust scatter 0.034

g/r/i/z cutouts of the Cartwheel coadded onto sparse HEALPix maps

g/r/i/z cutouts of the Cartwheel coadded onto sparse HEALPix maps

Coadd Legacy Surveys g/r/i/z cutouts of the Cartwheel onto sparse HEALPix maps. Runtime: about 10 s on CPU once the two 0.5 MB cutouts are cached.

Script: examples/legacy_healpix_multiband.py · site copy

legacy_cartwheel_griz: bands griz, 128 x 128 px at 0.524 arcsec
legacy_cartwheel_gz_fine: bands gz, 160 x 160 px at 0.350 arcsec
NSIDE = 2^19: 0.403 arcsec cells, 3.30e+12 on the full sphere
band g: 2 grid(s), 27454 cells; 25 arcsec disc  365.83 nmgy (AB 16.09) vs image plane  365.96 nmgy (ratio 0.9997); cell-by-cell difference -0.024 sigma median, 0.313 sigma robust rms
band r: 1 grid(s), 27454 cells; 25 arcsec disc  459.40 nmgy (AB 15.84) vs image plane  459.23 nmgy (ratio 1.0004); cell-by-cell difference -0.020 sigma median, 0.243 sigma robust rms
band i: 1 grid(s), 27454 cells; 25 arcsec disc  554.93 nmgy (AB 15.64) vs image plane  554.74 nmgy (ratio 1.0003); cell-by-cell difference -0.008 sigma median, 0.229 sigma robust rms
band z: 2 grid(s), 27454 cells; 25 arcsec disc  773.53 nmgy (AB 15.28) vs image plane  773.72 nmgy (ratio 0.9998); cell-by-cell difference -0.008 sigma median, 0.275 sigma robust rms
sparse storage: 109816 cells in 4 maps; a dense float32 map at this NSIDE would be 13.2 TB

JWST NIRCam (MAST)

Calibrated exposures cut from MAST products by HTTP range reads.

Four SMACS 0723 dithers coadded with Lanczos3 and drizzle, checked against MAST

Four SMACS 0723 dithers coadded with Lanczos3 and drizzle, checked against MAST

Coadd four dithered JWST NIRCam exposures of SMACS 0723 with Lanczos3 and drizzle. Runtime: about 5 s on CPU once they are cached.

Script: examples/jwst_smacs0723_coadd.py · site copy

exposure 1 (dither 1): pixel origin (976, 988) on NRCBLONG, background sigma 0.0084 MJy/sr, 235 flagged px
exposure 2 (dither 2): pixel origin (973, 1083) on NRCBLONG, background sigma 0.0085 MJy/sr, 242 flagged px
exposure 3 (dither 3): pixel origin (1069, 1086) on NRCBLONG, background sigma 0.0084 MJy/sr, 239 flagged px
exposure 4 (dither 4): pixel origin (1071, 991) on NRCBLONG, background sigma 0.0084 MJy/sr, 233 flagged px
pipeline 3.0.0 (jwst_1584.pmap); filter F444W
planned TAN grid: (258, 257) px at 0.0630 arcsec/px, rotated -145.0 deg
flux conservation, 5 sources above 1 uJy, 1 arcsec soft aperture, coadd / median of the inputs (17 source-exposure pairs):
  lanczos3        median 1.0027, range 0.9845-1.0082
  drizzle_square  median 0.9987, range 0.9828-1.0070
  input-to-input scatter of the same apertures (robust): median 0.03 %
noise in source-free pixels (robust rms / predicted 1/sqrt(inverse_variance)):
  each exposure   ratio 0.98-0.99

DSS photographic plates

A WCS from a real header, frames, footprints and reprojection.

Horsehead Nebula: WCS, footprint and reprojection

Horsehead Nebula: WCS, footprint and reprojection

Pixel to sky on a real photographic-plate image: the Horsehead Nebula. Runtime: about 4 s on CPU once the 1.6 MB file is cached.

Script: examples/horsehead_wcs_tour.py · site copy

horsehead.fits: 891 x 893 px, RA---TAN/DEC--TAN, ICRS
pixel -> world -> pixel round trip: max |dpix| = 6.8e-11
pixel scale 1.009 x 1.007 arcsec, field 15.0 x 15.0 arcmin, rotation +0.065 deg
footprint centre l, b = 206.97, -16.75 deg; exact polygon area 225 arcmin^2
Horsehead at pixel (549.0, 445.8), Galactic l, b = 206.96, -16.78 deg
MOC order 15: 674 cells, area 229 arcmin^2 (1.020 x polygon)
MOC degraded to order 12: 104 cells, 1 boundary loop(s), area 258 arcmin^2
rotated TAN grid (1219, 1219), CAR grid (895, 893); original -> CAR -> original residual rms = 0.015 of the image std
mean surface brightness: original 9831.5, CAR 9832.0 (ratio 1.0001)

Chandra

Photon event lists placed on the sphere.

Sgr A* events as a sparse HEALPix map and MOC

Sgr A* events as a sparse HEALPix map and MOC

Chandra ACIS events of Sgr A* as a sparse HEALPix counts map and a MOC. Runtime: about 6 s on CPU once the 31 MB file is cached.

Script: examples/chandra_events_on_sphere.py · site copy

ObsID 5950 (Sgr A*, 48.5 ks): 483964 events, 323657 in 0.5-7 keV; field centre 266.401, -28.987 deg
sparse map nside 16384 (12.9 arcsec cells): 8105 occupied cells of 3.22e+09, 323657 events conserved, peak 26512 counts/cell
MOC order 12: 132 cells, 420 arcmin^2 (five chips, edges inflated by the 51 arcsec cells); contains 323657/323657 events
smoothed 6 steps (sigma ~ 26 arcsec): 12236 cells, counts 323657.0 (conserved: True)
brightest smoothed cell (2266 counts) lies 10.0 arcmin from Sgr A*, a point source; the cell at Sgr A* holds 367 counts

CFHT MegaCam (MegaPipe)

Mosaicking independent stacks with different projections.

Four MegaPipe cutouts coadded with Lanczos3 and drizzle

Four MegaPipe cutouts coadded with Lanczos3 and drizzle

Mosaic four overlapping CFHT MegaPipe cutouts with Lanczos3 and drizzle. Runtime: about 10 s on CPU once the four 1 MB cutouts are cached.

Script: examples/megapipe_mosaic.py · site copy

tile 712.165: CRVAL (359.072, -7.500), exposure 240 s, noise 1.76 counts/px
tile 711.165: CRVAL (358.568, -7.500), exposure 240 s, noise 1.62 counts/px
tile 712.166a: CRVAL (358.673, -7.000), exposure 1224 s, noise 1.43 counts/px
tile 712.166b: CRVAL (358.673, -7.000), exposure 1224 s, noise 1.46 counts/px
common TAN grid: (712, 868) px
lanczos3: pairwise overlaps (interior, 8 px eroded)
  712.165 - 711.165: 152896 px, median offset -0.000, rms 0.25 (noise-only 2.39, ratio 0.10)
  712.165 - 712.166a: 127221 px, median offset -0.002, rms 0.56 (noise-only 2.26, ratio 0.25)
  712.165 - 712.166b:  47861 px, median offset -0.002, rms 0.69 (noise-only 2.29, ratio 0.30)
  711.165 - 712.166a: 125550 px, median offset -0.002, rms 0.52 (noise-only 2.16, ratio 0.24)
  711.165 - 712.166b: 112216 px, median offset -0.002, rms 0.47 (noise-only 2.19, ratio 0.22)
  coadd: 554955 covered px; pixels seen by 1/2/3/4 cutouts: 250638/178767/77689/47861

Mechanisms with synthetic data

Each example below builds its own inputs to isolate one mechanism.

Coordinates, frames and WCS (synthetic)

Pixel/world geometry and celestial frames, differentiable end to end.

WCS tour: TAN, SIP, TPV and extended projections

WCS tour: TAN, SIP, TPV and extended projections

A tour of torchsky WCS: TAN, TAN-SIP, TPV and extended projections.

Script: examples/wcs_tour.py · site copy

Frames, proper motion and observed alt/az

Celestial frames, proper motion, and observed alt/az in torchsky.coords. Runtime: about 2 s on CPU.

Script: examples/frames_and_motion.py · site copy

source      l [deg]   b [deg]   ecl.lon  ecl.lat
Sgr A*    359.9443   -0.0462  267.1751  -5.6107
Crab      184.5575   -5.7844   84.4209  -1.2914
LMC       280.4652  -32.8884  312.8596 -85.3536
Galactic round trip: 8.2e-07 mas; ICRS->FK5(J2000) shift: 28.6 mas
Barnard's star moves 351.9 arcsec in Dec over 34 yr; rigorous vs linear proper motion differ by 741.9 mas
Sgr A*   az= 119.77 alt= -68.82
Crab     az= 279.86 alt=  67.69
LMC      az= 188.90 alt=  -1.54
device=cpu

Sphere, HEALPix and spherical harmonics (synthetic)

Pixelization, regions and MOCs, power spectra, and inverse problems on the sphere.

HEALPix queries, sparse maps and MOC algebra

HEALPix queries, sparse maps and MOC algebra

HEALPix pixelization, region queries, sparse maps and MOC set algebra. Runtime: about 3 s on CPU.

Script: examples/healpix_and_moc.py · site copy

nside=64 npix=49152: max pixel-centre offset 0.934 deg (resolution 0.916 deg)
disc: 210 px, polygon: 241 px, overlap: 155 px
catalogue 7000 rows -> 1363/3072 occupied pixels (sparse == dense); degraded sum preserved: 7000
MOC areas [deg^2] cone=747.8 box=819.4 union=1016.6 intersection=550.6 difference=197.2; 2000 randoms drawn inside the intersection

Spherical harmonic transforms and C_ell recovery

Spherical harmonic transforms and C_ell recovery

Spherical harmonic transforms: synthesis, power spectrum recovery, smoothing. Runtime: about 3 s on CPU (NSIDE=128).

Script: examples/sht_power_spectrum.py · site copy

NSIDE=128 lmax=256: mean C_l(out)/C_l(in) over l=20..200 = 1.001 (cosmic-variance sigma 0.008)
map std 6.796e-01 -> 5.980e-01 after 2 deg beam; smoothed/(C_l b_l^2) = 1.001

All-sky harmonic fit from flat cutouts

All-sky harmonic fit from flat cutouts

Fit an all-sky harmonic model to flat cutouts with priors and constraints. Runtime: about 3 s.

Script: examples/sphere_image_inverse.py · site copy

Joint T/E/B inverse from temperature and Q/U cutouts

Joint T/E/B inverse from temperature and Q/U cutouts

Joint temperature and polarization (T/E/B) inverse from flat cutouts. Runtime: about 3 s.

Script: examples/polarization_teb.py · site copy

Catalogs at survey scale (synthetic)

Indexed, chunked catalogue operations that stay near-linear in N.

Crossmatch of two million-source catalogues

Crossmatch two large synthetic catalogues (1e6 x 1e6 by default). Runtime: about 3 s on CPU (about 0.5 s per mode for the match itself).

Script: examples/crossmatch_million.py · site copy

Mapmaking: coadds, drizzle and cubes (synthetic)

Resample many exposures onto one grid, a HEALPix map, or a spectral cube.

Coadd dithered SIP exposures: Lanczos3 and drizzle

Coadd dithered SIP exposures: Lanczos3 and drizzle

Coadd dithered, rotated TAN-SIP exposures with Lanczos3 and drizzle. Runtime: about 3 s on CPU.

Script: examples/coadd_dithered_sip.py · site copy

lanczos3 : shape (99, 99), 12 stars: median |dF/F| = 0.001, max centroid error = 0.025 pix
drizzle  : shape (99, 99), 12 stars: median |dF/F| = 0.002, max centroid error = 0.036 pix
background rms: single exposure 0.0201 -> coadd 0.0068 (expect ~0.0071 before correlated-noise inflation)

Exact square drizzle with flux conservation

Exact square drizzle of two sub-pixel-shifted detector images. Runtime: under 1 s on CPU.

Script: examples/drizzle_flagship.py · site copy

Multiband tiles coadded directly onto HEALPix

Multiband tiles coadded directly onto HEALPix

Coadd overlapping multiband tiles directly onto a HEALPix grid. Runtime: about 3 s on CPU.

Script: examples/coadd_to_healpix.py · site copy

IFU frames to a spectral cube

IFU frames to a spectral cube

Build a spectral cube from IFU-like detector frames with coadd_cube. Runtime: about 2 s on CPU.

Script: examples/spectral_cube.py · site copy

cube shape (20, 16, 16) (wave, y, x); spectral range 5002-5078 A
line peak at 5038 A (truth 5040); continuum 1.000 (truth 1.0); moment-0 centroid (6.01, 8.99) (truth 6.0, 9.0)

Spectra, photometry and cosmology (synthetic)

From a rest-frame SED to observed magnitudes.

Redshift, dust and synthetic photometry

Redshift, dust and synthetic photometry

Redshift, dust extinction, and synthetic photometry of a galaxy SED. Runtime: about 2 s on CPU.

Script: examples/sed_photometry.py · site copy

z      D_L [Mpc]  D_A [Mpc]  DM [mag]
 0.1      475.8      393.2    38.387
 0.5     2919.7     1297.7    42.327
 1.0     6791.7     1697.9    44.160
 2.0    15926.6     1769.6    46.011
flat-f_nu m(z=0.5) = [20.887, 20.887, 20.887, 20.887] vs closed form 20.886: max err 0.0001 mag
band dust dimming [mag]: {'g': 0.36, 'r': 0.275, 'i': 0.211, 'z': 0.159}  CCM89 A_lambda at pivot: [0.367, 0.274, 0.212, 0.158]
g-r: 0.11 at z=0.02, peaks at 0.85 (z=0.41) as the 4000 A break crosses g and r

Continuous fields and observation operators (experimental) (synthetic)

Field-like models and native forward models; these APIs are still evolving.

Multiband neural field

Multiband neural field

Fit a continuous multiband neural field to three noisy images. Runtime: about 5 s on CPU.

Script: examples/neural_field_multiband.py · site copy

Shared versus survey-private components

Separate a shared sky from survey-private components with a field model. Runtime: about 5 s.

Script: examples/survey_split.py · site copy

Native detector, response and likelihood operators

Native observation operators: detector moments, field response, pixel likelihood.

Script: examples/native_operators.py · site copy

Visualization (synthetic)

Presentation-quality figures from tensors.

All-sky figures for talks and papers

All-sky figures for talks and papers

Render slide-ready all-sky figures with torchsky.viz. Runtime: about 15 s.

Script: examples/allsky_figures.py · site copy

Sample data sources

Samples are validated (size, magic bytes, sha256 where the server file is immutable) on every cache hit. Catalogue cones use the TAP services of the Gaia archive and IRSA, with a COUNT(*) check against truncation.

Sample Size Description Credit and licence
horsehead 1.7 MB Horsehead Nebula DSS image with a TAN WCS (astropy tutorial). astropy-data tutorial file; DSS credit STScI/DSS
chandra_events 31.1 MB Chandra ACIS event list (binary table). astropy-data tutorial file; Chandra X-ray Center public data
sdss_spectrum 0.6 MB SDSS DR16 optical spectrum, plate 0751 MJD 52251 fiber 0160. SDSS public data (CC BY-style; cite SDSS DR16)
cadc_megapipe_cutout 1.1 MB 512x512 g-band cutout (pixels 8000:8511, 4000:4511) of the CFHT MegaPipe stack MegaPipe.712.165 from the CADC cutout service; TAN WCS, float32. CFHT/CADC MegaPipe (Gwyn 2008), open data; cite CFHT and CADC
megapipe_mosaic_a 1.1 MB 512x512 g-band cutout of the CFHT MegaPipe stack, pixels 9489:10000 x 9489:10000 (the north-west corner on the sky) of tile 712.165. The four cutouts share one sky window near RA 358.82, Dec -7.25 where tiles 712.165, 711.165 and 712.166 overlap (each tile has its own TAN reference point). CFHT/CADC MegaPipe (Gwyn 2008), open data; cite CFHT and CADC
megapipe_mosaic_b 1.1 MB 512x512 g-band cutout of the CFHT MegaPipe stack, pixels 1:512 x 9489:10000 of tile 711.165, the western neighbour of tile 712.165 in the same row. The four cutouts share one sky window near RA 358.82, Dec -7.25 where tiles 712.165, 711.165 and 712.166 overlap (each tile has its own TAN reference point). CFHT/CADC MegaPipe (Gwyn 2008), open data; cite CFHT and CADC
megapipe_mosaic_c 1.1 MB 512x512 g-band cutout of the CFHT MegaPipe stack, pixels 1930:2442 x 1:512 of tile 712.166, the next row north (the rows are staggered in RA). The four cutouts share one sky window near RA 358.82, Dec -7.25 where tiles 712.165, 711.165 and 712.166 overlap (each tile has its own TAN reference point). CFHT/CADC MegaPipe (Gwyn 2008), open data; cite CFHT and CADC
megapipe_mosaic_d 1.1 MB 512x512 g-band cutout of the CFHT MegaPipe stack, pixels 2186:2697 x 1:512 of tile 712.166, shifted 256 px from the previous cutout of the same stack. The four cutouts share one sky window near RA 358.82, Dec -7.25 where tiles 712.165, 711.165 and 712.166 overlap (each tile has its own TAN reference point). CFHT/CADC MegaPipe (Gwyn 2008), open data; cite CFHT and CADC
svo_sdss_u 0.0 MB SDSS u-band filter transmission (wavelength [A], photon response) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); cite SVO and Doi et al. 2010
svo_sdss_g 0.0 MB SDSS g-band filter transmission (wavelength [A], photon response) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); cite SVO and Doi et al. 2010
svo_sdss_r 0.0 MB SDSS r-band filter transmission (wavelength [A], photon response) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); cite SVO and Doi et al. 2010
svo_sdss_i 0.0 MB SDSS i-band filter transmission (wavelength [A], photon response) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); cite SVO and Doi et al. 2010
svo_sdss_z 0.0 MB SDSS z-band filter transmission (wavelength [A], photon response) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); cite SVO and Doi et al. 2010
healpy_full_weights_256 0.4 MB HEALPix ring-weight file for nside=256 (healpy-data). healpy-data repository (healpy licence)
planck_commander_sync_256 9.5 MB Planck PR2 Commander synchrotron component, HEALPix nside=256. Planck Legacy Archive (ESA); cite Planck Collaboration 2015 X
planck_commander_dust_256 28.3 MB Planck PR2 Commander thermal dust component, HEALPix nside=256. Planck Legacy Archive (ESA); cite Planck Collaboration 2015 X
planck_smica_1024 (opt-in) 176.2 MB Planck PR2 SMICA CMB I/Q/U, nside=1024 (smallest official CMB map; the PR3 SMICA map is 2 GB at nside=2048). Planck Legacy Archive (ESA); cite Planck Collaboration 2015 IX
manga_logcube (opt-in) 212.0 MB SDSS-IV MaNGA DR17 LOGCUBE, plate-IFU 7443-12703. SDSS public data; cite SDSS DR17 and MaNGA (Bundy et al. 2015)
manga_8485_1901 38.9 MB SDSS-IV MaNGA DR17 LOGCUBE, plate-IFU 8485-1901 (19-fibre bundle, 34 x 34 spaxels of 0.5 arcsec, 4563 log-lambda channels, 3622-10354 A); the smallest MaNGA cube format, a star-forming disc galaxy at z = 0.037. SDSS public data; cite SDSS DR17 and MaNGA (Bundy et al. 2015)
manga_8485_1901_rss 15.8 MB SDSS-IV MaNGA DR17 LOGRSS (row-stacked spectra) of plate-IFU 8485-1901: 171 fibre spectra (19 fibres x 9 dithered exposures) on the cube's log-lambda grid, with inverse variance, mask and per-wavelength fibre positions (XPOS/YPOS). SDSS public data; cite SDSS DR17 and MaNGA (Bundy et al. 2015)
legacy_cartwheel_griz 0.5 MB Legacy Surveys DR10 g/r/i/z cutout of the Cartwheel galaxy, 128 x 128 px at 0.524 arcsec/px (TAN), image cube in HDU 0 and inverse variance in HDU 1, nanomaggies. Legacy Surveys DR10 (Dey et al. 2019), public data; acknowledge the Legacy Surveys, DECam/DES and NOIRLab per legacysurvey.org/acknowledgment
legacy_cartwheel_gz_fine 0.4 MB Legacy Surveys DR10 g/z cutout of the Cartwheel on a second grid: 160 x 160 px at 0.35 arcsec/px, centre offset by 3 and 2.5 arcsec. Legacy Surveys DR10 (Dey et al. 2019), public data; acknowledge the Legacy Surveys, DECam/DES and NOIRLab per legacysurvey.org/acknowledgment
legacy_ngc288_grz 3.5 MB Legacy Surveys DR10 g/r/z cutout 4 arcmin west of the globular cluster NGC 288, 384 x 384 px at the native 0.262 arcsec/px, image cube in HDU 0 and inverse variance in HDU 1, nanomaggies. Legacy Surveys DR10 (Dey et al. 2019), public data; acknowledge the Legacy Surveys, DECam/DES and NOIRLab per legacysurvey.org/acknowledgment
legacy_ngc288_catalog 0.4 MB Legacy Surveys DR10 Tractor catalogue of the same field (143 Gaia stars with Tractor g/r/z fluxes and inverse variances). Legacy Surveys DR10 (Dey et al. 2019), public data; acknowledge the Legacy Surveys, DECam/DES and NOIRLab per legacysurvey.org/acknowledgment; Gaia DR3 (ESA/DPAC) astrometry
gaia_pleiades_cone 0.3 MB Gaia DR3 snapshot from the IRSA TAP service (CSV): sources with G < 16 and a proper motion within 1 degree of the Pleiades (RA 56.75, Dec +24.12), ordered by source_id. Gaia DR3 (ESA/Gaia/DPAC, CC BY-SA 3.0 IGO) via the IRSA TAP mirror; cite Gaia Collaboration 2023
gaia_taurus_cone 0.4 MB Gaia DR3 snapshot from the IRSA TAP service (CSV): G < 17 sources with BP/RP photometry and parallax_over_error > 5 within 1 degree of (RA 64.5, Dec +27.0) in the Taurus dark clouds, ordered by source_id. Gaia DR3 (ESA/Gaia/DPAC, CC BY-SA 3.0 IGO) via the IRSA TAP mirror; cite Gaia Collaboration 2023
sfd_ebv_healpix_512 25.2 MB Schlegel, Finkbeiner & Davis (1998) E(B-V) dust map resampled by LAMBDA to HEALPix nside=512, NESTED, Galactic coordinates (the smallest official HEALPix form of SFD). NASA LAMBDA (public domain, US Government work); cite Schlegel et al. 1998
sdss_dr17_photoz_sample 1.3 MB SDSS DR17 SkyServer snapshot (CSV): every spectroscopic galaxy with zWarning = 0 in RA 150-156, Dec 0-6, with ugriz model fluxes and inverse variances (nanomaggies) and the DR17 Photoz (Beck et al. 2016) estimate. SDSS public data; cite SDSS DR17 (Abdurro'uf et al. 2022) and Beck et al. 2016
moc_sdss_dr9 3.0 MB Coverage MOC (order 12) of the SDSS DR9 imaging HiPS. HiPS coverage MOC built by CDS (Strasbourg), mirrored by IRSA; cite SDSS DR9 (Ahn et al. 2012)
moc_galex_ais_nuv 0.3 MB Coverage MOC of the GALEX GR6 All-sky Imaging Survey NUV HiPS. HiPS coverage MOC built by CDS (Strasbourg), mirrored by IRSA; GALEX (NASA), cite Bianchi et al. 2017
moc_erosita_efeds 0.0 MB Coverage MOC (order 7) of the eROSITA eFEDS field HiPS from ESASky. ESASky HiPS (ESA); eROSITA EDR data (MPE, CC BY 4.0), cite Brunner et al. 2022
svo_decam_g 0.0 MB DECam g-band total throughput (wavelength [A], transmission) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); DECam throughputs from CTIO/DES
svo_decam_r 0.0 MB DECam r-band total throughput (wavelength [A], transmission) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); DECam throughputs from CTIO/DES
svo_decam_i 0.0 MB DECam i-band total throughput (wavelength [A], transmission) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); DECam throughputs from CTIO/DES
svo_decam_z 0.0 MB DECam z-band total throughput (wavelength [A], transmission) from the SVO Filter Profile Service. SVO Filter Profile Service (Rodrigo, Solano & Bayo 2012); DECam throughputs from CTIO/DES
smacs0723_f444w_cal_1 cutout JWST NIRCam F444W calibrated exposure 1 of the 9-point INTRAMODULEBOX dither (NRCBLONG, 837 s), 256 x 256 px cutout of SCI, ERR and VAR_RNOISE (MJy/sr) with the pipeline SIP WCS; pixels flagged DO_NOT_USE are NaN in SCI; cut from jw02736001001_02105_00001_nrcblong_cal.fits by range reads JWST ERO programme 2736 (SMACS J0723.3-7327), public via MAST (STScI); cite Pontoppidan et al. 2022 ApJL 936 L14 and acknowledge MAST/STScI
smacs0723_f444w_cal_2 cutout JWST NIRCam F444W calibrated exposure 2 of the 9-point INTRAMODULEBOX dither (NRCBLONG, 837 s), 256 x 256 px cutout of SCI, ERR and VAR_RNOISE (MJy/sr) with the pipeline SIP WCS; pixels flagged DO_NOT_USE are NaN in SCI; cut from jw02736001001_02105_00002_nrcblong_cal.fits by range reads JWST ERO programme 2736 (SMACS J0723.3-7327), public via MAST (STScI); cite Pontoppidan et al. 2022 ApJL 936 L14 and acknowledge MAST/STScI
smacs0723_f444w_cal_3 cutout JWST NIRCam F444W calibrated exposure 3 of the 9-point INTRAMODULEBOX dither (NRCBLONG, 837 s), 256 x 256 px cutout of SCI, ERR and VAR_RNOISE (MJy/sr) with the pipeline SIP WCS; pixels flagged DO_NOT_USE are NaN in SCI; cut from jw02736001001_02105_00003_nrcblong_cal.fits by range reads JWST ERO programme 2736 (SMACS J0723.3-7327), public via MAST (STScI); cite Pontoppidan et al. 2022 ApJL 936 L14 and acknowledge MAST/STScI
smacs0723_f444w_cal_4 cutout JWST NIRCam F444W calibrated exposure 4 of the 9-point INTRAMODULEBOX dither (NRCBLONG, 837 s), 256 x 256 px cutout of SCI, ERR and VAR_RNOISE (MJy/sr) with the pipeline SIP WCS; pixels flagged DO_NOT_USE are NaN in SCI; cut from jw02736001001_02105_00004_nrcblong_cal.fits by range reads JWST ERO programme 2736 (SMACS J0723.3-7327), public via MAST (STScI); cite Pontoppidan et al. 2022 ApJL 936 L14 and acknowledge MAST/STScI
smacs0723_f444w_i2d cutout JWST NIRCam F444W level-3 pipeline mosaic of all 9 dithers and both modules (drizzle, 0.063 arcsec/px), 280 x 280 px cutout of SCI; cut from jw02736-o001_t001_nircam_clear-f444w_i2d.fits by range reads JWST ERO programme 2736 (SMACS J0723.3-7327), public via MAST (STScI); cite Pontoppidan et al. 2022 ApJL 936 L14 and acknowledge MAST/STScI
pixi run fetch-example-samples                  # all small samples
pixi run fetch-example-samples -- --with-large  # also the opt-in ones

Applications and evaluation

Harness notebooks run from the harness checkout against a separately installed torchsky build; see its methodology page for subject selection and environment pinning.