SuperAPI AI 工具集

astropy-astronomy

通用与其它

查看项目

更新于 10-15 20:06

技能介绍

用途:该技能面向天文计算任务,覆盖天球坐标转换(ICRS、Galactic、AltAz)、天文量单位换算、FITS 文件读写与检查、宇宙学计算(距离、年龄、回溯时间)以及时间系统转换(UTC、TAI、TDB、MJD、JD)。

主要能力:使用 SkyCoord 表示和转换坐标,可计算角距;用 EarthLocation 与 Time 生成 AltAz 地平坐标;用 astropy.units 做单位换算,并支持光谱等价关系;用 astropy.io.fits 打开、检查、写入 FITS 文件;用 astropy.cosmology 的 Planck18 计算光度距离、角直径距离、宇宙年龄、回溯时间和哈勃参数;用 astropy.time 输出 JD、MJD、Unix 时间及 TAI、TDB 尺度。

使用方式:在 Python 中导入相应模块,例如 from astropy.coordinates import SkyCoord, EarthLocation, AltAz、from astropy.time import Time、import astropy.units as u、from astropy.io import fits、from astropy.cosmology import Planck18 as cosmo。坐标转换示例:coord = SkyCoord(ra=10.684u.deg, dec=41.269u.deg, frame='icrs'),再取 coord.galactic 或 transform_to(AltAz(obstime=time, location=location))。单位换算示例:d = 10 * u.pc,d.to(u.lyr);光谱换算需传 equivalencies=u.spectral()。FITS 用 with fits.open('image.fits') as hdul 读取,用 fits.PrimaryHDU 与 writeto 写出。宇宙学示例:cosmo.luminosity_distance(z)、cosmo.age(z)、cosmo.lookback_time(z)、cosmo.H(z)。时间示例:t = Time('2026-03-15 12:00:00', scale='utc'),读取 t.jd、t.mjd、t.unix、t.tai、t.tdb。

适用场景:需要坐标变换、单位换算、FITS 元数据与数据检查、宇宙学量计算或时间尺度转换的天文数据处理与分析。

限制:不用于望远镜控制或仪器自动化,不用于实时观测规划与排程,不用于图像归算或测光流程(应使用 photutils),不用于 N 体模拟。建议始终为量附加单位、显式指定时间尺度、默认使用 Planck18 宇宙学,并用上下文管理器关闭 FITS 文件以避免资源泄漏。其他细节暂未提供。