Description
Three quantitative diagnostics of the stacked image (or of a raw frame): PSF quality map with tilt and field-curvature detection, per-zone SNR and limiting magnitude, and transient detection by differencing against a reference stack.
What it does
The plugin provides three global analysis stages. They do not modify the image: they write reports (PNG + JSON) and a summary in the project state, which the report stage and the interface pick up.
All three work on the luminance (mean of the channels; a CFA frame is reduced to 2 × 2 superpixels, coordinates being scaled back to the frame afterwards). On the stacked image they preferably use the linear version kept by the core, even when placed after stretch.
psf_map — PSF quality map
- Star detection (SEP,
thresholdσ) and measurement of each star: FWHM (from the a and b semi-axes of the ellipse), eccentricity 1 − b/a, orientation. Objects that are too small (FWHM < 1.2 px, hot pixels) or outliers (FWHM > median + 8 MAD) are discarded. - Aggregation on a
grid×gridgrid: median FWHM, median eccentricity and mean oriented elongation (vector mean of the orientations, which does not cancel out when all the stars in a zone are stretched in the same direction). A zone with fewer thanmin_starsstars is left empty. - Split into 9 zones (corners, edges, centre) and diagnosis:
- tilt suspected if the FWHM spread between the four corners exceeds
tilt_threshold(the blurriest corner is named); - field curvature / backfocus if the corners are uniformly blurrier than the centre (ratio > 1 +
tilt_threshold) without tilt; - left/right and top/bottom asymmetries;
- elongated stars in the corners (coma or off-axis astigmatism) if corner eccentricity clearly exceeds that of the centre.
- tilt suspected if the FWHM spread between the four corners exceeds
- Summary image: colour FWHM map, eccentricity map with elongation strokes, and an aberration inspector (enlarged crops of the 9 zones,
tilepx wide).
snr_analysis — SNR, limiting magnitude, stacking gain
- Per-zone SNR on a
grid×gridgrid: background estimated by SEP, stars masked (3 σ segmentation, dilated); signal = local median − global background (sigma-clipped mean), noise = MAD of the background pixels outside stars. - Limiting magnitude at SNR = 5: aperture photometry (radius 1.5 × FWHM) of unsaturated stars, linear fit of log(SNR) versus magnitude, extrapolated to SNR = 5. If the
spccstage (plugin "astrometry") has provided a zero point, the magnitude is calibrated; otherwise it is relative (0 = brightest star in the field). - Stacking SNR gain: from the weight and noise of each frame (
qualitystage), equivalent number of frames (Σw)²/Σw², theoretical gain √N_eq, theoretical gain curve versus number of frames, and contribution of each frame (the "least useful" one is reported). curveoption: actual measurement of the gain by progressively stacking a central area (boxpx) of thecurve_framesbest aligned frames, the noise being estimated from differences between neighbouring pixels (insensitive to gradients).
transients — transients by image differencing
- Loads a reference stack of the same field (FITS, TIFF, PNG… or
.npy) and converts it to luminance. - Aligns the reference on the current image (astroalign, affine transform, cubic interpolation) if
alignis enabled. - Difference: background subtraction (SEP), PSF matching (the sharper image is blurred to the FWHM of the other), photometric scaling (median flux ratio of common stars), then current − scale × reference.
- Detection of positive sources (appeared or brighter) and negative ones (disappeared or fainter) above
sigmaσ, edges excluded. Star residuals whose variation stays belowstar_tolerance× their flux are ignored. Each detection is labelled "new source", "vanished source" or "variable" (if a reference star lies within 2 FWHM), and gets RA/Dec coordinates when a WCS is available.
When to use it
psf_map: tuning the optical train (camera tilt, backfocus of a flattener or reducer on a refractor), checking collimation, checking a smart telescope (Vespera, Seestar) after transport. Withframe: 0, a raw frame is analysed: this is the best way to judge the optics, without the smoothing introduced by registration and stacking. On the stack, the map also shows the effects of tracking and alt-az field rotation.snr_analysis: comparing nights, sites (light-polluted or not), filters (dual-band vs. no filter on a colour sensor) or settings; knowing how many more frames are worth taking (the gain curve flattens when the added frames are of poor quality); spotting a frame that brings almost nothing.transients: looking for a supernova in a galaxy, following a variable star or a nova, spotting an asteroid (which shows up as a + / − source pair) by comparing with a stack from another night.
Do not use it:
- on the Moon, planets or the Sun (no point-like stars: PSF and limiting magnitude are meaningless);
psf_mapon a field with very few stars (fewer than about ten): the map is empty or unreliable;transientswith a reference taken with a very different instrument (sampling, filter): the difference leaves many residuals; a non-linearly processed (stretched) reference also produces false transients.
Installation
astrostack plugin install analysis
Or from the application: Plugins view, "Image analysis" page, Install button.
No additional Python dependency: the plugin uses NumPy, SciPy, Astropy, OpenCV, SEP and astroalign, already required by the astrostack core.
Parameters
psf_map
| Parameter | Type | Default | Description |
|---|---|---|---|
grid |
integer (2 to 20) | 5 |
Number of zones per side of the map. |
frame |
integer (optional) | none | Analyse a calibrated raw frame (index) instead of the stacked image. |
threshold |
float (2 to 50) | 5.0 |
Star detection threshold (σ). |
min_stars |
integer (1 to 50) | 3 |
Minimum number of stars per zone. |
tile |
integer (16 to 512) | 64 |
Size of the aberration-inspector crops (px). |
tilt_threshold |
float (0.02 to 1) | 0.15 |
Relative FWHM difference reported as tilt or curvature (0.15 = 15 %). |
snr_analysis
| Parameter | Type | Default | Description |
|---|---|---|---|
grid |
integer (2 to 32) | 8 |
Number of zones per side for the SNR map. |
frame |
integer (optional) | none | Analyse a calibrated raw frame (index) instead of the stacked image. |
curve |
boolean | false |
Actual measurement of the SNR gain by progressive stacking (costly: re-reads the frames). |
curve_frames |
integer (2 to 200) | 16 |
Maximum number of frames for the measured curve. |
box |
integer (64 to 2048) | 384 |
Size of the central area used for the measured curve (px). |
transients
| Parameter | Type | Default | Description |
|---|---|---|---|
reference |
text (path) | "" (required) |
Reference stack of the same field (FITS/TIFF/PNG/npy, preferably linear). |
sigma |
float (2 to 30) | 5.0 |
Detection threshold in the difference image (σ). |
minarea |
integer (1 to 100) | 5 |
Minimum area of a detection (px). |
align |
boolean | true |
Align the reference (astroalign); disable if it is already registered to the pixel. |
star_tolerance |
float (0 to 2) | 0.3 |
A star residual is ignored if it stays below this fraction of its flux. |
max_results |
integer (1 to 10000) | 200 |
Maximum number of transients listed. |
None of these stages has a mask parameter: they are analyses and do not modify the image.
YAML examples
Recommended position: after crop (poorly covered edges skew the measurements), and for snr_analysis after spcc if you want a calibrated limiting magnitude. They can also be placed at the end of the chain (before report): they re-read the linear version.
Full diagnosis of a session:
pipeline:
- stack: {method: sigma_clip}
- crop: {min_coverage: 0.9}
- platesolve: {} # plugin "astrometry", for spcc
- spcc: {reference: G2V} # zero point for the limiting magnitude
- psf_map: {grid: 6}
- snr_analysis: {curve: true, curve_frames: 30}
- stretch: {method: auto}
- export: {formats: [fits, png]}
- report: {} # includes the maps and figures
Checking tilt or backfocus on a raw frame (Vespera, refractor + flattener):
pipeline:
- masters: {}
- psf_map: {frame: 0, grid: 7, tilt_threshold: 0.1}
Supernova search against a stack from a previous night:
pipeline:
- stack: {}
- crop: {}
- platesolve: {} # optional: adds RA/Dec to detections
- transients:
reference: ~/Astro/M101/2026-04-12/out/M101_linear.fits
sigma: 6
max_results: 50
Outputs
Files written to the output folder (output.dir), <name> being the project (or group) name:
| Stage | Files | ctx.state key |
|---|---|---|
psf_map |
<name>_psf_map.png (maps + inspector), <name>_psf_map.json (FWHM/eccentricity/elongation/angle/star-count grids, 9 zones, diagnosis) |
psf_map: json, png, n_stars, fwhm_median, center_fwhm, corner_fwhm, tilt, curvature, messages |
snr_analysis |
<name>_snr_map.png (SNR map overlaid on the image), <name>_snr.json (signal/noise/SNR grids, limiting magnitude, measured stars, weights, theoretical and measured gains, contribution of each frame) |
snr: median_snr, limiting_mag, mag_system, n_equivalent, snr_gain, json, png |
transients |
<name>_transients.png (circled, numbered detections: green = appeared, red = vanished), <name>_transients.json (list: x, y, RA/Dec, sign, flux, SNR, type) |
transients: n, json, png |
The three stages are excluded from the Workshop's interactive preview (preview = False) and create no checkpoint (the image is not modified). A summary is printed in the log. Messages and labels written by the stages are in French.
Limitations
- FWHM in pixels, measured from SEP moments: a robust estimate for comparing zones, not fitted PSF photometry. On the stack, registration (interpolation, field rotation) slightly broadens the stars; use
frame:to judge the optics. - The tilt/curvature diagnosis relies on simple thresholds; a field with a dense nebula or very few stars in one corner can trigger a false alarm.
- Limiting magnitude: without an
spcczero point it is relative to the brightest star and cannot be compared across fields; withspcc, its accuracy depends on that of the zero point (Gaia band, filters and sensor response curve are not modelled); it is an extrapolated estimate, not a completeness measurement. - The theoretical SNR gain assumes independent noise; the measured curve (
curve) only covers the central area and re-reads the frames (time proportional tocurve_frames); it requiresregister. transients: the result depends on the quality of the reference (same field, same filter, ideally the same sampling, linear image). Saturated stars, strong-gradient areas and frames with very different seeing leave residuals. No distortion correction: affine alignment only. RA/Dec coordinates require a WCS (platesolve).
Licences
- Plugin: MIT licence, © Erwan Sturzenegger.
- Dependencies (provided by the astrostack core): NumPy (BSD-3-Clause), SciPy (BSD-3-Clause), Astropy (BSD-3-Clause), OpenCV (
opencv-python-headless, Apache 2.0), SEP (LGPL-3.0, with parts under BSD and MIT licences), astroalign (MIT).
Steps provided
This plugin adds 3 steps to the pipeline.
| Step | Type | Role |
|---|---|---|
psf_map PSF quality map | Analysis | FWHM and eccentricity across the field, aberration inspector (tilt, coma). |
snr_analysis SNR analysis | Analysis | SNR per region, limiting magnitude, stacking gain. |
transients Transients | Analysis | Sources that appeared or vanished, by difference with a reference stack. |
- Analysis Measurement or annotation, writes result files.
Dependencies
No dependency beyond CelestiaX: the plugin works as soon as it is installed.
Versions
- 1.0.0 current
Initial release (extracted from the astrostack core)