Token导航 LogoToken导航

Agent Skill · 研究检索

photutils(photutils 搜索)

photutils 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

photutils 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 63,891。

总安装 309周安装 13GitHub Stars 9下载 108核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:photutils(photutils 搜索)
来源仓库:https://github.com/tondevrel/scientific-agent-skills
仓库路径:skills/photutils
安装命令:
npx skills add https://github.com/tondevrel/scientific-agent-skills --skill photutils
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/tondevrel/scientific-agent-skills --skill photutils

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找 photutils 相关的科学图像处理工具信息。适合在 Codex、Claude、Cursor、Gemini CLI 中检索算法或库文档。可通过 npx 命令从 scientific-agent-skills 仓库安装。建议查看原始 README 了解具体函数与模块支持。注意运行环境依赖与数据格式兼容性。

来源仓库内路径:skills/photutils

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/tondevrel/scientific-agent-skills --skill phot…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

photutils 怎么安装?

在终端执行 npx skills add https://github.com/tondevrel/scientific-agent-skills --skill photutils。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

photutils 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

photutils 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

photutils 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

photutils 用的人多吗?

公开数据是累计安装 309 次,近一周安装 13 次,下载 108 次,GitHub 9 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

photutils 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
photutils

photutils 搜索 · 本页

3099需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Photutils - Astronomical Photometry

Photutils is the modern standard for extracting quantitative data from astronomical images. It replaces legacy tools like SExtractor or DAOPHOT with a modular, Pythonic interface integrated with the Astropy ecosystem.

When to Use

  • Detecting stars or galaxies in an astronomical image (DAOStarFinder, IRAFStarFinder).
  • Measuring the brightness of objects using circular, elliptical, or rectangular apertures.
  • Performing PSF-fitting photometry (essential for crowded stellar fields).
  • Estimating and subtracting complex 2D backgrounds (sky background).
  • Calculating the centroids (precise centers) of astronomical sources.
  • Performing "isophotal analysis" (measuring shapes of galaxies).
  • Segmentation of images based on thresholding.

Reference Documentation

Official docs: https://photutils.readthedocs.io/ GitHub: https://github.com/astropy/photutils Search patterns: photutils.aperture, photutils.detection, photutils.background, photutils.psf

Core Principles

Background First

Accurate photometry is impossible without correct background subtraction. Photutils provides tools to estimate global and local sky levels.

Aperture vs. PSF

  • Aperture Photometry: Summing pixels within a fixed shape. Best for isolated sources or galaxies.
  • PSF Photometry: Fitting a mathematical model of a star to the data. Best for overlapping stars or high-precision work.

Units and WCS

Photutils is fully units-aware. If your image has WCS metadata, apertures can be defined in sky coordinates (degrees) rather than just pixels.

Quick Reference

Installation

pip install photutils

Standard Imports

import numpy as np
import matplotlib.pyplot as plt
from astropy import units as u
from photutils.detection import DAOStarFinder
from photutils.aperture import CircularAperture, aperture_photometry
from photutils.background import Background2D, MedianBackground

Basic Pattern - Detection and Aperture Photometry

import numpy as np
from photutils.detection import DAOStarFinder
from photutils.aperture import CircularAperture, aperture_photometry

# 1. Detect sources
# fwhm: Full Width at Half Maximum of the stars
finder = DAOStarFinder(fwhm=3.0, threshold=5.*std)
sources = finder(image - background)

# 2. Define apertures at detected positions
positions = np.transpose((sources['xcentroid'], sources['ycentroid']))
apertures = CircularAperture(positions, r=4.0)

# 3. Perform photometry
phot_table = aperture_photometry(image - background, apertures)
print(phot_table)

Critical Rules

✅ DO

  • Subtract background first - Detection and photometry always work better on a background-subtracted image.
  • Use Background2D - For images with varying sky levels, a 2D mesh estimation is more accurate than a single median value.
  • Specify the Gain - For accurate error (uncertainty) estimation, provide the detector gain to aperture_photometry.
  • Match FWHM - Ensure the fwhm parameter in finders matches the actual PSF of your images.
  • Vectorize apertures - One CircularAperture object can hold thousands of positions; don't create them in a loop.
  • Use SkyAperture - If you have a WCS, define apertures in RA/Dec to ensure they stay on target if the image is rotated or reprojected.

❌ DON'T

  • Ignore mask pixels - If your image has bad pixels (cosmic rays, saturated stars), pass a mask to the photometry functions.
  • Use small apertures - If an aperture is too small, you lose light (aperture correction required). If too large, you add noise.
  • Blindly trust defaults - Always visualize your apertures on top of the image to verify they align with the stars.
  • Mix pixel and sky units - Be careful whether you are passing (x, y) or (RA, Dec).

Anti-Patterns (NEVER)

# ❌ BAD: Manual pixel summation
# light_sum = np.sum(image[y-r:y+r, x-r:x+r]) # No circular masking!

# ✅ GOOD: Proper aperture photometry
from photutils.aperture import CircularAperture
ap = CircularAperture((x, y), r=r)
phot = aperture_photometry(image, ap)

# ❌ BAD: Detecting sources on raw data with high background
# finder = DAOStarFinder(threshold=100)(raw_image)

# ✅ GOOD: Detection on noise-subtracted data
from photutils.background import Background2D, MedianBackground
bkg = Background2D(image, (50, 50), filter_size=(3, 3), bkg_estimator=MedianBackground())
sources = finder(image - bkg.background)

Background Estimation (photutils.background)

Robust 2D Background Mapping

from photutils.background import Background2D, MedianBackground
from astropy.stats import SigmaClip

sigma_clip = SigmaClip(sigma=3.0)
bkg_estimator = MedianBackground()

# box_size: size of the mesh grid
bkg = Background2D(image, box_size=(50, 50),
                   filter_size=(3, 3),
                   sigma_clip=sigma_clip,
                   bkg_estimator=bkg_estimator)

print(f"Global median background: {bkg.background_median}")
clean_image = image - bkg.background

Source Detection (photutils.detection)

Star Finding Algorithms

from photutils.detection import DAOStarFinder, IRAFStarFinder

# DAOStarFinder: Optimized for stars
daofind = DAOStarFinder(fwhm=3.0, threshold=5.0*std)
sources = daofind(data)

# IRAFStarFinder: Alternative implementation
iraffind = IRAFStarFinder(threshold=5.0*std, fwhm=3.0)
sources_iraf = iraffind(data)

# Extract coordinates for photometry
positions = np.transpose((sources['xcentroid'], sources['ycentroid']))

Aperture Photometry (photutils.aperture)

Handling Multiple Shapes

from photutils.aperture import CircularAperture, CircularAnnulus, aperture_photometry

# 1. Main aperture and Annulus (for local background)
positions = [(100.5, 120.3), (250.1, 88.4)]
aperture = CircularAperture(positions, r=5.0)
annulus = CircularAnnulus(positions, r_in=10.0, r_out=15.0)

# 2. Local background subtraction
# Calculate median in the annulus
annulus_masks = annulus.to_mask(method='center')
bkg_median = []
for mask in annulus_masks:
    annulus_data = mask.multiply(image)
    annulus_data_1d = annulus_data[mask.data > 0]
    bkg_median.append(np.median(annulus_data_1d))

# 3. Perform photometry and subtract local background
phot = aperture_photometry(image, aperture)
phot['local_bkg'] = bkg_median
phot['aper_sum_corrected'] = phot['aperture_sum'] - (bkg_median * aperture.area)

PSF Photometry (photutils.psf)

Fitting Overlapping Sources

from photutils.psf import BasicPSFFitter, IntegratedGaussianPRF
from photutils.background import MMMBackground

# 1. Define the PSF model (Gaussian or custom)
psf_model = IntegratedGaussianPRF(sigma=1.5)

# 2. Initialize the fitter
fitter = BasicPSFFitter(psf_model, fitshape=(11, 11),
                        finder=daofind,
                        bkg_estimator=MMMBackground())

# 3. Perform fitting
# result_table contains fitted x, y, and flux
result_table = fitter(image)

# 4. Get the residual image (original - fitted stars)
residual_image = fitter.get_residual_image()

Centroiding (photutils.centroids)

Precise Star Centering

from photutils.centroids import centroid_com, centroid_2dg

# Center of mass (simple)
x1, y1 = centroid_com(image[y-5:y+6, x-5:x+6])

# 2D Gaussian fit (most precise for stars)
x2, y2 = centroid_2dg(image[y-5:y+6, x-5:x+6])

Practical Workflows

1. Full Image Pipeline (Detection to Magnitude)

def extract_magnitudes(image, zero_point=25.0):
    # 1. Subtract 2D Background
    bkg = Background2D(image, box_size=(64, 64))
    data_sub = image - bkg.background

    # 2. Detect sources
    finder = DAOStarFinder(fwhm=2.5, threshold=5*bkg.background_rms_median)
    sources = finder(data_sub)

    # 3. Aperture Photometry
    pos = np.transpose((sources['xcentroid'], sources['ycentroid']))
    ap = CircularAperture(pos, r=4.0)
    phot = aperture_photometry(data_sub, ap)

    # 4. Convert to instrumental magnitudes
    phot['mag'] = -2.5 * np.log10(phot['aperture_sum']) + zero_point
    return phot

2. Checking Photometry Quality with Residuals

def check_psf_quality(image, sources):
    """Fits PSF and returns residual to check for artifacts."""
    # ... setup PSF fitter ...
    result = fitter(image, init_guesses=sources)
    residual = fitter.get_residual_image()

    # If residual has 'holes' or 'donuts', PSF model is bad.
    return residual

Performance Optimization

Using n_jobs in fitting

While current Photutils doesn't natively support n_jobs in all fitters, you can parallelize by splitting the image into tiles.

Aperture Masks

For very large images, use aperture.to_mask() to extract only relevant sub-arrays instead of performing calculations on the full image.

Common Pitfalls and Solutions

Negative Flux in log10

If the background subtraction is too aggressive, some faint stars might have negative aperture_sum.

# ✅ Solution: Filter results before log
valid = phot[phot['aperture_sum'] > 0]
valid['mag'] = -2.5 * np.log10(valid['aperture_sum'])

Crowded Fields

Aperture photometry fails when stars overlap.

# ❌ Problem: One aperture contains 3 stars
# ✅ Solution: Switch to PSF Photometry (photutils.psf)
# This fits the shapes and accounts for overlapping light.

Coordinate Order

photutils uses (x, y) which corresponds to (column, row).

# ❌ Error: image[x, y] # This is wrong for numpy!
# ✅ Solution: Use image[y, x] or image[row, col]

Photutils is the "measuring stick" for astronomical imagery. By combining robust statistical detection with precise mathematical fitting, it allows astronomers to turn digital images into scientific catalogs with known uncertainties.

平台分布

Codex

33.69%
按下载量换算36

Claude

33.55%
按下载量换算36

Cursor

17.37%
按下载量换算19

Gemini CLI

10.1%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills