PSF¶
Effective-PSF and extended-PSF construction helpers.
robust_combine(stack, *, weight=None, method='clipped_mean', combine_kappa=3.0, combine_max_iter=5)
builtin
¶
Robustly combine an aligned (N, h, w) stack along the stamp axis
with sign-agnostic outlier rejection.
A pure cross-N reducer: the caller passes an already-aligned native stack plus the complete per-pixel weight. Used for the extended-PSF native wing stack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stack
|
ndarray
|
|
required |
weight
|
ndarray
|
|
None
|
method
|
(clipped_mean, median)
|
|
"clipped_mean"
|
combine_kappa
|
float
|
|
3.0
|
combine_max_iter
|
int
|
|
5
|
Returns:
| Type | Description |
|---|---|
RobustCombined
|
Three |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
RobustCombined
¶
Result of robust_combine: three (h, w) planes. A pixel with
no surviving sample carries combined = NaN, weight = 0,
count = 0 (passed through unchanged, never raised).
combined
property
¶
The combined value per pixel, shape (h, w), dtype
float64. NaN for a no-survivor pixel.
count
property
¶
The number of surviving samples per pixel, shape (h, w),
dtype uint32. 0 for a no-survivor pixel.
weight
property
¶
The effective combined weight per pixel (sum of surviving
weights; equals count when weight was None), shape
(h, w), dtype float64. 0 for a no-survivor pixel.
solve_flux_background(epsf, oversample, data, delta, *, weight=None)
builtin
¶
Solve the per-star (flux, background) at a fixed delta by an
exact 2x2 weighted linear least squares (no iteration).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epsf
|
ndarray
|
|
required |
oversample
|
int
|
The oversample factor |
required |
data
|
ndarray
|
|
required |
delta
|
ndarray
|
|
required |
weight
|
ndarray
|
|
None
|
Returns:
| Type | Description |
|---|---|
FluxBackground
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
FluxBackground
¶
Result of solve_flux_background: the per-star (flux,
background) at the supplied fixed delta. An unsolved star
carries flux = NaN, background = NaN, ok = False (passed
through unchanged, never raised).
build_epsf(data, delta_init, oversample, *, weight=None, psi_init=None, max_iter=50, tol=0.0001, step=1.0, residual_reweight='none', reweight_c=4.0, nuisance_max_iter=3, nuisance_tol=0.0001)
builtin
¶
Solve the core oversampled effective PSF from a caller-assembled stamp stack by projected-Landweber super-resolution, jointly refining the per-star nuisance table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
|
required |
delta_init
|
ndarray
|
|
required |
oversample
|
int
|
The oversample factor |
required |
weight
|
ndarray
|
|
None
|
psi_init
|
ndarray
|
|
None
|
max_iter
|
int
|
Outer SR iteration cap. Must be |
50
|
tol
|
float
|
|
0.0001
|
step
|
float
|
Landweber relaxation (operator-norm adaptive, so |
1.0
|
residual_reweight
|
(none, huber, tukey)
|
Per-pixel residual M-estimator down-weighting. Symmetric /
sign-agnostic. Default |
"none"
|
reweight_c
|
float
|
The Huber / Tukey transition in robust sigmas. Must be finite and
|
4.0
|
nuisance_max_iter
|
int
|
Per-round |
3
|
nuisance_tol
|
float
|
Per-round |
0.0001
|
Returns:
| Type | Description |
|---|---|
BuildEpsf
|
The unit-volume-gauged |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
BuildEpsf
¶
Result of build_epsf: the solved oversampled effective PSF plus
the refined per-star table and the global fixed-point flags. A star
that could not be solved carries the nuisance sentinel and
ok = False (passed through unchanged, never raised).
background
property
¶
(N,) refined per-star scalar background, dtype float64.
NaN where ok = False.
converged
property
¶
Global convergence: ‖Δpsi‖_rel < tol was reached strictly
before max_iter (distinct from any per-star flag).
delta
property
¶
(N, 2) refined per-star centroid (delta_row, delta_col),
dtype float64.
epsf
property
¶
(os*s, os*s) solved oversampled effective PSF, unit-volume
gauged (sum(epsf) / os^2 = 1), dtype float64.
flux
property
¶
(N,) refined per-star flux, dtype float64. NaN where
ok = False.
iterations
property
¶
Number of outer SR iterations actually run.
ok
property
¶
(N,) per-star usability, dtype bool. A False star did
not enter the psi accumulate.
stitch_psf(core, oversample, wing, *, wing_confidence=None, match_radius=8.0, feather_width=4.0, ee_aperture_radius=15.0)
builtin
¶
Stitch a Phase-6 oversampled core and a native wing into a hybrid encircled-energy-normalized extended PSF. The core is not re-solved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
core
|
ndarray
|
|
required |
oversample
|
int
|
The oversample factor |
required |
wing
|
ndarray
|
|
required |
wing_confidence
|
ndarray
|
|
None
|
match_radius
|
float
|
Native-pixel core<->wing crossover (the feather ring center).
Finite, |
8.0
|
feather_width
|
float
|
Native-pixel raised-cosine feather full width. Finite, |
4.0
|
ee_aperture_radius
|
float
|
Native-pixel circular aperture the result is encircled-energy
normalized to (integral within == 1). Finite, |
15.0
|
Returns:
| Type | Description |
|---|---|
ExtendedPsf
|
The hybrid / multi-resolution extended PSF. A degenerate all-sentinel wing yields a pure-core EE-normalized result, not an error. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ExtendedPsf
¶
The hybrid / multi-resolution extended PSF: an oversampled core plus a native wing plus the meta-info linking the two grids.
Sampling contract: recon(r) = f_core(r) * core_sample(r) +
wing_sample(r) with the raised-cosine f_core = 1 - f_wing. The
stored wing already has f_wing and the scalar match baked in
(so it is ~0 in the core region); both planes are encircled-energy
normalized.
core
property
¶
(os*s, os*s) oversampled core, EE-normalized, dtype
float64.
ee_aperture_radius
property
¶
The native-pixel encircled-energy aperture radius.
feather_width
property
¶
The native-pixel feather full width.
match_radius
property
¶
The native-pixel core<->wing crossover radius.
oversample
property
¶
The oversample factor os (the meta-info linking the two
grids).
wing
property
¶
(H, W) native wing: scalar-matched at match_radius,
raised-cosine feathered (so ~0 in the core region), and
EE-normalized, dtype float64.
build_extended_psf(wing_data, wing_delta, core, oversample, *, wing_weight=None, match_radius=8.0, feather_width=4.0, ee_aperture_radius=15.0, combine='clipped_mean', combine_kappa=3.0, combine_max_iter=5, scale_aperture_radius=6.0, scale_background_annulus=(18.0, 24.0))
builtin
¶
Build the native wing from a bright-star stack (per-stamp robust sky + per-stamp scale + robust combine) and stitch it onto a Phase-6 core.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wing_data
|
ndarray
|
|
required |
wing_delta
|
ndarray
|
|
required |
core
|
ndarray
|
|
required |
oversample
|
int
|
The oversample factor |
required |
wing_weight
|
ndarray
|
|
None
|
match_radius
|
float
|
Native-pixel core<->wing crossover. Finite, |
8.0
|
feather_width
|
float
|
Native-pixel raised-cosine feather full width. Finite, |
4.0
|
ee_aperture_radius
|
float
|
Native-pixel encircled-energy aperture radius. Finite, |
15.0
|
combine
|
(clipped_mean, median)
|
The |
"clipped_mean"
|
combine_kappa
|
float
|
|
3.0
|
combine_max_iter
|
int
|
|
5
|
scale_aperture_radius
|
float
|
Native-pixel aperture radius for the aperture-photometry fallback
scale (used when the core solve is saturated). Finite, |
6.0
|
scale_background_annulus
|
tuple of (float, float)
|
Native-pixel |
(18.0, 24.0)
|
Returns:
| Type | Description |
|---|---|
ExtendedPsfBuilt
|
The stitched |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ExtendedPsfBuilt
¶
Result of build_extended_psf: the stitched ExtendedPsf plus
the per-bright-star table. A star that cannot be calibrated carries
star_ok = False and NaN scale/background (passed through
unchanged, never raised).
extended
property
¶
The stitched hybrid extended PSF (an ExtendedPsf).
star_background
property
¶
(M,) per-stamp robust sky actually subtracted, dtype
float64. NaN where star_ok = False.
star_flux
property
¶
(M,) per-stamp scale actually used (core-solve flux or
aperture-photometry fallback), dtype float64. NaN where
star_ok = False.
star_ok
property
¶
(M,) per-star usability, dtype bool. False means
saturated and the aperture fallback was also unusable.
star_scale_from_core
property
¶
(M,) scale provenance, dtype bool: True = the core
solve_flux_background, False = the aperture-photometry
fallback. Meaningless where star_ok = False.