科研 Skill
恒星测光分析
photutils-photometry
Performs PSF and aperture photometry with photutils: source detection, PSF fitting, background estimation, multi-epoch light curves. Use for precision stellar photometry beyond one aperture sum.
SKILL.md
Photutils Photometry
Purpose
Covers precision stellar and point-source photometry with
photutils: robust background estimation, source detection, aperture
photometry with proper error propagation, PSF/PRF model fitting for
crowded or faint fields, and building calibrated multi-epoch light
curves. The astropy-astronomy skill demonstrates a single
introductory aperture-photometry example; this skill goes further —
PSF fitting for crowded fields, curve-of-growth aperture correction,
and the light-curve assembly needed for variable-star or exoplanet
transit work.
Use when a single aperture-sum example is not enough: crowded fields where apertures overlap, faint sources near the detection limit, building a light curve across many epochs, or needing calibrated (not instrumental) magnitudes with honest uncertainties.
When to Use
- Detecting point sources in an image and measuring their flux with aperture or PSF photometry.
- Crowded-field photometry where neighboring sources contaminate a simple circular aperture.
- Building a time-series light curve from many exposures of the same field (variable stars, exoplanet transits, asteroid rotation).
- Calibrating instrumental magnitudes to a standard photometric system using reference stars.
Prerequisites
photutils,astropy,numpyinstalled (pip install photutils astropy numpy).- Background-subtracted or at least bias/flat-corrected science images; this skill covers photometric background estimation for local sky subtraction, not detector-level calibration (bias, dark, flat-fielding), which must already be done.
- A WCS solution on the image if sky coordinates (rather than only pixel coordinates) are needed for cross-matching detected sources.
Workflow
1. Estimate the background
from photutils.background import Background2D, MedianBackground
from astropy.stats import SigmaClip
sigma_clip = SigmaClip(sigma=3.0)
bkg_estimator = MedianBackground()
bkg = Background2D(data, box_size=(50, 50), filter_size=(3, 3),
sigma_clip=sigma_clip, bkg_estimator=bkg_estimator)
data_sub = data - bkg.background
A single global median is rarely good enough for real images with
gradients (sky brightness, flat-fielding residuals, vignetting) — use
Background2D with a box size a few times larger than the typical
source size, not a single scalar background value.
2. Detect sources
from photutils.detection import DAOStarFinder
mean, median, std = sigma_clipped_stats(data_sub, sigma=3.0)
daofind = DAOStarFinder(fwhm=3.0, threshold=5.0 * std)
sources = daofind(data_sub)
DAOStarFinderassumes roughly Gaussian, unresolved point sources with a known approximate FWHM; for irregular/extended sources usephotutils.segmentation(detect_sources+SourceCatalog) instead.- Set the detection threshold as a multiple of the background RMS (commonly 3-5 sigma), not an absolute count value, so it generalizes across exposures with different noise levels.
3. Aperture photometry with proper error propagation
from photutils.aperture import CircularAperture, CircularAnnulus, ApertureStats
positions = list(zip(sources["xcentroid"], sources["ycentroid"]))
apertures = CircularAperture(positions, r=5.0)
annulus = CircularAnnulus(positions, r_in=8.0, r_out=12.0)
ann_stats = ApertureStats(data_sub, annulus, sigma_clip=sigma_clip)
local_bkg = ann_stats.median
aperture_stats = ApertureStats(data_sub, apertures)
net_flux = aperture_stats.sum - local_bkg * apertures.area
- Propagate Poisson (source) and background noise explicitly for the
flux uncertainty:
error = sqrt(net_flux / gain + apertures.area * (1 + apertures.area / annulus.area) * bkg_std**2)— this is the standard CCD-equation form; omitting the background-annulus-area term understates the uncertainty for faint sources. - Determine the aperture radius from a curve of growth (flux vs. aperture radius on a bright, isolated star in the same frame) rather than guessing a fixed radius, and apply an aperture correction if using a small aperture for crowded-field work.
4. PSF photometry for crowded or faint fields
from photutils.psf import IterativePSFPhotometry, GriddedPSFModel
from photutils.psf import SourceGrouper
grouper = SourceGrouper(min_separation=10)
psf_model = ... # build or fit an empirical/analytic PSF model, e.g. from photutils.psf.EPSFBuilder
photometry = IterativePSFPhotometry(psf_model=psf_model, fit_shape=(5, 5),
finder=daofind, grouper=grouper)
result = photometry(data_sub)
- Build an empirical PSF (
EPSFBuilder) from several bright, isolated stars in the same frame rather than assuming an analytic Gaussian PSF — real PSFs have wings and asymmetries that bias flux for faint/blended sources if ignored. IterativePSFPhotometryfits overlapping sources jointly and iterates to recover sources missed in crowded regions — use this instead of independent aperture photometry whenever source spacing is comparable to the PSF FWHM.
5. Calibrate to a standard photometric system
- Compute instrumental magnitude:
m_inst = -2.5 * log10(net_flux / exposure_time). - Fit a zero-point (and optionally a color term) against reference
stars with known catalog magnitudes in the same field (e.g., from a
catalog query — see the astro-catalog-queries skill):
m_cat = m_inst + ZP + c * (color_term), solved by linear regression over several reference stars, not a single star. - Report the zero-point uncertainty (scatter across reference stars) alongside the calibrated magnitudes.
6. Build a multi-epoch light curve
- Photometer each epoch with a consistent method (same aperture size or same PSF-fitting configuration) so that systematic differences between epochs do not masquerade as source variability.
- Use several non-variable reference stars in the same field for differential photometry: subtract their magnitude scatter from the target's light curve to remove shared systematics (airmass, transparency, tracking).
- Flag or clip epochs with poor seeing, clouds, or tracking issues (e.g., using the FWHM or background RMS of that epoch) rather than silently including degraded data points.
Limitations
- Assumes detector-level calibration (bias, dark, flat-fielding) is already done; this skill covers photometric (not instrumental) calibration.
- PSF photometry quality depends heavily on having enough bright, isolated stars in the frame to build a good empirical PSF model; very sparse or very crowded fields may need a reference PSF from a different exposure or instrument model.
- Differential/relative photometry for light curves assumes several non-variable comparison stars exist in the field; absolute flux calibration in the absence of standard-star observations is only approximate.
- Does not cover space-based instrument-specific pipelines (e.g., JWST/HST native photometry tools), which have their own calibrated photometry packages and conventions.
Quality Checklist
- Background estimated with a spatially-varying model
(
Background2D), not a single scalar, unless the field is genuinely flat. - Detection threshold set relative to background RMS, not an absolute count.
- Aperture radius justified by a curve of growth, or PSF model built from real in-frame stars rather than assumed analytically.
- Flux uncertainty includes both source Poisson noise and background-annulus noise terms.
- Photometric zero-point fit from multiple reference stars with reported scatter, not a single star.
- Light curves use consistent per-epoch methodology and differential correction against stable reference stars.
示例提示词
帮我对这组多历元图像做PSF测光并构建变星光变曲线。
所属插件
安装该插件会一并获得同领域的 22 个 Skill / MCP。
同插件的其他科研 Skill
- 天文星表检索Queries astronomical archives (Gaia, SDSS, VizieR, MAST, NED, SIMBAD) via astroquery/TAP/ADQL and cross-matches results. Use when sourcing or combining survey data by position.
- 天文光谱分析Reduces 1D astronomical spectra with specutils: continuum normalization, line fitting, redshift/radial-velocity measurement, equivalent widths. Use for spectral classification or velocity work.
- 天文观测数据分析Runs applied astronomy pipelines with astropy/astroquery: catalog cross-matching, Gaia/SIMBAD queries, aperture photometry, CMB power spectra. Use for end-to-end data-analysis workflows.
- Astropy天文数据处理Covers core Astropy APIs for units, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use as the API reference, before reaching for applied workflows.
- 谷歌量子计算框架Builds noise-aware quantum circuits for Google Quantum AI hardware and runs characterization experiments. Use for Google-hardware targeting; use qiskit for IBM or pennylane for differentiable ML.
- 有限元法求解偏微分方程Solves PDEs with finite elements using FEniCS/dolfinx: weak forms, gmsh meshing, Poisson/elasticity problems, boundary conditions, ParaView export. Use for continuum-physics simulation.
- 计算流体力学模拟Runs pseudospectral CFD simulations in Python: Navier-Stokes, shallow water, stratified flows with FFT-based solvers. Use for turbulence, vortex dynamics, or geophysical flow simulation.
- LAMMPS经典分子动力学Runs classical molecular dynamics with LAMMPS: force field selection, NVT/NPT ensembles, RDF/MSD post-processing, OVITO visualization. Use for atomistic materials or molecular simulation.
- 三维科学可视化Creates 3D scientific visualizations with Mayavi: vector fields, isosurfaces, volume rendering, animated 3D plots. Use for visualizing volumetric or vector-field physics data.
- 蒙特卡洛物理模拟Simulates physical systems with Monte Carlo methods: statistical integration, MCMC sampling, the Ising model, error estimation. Use for stochastic physics simulation.
- 地震学数据处理Analyzes seismological data with ObsPy: FDSN waveform download, response removal, phase picking, moment tensor inversion. Use for earthquake and seismic-waveform analysis.
- 粒子图像测速分析Extracts velocity fields from PIV image pairs with OpenPIV: cross-correlation, vector validation, vorticity/strain-rate statistics. Use for experimental fluid-flow measurement.
- 量子机器学习框架Trains quantum circuits with autodiff across IBM/Google/Rigetti/IonQ devices: VQE, QAOA, hybrid models with PyTorch/JAX. Use for gradient-based variational quantum algorithms.
- 物理信息神经网络Builds physics-informed neural networks, neural ODEs, and data-driven force fields with PyTorch, DeepXDE, torchdiffeq. Use for ML-based physics simulation and surrogate modeling.
- IBM量子计算框架Runs IBM Quantum workflows end to end: Runtime primitives, transpilation, hardware backend selection, error mitigation. Use when targeting IBM Quantum hardware or Runtime.
- Qiskit量子线路实验Implements Qiskit algorithms: circuit construction, VQE/QAOA workflows, noise-model simulation, statevector-vs-shot comparisons. Use for algorithm design and local simulation.
- 开放量子系统模拟Simulates open quantum systems with QuTiP: master equations, Lindblad dynamics, decoherence, cavity QED. Use for open-system physics, not circuit-based quantum computing.
- SciPy数值计算工具Solves ODEs/PDEs, runs FFT analysis, optimization, and sparse linear algebra with SciPy for physics problems. Use as the general-purpose numerical-computing toolkit.
- SymPy符号计算Performs symbolic computation for physics with SymPy: algebra, calculus, Lagrangian mechanics, quantum operators, code generation. Use for exact derivations, not numerical solving.
- 物理量纲与不确定度传播Tracks physical units and propagates measurement uncertainty with pint/uncertainties: GUM budgets, Monte Carlo propagation, dimensionless-group checks. Use to sanity-check a result or unit.
- 多维标注数组NetCDF分析Analyzes labeled multi-dimensional arrays with xarray: NetCDF/HDF5 I/O, lazy Dask loading, rechunking, Zarr stores, CF conventions. Use for gridded scientific data handling.
常见问题
恒星测光分析能做什么?
Performs PSF and aperture photometry with photutils: source detection, PSF fitting, background estimation, multi-epoch light curves. Use for precision stellar photometry beyond one aperture sum。
如何安装恒星测光分析?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「恒星测光分析」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
恒星测光分析需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
恒星测光分析经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。