Communitygithub.com

ASoudy/AGS

Astropy는 천문학 연구 및 데이터 분석을 위한 핵심 기능을 제공하는 파이썬 패키지입니다.

AGS란 무엇인가요?

Astropy는 천문학 연구 및 데이터 분석에 필요한 핵심 기능을 제공하는 종합적인 파이썬 패키지입니다. 이 기술은 좌표 변환 (ICRS, Galactic, AltAz 등), 물리적 단위 및 양 계산, FITS 파일 작업 (이미지 및 테이블), 우주론적 계산 (광도 거리, 후퇴 시간), 정밀 시간 처리 (UTC, TAI, TDB, JD, MJD), 테이블 조작 (카탈로그 읽기, 교차 매칭, 필터링), WCS 변환 (픽셀 ↔ 세계 좌표) 등 천문학 작업의 광범위한 범위를 다룹니다. Claude Code, Cursor, Codex를 포함한 모든 AI 에이전트 환경에서 사용할 수 있습니다. 이 기술은 astropy의 핵심 모듈을 사용하여 복잡한 천문학 계산을 간소화하고, 코드를 더 읽기 쉽고 오류에 강하게 만들며, 과학적 작업 흐름의 재현성을 보장합니다. 사용자는 단위를 사용하여 물리량을 정의하고, 다양한 좌표계 간에 변환하고, FITS 파일을 읽고 쓰고, 우주론적 거리를 계산하고, 시간 척도를 변환하고, 테이블 형식 데이터를 조작하고, 천체 이미지의 WCS 정보를 처리할 수 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ASoudy/AGS/tree/HEAD/AGAS/plugins/antigravity-awesome-skills-claude/skills/astropy

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

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

문서

Astropy

개요

Astropy는 천문학 연구 및 데이터 분석에 필요한 핵심 기능을 제공하는 파이썬 패키지입니다. astropy는 좌표 변환, 단위 및 양 계산, FITS 파일 작업, 우주론적 계산, 정밀 시간 처리, 테이블 형식 데이터 조작, 천문 이미지 처리에 사용됩니다.

이 기술을 사용해야 하는 경우

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

  • 천체 좌표계 간 변환 (ICRS, Galactic, FK5, AltAz 등)
  • 물리적 단위 및 양 작업 (Jy를 mJy로, pc를 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 좌표 작업을 위한 거리 포함
  • 고유 운동과 시선 속도 처리
  • 온라인 데이터베이스에서 명명된 객체 질의

참고: references/coordinates.md에서 상세 좌표 프레임 설명, 변환, 관측자 의존 프레임(AltAz), 카탈로그 매칭 및 성능 팁을 확인하세요.

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

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

주요 작업:

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

참고: 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)
  • 마스킹으로 누락된 데이터 처리

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

6. 시간 처리 (astropy.time)

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

주요 작업:

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

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

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

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

주요 작업:

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

참고: references/wcs_and_other_modules.md에서 WCS 작업 및 변환에 대한 자세한 내용을 확인하세요.

추가 기능

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"Alt={c_altaz.alt.deg}, Az={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.

ASoudy/AGS

Advanced JavaScript animation library skill for creating complex, high-performance web animations.

ASoudy/AGS

Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

ASoudy/AGS

One sentence - what this skill does and when to invoke it

ASoudy/AGS

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

ASoudy/AGS

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

ASoudy/AGS

Pull a YouTube video transcript into a queryable markdown vault with yt-dlp subtitle discovery, VTT cleanup, metadata frontmatter, and capture-seed stubs.

ASoudy/AGS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

ASoudy/AGS

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

ASoudy/AGS

AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

ASoudy/AGS

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

ASoudy/AGS

Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

ASoudy/AGS

Next.js App Router principles. Server Components, data fetching, routing patterns.

ASoudy/AGS

Expert integration of Supabase Auth with Next.js App Router

ASoudy/AGS

React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

ASoudy/AGS

Best practices for Remotion - Video creation in React

ASoudy/AGS

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

ASoudy/AGS

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

ASoudy/AGS

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

ASoudy/AGS

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

ASoudy/AGS

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

관련 스킬