Rejects and Database Sync

Move rejected frames out of the folders your stacking tool reads, remove old rejects from the catalog, and copy captures, plans and grades between two catalogs: two database files, or two PSF Guard servers.

Manual transfer
Use the Sync plugin for N.I.N.A.

The plugin transfers captures, plans and grades between the telescope and PSF Guard. Use the database transfer steps below when you need to copy between separate database files by hand.

Connect N.I.N.A. →

Archive rejected files

CLI
Preview with --dry-run first

Every move is recorded, so a restore puts each file back where it was.

CLI reference →

Stacking tools such as PixInsight load every file under your lights folder, rejected frames included. move-rejects moves each rejected frame and its sidecars (.json and .txt by default) into a REJECT/ folder just below the project folder, and records where each came from:

# Move rejects to <image_dir>/<Project>/REJECT/... with their sidecars.
# Re-runs skip frames already moved.
psf-guard move-rejects --db my-db --dry-run
psf-guard move-rejects --db my-db

# Un-reject frames in the UI, then bring them back
psf-guard restore-rejects --db my-db          # only frames no longer Rejected
psf-guard restore-rejects --db my-db --all    # everything in the archive
Archiving needs Target Scheduler schema 22 or later, for stable image GUIDs. If Target Scheduler skipped giving older rows a GUID, Fill in GUIDs under Settings → Databases fills them; see Configuration. The legacy filter-rejected command remains for its statistical flags.

Remove old rejects

An archived reject stays in the catalog. To take frames that are truly bad out of it, and free their disk space, remove them. Removal runs only when you ask, and a restore undoes it until the trash is emptied. It needs an editor.

  1. In Settings → Databases, click Purge Rejects beside the database's Import.
  2. Choose how many days a frame must have been rejected (7 by default; 0 takes every reject) and click Preview. The preview lists the frames and their size, and explains why any rejected frame will remain.
  3. Choose how many days to keep the files in the trash (14 by default) and click Remove N frames.

Sync pulls, imports, automatic imports and remote uploads leave removed frames out, purged ones included, and plan progress still counts them as rejected. Removal changes only this catalog: a rig's own Target Scheduler copy keeps its rows.

# Preview, then remove frames rejected 7 days ago or more.
# --cache-dir points to the server's cache, so the frames' cached files go too.
psf-guard remove-rejects --db my-db --days 7
psf-guard remove-rejects --db my-db --days 7 --apply --cache-dir /path/to/cache

psf-guard list-removed --db my-db
psf-guard restore-removed --db my-db --batch <batch>
psf-guard empty-reject-trash --db my-db    # files past their time in the trash
psf-guard purge-removed --db my-db         # saved rows of emptied batches

Direct database access (deprecated)

Your current Target Scheduler setup will keep working in 0.12, including direct CLI/API access. A later update will create a PSF Guard catalog for you and keep captures, plans and grades in sync with Target Scheduler. Separate catalogs let us add features to PSF Guard and support new Target Scheduler versions. We plan to remove direct database access in 0.13 or later.

For new Target Scheduler databases, choose Settings → Databases → Import from Target Scheduler to import the database and set up sync.

Import a local TS file and keep the source connected, or choose the N.I.N.A. Sync plugin for a network connection.

Back up before writing through an existing direct registration. Grading and planning edits write to the shared file. Use Backups to copy catalogs safely while N.I.N.A. runs.

Image folders can be read-only. A directly opened database must be writable to save grades and plans. When both applications use that file, those edits need no transfer. New imports use a separate working catalog instead.

Sync two database files

Grade on one machine while the telescope keeps capturing on another. Sync copies chosen state between two Target Scheduler databases, each given as a registry slug or .sqlite path, and matches rows by their stable GUID (schema 22 or later).

Data Transfer in Settings

Choose the source, destination and action, then preview the changes before applying them.
Choose the source, destination and action, then preview the changes before applying them.

For an imported TS catalog, the saved Target Scheduler connection appears beside the owned catalog in the source and destination lists. You do not need to register the source as a second catalog. Turn off automatic grade writeback if you want to send grades only after review.

Open Settings → Sync. Data Transfer takes a Source and a Destination and offers three directions:

DirectionCopies
Merge catalogsProjects, targets, plans and captures. Reviewed grades already at the destination win. Include stored image thumbnails copies Target Scheduler's thumbnails too.
Send planningProjects, targets, templates, exposure plans and rule weights. Captures, counts and grades at the destination stay.
Send reviewed gradesGrades and reject reasons. Pending grades stay out by default.

Each direction makes a preview on the server first. The preview keeps a frozen copy of the source and comes back after a page reload. Apply refuses if the destination changed since the preview. The Sync tab needs an editor.

Calibration travels with a merge

New in 0.12. A merge carries calibration choices and flat-group choices, and its preview counts them.

Merge catalogs and sync pull also copy the calibration library: rigs, raw calibration-frame records and their grades. Generated masters and cached files stay behind; the destination builds its own. With them travel the choices that change which frames a master takes or which flats PSF Guard uses for a light:

The preview counts these choices, such as "Calibration choices: 3 kept out, 1 used anyway. Masters built from these frames change.", because they change the destination's masters. The Remote PSF Guard preview counts them as calibration choices.

Merge preview with zero new rows, two updated rows, one calibration frame kept out and one used anyway.
The merge preview includes one Keep out choice and one Use anyway choice. Apply this preview would update two rows.

An import catalogues a calibration frame that is on disk twice, such as a copy a filer has not yet cleaned out of the drop folder, once; when the original goes, its row moves to the copy and keeps its grade and marks. A later pull does not undo a duplicate repair: a row a repair merged here is never brought back from a catalog that still holds it, and a row the source's repair merged is merged here too, its masters built again. The source keeps its own duplicates until it is repaired there. See Calibration Libraries.

Sync from the command line

# Captures and structure FROM the telescope INTO your copy.
# Your reviewed grades stay; new frames arrive with the telescope's grade.
psf-guard sync pull --from telescope.sqlite --to my-db --dry-run

# Edited projects, targets, templates, plans and rule weights back TO the telescope.
# Its captures, counts and grades stay.
psf-guard sync planning --from my-db --to telescope.sqlite --dry-run

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

All three open the source read-only, refuse when source and destination are the same file, run in one transaction, and report matched, changed, unchanged and unmatched rows. Each takes --dry-run and --project.

How rows match

RowMatched byResult
Project, target, template, planGUIDThe source wins in the direction you chose
Captured frameGUIDInserted, or its capture fields updated
A frame PSF Guard catalogued itself (import or upload) before the telescope's row arrivedTarget, file name, and capture time within 2 sUpdated in place: it takes the telescope's GUID and keeps a reviewed grade
A frame catalogued from its calibrated copy before the raw file arrivedTarget, capture time, exposure and filterUpdated in place: the raw file becomes the light, and a reviewed grade stays
Reviewed grade during a mergeGUIDThe destination wins
Keep out or Use anyway on a calibration frameFrame IDThe later choice wins; a destination choice stays with its file
Flat-group split or join, a light's flat sideFlat and light GUIDThe later choice or reset wins
Pending grade during a mergeGUIDFilled from the source
Grade pushGUIDThe source grade and reason win
Row only at the destinationKept
Duplicate or empty GUIDSkipped and reported
Same name or coordinates, another GUIDWarned about, never merged
Keep to these directions: pull from the telescope, then send planning and grades back. A pull protects your reviewed grades, a planning push leaves the telescope's capture history alone, and a grade push changes only grades. Reversing one direction could overwrite work.

Staged previews

Settings → Sync → Staged previews lists every transfer waiting on the server, including those the N.I.N.A. plugin sent: the catalog, operation, source, change counts and expiry. Expand What would change for the field changes, grade transitions, reject reasons, and the projects, targets, plans or frames to be inserted or updated, up to 400 lines.

Nothing changes until you click Apply. The server prepares large previews in the background while the page checks progress.

In Data Transfer and Remote PSF Guard, you can change options while a preview runs. PSF Guard stops that preview; click Preview changes to check the new choices. A newer preview replaces one still running. You can also stop previews from the header’s jobs list.

Sync with another PSF Guard

One PSF Guard can sync with another over HTTP: no shared file system, and no copying a live SQLite file. The peer must allow it. On the peer, edit the catalog under Settings → Databases, generate a Remote API key, and tick Accept remote scheduler sync. A server with no Settings grants the same with a [[remote_sync]] block in its config file; see Configuration.

Add a peer before testing a connection or previewing a remote transfer.
Add a peer before testing a connection or previewing a remote transfer.

Then, on this server, open Settings → Sync → Remote PSF Guard:

  1. Click Add peer, enter its Name, Base URL and API key, and click Save peer. The key stays on the server and is never sent back to the page.
  2. Click Test connection.
  3. Choose Pull from peer, Send planning or Send grades, and the Local catalog.
  4. Click Preview changes, read the counts, then Apply this preview.

The command line does the same, for a terminal or a cron job:

psf-guard sync remote --direction pull \
  --local review --peer https://telescope.example:3000 --token-file key.txt

--direction takes pull, push-planning or push-grades. Every direction previews first. A push is reviewed by the peer, which writes nothing until the preview it issued is applied. --dry-run stops after the preview. push-grades sends only reviewed grades unless you pass --all-grades. The key comes from --token-file, then PSF_GUARD_SYNC_TOKEN, then --token; an argument is visible to every process on the machine.

The peer appends every remote action, refusals included, to remote-sync-audit.jsonl in its cache folder.

To sync a live Target Scheduler database from N.I.N.A. itself, without copying files or running a second server, use the PSF Guard Sync plugin.

Run the whole loop

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

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

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

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

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

More projects from theatr.us