Comprehensive Python library for astronomy and astrophysics.

BSD-3-ClauseAuto-check passedResearch & Science

Install Astropy

skills CLI
$ npx skills add zLanqing/codex-claude-academic-skills --skill astropy -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install zLanqing/codex-claude-academic-skills astropy --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/zLanqing/codex-claude-academic-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/scientific-toolkit-skill/references/scientific-skills/astropy .claude/skills/astropy && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
astropy
GitHub stars
4.6k
Used in
14 other repos
Token cost
~2.9k tokens
SKILL.md length
917 words
Files
8 (incl. references)
Skills in repo
17
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Comprehensive Python library for astronomy and astrophysics.

  • Works in 7 steps: Units and Quantities (astropy.units) → Coordinate Systems (astropy.coordinates) → Cosmological Calculations… → …
  • Tasks involve coordinate transformations
  • SKILL.md covers Overview, When to Use This Skill, Quick Start and Core Capabilities, plus 6 more sections
  • Calls uv

What it does

Astropy is an agent skill from zLanqing/codex-claude-academic-skills. Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files (for example `references/coordinates.md`, `references/cosmology.md` and `references/fits.md`).

It sits in Research & Science, covering Physical and earth sciences. It works with Python. The repository describes itself as: 本仓库包含三个面向学术科研人员的Skills,覆盖从文献阅读、论文写作到科学计算的完整研究工作流。office-academic-skill 负责论文阅读报告与学术 PPT/Word 文档生成;research-writing-skill 提供论文写作、润色与审稿回复辅助;scientific-toolkit-skill 整合 MATLAB/Python… The licence is BSD-3-Clause.

When your agent uses it

  • Tasks involve coordinate transformations
  • Unit conversions
  • FITS file manipulation
  • Cosmological distance calculations

Example prompts

  • “/astropy”

Requirements

  • Python 3

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Units and Quantities (astropy.units)
  2. Coordinate Systems (astropy.coordinates)
  3. Cosmological Calculations (astropy.cosmology)
  4. FITS File Handling (astropy.io.fits)
  5. Table Operations (astropy.table)
  6. Time Handling (astropy.time)
  7. World Coordinate System (astropy.wcs)

What it can do on your machine

Read from SKILL.md and the folder at commit 7ed6377. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.astropy.org
    • learn.astropy.org
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Astropy loads about 2.9k tokens when it runs, and up to ~16k if it reads all its reference files. Until then it costs about 123 tokens; SKILL.md has 917 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~123
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~16k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from zLanqing/codex-claude-academic-skills at commit 7ed6377, republished under its BSD-3-Clause licence (© zLanqing). 917 words, ~2,884 tokens.

Download SKILL.mdSave it as .claude/skills/astropy/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
astropy
description
Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.
license
BSD-3-Clause license
metadata.skill-author
K-Dense Inc.

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

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')
jd = t.jd  # Julian Date

# FITS files
data = fits.getdata('image.fits')
header = fits.getheader('image.fits')

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

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

Core Capabilities

1. Units and Quantities (astropy.units)

Handle physical quantities with units, perform unit conversions, and ensure dimensional consistency in calculations.

Key operations:

  • Create quantities by multiplying values with units
  • Convert between units using .to() method
  • Perform arithmetic with automatic unit handling
  • Use equivalencies for domain-specific conversions (spectral, doppler, parallax)
  • Work with logarithmic units (magnitudes, decibels)

See: references/units.md for comprehensive documentation, unit systems, equivalencies, performance optimization, and unit arithmetic.

2. Coordinate Systems (astropy.coordinates)

Represent celestial positions and transform between different coordinate frames.

Key operations:

  • Create coordinates with SkyCoord in any frame (ICRS, Galactic, FK5, AltAz, etc.)
  • Transform between coordinate systems
  • Calculate angular separations and position angles
  • Match coordinates to catalogs
  • Include distance for 3D coordinate operations
  • Handle proper motions and radial velocities
  • Query named objects from online databases

See: references/coordinates.md for detailed coordinate frame descriptions, transformations, observer-dependent frames (AltAz), catalog matching, and performance tips.

3. Cosmological Calculations (astropy.cosmology)

Perform cosmological calculations using standard cosmological models.

Key operations:

  • Use built-in cosmologies (Planck18, WMAP9, etc.)
  • Create custom cosmological models
  • Calculate distances (luminosity, comoving, angular diameter)
  • Compute ages and lookback times
  • Determine Hubble parameter at any redshift
  • Calculate density parameters and volumes
  • Perform inverse calculations (find z for given distance)

See: references/cosmology.md for available models, distance calculations, time calculations, density parameters, and neutrino effects.

4. FITS File Handling (astropy.io.fits)

Read, write, and manipulate FITS (Flexible Image Transport System) files.

Key operations:

  • Open FITS files with context managers
  • Access HDUs (Header Data Units) by index or name
  • Read and modify headers (keywords, comments, history)
  • Work with image data (NumPy arrays)
  • Handle table data (binary and ASCII tables)
  • Create new FITS files (single or multi-extension)
  • Use memory mapping for large files
  • Access remote FITS files (S3, HTTP)

See: references/fits.md for comprehensive file operations, header manipulation, image and table handling, multi-extension files, and performance considerations.

5. Table Operations (astropy.table)

Work with tabular data with support for units, metadata, and various file formats.

Key operations:

  • Create tables from arrays, lists, or dictionaries
  • Read/write tables in multiple formats (FITS, CSV, HDF5, VOTable)
  • Access and modify columns and rows
  • Sort, filter, and index tables
  • Perform database-style operations (join, group, aggregate)
  • Stack and concatenate tables
  • Work with unit-aware columns (QTable)
  • Handle missing data with masking

See: references/tables.md for table creation, I/O operations, data manipulation, sorting, filtering, joins, grouping, and performance tips.

6. Time Handling (astropy.time)

Precise time representation and conversion between time scales and formats.

Key operations:

  • Create Time objects in various formats (ISO, JD, MJD, Unix, etc.)
  • Convert between time scales (UTC, TAI, TT, TDB, etc.)
  • Perform time arithmetic with TimeDelta
  • Calculate sidereal time for observers
  • Compute light travel time corrections (barycentric, heliocentric)
  • Work with time arrays efficiently
  • Handle masked (missing) times

See: references/time.md for time formats, time scales, conversions, arithmetic, observing features, and precision handling.

Show full SKILL.md (330 more words)Show less
7. World Coordinate System (astropy.wcs)

Transform between pixel coordinates in images and world coordinates.

Key operations:

  • Read WCS from FITS headers
  • Convert pixel coordinates to world coordinates (and vice versa)
  • Calculate image footprints
  • Access WCS parameters (reference pixel, projection, scale)
  • Create custom WCS objects

See: references/wcs_and_other_modules.md for WCS operations and transformations.

Additional Capabilities

The references/wcs_and_other_modules.md file also covers:

NDData and CCDData

Containers for n-dimensional datasets with metadata, uncertainty, masking, and WCS information.

Modeling

Framework for creating and fitting mathematical models to astronomical data.

Visualization

Tools for astronomical image display with appropriate stretching and scaling.

Constants

Physical and astronomical constants with proper units (speed of light, solar mass, Planck constant, etc.).

Convolution

Image processing kernels for smoothing and filtering.

Statistics

Robust statistical functions including sigma clipping and outlier rejection.

Installation

bash
# Install astropy
uv pip install astropy

# With optional dependencies for full functionality
uv pip install astropy[all]

Common Workflows

Converting Coordinates Between Systems
python
from astropy.coordinates import SkyCoord
import astropy.units as u

# Create coordinate
c = SkyCoord(ra='05h23m34.5s', dec='-69d45m22s', frame='icrs')

# Transform to galactic
c_gal = c.galactic
print(f"l={c_gal.l.deg}, b={c_gal.b.deg}")

# Transform to alt-az (requires time and location)
from astropy.time import Time
from astropy.coordinates import EarthLocation, AltAz

observing_time = Time('2023-06-15 23:00:00')
observing_location = EarthLocation(lat=40*u.deg, lon=-120*u.deg)
aa_frame = AltAz(obstime=observing_time, location=observing_location)
c_altaz = c.transform_to(aa_frame)
print(f"Alt={c_altaz.alt.deg}, Az={c_altaz.az.deg}")
Reading and Analyzing FITS Files
python
from astropy.io import fits
import numpy as np

# Open FITS file
with fits.open('observation.fits') as hdul:
    # Display structure
    hdul.info()

    # Get image data and header
    data = hdul[1].data
    header = hdul[1].header

    # Access header values
    exptime = header['EXPTIME']
    filter_name = header['FILTER']

    # Analyze data
    mean = np.mean(data)
    median = np.median(data)
    print(f"Mean: {mean}, Median: {median}")
Cosmological Distance Calculations
python
from astropy.cosmology import Planck18
import astropy.units as u
import numpy as np

# Calculate distances at z=1.5
z = 1.5
d_L = Planck18.luminosity_distance(z)
d_A = Planck18.angular_diameter_distance(z)

print(f"Luminosity distance: {d_L}")
print(f"Angular diameter distance: {d_A}")

# Age of universe at that redshift
age = Planck18.age(z)
print(f"Age at z={z}: {age.to(u.Gyr)}")

# Lookback time
t_lookback = Planck18.lookback_time(z)
print(f"Lookback time: {t_lookback.to(u.Gyr)}")
Cross-Matching Catalogs
python
from astropy.table import Table
from astropy.coordinates import SkyCoord, match_coordinates_sky
import astropy.units as u

# Read catalogs
cat1 = Table.read('catalog1.fits')
cat2 = Table.read('catalog2.fits')

# Create coordinate objects
coords1 = SkyCoord(ra=cat1['RA']*u.degree, dec=cat1['DEC']*u.degree)
coords2 = SkyCoord(ra=cat2['RA']*u.degree, dec=cat2['DEC']*u.degree)

# Find matches
idx, sep, _ = coords1.match_to_catalog_sky(coords2)

# Filter by separation threshold
max_sep = 1 * u.arcsec
matches = sep < max_sep

# Create matched catalogs
cat1_matched = cat1[matches]
cat2_matched = cat2[idx[matches]]
print(f"Found {len(cat1_matched)} matches")

Best Practices

  1. Always use units: Attach units to quantities to avoid errors and ensure dimensional consistency
  2. Use context managers for FITS files: Ensures proper file closing
  3. Prefer arrays over loops: Process multiple coordinates/times as arrays for better performance
  4. Check coordinate frames: Verify the frame before transformations
  5. Use appropriate cosmology: Choose the right cosmological model for your analysis
  6. Handle missing data: Use masked columns for tables with missing values
  7. Specify time scales: Be explicit about time scales (UTC, TT, TDB) for precise timing
  8. Use QTable for unit-aware tables: When table columns have units
  9. Check WCS validity: Verify WCS before using transformations
  10. Cache frequently used values: Expensive calculations (e.g., cosmological distances) can be cached

Documentation and Resources

Reference Files

For detailed information on specific modules:

  • references/units.md - Units, quantities, conversions, and equivalencies
  • references/coordinates.md - Coordinate systems, transformations, and catalog matching
  • references/cosmology.md - Cosmological models and calculations
  • references/fits.md - FITS file operations and manipulation
  • references/tables.md - Table creation, I/O, and operations
  • references/time.md - Time formats, scales, and calculations
  • references/wcs_and_other_modules.md - WCS, NDData, modeling, visualization, constants, and utilities

© zLanqing, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (references) in scientific-toolkit-skill/references/scientific-skills/astropy of zLanqing/codex-claude-academic-skills.

  • SKILL.md
  • references/coordinates.md
  • references/cosmology.md
  • references/fits.md
  • references/tables.md
  • references/time.md
  • references/units.md
  • references/wcs_and_other_modules.md

Open the folder on GitHubat commit 7ed6377

Used in 14 other repositories

We found 30 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 14 other GitHub owners. This page covers the copy in zLanqing/codex-claude-academic-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Astropy next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Astropy compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Astropy this skillzLanqing/codex-claude-academic-skills4.6k14 repos~2.9kAutomated safety check: PassBSD-3-Clause
Cantera Ignition DelayK-Dense-AI/scientific-agent-skills48k1 repos~2.2kAutomated safety check: PassMIT
Climate DsHongjian01/ClimWorkflow102—~1.2kAutomated safety check: PassCustom licence
Chemgraphargonne-lcf/ChemGraph162—~743Automated safety check: PassApache-2.0
FluidSim CFD Simulationsdavila7/claude-code-templates32k10 repos~2.3kAutomated safety check: PassMIT
DP-GEN Simplify Workflowjinzhezenggroup/computational-chemistry-agent-skills148—~2.7kAutomated safety check: PassLGPL-3.0-or-later

Similar skills

  • Cantera Ignition Delay

    K-Dense-AI/scientific-agent-skills

    Runs Cantera constant-volume or constant-pressure ignition simulations and reports temperature-based ignition delay with mechanism provenance and checks.

    48k GitHub starsUsed in 1 repo~2.2k tokens
    Research & ScienceAuto-check passed
  • Climate Ds

    Hongjian01/ClimWorkflow

    ClimWorkflow climate-data workflow: map a natural-language climate goal to Plan-Agent / Data-Agent / Coding-Agent roles, then call the 7-tool DAG (optional read-only validate after report).

    102 GitHub stars~1.2k tokensUpdated 19 days ago
    Research & ScienceAuto-check passed
  • Chemgraph

    argonne-lcf/ChemGraph

    Use ChemGraph Python and CLI workflows, agent-written batch scripts, and attached chemistry MCP tools.

    162 GitHub stars~743 tokensUpdated 2 days ago
    Research & ScienceAuto-check passed
  • FluidSim CFD Simulations

    davila7/claude-code-templates

    Runs computational fluid dynamics simulations with the FluidSim Python framework: 2D and 3D Navier-Stokes, shallow water and stratified flow solvers plus output analysis.

    32k GitHub starsUsed in 10 repos~2.3k tokens
    Research & ScienceAuto-check passed
  • DP-GEN Simplify Workflow

    jinzhezenggroup/computational-chemistry-agent-skills

    Prepares, validates and runs DP-GEN simplify jobs that thin out repeated or redundant DeepMD datasets, generating param.json and machine.json for local or scheduler runs.

    148 GitHub stars~2.7k tokensUpdated 2 days ago
    Research & ScienceAuto-check passed
  • Rowan

    K-Dense-AI/scientific-agent-skills

    Rowan is a cloud-native molecular modeling and medicinal-chemistry workflow platform with a Python API.

    48k GitHub starsUsed in 3 repos~4.3k tokens
    Research & ScienceAuto-check passed

More from zLanqing/codex-claude-academic-skills

All 17 skills in this repo
  • Matplotlib

    zLanqing/codex-claude-academic-skills

    Low-level plotting library for full customization. An agent skill from zLanqing/codex-claude-academic-skills.

    4.6k GitHub starsUsed in 17 repos~2.9k tokens
    Auto-check passed
  • Scikit Learn

    zLanqing/codex-claude-academic-skills

    Machine learning in Python with scikit-learn. An agent skill from zLanqing/codex-claude-academic-skills.

    4.6k GitHub starsUsed in 17 repos~3.9k tokens
    Auto-check passed
  • Simpy

    zLanqing/codex-claude-academic-skills

    Process-based discrete-event simulation framework in Python.

    4.6k GitHub starsUsed in 11 repos~3k tokens
    Auto-check passed
  • Networkx

    zLanqing/codex-claude-academic-skills

    Comprehensive toolkit for creating, analyzing, and visualizing complex networks and graphs in Python.

    4.6k GitHub starsUsed in 16 repos~3.2k tokens
    Auto-check passed
  • Seaborn

    zLanqing/codex-claude-academic-skills

    Statistical visualization with pandas integration. An agent skill from zLanqing/codex-claude-academic-skills.

    4.6k GitHub starsUsed in 16 repos~4.9k tokens
    Auto-check passed
  • Timesfm Forecasting

    zLanqing/codex-claude-academic-skills

    Zero-shot time series forecasting with Google's TimesFM foundation model.

    4.6k GitHub starsUsed in 6 repos~7.5k tokens
    Auto-check: notes

Works with

Questions about Astropy

What does Astropy do?

Comprehensive Python library for astronomy and astrophysics. Astropy is an agent skill from zLanqing/codex-claude-academic-skills. Comprehensive Python library for astronomy and astrophysics.

When should I use Astropy?

Astropy fits situations like: tasks involve coordinate transformations; unit conversions; FITS file manipulation; cosmological distance calculations.

How do I install Astropy in Claude Code?

Run `npx skills add zLanqing/codex-claude-academic-skills --skill astropy -a claude-code`. Or copy the skill folder (scientific-toolkit-skill/references/scientific-skills/astropy in zLanqing/codex-claude-academic-skills) into .claude/skills/astropy in your project. Claude Code loads it when a task matches its description.

How do I install Astropy in Codex?

Run `npx skills add zLanqing/codex-claude-academic-skills --skill astropy -a codex`. Or copy the skill folder (scientific-toolkit-skill/references/scientific-skills/astropy in zLanqing/codex-claude-academic-skills) into .agents/skills/astropy in your project. Codex loads it when a task matches its description.

Can I use Astropy in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zLanqing/codex-claude-academic-skills --skill astropy -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/astropy, .gemini/skills/astropy, .github/skills/astropy and .opencode/skills/astropy in your project.

What does Astropy need to run?

Going by SKILL.md and its folder, Astropy needs the command-line tools its instructions call (uv). Our summary lists: Python 3.

Does Astropy access the network?

SKILL.md names 3 domains. As links in the text: docs.astropy.org, learn.astropy.org and github.com. This is read from the text; nothing was executed.

Is Astropy safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Astropy use?

Astropy is published under the BSD-3-Clause licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Astropy use?

About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 13k tokens, read only when the agent opens those files.

What are the alternatives to Astropy?

Skills that share tags, products or a category with Astropy: Cantera Ignition Delay (K-Dense-AI/scientific-agent-skills, 48k stars), Climate Ds (Hongjian01/ClimWorkflow, 102 stars), Chemgraph (argonne-lcf/ChemGraph, 162 stars) and FluidSim CFD Simulations (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Astropy?

zLanqing (a GitHub user) maintains it in zLanqing/codex-claude-academic-skills, which has 4,578 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on May 14, 2026.

Source: zLanqing/codex-claude-academic-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.