Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
beita6969 avatar

Astropy Astronomy

  • 17 installs
  • 869 repo stars
  • Updated June 8, 2026
  • beita6969/scienceclaw

astropy-astronomy is a Claude skill that performs astronomical computations using the Astropy Python library, including coordinate transforms, FITS handling, and cosmology.

About

Performs astronomical computations with the Astropy Python library: celestial coordinate transforms, unit conversions, FITS file I/O, cosmological distances, and time-system conversions. A developer uses it when they need concrete Astropy code for coordinate work, reading FITS data, or computing luminosity/angular-diameter distances. It defaults to Planck18 cosmology and attaching units to all quantities.

  • Astronomical computations via the Astropy Python library
  • Covers coordinate transforms, FITS files, cosmology, and time-system conversions
  • Includes runnable Python and a one-liner for galactic coordinate conversion

Astropy Astronomy by the numbers

  • 17 all-time installs (skills.sh)
  • Ranked #190 of 290 Python skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
At a glance

astropy-astronomy capabilities & compatibility

Capabilities
astronomy cosmology · biopython · biopython bio
Use cases
research · data analysis
Pricing
Free
From the docs

What astropy-astronomy says it does

Astronomical computations using Astropy.
SKILL.md
Use `Planck18` as default cosmology unless otherwise specified.
SKILL.md
Always attach units to quantities using `astropy.units`.
SKILL.md
npx skills add https://github.com/beita6969/scienceclaw --skill astropy-astronomy

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs17
repo stars869
Last updatedJune 8, 2026
Repositorybeita6969/scienceclaw

What it does

Compute celestial coordinates, read FITS files, and calculate cosmological distances using Astropy in Python.

Who is it for?

Developers who need Astropy code for celestial coordinates, FITS files, or cosmological calculations.

Skip if: Telescope control, observation planning, image reduction/photometry (use photutils), or N-body simulations.

When should I use this skill?

The user asks about celestial coordinates, FITS files, or cosmological calculations.

What you get

Correct Astropy-based transforms, FITS reads/writes, and cosmological distances with units attached.

  • Coordinate transforms
  • FITS file reads/writes
  • Cosmological distances and time conversions

By the numbers

  • 5 best-practice rules
  • covers 5 computation areas (coordinates, units, FITS, cosmology, time)

Files

SKILL.mdMarkdownGitHub ↗

Astropy Astronomy

Astronomical computations using Astropy.

When to Use

  • Celestial coordinate transforms (ICRS, Galactic, AltAz)
  • Unit conversions for astronomical quantities
  • Reading, writing, or inspecting FITS files
  • Cosmological calculations (distances, ages, lookback times)
  • Time system conversions (UTC, TAI, TDB, MJD, JD)

When NOT to Use

  • Telescope control or instrument automation
  • Real-time observation planning or scheduling
  • Image reduction or photometry pipelines (use photutils)
  • N-body simulations

Coordinate Transforms

from astropy.coordinates import SkyCoord, EarthLocation, AltAz
from astropy.time import Time
import astropy.units as u

coord = SkyCoord(ra=10.684*u.deg, dec=41.269*u.deg, frame='icrs')  # M31
coord_str = SkyCoord('00h42m44.3s', '+41d16m09s', frame='icrs')

# ICRS to Galactic
galactic = coord.galactic
print(f"l={galactic.l:.4f}, b={galactic.b:.4f}")

# Angular separation
c1 = SkyCoord(ra=10.684*u.deg, dec=41.269*u.deg)
c2 = SkyCoord(ra=11.0*u.deg, dec=41.5*u.deg)
sep = c1.separation(c2)

# AltAz (horizontal) coordinates
location = EarthLocation(lat=34.05*u.deg, lon=-118.25*u.deg, height=100*u.m)
time = Time('2026-03-15 03:00:00', scale='utc')
altaz = coord.transform_to(AltAz(obstime=time, location=location))
print(f"Alt={altaz.alt:.2f}, Az={altaz.az:.2f}")

Unit Conversions

import astropy.units as u

d = 10 * u.pc
print(d.to(u.lyr))         # parsecs to light-years
wav = 21 * u.cm
freq = wav.to(u.GHz, equivalencies=u.spectral())
wavelength = (13.6 * u.eV).to(u.nm, equivalencies=u.spectral())

FITS File Handling

from astropy.io import fits

with fits.open('image.fits') as hdul:
    hdul.info()
    header = hdul[0].header
    data = hdul[0].data

hdu = fits.PrimaryHDU(data_array)
hdu.header['OBJECT'] = 'M31'
hdu.writeto('output.fits', overwrite=True)

Cosmological Calculations

from astropy.cosmology import Planck18 as cosmo

z = 1.0
d_L = cosmo.luminosity_distance(z)       # luminosity distance
d_A = cosmo.angular_diameter_distance(z) # angular diameter distance
age = cosmo.age(z)                       # age of universe at z
lookback = cosmo.lookback_time(z)        # lookback time
H_z = cosmo.H(z)                        # Hubble parameter at z

Time Conversions

from astropy.time import Time
import astropy.units as u

t = Time('2026-03-15 12:00:00', scale='utc')
print(t.jd, t.mjd, t.unix)   # JD, MJD, Unix
print(t.tai, t.tdb)           # TAI, TDB scales
now = Time.now()

Quick One-liner

python3 -c "
from astropy.coordinates import SkyCoord; import astropy.units as u
c = SkyCoord(ra=83.633*u.deg, dec=22.014*u.deg)
print(f'Galactic: l={c.galactic.l:.3f}, b={c.galactic.b:.3f}')
"

Best Practices

1. Always attach units to quantities using astropy.units. 2. Specify time scale explicitly (utc, tai, tdb). 3. Use Planck18 as default cosmology unless otherwise specified. 4. Close FITS files or use context managers to prevent resource leaks. 5. Use SkyCoord for all coordinate work rather than manual trig.

Related skills

FAQ

What cosmology does it default to?

It defaults to Planck18 unless otherwise specified.

When should I not use it?

Not for telescope control, real-time observation planning, image reduction/photometry, or N-body simulations.

Pythonresearch

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.