Spectrophotometric Standard Star Calibration (SSSC)

No-QE-curve color calibration. SSSC solves the camera's true effective response R(λ) from the stars already in the image — compared against real measured spectra from the Gaia mission — rather than taking a sensor QE curve as an input. Filter curves stay as inputs; everything else (sensor QE at operating temperature, AR coating, optics, atmosphere) is absorbed into R(λ) and solved empirically. Each run's solution is kept in a per-rig session history.

Published method. SSSC is a SetiAstro invention, documented in a formal whitepaper:
Marek, F. (2026). Spectrophotometric Standard Star Calibration: An Empirical System-Response Approach to Astrophotographic Color Calibration. Zenodo. doi:10.5281/zenodo.23107662. Wiki page: GitHub Wiki.

1. Using the tool

The window is the settings for your optical chain and one button. Pick the filters once (they and the Camera / Rig label are remembered), make the image you want calibrated the active view, and press Calibrate. SSSC finds the stars, looks up their spectra, measures them, solves the system response, applies the correction, and shows a summary and every chart beside the settings. On a 12 Mpx frame that takes about 6–11 seconds; the first run of a session is the slower one. Continuing a long-term calibration on the same equipment is just “open, Calibrate”.

SSSC needs a plate solution to map pixels to sky coordinates. If the active document already has a WCS it's used directly; otherwise Calibrate offers to run the plate solver first. Undo reverts the calibration like any other edit.

The settings

What Calibrate does

Finding the stars and their spectra is mechanically identical to SFCC (same auto-σ SEP search, same bulk Gaia-library match and plate-solution check, same SIMBAD query, same B−V letter inference, same synthetic Johnson B/V/R via gaiaxpy) — see the SFCC doc. The stars are found once and measured where they were found; the old two-step window detected them all over again for the solve. The calibrators are the stars with a Gaia XP spectrum; Pickles templates (from SIMBAD spectral types) fill in only when there are fewer than 50 of them, because a template is a dust-free spectrum and predicts a reddened star too blue. Then the calibrators are measured, the response is solved at the highest bootstrap stage the field supports (§2.2), the correction is applied, and the solution is saved to the session history.

Session memory — the long game

SSSC accumulates calibration quality across runs. Every solve is saved, keyed on the filter + camera combination, into the Gaia XP sqlite cache:

Over several nights of imaging with the same rig, the history builds the data for your actual rig-specific R(λ) — a measurement no datasheet could give you. See §2.7 for the endgame.

Reading the results

The lines above the charts give the star count (Gaia XP spectra and Pickles templates), the time the run took, the stage reached, the B−V range, the residual RMS, how many runs the session has, the gains, and how many more stars (if any) stand between you and Stage 3. The report below has six panels: the four diagnostics, and in the right-hand column the same two star charts SFCC shows (the spectral-type histogram and the calibration-source pie; see the SFCC doc for reading them). The suptitle names the stage reached, star count, and per-stage RMS waterfall.

An amber warning under the summary means the stars do not follow the chosen filter curves (the scalar Stage 1 fit leaves more than 8 %; about 2 % is normal). The usual cause is an OSC camera behind a UV/IR cut described by UV-cut-only curves: pick the UV/IR-cut curves, or add the cut filter as LP/Cut.

Panel 1 — Solved R(λ) per channel

The headline plot. For Stage 3 each channel's own solved R(λ) is drawn as a solid colored line (R red, G green, B blue) inside its filter passband, with the three filter transmission curves shaded faintly behind. For Stage 1/2 a single stitched dashed grey composite is drawn instead, because the stages don't solve for the detailed shape. If a manufacturer QE curve is passed in (not by default), it's overlaid in dashed amber for comparison. This panel is the plot that replaces the QE datasheet: it's what the solver saw, through this camera, on this night. A healthy Stage 3 result shows three smooth response lobes, one per channel, each covering its own filter without wild spikes or dropouts.

Panel 2 — Residuals before / after

Scatter of fractional residuals (meas/exp − 1) in R/G and B/G ratio space vs expected ratio, four series: dark circles for before correction (what the raw image showed), lighter triangles for after. The before clouds should sit off the zero line (that's the colour error SSSC is fixing); the after triangles should collapse to a tight band on zero. The horizontal dashed line is the perfect-calibration reference. If a residual slope or curvature remains, the curves (or the model) do not describe this camera well.

Panel 3 — Calibration quality by stage (the waterfall)

A horizontal bar chart with one row per bootstrap stage, bar length = fractional-residual RMS, shorter is better. Stages that ran show as coloured bars with their RMS number; a green ▼ delta annotation on the right side of a row quantifies the improvement over the previous stage. Stages that did not run show as faint placeholder bars with an italic note (“need 142 more stars” or “Requires DR4 + multi-night airmass data”). The small monospace block at the bottom right of this panel reports the final gains k_R, k_G=1, k_B and the B−V span of the calibrator population — the two numbers that gate stage selection.

Panel 4 — Calibrator spectral coverage

Histogram of the B−V colour index of the valid calibrator stars, with the actual range used marked by two orange dashed lines. A good Stage 3 field looks like a broad hump covering roughly -0.3 to +1.8 — hot O/B stars pin the blue edge of each filter, cool K/M stars pin the red edge, together they triangulate the shape of R(λ). If the title says “need N more stars for Stage 3” this panel is where you'll see whether to point at a denser field (add stars) or a wider colour spread (add span).

After apply

Calibrate commits the calibrated image as an “SSSC Calibrated” step; the metadata records the stage reached, star count, residual RMS, gains, B−V range and session id for traceability.

Shortcuts and Function Bundles

The grip at the bottom of the settings column carries the window's current settings. Drag it to the canvas for a shortcut, or into a Function Bundle for a step; drop it on an image to calibrate that image straight away, with no window. To change a step's settings, use Edit Preset: the form opens on the settings saved in the SSSC window. A shortcut or step keeps the settings it was made with; a step with an empty preset uses whatever the SSSC window has saved.

A run from a shortcut or bundle plate-solves an image that isn't solved yet, and is saved to the session history like a run from the window. Scripts can call it as ctx.run_command('sssc', {}).

2. Technical details

RGB only. The core departure from SFCC: SSSC never multiplies by a sensor QE curve. Instead it treats the per-channel system response R_c(λ) as the unknown and solves it from the measured photometry of stars with known Gaia XP spectra. The filter transmission is the only published optical datum that enters the solver.

Third-party data used. Gaia DR3 XP calibrated spectra (ESA/DPAC) via gaiaxpy; the Pickles 1998 stellar flux library and SIMBAD (CDS Strasbourg) as fallbacks when a field has fewer than 50 XP stars; SEP for source extraction. The empirical system-response solver, the bootstrap-stage machinery, the hat-basis control-point parameterisation, the Stage 3 least-squares solve with its per-star grey factor, the session history, and every SSSC-specific guard below are SetiAstro's own work — see the published whitepaper for the formal derivation.

2.1 The model

For every star i and channel c ∈ {R, G, B}:

\mathrm{measured}_c \;=\; k_c \,\int f_{\mathrm{star}}(\lambda)\,T^{c}_{\mathrm{filter}}(\lambda)\,R(\lambda)\,d\lambda

(integrated photon-counting, ∫ f λ T R dλ: a sensor counts photons, each of energy hc/λ; until 2026-11-28 the integrals were energy, a difference of about 1 % once the white reference divides out) where f_star(λ) is the Gaia XP calibrated spectrum (interpolated onto the 3000–11000 Å, 1 Å grid), over the whole filter curve, T_filter^c is the published filter transmission (combined with any LP/cut filters), R(λ) is the unknown effective system response the solver is after, and k_c is a per-channel scalar gain. R(λ) absorbs everything the manufacturer QE curve cannot tell you — true sensor QE at operating temperature, AR coating transmission, mirror and lens throughput, flattener, and atmospheric extinction at the time of observation.

2.2 Bootstrap-stage selection

The solver automatically picks the richest stage the data supports. Two numbers decide: N = valid calibrator stars, and Δ(B−V) = (B−V)_max − (B−V)_min = colour span of the population:

Stage = 3 if N ≥ 200 AND Δ(B-V) ≥ 1.5 2 if 50 ≤ N < 200 1 if N < 50

Stage 3 is kept unless its RMS is more than 1.25× Stage 2's (§2.5). With a field of 50 or more Gaia XP stars, N counts only those: Pickles templates fill in below that.

2.3 Stage 1 — scalar per-channel gains

The baseline. Compute measured and expected band ratios meas_RG = R_meas/G_meas, exp_RG = S_R/S_G (and likewise for B/G); the scalar gain that minimises per-star residual is the median ratio of ratios:

k_c=\mathrm{median}_i\!\left(\frac{\mathrm{meas}_{c/G}^{(i)}}{\mathrm{exp}_{c/G}^{(i)}}\right)

with k_G = 1 (G is the reference), each gain clipped to [0.1, 10]. Equivalent to a traditional scalar SPCC white balance — but computed with no QE curve.

Every stage's RMS is a fractional residual on the same 3σ-clipped stars: for Stage 1, (m/k)/exp − 1; for Stage 2, p(m)/exp − 1; for Stage 3, the measured ratio against the solved one. (Until 2026-11-28 Stage 1 used k·m and Stage 2 m/p(m), which measure the gain, not the fit: 0.31 and 0.17 on ngc1333, where the true numbers are 0.018 and 0.017.) A Stage 1 RMS above 0.08 raises the curve-mismatch warning.

2.4 Stage 2 — color-dependent band response

Same three-model fit as SFCC §2.4 (slope-only closed form, affine least-squares, quadratic polyfit), scored by fractional-residual RMS and selected per channel. The important difference is that the expected integrals S_c are now computed with filter × LP only — no QE curve enters anywhere.

Two SSSC-specific guards protect against the pathological-field blow-ups that can occur with very wide B−V populations (carbon stars, extreme mismatches):

Applying it: the white reference

The fit maps a star's measured ratio m to its expected ratio p(m) ≈ S_c/S_G. An expected ratio is not a colour: through the Antlia R/G/B filters a G2V star's expected (R/G, B/G) is about (0.85, 1.12), because the bands differ in width and the spectrum in brightness. The corrected ratio is therefore the expected ratio relative to the white reference's, computed through the same curves:

\mathrm{gain}_c(m)=\frac{p_c(m)}{m\;\cdot\;S^{\mathrm{ref}}_c/S^{\mathrm{ref}}_G}

applied per pixel around the channel median (the background stays where it is). Stage 1 is the same with p(m) = m/k_c. Anything that scales a whole band — the unknown QE, exposure, the scale of a curve — scales the star and the reference alike and cancels, which is why SSSC needs no QE curve. On ngc1333 the corrected star colours match each star's colour relative to G2V through the full filter × QE system to within 1–2 %. (Before 2026-11-28 the division was missing: stars were driven to their raw expected ratios, which left them about 8 % short in R/G and 20 % over in B/G — a purple cast.)

2.5 Stage 3 — full R(λ) solver

The main SSSC contribution. For each channel SSSC solves for a piecewise-linear R_c(λ) parameterised by N_ctrl control points on the filter's main lobe:

R_c(\lambda)=\sum_{j=1}^{N_{\mathrm{ctrl}}} a_j^{(c)}\,\phi_j(\lambda)

where φ_j are tent (hat) functions on the ctrl_wl grid, held flat beyond the outer control points (never zero). The per-channel gain k_c is folded into a^(c). Each star's spectrum and its measured fluxes are divided by its own G integral, and precomputed weight matrices turn the spectral integrals into one matrix-vector product per channel, over the whole filter curve:

\hat{S}^{c}_i=\sum_{j} W_{ij}^{(c)}\,a_j^{(c)}\,,\quad W_{ij}^{(c)}=\int \tilde f_i(\lambda)\,\lambda\,T^{c}_{\mathrm{filter}}(\lambda)\,\phi_j(\lambda)\,d\lambda

Where the control points sit

On each channel's main lobe: the contiguous run around the peak where T_filter^c is above a fraction of its peak.

ChannelThresholdRationale
R0.30 Covers the steep rolloffs of astro filters.
G0.707 (half-power) Keeps the control points off an OSC Bayer green's secondary red lobe. The lobe is still in the integral: its light reaches the green pixels, so R(λ) there holds the nearest control value.
B0.30Same as R.

Until 2026-11-28 the green integrals (Stages 1–3) used only the half-power core, and Stage 3 integrated only inside these thresholds. The camera records the shoulders and the lobe, so the model left out flux the data contains. On real Gaia XP spectra with a simulated OSC camera (SONY_COLOR_SENSOR_*-UVCUT) that put star colours off by a factor of about 1.8; with the whole curve they came out within 1–2 %. On mono filters with no lobe it made no difference. A camera whose IR cut removes the lobes is described by choosing the UV/IR-cut curves, or by adding the cut filter as LP/Cut.

The solve

For star i and channel c:

m^{(c)}_i \;\approx\; s_i\,\hat{S}^{c}_i

s_i is a per-star grey factor: anything that scales all three channels of one star alike (aperture loss, the XP flux zero point, a passing cloud). Given s, each channel is a bounded linear least-squares problem (a ≥ 0) whose coefficients are exact (spectrum × filter × basis) and whose noise is only on the right-hand side; given a, s_i is the mean over channels of m/Ŝ. Six passes alternate the two. Rows are weighted by the model, so each residual is a fractional error; a mild second-difference penalty keeps R(λ) smooth; stars beyond 3σ (MAD) are dropped on each pass, and only stars Stage 2's clip kept take part at all. One overall level is free and is fixed by mean(a^(G)) = 1, which keeps the channels' relative levels: the camera's channel balance.

This replaced (2026-11-28) a coordinate descent in colour-ratio space, which stepped control values by ±10–20 %. That is about 1 % in an integral, coarser than the colour signal it chases, so the curve stayed at its flat start; and the ratio form puts the noisy measurements into the coefficients, a bias more stars do not remove. On real Gaia XP spectra with a known simulated response (1.5 % noise, 2 % grey per star) the new solve recovers R(λ) to about 1–3 % from 87 stars and about 1 % from 2000; the old one stayed at the flat curve's 3–10 % error. (Simulations check the arithmetic; the real test is your own data.)

Sessions

A convex solve has one answer whatever it starts from, so earlier sessions no longer seed it. Each session's control values are stored with their covariance (§2.6); that is what the multi-session Stage 4 needs to combine sessions, each weighted by how well it was measured.

Guard

Stage 3 is a physical model (one R(λ) per channel for every star); Stage 2 is a free quadratic fitted straight to the ratios. So Stage 3's ratio RMS can sit a little above Stage 2's and still be right. Far above means a wrong solve (unsuitable curves, a pathological field):

\mathrm{if}\;\mathrm{RMS}_3>1.25\,\mathrm{RMS}_2\;\Rightarrow\;\mathrm{keep\ Stage\ 2}

and nothing from the rejected solve is saved.

What drives the pixel correction

Even for a Stage 3 solve, the per-pixel correction applied to the image uses the Stage 2 quadratic coefficients with the white reference (§2.4). Stage 3's R(λ) is the measurement: the diagnostics panel and the session history. This is deliberate: a piecewise-linear R(λ) on 8–16 control points can have mild oscillation that is harmless in integral space but would be loud when evaluated per pixel; the Stage 2 quadratic is well-conditioned and carries all the gain information that matters for colour.

2.6 Session identity & the response cache

Each solve is tagged with an 8-character session id derived from the filter+camera configuration:

\mathrm{session\_id}=\mathrm{SHA256}\!\left([R,G,B,\mathrm{LP}_1,\mathrm{LP}_2,\mathrm{cam}]\right)[:8]

Deliberately independent of any QE curve name — SSSC is solving for QE, so it cannot be a key. The SessionResponseCache is a table in gaia_xp_cache.sqlite storing the full JSON-serialised SystemResponse for every run (gains, control points, per-stage RMS, timestamp, B−V range). Since 2026-11-28 each run also stores the covariance of its control values and what it was measured on: the filters, LP filters and camera label, the white reference, the image name and the header's DATE-AVG / DATE-OBS, AIRMASS and altitude (the observations Stage 4 needs). Each save appends; Clear History issues a DELETE WHERE session_id = ? and Delete Run deletes the one row.

The History window's combined curve is the inverse-variance weighted mean of the runs' control values, taken control point by control point, with σk,i from the diagonal of run i's covariance:

\bar a_k=\frac{\sum_i a_{k,i}/\sigma_{k,i}^2}{\sum_i 1/\sigma_{k,i}^2}

It is a display of agreement between nights, not yet Stage 4: it does not separate the atmosphere, so nights at very different airmass will disagree in the blue.

2.7 Stage 4 (future) — hardware/atmosphere separation

Not yet shipped. With Gaia DR4 (fainter XP coverage, so ∼10× more calibrators per field) and multi-session data spanning a range of airmasses, R(λ) decomposes as:

R(λ) = R_hardware(λ) × R_atmosphere(λ, X)

Hardware stays stable night-to-night (sensor, coatings, optics, filters); atmosphere varies with airmass X and conditions. Imaging the same rig across many nights at different airmasses lets the solver isolate R_hardware(λ) and lock it in permanently. From then on every calibration is Stage 2 speed with Stage 3+ accuracy, using your measured hardware curve instead of a datasheet guess. The curve also tracks aging naturally — mirror oxidation, filter wear, and optical changes appear as drift in R_hardware(λ) over time.

DR4 migration points in the code (filter-list bump to G ≤ 16.5, gaiadr3 → gaiadr4 query change, lowered Stage-3 star threshold, Stage-4 solver path, airmass header ingestion) are flagged in the module header for the forthcoming port.