# Astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs...

- Repository: https://github.com/K-Dense-AI/scientific-agent-skills (55651 stars)
- Category: Testing
- License: BSD-3-Clause license
- Last updated: 2026-10-26
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add K-Dense-AI/scientific-agent-skills --skill astropy -g -a claude-code -y`
Codex: `npx skills add K-Dense-AI/scientific-agent-skills --skill astropy -g -a codex -y`
Cursor: `npx skills add K-Dense-AI/scientific-agent-skills --skill astropy -g -a cursor -y`
Gemini CLI: `npx skills add K-Dense-AI/scientific-agent-skills --skill astropy -g -a gemini-cli -y`

## Description

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Astropy

## Overview

Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis. Use astropy for coordinate transformations, unit and quantity calculations, FITS file operations, cosmological calculations, precise time handling, tabular data manipulation, and astronomical image processing.

## When to Use This Skill

Use astropy when tasks involve:
- Converting between celestial coordinate systems (ICRS, Galactic, FK5, AltAz, etc.)
- Working with physical units and quantities (converting Jy to mJy, parsecs to km, etc.)
- Reading, writing, or manipulating FITS files (images or tables)
- Cosmological calculations (luminosity distance, lookback time, Hubble parameter)
- Precise time handling with different time scales (UTC, TAI, TT, TDB) and formats (JD, MJD, ISO)
- Table operations (reading catalogs, cross-matching, filtering, joining)
- WCS transformations between pixel and world coordinates
- Astronomical constants and calculations

## Quick Start

Targets Astropy 8.0.1. Numerical and small synthetic file examples were executed;
blocks using observation/catalog filenames, online services or a GUI are illustrative
and require those inputs. See [review evidence and sources](references/review.md).

```python
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
from astropy.io import fits
from astropy.table import Table
from astropy.cosmology import Planck18

# Units and quantities
distance = 100 * u.pc
distance_km = distance.to(u.km)

# Coordinates
coord = SkyCoord(ra=10.5*u.degree, dec=41.2*u.degree, frame='icrs')
coord_galactic = coord.galactic

# Time
t = Time('2023-01-15 12:30:00', scale='utc')
jd = t.jd  # Julian Date

# FITS files
data, header = fits.getdata('image.fits', ext=0, header=True)  # Select actual image HDU

# Tables
table = Table.read('catalog.fits')

# Cosmology
d_L = Planck18.luminosity_distance(1.0)
```

## Core Capabilities

The rest: https://github.com/K-Dense-AI/scientific-agent-skills/blob/HEAD/skills/astropy/SKILL.md
