lucky_select — ASTROSTACK quality op

Data kinds: imagesindices

Call: import astrostack; astrostack.lucky_select(frames, keep_fraction=0.3, min_keep=1, **quality_kw) (or opsastrostack.get("lucky_select"))

Usage

Keep only the top `keep_fraction` by quality score — the lucky-imaging cut.

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

採用枚数は `max(min_keep, ceil(keep_fraction * N))`。必ず 1 枚は残す

ので、`keep_fraction` をいくら小さくしても空にはならない(空の合成を

後段へ渡す方が事故が大きい)。並べ替えは点の降順で、同点は元の順序を保つ

安定ソート —— 同じ入力なら同じ並びが返る。

Returns `(indices, scores)`:

• `indices —— (K,)` int64、採用フレームの添字を良い順に

(`indices 語彙)。[frames[i] for i in indices]` がそのまま

:func:sigma_clip_stack へ渡せる。

• `scores —— (N,)` float64、全フレームの点(捨てた側も含む)。

捨てた理由を図にできるように、選別の結果ではなく素材を返す。

Ground truth it reproduces(`tests/test_astrostack.py`): 同じ星野を

FWHM だけ変えて撮ったフレーム列では、点は FWHM とともに下がる

96x96 に 20 星、FWHM を 3.462〜6.080 px で振った 12 枚の実測で

`corr(fwhm, score) = -0.925`。上位 25 %(3 枚)を採って平均合成すると、

12 枚全部を平均した場合に比べて合成後の FWHM が 4.403 → 3.672 px、

16.6 % 改善する —— 枚数を 1/4 に減らしたのに像は鋭くなる、というのが

lucky imaging の主張そのもの(その代わり雑音は sqrt(4) = 2 倍になる)。

Raises `ValueError`: *frames* が list / tuple でない(3-D 配列は

明示的に拒否)/ 枚数が 1 未満 / `keep_fraction` が (0, 1] の外 /

*min_keep* が枚数を超える場合。

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_astro_photometrypy -3.11 examples/poc_astro_photometry.py

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

Same category (quality)

frame_quality · noise_sigma


*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.