Quality Screening

PSF Guard screens light frames for problems that affect integrations but are not caught by conventional grading. These problems include occlusion from trees or dome edges, small clouds, thin veils, stray light, static glow, off-target pointing, tracking loss, and plate-solve failures. The system can render spatial detections as annotated diagnostics, and astrometry results provide solved centers and field-relative evidence.

All detections use classical statistics. Thresholds are calibrated against real session data, which includes measured clean-frame envelopes across multiple nights and filters. Each detector is verified by regression tests to ensure consistent behavior.

Global metrics do not capture localized frame degradation

Star count and half-flux radius (HFR), which conventional grading tools rely on, often show little change when a frame is partially degraded. For example, in a session where a tree line progressively occluded the field of view:

The screening stack uses local, photometric, and temporal signals to identify these issues. It evaluates individual grid cells, measures flux ratios instead of star counts, and compares each cell to its historical baseline to prevent gradual occlusions from being ignored.

The detection stack monitors multiple image characteristics

SignalCatchesHow
Dead cellsOcclusion (trees, dome, dew shield) This measures the fraction of the 8×6 grid cells whose star density has collapsed compared to the median cell of the frame.
TransparencyThin uniform veils This calculates the median flux ratio of stars matched against a per-sequence reference catalog. A ratio of 0.7 indicates the whole frame is approximately 0.4 magnitudes dimmer.
Localized extinctionSmall clouds This divides per-cell flux ratios by global transparency. A passing cloud shows as a coherent dip in a specific patch of stars.
Star-share dropsSmall opaque clouds This compares each cell's share of the stars in the frame against the temporal median of that cell using a Poisson-aware calculation.
Background riseErrant light (headlights, flashlights) This compares the per-cell background level to the history of that cell after subtracting the gradient using a robust plane fit.
Background fallDark occluders, cloud shadow This measures background drops where an occluder blocks skyglow, causing the area to appear darker.
Static glowCorner haze, lit occluder edges This flags cells that are brighter than the gradient model of the frame. This detects issues present from the first frame, which temporal baselines cannot identify.
Fresh plate solutionOff-target frames, pointing jumps/drift, deterministic no-solves The solver processes the current pixels and compares the solved center with the target coordinates, stable framing clusters, and drift within the segment.

These signals feed a sequence analyzer that scores each frame from 0 to 1 relative to its session. Sessions are defined by the same target, filter, and exposure, and they are split when a gap of 60 minutes or more occurs. The analyzer classifies potential issues with verdicts of OK, WARN (for recoverable issues like gradients that flat-frame processing can resolve or glow that causes stacking artifacts), and REJECT (for severe issues like clouds and occlusion).

Scores are calculated using only the available evidence. If an optional scan has not run, the analyzer renormalizes the score using the completed checks instead of penalizing the frame. This ensures that frames without spatial scans are not graded down, and a frame will receive the same score regardless of the session context or project view.

The analyzer applies score guardrails and penalty controls

A low relative score does not automatically assign a fault or recommend a rejection. PSF Guard only assigns a specific cause when the corresponding detector collects sufficient evidence, and rejection recommendations are based on these causes rather than the score alone.

The system applies an absolute guardrail: any light frame with zero detected stars receives a failing score and is assigned a No Stars Detected cause, even if no other sequence frames are available. Frames that have not been measured are not penalized, as missing optional analysis is not treated as evidence of a poor image.

You can adjust how strongly satellite trails, pointing failures, and temporal anomalies affect the score by opening the Penalties section in the Sequence view. The penalty sliders range from 0% (which ignores the evidence) to a default of 100%, up to a maximum of 200% (which doubles the score penalty). The chosen settings apply to the Sequence view, grid badges, and detail panel. The zero-star guardrail is fixed and cannot be scaled. Setting the satellite or pointing penalty to 0% also prevents that evidence from triggering a rejection recommendation.

Sequence Analysis with the Satellite, Pointing, and Temporal penalty controls open
The Sequence view displays the three evidence penalty controls next to the score distribution, session groups, and frame recommendations.

Get started with quality screening

In the app
Open the Sequence view for a target and click Scan Quality.

Results are displayed on the affected frames and are cached across application restarts.

Sequence view →

You can use the selectors to focus on Clouded, Off Target, Unsolved, or all Recommended frames. PSF Guard displays a review screen before applying any rejections. For more information, see Astrometry Quality.

CLI / NAS
You can screen folders in batches or without using a database.

Include the --regrade-db option to enable target-aware checks and grade proposals.

CLI reference →
# Screen a night of lights (no database needed)
psf-guard screen-fits "/path/to/2026-06-30/LIGHT"

# Render an annotated diagnostic PNG for every WARN/REJECT frame
psf-guard screen-fits "/path/to/LIGHT" --annotate /tmp/diagnostics

# Add target-aware astrometry and propose/write supported [Auto] rejections
# (dry-run first; frames matched by filename AND capture timestamp)
psf-guard screen-fits "/path/to/LIGHT" --regrade-db my-db-slug --dry-run
psf-guard screen-fits "/path/to/LIGHT" --regrade-db my-db-slug

# Then archive the rejected files out of your stacking tree
psf-guard move-rejects --db my-db-slug

If orbital elements are cached, the quality scan projects satellite crossings and checks a narrow pixel corridor along each predicted path. Predicted crossings that are not detected in the pixels generate a warning, while only pixel-confirmed high-risk trails trigger a rejection recommendation. See Satellite Tracks.

Read the annotated diagnostic images

The --annotate option renders each flagged frame with an overlaid analysis grid. Cells are color-coded based on the triggered detection signal, and the caption contains the verdict, score, per-frame metrics, and classifier details.

MarkingMeaning
Red fillThis indicates a dead cell where the star density collapsed due to occlusion.
Orange fillThis indicates localized extinction where stars are dimmed by a small cloud, labeled with the cell's flux ratio.
Magenta fillThis indicates a transient drop in the cell's share of stars.
Yellow borderThis indicates a transient background rise caused by stray light.
Blue borderThis indicates a transient background fall caused by a dark occluder or cloud shadow.
Cyan fillThis indicates static glow that rises above the gradient model of the frame.

The detector identifies arriving occlusion

Occlusion onset: red cells trace the tree line
In this frame, 25% of the cells have lost their stars, and the red region traces the out-of-focus occluder. The transparency metric is 1.01, indicating that the remaining unoccluded field is photometrically normal. This explains why global metrics fail to catch these frames.

The detector flags heavy occlusion with a lit edge

Heavy occlusion with a yellow-bordered stray-lit cell
Half of the field is flagged as dead, and a yellow border highlights a cell where the background level rose above its temporal baseline. This occurs when the stray-lit edge of the occluder bleeds into a live cell.

The boundary of the advancing occluder is highlighted

Blue cells darker than history, yellow lit fringe
Later in the same session, blue borders mark cells that are darker than their historical average because the dark occluder blocks background skyglow. Yellow borders mark the illuminated edge of the occluder.

Photometry detects thin cloud veils

Clean frame: 2973 stars, transparency 1.05
This clean frame has 2,973 stars and a transparency of 1.05.
Veiled frame: 1417 stars, transparency 0.63, REJECT
The same field 13 minutes later has 1,417 stars and a transparency of 0.63, representing approximately 0.5 magnitudes of uniform extinction. This is marked as REJECT.

No individual cell is flagged because there is no localized degradation. The issue is detected solely through the matched-star flux ratios. This frame was accepted by conventional grading tools.

The static glow detector flags corner haze

Cyan cells sitting on corner haze at 4.7% above the gradient plane
Haze is present from the first frame of the session, which makes temporal detectors unable to identify it. The static glow signal instead compares each cell against the gradient model of the frame. The cyan cells highlight the haze, which measures 4.7% above the plane.

You can tune the screening detectors

The default parameters were calibrated against clean-frame envelopes across multiple nights and filters. The primary configuration settings are listed below:

KnobDefaultNotes
--min-score0.35This sets the composite score threshold below which a frame is rejected.
--dead-cell-rise0.08This sets the occlusion sensitivity. Clean-frame jitter is usually 0.04 or lower, making 0.08 a conservative threshold.
--session-gap60 minThis defines the gap in minutes used to split sequences into separate sessions.
glow threshold2.5% of sky and >30 ADUThe ADU floor prevents narrowband nebulosity from triggering false detections. True haze typically measures 48 to 103 ADU. This setting is rig-specific.
transparency threshold0.80This sets the global transparency threshold for uniform veil rejections.

Safety properties prevent incorrect rejections

The quality screening system has some limitations

The complete technical documentation is available in the repository at docs/SCREENING.md.

More projects from theatr.us