Skills

Astropy

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

Install

npx skills add K-Dense-AI/scientific-agent-skills --skill astropy -g -a claude-code -y
Category
Testing
Updated
9d ago
License
BSD-3-Clause license
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

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.

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.

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

Read the whole SKILL.md on GitHub

More in Testing