\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[hidelinks]{hyperref}
\usepackage{siunitx}
\usepackage{xcolor}

\newcommand{\code}[1]{\texttt{\small #1}}
\newcommand{\mas}{\si{\milli\arcsecond}}

\setlength{\parskip}{0.4em}
\setlength{\parindent}{0pt}

\begin{document}

\title{Diagnostic measurements for the JWST field \textsc{sgrb2}}
\author{JWST Galactic Centre pipeline --- automated diagnostic write-up}
\date{2026-08-01}
\maketitle

\begin{abstract}
This document characterises the astrometric, photometric and diffuse-background measurements delivered for \textsc{sgrb2} (JWST programme(s) 5365). It is an analysis of the finished data products, not a quality gate: it asks how well the measurements behave and where their limits are, rather than whether they pass a threshold. Every figure is generated from the products on disk by \code{jwst\_gc\_pipeline.diagnostics}, and every number quoted in the text is read back from the same computation that drew the figure.
\end{abstract}

\section{Scope}
Three related efforts characterise these data and it is worth saying at the outset which is which. The \code{JWST-GC/data-qa} repository checks \emph{initial} data products, close to the telescope, and is oriented towards catching a bad exposure early. The astrometry paper is a technique-development document: it follows the iterative work of establishing how to measure a position at all in these fields. This write-up is neither. It takes the finished, released products for one field and measures their properties comprehensively, so that a user of the catalogue can see what precision they are entitled to assume.

\paragraph{Product gaps.} No per-filter catalogue for F1280W, F2550W.

\section{Products measured}
The field directory is \code{/orange/adamginsburg/jwst/sgrb2/}. The cross-band merge used here is \code{basic\_merged\_indivexp\_photometry\_tables\_merged\_resbgsub\_m7.fits} and the astrometric reference is \code{gaia\_virac2\_refcat\_epoch2024.68.fits}.

{\footnotesize
\begin{longtable}{lll}
\toprule
Filter & Per-filter catalogue & Mosaic \\
\midrule
\endhead
F150W & f150w\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f150w-nrcb\_i2d.fits \\
F182M & f182m\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f182m-merged\_i2d.fits \\
F187N & f187n\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f187n-merged\_i2d.fits \\
F210M & f210m\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f210m-merged\_i2d.fits \\
F212N & f212n\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f212n-merged\_i2d.fits \\
F300M & f300m\_merged\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f300m-merged\_i2d.fits \\
F360M & f360m\_merged\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f360m-merged\_i2d.fits \\
F405N & f405n\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f405n-merged\_i2d.fits \\
F410M & f410m\_merged\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f410m-merged\_i2d.fits \\
F466N & f466n\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f466n-merged\_i2d.fits \\
F480M & f480m\_nrcb\_indivexp\_merged\_resbgsub\_m7\_dao\_basic.fits & jw05365-o001\_t001\_nircam\_clear-f480m-merged\_i2d.fits \\
F770W & f770w\_mirimage\_indivexp\_merged\_resbgsub\_m6\_dao\_basic.fits & -- \\
F1280W & -- & -- \\
F2550W & -- & -- \\
\bottomrule
\end{longtable}
}

\section{Overview}
Figure~\ref{fig:D1_overview} orients the rest of the document. The per-filter catalogues hold 2,594,103 measurements in total, the largest being F466N with 288,115 sources over roughly 27730 square arcseconds. The peak surface density is 20.65 sources per square arcsecond and the typical occupied cell holds 10.32. At that density the mean separation between neighbours is comparable to the point-spread function, so crowding, not photon noise, sets the achievable precision over much of the field; the qfit and propagated-error diagnostics below should be read with that in mind. Number counts turn over at -5.01 in F210M to 20.05 in F300M, which is the practical completeness limit of each band. These magnitudes are instrumental: this field has no cross-band merge from which to recover a photometric zero-point, so the scale is $-2.5\log_{10}(\mathrm{flux})$ in image units and only differences within a band are meaningful. 

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D1_overview.pdf}
\caption{Overview of sgrb2. Left: source surface density in 72$\times$72 sky cells for F466N, the filter with the most detections. Centre: the sky coverage of each filter, sub-sampled. Right: number counts per filter; the peak of each curve is the turnover magnitude, the practical completeness limit beyond which the counts are set by detectability rather than by the stellar population.}
\label{fig:D1_overview}
\end{figure}

\section{Astrometry}
\paragraph{How the offsets were measured.} Every offset in this section comes from offset-histogram stacking: all pairs within a search window contribute to a two-dimensional histogram of their separations and the peak is the offset. The alternative --- matching each source to its nearest reference counterpart and taking the median --- is not used and is prohibited in this pipeline. When the true shift exceeds the reference catalogue's own nearest-neighbour spacing, nearest-neighbour matching pairs the wrong star, and the median of those wrong pairs collapses towards zero: the method reports agreement precisely when the frame is most badly misregistered. The search window is also swept rather than fixed, because a shift much larger than the window leaves no true pairs inside it and reads as noise rather than as a large offset.

\subsection{Repeatability}
Figure~\ref{fig:D2_astrometry_internal} shows the exposure-to-exposure scatter of each source about its merged position. The bright-end floor is 2.78\,\mas{} in F150W to 4.53\,\mas{} in F466N. This floor is the single-exposure centroiding precision convolved with whatever residual frame-to-frame misregistration survived alignment; it is an upper limit on the latter, and the merged position of a star seen in $N$ exposures is better than it by roughly $\sqrt{N}$. \ 763,666 measurements (29 per cent) report a scatter far below any achievable centroiding precision, in most cases identically zero. These are forced or seeded fits whose position was copied from a fixed seed and never re-measured per exposure, so the value is the absence of a measurement rather than a perfect one; they are excluded from the curves and from the floor above. 

The same stars measured independently in different filters agree to a median of 7.50\,\mas{}, with the worst filter pair at 11.56\,\mas{} and a typical 84th percentile of 172.1\,\mas{}. Because the two measurements share no detector pixels, no distortion solution and no PSF, this is a stringent internal check: it bounds the systematic floor of the astrometry in a way that the within-filter scatter, which shares all of those, cannot. 

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D2_astrometry_internal.pdf}
\caption{Internal astrometry of sgrb2. Per filter: the scatter of the individual-exposure centroids about the merged position, against brightness; greyscale is source density, the coloured line and band are the running median and 16--84th percentile, and the dotted line marks the bright-decile floor quoted in the panel. The final panel is the median separation between the same stars measured independently in each pair of filters; only sources independently detected in both bands are counted, since a forced or seeded position imported from another band would measure the merge radius rather than the astrometry.}
\label{fig:D2_astrometry_internal}
\end{figure}

\subsection{Absolute tie}
Figure~\ref{fig:D3_astrometry_absolute} ties the catalogue to its registered reference. Bulk offsets run from 17.5 to 136.7\,\mas{} (largest: F150W). Mapped per tile, the median tile offset across filters is 130.3\,\mas{}, the 95th percentile 149.3\,\mas{}, and the worst single tile 2850.8\,\mas{} in F480M. More than five per cent of tiles exceed 50\,\mas{}, so this is not an isolated bad tile: it is a spatially varying registration residual of the kind a field-averaged number washes out, and it is exactly what the per-tile map exists to catch. The overlap regions of the affected bands should be inspected before those positions are used at the tens of milliarcsecond level. 167 of 1709 tiles across all filters (10 per cent) reached a tie only after the search window was widened. Those tiles hold too few sources for a coherent peak at the nominal window, so their offsets are excluded from the numbers above and are marked rather than drawn in the figure; a high fraction means the map is sparse, not that the field is misregistered. 

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D3_astrometry_absolute.pdf}
\caption{Absolute astrometry of sgrb2 against its registered reference catalogue. Each per-filter panel maps the offset-histogram tie on a 12$\times$12 tile grid (arrows, exaggerated; colour is the per-tile peak contrast), with the whole-field bulk tie quoted in the corner. Grey crosses mark tiles whose tie was only found by widening the search window and whose offset is therefore not trustworthy. The final panel collects the bulk ties. Offsets are measured by offset-histogram stacking, which is immune to the nearest-neighbour pairing collapse that a median against a dense reference suffers; the per-tile map is shown because a bulk offset near zero does not by itself mean the field is registered.}
\label{fig:D3_astrometry_absolute}
\end{figure}

\section{Photometry}
\subsection{Precision and depth}
Figure~\ref{fig:D4_photometry_precision} shows the fractional flux uncertainty against brightness. The $5\sigma$ depth --- where the median $\sigma_F/F$ reaches $0.2$ --- runs from -1.67 mag in F150W to -4.72 mag in F212N, on the instrumental scale: no cross-band merge exists for this field, so no photometric zero-point could be recovered and the numbers are comparable within this field only. The depth of F300M, F360M, F410M is not quoted alongside these: those bands are absent from the cross-band merge, so no zero-point could be recovered and the panel is on an instrumental scale that is not comparable with the rest. The uncertainty propagated from the exposure-to-exposure scatter differs from the fitter's formal covariance by a median factor of 1.00 (1.08 in F187N to 1.00 in F770W). The two agree closely, which means the noise model is adequate and the fits are not being perturbed by exposure-dependent crowding. 

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D4_photometry_precision.pdf}
\caption{Photometric precision of sgrb2. Greyscale is source density; the solid line is the running median of the fitter's formal uncertainty $\sigma_F/F$ and the dashed line the same quantity propagated from the per-exposure scatter. The dotted horizontal line is $\sigma_F/F = 0.2$, and where the median crosses it is quoted as the $5\sigma$ depth. A propagated-to-formal ratio above unity means the exposures disagree by more than the fit covariance predicts.}
\label{fig:D4_photometry_precision}
\end{figure}

\subsection{Fit quality}
Figure~\ref{fig:D5_photometry_quality} shows the normalised PSF-fit residual. Median qfit is 0.160 in F210M to 1.060 in F466N; the fraction of sources above the vetting threshold peaks at 86.5 per cent in F466N. Where that fraction is large the catalogue is dominated by sources whose profile the model does not reproduce, which in these fields is normally blending rather than a defective PSF: the qfit distribution rises towards the faint end where neighbours are unresolved, not towards the bright end where a bad PSF model would show. Saturation touches at most 0.3 per cent of a band (F360M); the census panel breaks that down into the flagged, core-replaced, gate-rejected and clip-corrected populations, which is the accounting needed before trusting any bright-star photometry. 

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D5_photometry_quality.pdf}
\caption{PSF-fit quality for sgrb2. Per filter, the normalised fit residual qfit against brightness (greyscale: source density; line: running median; dotted: the qfit\,=\,0.2 vetting threshold). The final panel is the fraction of each filter's catalogue touched by the saturation-handling paths: flagged saturated, core-replaced, rejected by the saturated-star gate, and clip-corrected.}
\label{fig:D5_photometry_quality}
\end{figure}

\subsection{Colour diagrams}
Figure~\ref{fig:D8_color_diagrams} closes the photometric section. Colours are differential between filters and so reveal systematics that survive every per-band statistic above: a zero-point error displaces a sequence as a whole, a saturation-correction discontinuity breaks it at one magnitude, and a filter-dependent background error tilts it. A sequence that is continuous and has no spur is the strongest single piece of evidence that the cross-band merge assembled the same physical star in every band.

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D8_color_diagrams.pdf}
\caption{Colour diagrams for sgrb2, from the stage-m7 cross-band merge, in Vega magnitudes. These are differential between filters and so respond to systematics that per-filter statistics cannot see: a zero-point error shifts a sequence bodily, a saturation-correction discontinuity breaks it at a specific magnitude, and a filter-dependent background error tilts it.}
\label{fig:D8_color_diagrams}
\end{figure}

\section{Background and diffuse emission}
\paragraph{Two different quantities.} The catalogues carry up to two background columns and they do not measure the same thing. \code{local\_bkg} is the sigma-clipped annulus median that was handed to the PSF fitter, evaluated on whatever image that stage fitted; in the later stages that image has already had a smoothed background removed, so the column measures the residual of that subtraction and tends towards zero. \code{mean\_modelsub\_bkg} is the mean over a $3\times3$ pixel box on the per-exposure residual after only the star model is subtracted, combined across exposures as a sigma-clipped weighted mean. Writing $D_i$ for the exposure data, $S_i$ for the smoothed background subtracted before fitting, $B_i$ for the annulus background and $P_i$ for the fitted PSF model,
\begin{equation}
A_i = D_i - S_i - B_i, \qquad R_i = D_i - S_i - P_i,
\end{equation}
where $A_i$ is the array the fitter minimised against and $R_i$ is the image this column is measured on. Because $R_i$ removes only the star, the second quantity is invariant across pipeline stages while the first is not --- which is why they are plotted separately and never averaged together.

\subsection{Distributions}
Figure~\ref{fig:D6_background_distributions} shows both estimators. The median annulus background is -0.061 image units in F187N to 0.314 image units in F405N. The residual-footprint background is absent from every catalogue here: it was introduced in July 2026 and these products predate it. Re-running the cataloguing stage would add it, and would make the background measurement independent of which pipeline stage produced the catalogue --- which the annulus estimator is not. Towards the bright end the annulus estimator rises: the brightest one per cent of sources sit on a background that is 7.487 image units above the field median in F212N, the largest such offset in this field. This is the star's own wings entering its own background aperture, and it is a systematic rather than noise --- it biases in one direction and grows with brightness. Any use of the background column for bright stars should account for it. 

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D6_background_distributions.pdf}
\caption{Background estimators for sgrb2. First panel: the distribution of the annulus background handed to the fitter (solid) and, where available, the residual-footprint background (dashed). Remaining panels: the running median of each against brightness, with the 16--84th percentile band for the annulus estimator; the vertical dotted line marks the brightest 1 per cent, where a star's own wings begin to enter its own background aperture. The residual-footprint column is present for 0 of 12 filters; it was added in 2026-07, so catalogues produced before then carry only the annulus estimator.}
\label{fig:D6_background_distributions}
\end{figure}

\subsection{Spatial structure}
Figure~\ref{fig:D7_background_spatial} is the test of the physical claim. The left column is a map of the diffuse emission built entirely out of the star catalogue; the right column sets the same per-source value against the drizzled mosaic sampled at each star. The rank correlation between them is 0.263 in F187N to 0.538 in F150W, with a median of 0.447. That is a real but partial correlation. The per-source background is picking up the extended emission, but a substantial part of its variance comes from something else --- most plausibly the fitting residuals of neighbouring stars, which in a crowded field contribute to the same aperture. 

\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/D7_background_spatial.pdf}
\caption{Spatial background structure in sgrb2. Left column: the median per-source background in 56$\times$56 sky cells -- a map of the diffuse emission built entirely from the star catalogue. Right column: the same per-source value against the surface brightness of the drizzled mosaic sampled at that source's position, with the running median in red and the Spearman rank correlation quoted. A high rank correlation is the evidence that the per-source background is measuring the astrophysical extended emission rather than a fitting artefact.}
\label{fig:D7_background_spatial}
\end{figure}

\section{Implications}
\begin{itemize}
\item Positions in this field are repeatable to 3.2\,\mas{} per exposure at the bright end, so a proper-motion programme against an earlier epoch is limited by the epoch baseline and by the reference frame, not by these measurements.
\item Local registration residuals reach 149\,\mas{} at the 95th percentile of tiles --- widespread rather than isolated. Resolve this before using the affected bands for anything positional at the tens of milliarcsecond level.
\item Re-cataloguing this field would add the stage-invariant residual-footprint background, which the current products predate; until then the background column here cannot be compared with a field catalogued after July 2026.
\end{itemize}

\section{Reproducibility}
Every figure in this document was produced by
\begin{quote}\code{python scripts/analysis/make\_diagnostic\_writeup.py --field sgrb2}\end{quote}
against \code{jwst\_gc\_pipeline} version \code{0.1.dev3+g737c2722d}. The numerical values quoted in the text are stored alongside the figures in \code{measurements.json}, so the prose and the plots are generated from one computation and cannot disagree.

\end{document}
