psf_fit — ASTROSTACK photometry op

Data kinds: image2d × keypointstable

Call: import astrostack; astrostack.psf_fit(image, centers, model='gaussian', box=11, max_iter=200) (or opsastrostack.get("psf_fit"))

Usage

Fit a PSF to a star image and get its centre and FWHM.

> The detailed description below is the original text — the summary and the headings are translated.

*model* `"gaussian"` は楕円ガウシアン

`bkg + amp * exp(-((dr/sr)^2 + (dc/sc)^2)/2)` の 6 パラメータ当てはめで、

真円度(`roundness = min(sr,sc)/max(sr,sc)`)が副産物として出る ——

追尾誤差や風で伸びた星像はここに出る。`"moffat"` は円対称の

`bkg + amp * (1 + r^2/alpha^2)^(-beta)(Moffat 1969)で、beta` も

自由パラメータ。最小二乗は :func:scipy.optimize.least_squares

(Trust Region Reflective)で、初期値は 2 次モーメントから作る決定的な値

—— 乱数を使わないので同じ入力なら同じ答え。

FWHM は当てはめたパラメータからの閉形式:

ガウシアンは `2 sqrt(2 ln 2) * sqrt(sr*sc)`(幾何平均)、Moffat は

`2 alpha sqrt(2^(1/beta) - 1)`。

画素の箱のぶんだけ、必ず太く出る。 ここが当てはめているのは*連続の*

ガウシアンだが、画像の各画素は連続分布を 1 画素の箱で積分した値である。

一様な幅 1 の箱の分散は `1/12` なので、返る sigma は真の sigma ではなく

`sqrt(sigma^2 + 1/12)` になる —— これは推定の誤差ではなく**画像がそう

できている**ということ。実測はこの予測とよく合う::

真の FWHM 予測 = 2.3548*sqrt(sigma^2+1/12) 実測(中央値)

2.5 2.5908 2.5930

3.5 3.5654 3.5625

5.0 5.0460 5.0145

真の sigma が欲しければ `sqrt(sigma_fit^2 - 1/12)` と引けばよいが、

既定では引かない —— 星の測定で普通に言う「FWHM」は画像上の見た目の

幅であり、黙って補正を入れると他の道具の値と合わなくなる。

Returns 各星 1 つの dict の `list(table` 語彙)。キーは

`row / col(当てはめた中心)、fwhm_pxamplitude`、

`backgroundroundnessrms(残差 RMS)、converged`(bool)、

`model、そして model 依存の sigma_row_px / sigma_col_px`

または `alpha_px / beta`。窓が画像からはみ出す星、当てはめが

収束しなかった星も落とさずに `converged=False` で返す

—— 黙って消すと「星が減った」ことに誰も気づけない。

Raises `ValueError: *model* が :data:PSF_MODELS` にない /

*box* が 5 未満または偶数 / *centers* が `(N, 2)` でない場合。

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

astro_stackingpy -3.11 examples/astro_stacking.py

poc_star_astrometrypy -3.11 examples/poc_star_astrometry.py

Ops the type connects to (they accept table as input)

Same category (photometry)

star_detect · aperture_photometry


*Provenance: astrostack.py — ASTROSTACK operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.