跳到正文
Skillpedia
通用编程48k · #3829

astropy

它能做什么

Astropy 是一个面向天文学家的工具包,可以帮助处理天文数据。它能进行带单位的计算(比如光年)、转换恒星的坐标,还能分析太空图像。

适用场景

  • ✓换算距离单位(例如把光年换算成千米)。
  • ✓把恒星的位置从一种坐标系转换到另一种坐标系。
  • ✓读取望远镜图像文件(FITS 文件)中的信息。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/astropy/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/astropy/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请把 100 光年换算成千米,并告诉我一颗恒星的银河坐标,它的 ICRS 坐标是:RA=10.5 度,Dec=41.2 度。”

每周 5 个新技能,1 分钟读完。

工作原理

在内部,Astropy 使用程序代码来理解和处理天文数据。它内置了现成的函数,可以处理单位、天球位置,以及天文学中常见的文件格式。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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

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

…

常见问题

什么是 FITS 文件?

FITS 文件是一种常见的格式,用于存储科学数据,尤其是望远镜拍摄的图像和表格。

什么是天球坐标系?

这是一种描述天体在天空中位置的方法,比如 ICRS 坐标系(类似于地球上的经纬度),或者银河坐标系(以我们的银河系为基准)。

Astropy 能帮我找到行星吗?

Astropy 主要专注于数据处理和计算。它不能直接搜索行星,但可以帮助分析已经收集到的相关数据。

详情

作者的原始描述

Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3829
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能