Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính51k · #3427

astropy

Skill này làm gì

Astropy là bộ công cụ thiết yếu cho các nhà thiên văn học làm việc với dữ liệu. Nó giúp quản lý đơn vị đo, vị trí trên bầu trời, các tệp dữ liệu thiên văn (như FITS) và tính toán về vũ trụ và thời gian.

Khi nào nên dùng

  • ✓Khi bạn cần đổi đơn vị thiên văn (ví dụ parsec sang kilômét).
  • ✓Khi bạn làm việc với vị trí của các ngôi sao và thiên hà trên bầu trời.
  • ✓Khi bạn đọc hoặc ghi các tệp dữ liệu thiên văn (FITS).

Liên kết skill

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/astropy/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/astropy/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Đổi 100 parsec sang kilômét bằng Astropy.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Astropy hoạt động bằng cách định nghĩa đại lượng cùng đơn vị của chúng (như 100 * u.pc), rồi dùng các phương thức như .to() để thực hiện chuyển đổi. Với vị trí, nó dùng các đối tượng như SkyCoord.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Targets Astropy 8.0.1. Numerical and small synthetic file examples were executed; blocks using observation/catalog filenames, online services or a GUI are illustrative and require those inputs. See review evidence and sources.

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

# FITS files
data, header = fits.getdata('image.fits', ext=0, header=True)  # Select actual image HDU

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

# Cosmology
d_L = Planck18.luminosity_distance(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)

…

Câu hỏi thường gặp

Tệp FITS là gì?

FITS (Flexible Image Transport System) là định dạng tệp phổ biến trong thiên văn học, dùng để lưu dữ liệu hình ảnh và bảng.

“Đơn vị và đại lượng” là gì?

Đây là các giá trị có kèm đơn vị đo, như “100 parsec” hoặc “5 Kelvin”. Astropy đảm bảo các phép tính với đơn vị luôn chính xác.

“Hệ tọa độ thiên văn” là gì?

Đây là cách mô tả vị trí của các vật thể trên bầu trời, như “ICRS” hoặc “Galactic”. Astropy cho phép bạn chuyển đổi giữa các hệ này.

Chi tiết

Mô tả gốc của tác giả

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

repo: K-Dense-AI/scientific-agent-skills

Độ phổ biến

Sao GitHub
51k
Vị trí xếp hạng
#3427
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự