Rejects & Sync

Two workflows that close the loop after grading: getting rejected files out of your stacking software's way — reversibly — and moving grades and captures between machines.

Managing rejected files

Stacking tools like PixInsight happily load everything under your lights directory — including frames you've rejected. move-rejects archives rejected frames (and their sidecars: .xisf, .json, .txt) into a REJECT/ subtree so they're out of the scan path but never lost:

# Move rejects to <image_dir>/<Project>/REJECT/... with their sidecars.
# Idempotent; every move is recorded for restore.
psf-guard move-rejects --db my-db [--dry-run]

# Changed your mind? Un-reject frames in the UI, then:
psf-guard restore-rejects --db my-db          # restores only un-rejected files
psf-guard restore-rejects --db my-db --all    # restores everything
Requires Target Scheduler plugin schema v22+ (the stable image GUID). Older databases are refused with a pointer at the legacy filter-rejected command, which still works but leaves files in the same tree.

Syncing between machines

Grade on one machine while the telescope keeps capturing on another. sync moves state between two scheduler databases — registry slugs or .sqlite paths — matching images by their stable GUID:

# Mirror projects, targets and captured images FROM the telescope INTO your DB.
# Your local grading is preserved; new images arrive with the telescope's grade.
psf-guard sync pull --from telescope.sqlite --to my-db --dry-run

# Push your grading decisions back TO the telescope (one-way, source wins).
psf-guard sync grades --from my-db --to telescope.sqlite --dry-run

Use them as a loop — pull to refresh, grade locally, push grades back:

Don't reverse the directions — pulling grades from the telescope over your local decisions, or pushing structure to it, would overwrite work. The two commands are deliberately one-way and complementary.

The full loop, end to end

# 1. Bring the night's captures over from the telescope
psf-guard sync pull --from telescope.sqlite --to my-db

# 2. Screen the night automatically, write rejections
psf-guard screen-fits /images/2026-06-30/LIGHT --regrade-db my-db

# 3. Review borderline frames in the grader UI
psf-guard server

# 4. Archive rejects out of the stacking tree
psf-guard move-rejects --db my-db

# 5. Push final grades back so the scheduler re-captures
psf-guard sync grades --from my-db --to telescope.sqlite