Communitygithub.com

ComeOnOliver/skillshub

Astropy는 천문학 연구와 데이터 분석을 위한 핵심 Python 패키지로, 좌표 변환, 단위 및 수량 계산, FITS 파일 작업, 우주론 계산, 정밀 시간 처리, 테이블 데이터 조작, 천문 이미지 처리 등에 사용됩니다.

skillshub란 무엇인가요?

이 스킬은 AI 에이전트(예: Claude Code, Cursor 등)가 천문학 연구 및 데이터 분석을 위해 Astropy 라이브러리를 효과적으로 활용할 수 있도록 설계되었습니다. Astropy는 천문학 분야의 핵심 Python 패키지로, 좌표계 변환(ICRS, Galactic, AltAz 등), 물리 단위 및 수량 계산(예: Jy → mJy, parsec → km), FITS 파일 읽기/쓰기/조작, 우주론적 거리 및 시간 계산(Planck18, WMAP9 등), 정밀 시간 처리(UTC, TAI, TDB 등), 테이블 데이터 조작(카탈로그 매칭, 필터링, 조인), WCS(World Coordinate System) 변환 등 다양한 기능을 제공합니다. 이 스킬은 사용자에게 각 핵심 기능에 대한 빠른 시작 예제, 상세 사용법, 모범 사례 및 참조 파일(예: `references/units.md`, `references/coordinates.md`)을 제공하여 AI 에이전트가 복잡한 천문학 작업을 자동화하고 정확하게 수행할 수 있도록 돕습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/K-Dense-AI/claude-scientific-skills/astropy

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Astropy

개요

Astropy는 천문학 연구와 데이터 분석을 위한 핵심 Python 패키지로, 천문학 연구 및 데이터 분석에 필수적인 기능을 제공합니다. 좌표 변환, 단위 및 수량 계산, FITS 파일 작업, 우주론 계산, 정밀 시간 처리, 테이블 데이터 조작, 천문 이미지 처리 등에 Astropy를 사용하세요.

이 스킬을 사용해야 할 때

다음과 같은 작업에 Astropy를 사용하세요:

  • 천체 좌표계 변환(ICRS, Galactic, FK5, AltAz 등)
  • 물리 단위 및 수량 작업(Jy를 mJy로, 파섹을 km로 변환 등)
  • FITS 파일(이미지 또는 테이블) 읽기, 쓰기, 조작
  • 우주론 계산(광도 거리, 후방 시간, 허블 매개변수)
  • 다양한 시간 척도(UTC, TAI, TT, TDB)와 형식(JD, MJD, ISO)을 사용한 정밀 시간 처리
  • 테이블 작업(카탈로그 읽기, 교차 매칭, 필터링, 조인)
  • 픽셀 좌표와 세계 좌표 간의 WCS 변환
  • 천문 상수 및 계산

빠른 시작

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

# 단위와 수량
distance = 100 * u.pc
distance_km = distance.to(u.km)

# 좌표
coord = SkyCoord(ra=10.5*u.degree, dec=41.2*u.degree, frame='icrs')
coord_galactic = coord.galactic

# 시간
t = Time('2023-01-15 12:30:00')
jd = t.jd  # 율리우스 적일

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

# 테이블
table = Table.read('catalog.fits')

# 우주론
d_L = Planck18.luminosity_distance(z=1.0)

핵심 기능

1. 단위와 수량 (astropy.units)

물리량을 단위와 함께 처리하고, 단위 변환을 수행하며, 계산에서 차원 일관성을 보장합니다.

주요 작업:

  • 값에 단위를 곱하여 수량 생성
  • .to() 메서드를 사용하여 단위 간 변환
  • 자동 단위 처리를 통한 산술 연산 수행
  • 도메인별 변환을 위한 등가성 사용(스펙트럼, 도플러, 시차)
  • 로그 단위 작업(등급, 데시벨)

참조: 단위 시스템, 등가성, 성능 최적화 및 단위 산술에 대한 포괄적인 문서는 references/units.md를 참조하세요.

2. 좌표계 (astropy.coordinates)

천체 위치를 나타내고 서로 다른 좌표 프레임 간 변환합니다.

주요 작업:

  • 모든 프레임(ICRS, Galactic, FK5, AltAz 등)에서 SkyCoord로 좌표 생성
  • 좌표계 간 변환
  • 각분리 및 위치각 계산
  • 카탈로그에 좌표 매칭
  • 3D 좌표 연산을 위한 거리 포함
  • 고유 운동 및 시선 속도 처리
  • 온라인 데이터베이스에서 명명된 객체 쿼리

참조: 상세 좌표 프레임 설명, 변환, 관측자 종속 프레임(AltAz), 카탈로그 매칭 및 성능 팁은 references/coordinates.md를 참조하세요.

3. 우주론 계산 (astropy.cosmology)

표준 우주론 모델을 사용하여 우주론 계산을 수행합니다.

주요 작업:

  • 내장 우주론 사용(Planck18, WMAP9 등)
  • 사용자 정의 우주론 모델 생성
  • 거리 계산(광도, 공변, 각지름)
  • 나이 및 후방 시간 계산
  • 모든 적색편이에서 허블 매개변수 결정
  • 밀도 매개변수 및 부피 계산
  • 역계산 수행(주어진 거리에 대한 z 찾기)

참조: 사용 가능한 모델, 거리 계산, 시간 계산, 밀도 매개변수 및 중성미자 효과는 references/cosmology.md를 참조하세요.

4. FITS 파일 처리 (astropy.io.fits)

FITS(유연한 이미지 전송 시스템) 파일을 읽고, 쓰고, 조작합니다.

주요 작업:

  • 컨텍스트 관리자로 FITS 파일 열기
  • 인덱스 또는 이름으로 HDU(헤더 데이터 단위) 접근
  • 헤더 읽기 및 수정(키워드, 주석, 이력)
  • 이미지 데이터 작업(NumPy 배열)
  • 테이블 데이터 처리(이진 및 ASCII 테이블)
  • 새 FITS 파일 생성(단일 또는 다중 확장)
  • 대용량 파일을 위한 메모리 매핑 사용
  • 원격 FITS 파일 접근(S3, HTTP)

참조: 포괄적인 파일 작업, 헤더 조작, 이미지 및 테이블 처리, 다중 확장 파일 및 성능 고려 사항은 references/fits.md를 참조하세요.

5. 테이블 작업 (astropy.table)

단위, 메타데이터 및 다양한 파일 형식을 지원하는 테이블 형식 데이터를 다룹니다.

주요 작업:

  • 배열, 리스트 또는 사전에서 테이블 생성
  • 여러 형식(FITS, CSV, HDF5, VOTable)으로 테이블 읽기/쓰기
  • 열과 행 접근 및 수정
  • 테이블 정렬, 필터링 및 인덱싱
  • 데이터베이스 스타일 작업 수행(조인, 그룹화, 집계)
  • 테이블 쌓기 및 연결
  • 단위 인식 열 작업(QTable)
  • 마스킹으로 누락된 데이터 처리

참조: 테이블 생성, I/O 작업, 데이터 조작, 정렬, 필터링, 조인, 그룹화 및 성능 팁은 references/tables.md를 참조하세요.

6. 시간 처리 (astropy.time)

정밀한 시간 표현과 시간 척도 및 형식 간 변환을 제공합니다.

주요 작업:

  • 다양한 형식(ISO, JD, MJD, Unix 등)으로 Time 객체 생성
  • 시간 척도 간 변환(UTC, TAI, TT, TDB 등)
  • TimeDelta로 시간 산술 연산 수행
  • 관측자를 위한 항성시 계산
  • 광행차 시간 보정 계산(질량중심, 태양중심)
  • 시간 배열 효율적으로 처리
  • 마스킹된(누락된) 시간 처리

참조: 시간 형식, 시간 척도, 변환, 산술, 관측 기능 및 정밀도 처리는 references/time.md를 참조하세요.

7. 세계 좌표계 (astropy.wcs)

이미지의 픽셀 좌표와 세계 좌표 간 변환합니다.

주요 작업:

  • FITS 헤더에서 WCS 읽기
  • 픽셀 좌표를 세계 좌표로 변환(및 역변환)
  • 이미지 풋프린트 계산
  • WCS 매개변수 접근(기준 픽셀, 투영, 축척)
  • 사용자 정의 WCS 객체 생성

참조: WCS 작업 및 변환에 대한 자세한 내용은 references/wcs_and_other_modules.md를 참조하세요.

추가 기능

references/wcs_and_other_modules.md 파일은 다음 내용도 다룹니다:

NDData 및 CCDData

메타데이터, 불확실성, 마스킹 및 WCS 정보를 포함한 n차원 데이터셋을 위한 컨테이너입니다.

모델링

천문 데이터에 수학적 모델을 생성하고 피팅하기 위한 프레임워크입니다.

시각화

적절한 스트레칭 및 스케일링을 사용한 천문 이미지 표시 도구입니다.

상수

적절한 단위를 갖는 물리 및 천문 상수(광속, 태양 질량, 플랑크 상수 등)입니다.

컨볼루션

평활화 및 필터링을 위한 이미지 처리 커널입니다.

통계

시그마 클리핑 및 이상치 제거를 포함한 강건한 통계 함수입니다.

설치

# Astropy 설치
uv pip install astropy

# 전체 기능을 위한 선택적 종속성 포함
uv pip install astropy[all]

일반적인 워크플로

좌표계 간 변환

from astropy.coordinates import SkyCoord
import astropy.units as u

# 좌표 생성
c = SkyCoord(ra='05h23m34.5s', dec='-69d45m22s', frame='icrs')

# 은하 좌표로 변환
c_gal = c.galactic
print(f"l={c_gal.l.deg}, b={c_gal.b.deg}")

# 고도-방위각으로 변환(시간과 위치 필요)
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"고도={c_altaz.alt.deg}, 방위각={c_altaz.az.deg}")

FITS 파일 읽기 및 분석

from astropy.io import fits
import numpy as np

# FITS 파일 열기
with fits.open('observation.fits') as hdul:
    # 구조 표시
    hdul.info()

    # 이미지 데이터 및 헤더 가져오기
    data = hdul[1].data
    header = hdul[1].header

    # 헤더 값 접근
    exptime = header['EXPTIME']
    filter_name = header['FILTER']

    # 데이터 분석
    mean = np.mean(data)
    median = np.median(data)
    print(f"평균: {mean}, 중앙값: {median}")

우주론적 거리 계산

from astropy.cosmology import Planck18
import astropy.units as u
import numpy as np

# z=1.5에서 거리 계산
z = 1.5
d_L = Planck18.luminosity_distance(z)
d_A = Planck18.angular_diameter_distance(z)

print(f"광도 거리: {d_L}")
print(f"각지름 거리: {d_A}")

# 해당 적색편이에서 우주 나이
age = Planck18.age(z)
print(f"z={z}에서 나이: {age.to(u.Gyr)}")

# 후방 시간
t_lookback = Planck18.lookback_time(z)
print(f"후방 시간: {t_lookback.to(u.Gyr)}")

카탈로그 교차 매칭

from astropy.table import Table
from astropy.coordinates import SkyCoord, match_coordinates_sky
import astropy.units as u

# 카탈로그 읽기
cat1 = Table.read('catalog1.fits')
cat2 = Table.read('catalog2.fits')

# 좌표 객체 생성
coords1 = SkyCoord(ra=cat1['RA']*u.degree, dec=cat1['DEC']*u.degree)
coords2 = SkyCoord(ra=cat2['RA']*u.degree, dec=cat2['DEC']*u.degree)

# 일치 항목 찾기
idx, sep, _ = coords1.match_to_catalog_sky(coords2)

# 분리 임계값으로 필터링
max_sep = 1 * u.arcsec
matches = sep < max_sep

# 일치된 카탈로그 생성
cat1_matched = cat1[matches]
cat2_matched = cat2[idx[matches]]
print(f"{len(cat1_matched)}개의 일치 항목을 찾았습니다")

모범 사례

  1. 항상 단위 사용: 수량에 단위를 첨부하여 오류를 방지하고 차원 일관성 보장
  2. FITS 파일에는 컨텍스트 관리자 사용: 적절한 파일 종료 보장
  3. 루프보다 배열 선호: 더 나은 성능을 위해 여러 좌표/시간을 배열로 처리
  4. 좌표 프레임 확인: 변환 전 프레임 확인
  5. 적절한 우주론 사용: 분석에 맞는 우주론 모델 선택
  6. 누락된 데이터 처리: 누락된 값이 있는 테이블에는 마스킹된 열 사용
  7. 시간 척도 지정: 정밀한 시간 측정을 위해 시간 척도(UTC, TT, TDB)를 명시적으로 지정
  8. 단위 인식 테이블에는 QTable 사용: 테이블 열에 단위가 있는 경우
  9. WCS 유효성 확인: 변환을 사용하기 전에 WCS 확인
  10. 자주 사용하는 값 캐싱: 비용이 많이 드는 계산(예: 우주론적 거리)은 캐싱 가능

문서 및 리소스

참조 파일

특정 모듈에 대한 자세한 내용은 다음 파일을 참조하세요:

  • references/units.md - 단위, 수량, 변환 및 등가성
  • references/coordinates.md - 좌표계, 변환 및 카탈로그 매칭
  • references/cosmology.md - 우주론 모델 및 계산
  • references/fits.md - FITS 파일 작업 및 조작
  • references/tables.md - 테이블 생성, I/O 및 작업
  • references/time.md - 시간 형식, 척도 및 계산
  • references/wcs_and_other_modules.md - WCS, NDData, 모델링, 시각화, 상수 및 유틸리티

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

관련 스킬