Work with astronomical data using Astropy for FITS file I/O, coordinate transformations, physical units, precise time handling, and catalog operations. Use when processing telescope images, matching celestial catalogs, handling time-series observations, or building photometry/spectroscopy pipelines. Ideal for astronomy research requiring proper unit handling, coordinate frame transformations, and astronomical time scales.
View on GitHubuw-ssec/rse-plugins
scientific-domain-applications
plugins/scientific-domain-applications/skills/astropy-fundamentals/SKILL.md
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/uw-ssec/rse-plugins/blob/main/plugins/scientific-domain-applications/skills/astropy-fundamentals/SKILL.md -a claude-code --skill astropy-fundamentalsInstallation paths:
.claude/skills/astropy-fundamentals/# Astropy Fundamentals
Master **Astropy**, the foundational Python library for astronomy and astrophysics. Learn to work with astronomical data formats, coordinate systems, physical units, precise time calculations, and scientific tables - the essential toolkit for modern astronomical computing.
**Official Documentation**: https://docs.astropy.org/en/stable/
**GitHub**: https://github.com/astropy/astropy
## Quick Reference Card
### Installation & Setup
```bash
# Using pixi (recommended for scientific projects)
pixi add astropy photutils specutils
# Using pip
pip install astropy[all]
# Optional affiliated packages
pixi add photutils specutils astroquery reproject
```
### Essential Operations
```python
import astropy.units as u
from astropy.io import fits
from astropy.coordinates import SkyCoord
from astropy.time import Time
from astropy.table import Table, QTable
from astropy.wcs import WCS
# Units and Quantities
distance = 10 * u.parsec
wavelength = 5000 * u.angstrom
freq = wavelength.to(u.Hz, equivalencies=u.spectral())
# FITS I/O
with fits.open('image.fits') as hdul:
data = hdul[0].data
header = hdul[0].header
# Coordinates
coord = SkyCoord(ra=10.625*u.degree, dec=41.2*u.degree, frame='icrs')
galactic = coord.galactic
separation = coord.separation(other_coord)
# Time
t = Time('2024-01-01T00:00:00', format='isot', scale='utc')
jd = t.jd
future = t + 1*u.day
# Tables
tbl = Table([ra_col, dec_col, flux_col], names=['ra', 'dec', 'flux'])
filtered = tbl[tbl['flux'] > 100]
# WCS
wcs = WCS(header)
ra, dec = wcs.pixel_to_world(x_pix, y_pix)
```
### Quick Decision Tree
```
Working with astronomical data?
├─ FITS files → astropy.io.fits
├─ Celestial coordinates → astropy.coordinates (SkyCoord)
├─ Physical quantities → astropy.units
├─ Astronomical time → astropy.time
├─ Catalogs/tables → astropy.table
├─ Image coordinates → astropy.wcs
├─ Photometry → photutils
└─ Spectroscopy → specutils
Need coordinate transformation?
├─ Simple conversions → SkyCo