astropy-astronomy

Astronomical computations via Astropy. Use when: user asks about celestial coordinates, FITS files, or cosmological calculations. NOT for: telescope control or real-time observation planning.

564 stars

Best use case

astropy-astronomy is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Astronomical computations via Astropy. Use when: user asks about celestial coordinates, FITS files, or cosmological calculations. NOT for: telescope control or real-time observation planning.

Teams using astropy-astronomy should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/astropy-astronomy/SKILL.md --create-dirs "https://raw.githubusercontent.com/beita6969/ScienceClaw/main/skills/astropy-astronomy/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/astropy-astronomy/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How astropy-astronomy Compares

Feature / Agentastropy-astronomyStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Astronomical computations via Astropy. Use when: user asks about celestial coordinates, FITS files, or cosmological calculations. NOT for: telescope control or real-time observation planning.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

```python
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

```python
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

```python
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

```python
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

```python
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

```bash
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

astronomy-cosmology

564
from beita6969/ScienceClaw

Analyzes astronomical observations and cosmological models including telescope data processing, celestial mechanics calculations, stellar evolution, galaxy classification, and cosmological parameter estimation; trigger when users discuss stars, galaxies, exoplanets, dark matter, or the universe's large-scale structure.

xurl

564
from beita6969/ScienceClaw

A CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.

xlsx

564
from beita6969/ScienceClaw

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

writing

564
from beita6969/ScienceClaw

No description provided.

world-bank-data

564
from beita6969/ScienceClaw

World Bank Open Data API for development indicators. Use when: user asks about GDP, population, poverty, health, or education statistics by country. NOT for: real-time financial data or stock prices.

wikipedia-search

564
from beita6969/ScienceClaw

Search and fetch structured content from Wikipedia using the MediaWiki API for reliable, encyclopedic information

wikidata-knowledge

564
from beita6969/ScienceClaw

Query Wikidata for structured knowledge using SPARQL and entity search. Use when: (1) finding structured facts about entities (people, places, organizations), (2) querying relationships between entities, (3) cross-referencing external identifiers (Wikipedia, VIAF, GND, ORCID), (4) building knowledge graphs from linked data. NOT for: full-text article content (use Wikipedia API), scientific literature (use semantic-scholar), geospatial data (use OpenStreetMap).

weather

564
from beita6969/ScienceClaw

Get current weather and forecasts via wttr.in or Open-Meteo. Use when: user asks about weather, temperature, or forecasts for any location. NOT for: historical weather data, severe weather alerts, or detailed meteorological analysis. No API key needed.

wacli

564
from beita6969/ScienceClaw

Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).

voice-call

564
from beita6969/ScienceClaw

Start voice calls via the OpenClaw voice-call plugin.

visualization

564
from beita6969/ScienceClaw

Create publication-quality scientific figures and plots using Python (matplotlib, seaborn, plotly). Supports bar charts, scatter plots, heatmaps, box plots, violin plots, survival curves, network graphs, and more. Use when user asks to plot data, create figures, make charts, visualize results, or generate publication-ready graphics. Triggers on "plot", "chart", "figure", "graph", "visualize", "heatmap", "scatter plot", "bar chart", "histogram".

video-frames

564
from beita6969/ScienceClaw

Extract frames or short clips from videos using ffmpeg.