WorksPhysics and Astronomy
GPUPhot: Kernel-Based Algorithms for Point-Source Detection and Photometry with a Spatially Variable PSF
Abstract
Modern imaging surveys generate data at rates that exceed the throughput of photometry pipelines built on iterative, per-source fitting, a construct that does not map onto parallel hardware. We present a set of algorithms for point-source detection and photometry reformulated so that the entire reduction runs natively on a Graphics Processing Unit (GPU), implemented in GPUPhot. Their design rests on a single principle: every stage is cast as a convolution with a fixed kernel or an element-wise operation on full-frame maps. The algorithms are designed to operate on wide-field images with a spatially variable Point Spread Function (PSF), where the field-dependent PSF is described through a small set of fixed, flux-conserving principal-component eigenmodes with position-dependent coefficients, so that the spatially varying matched filter decomposes exactly into a few genuine convolutions while retaining its maximum-likelihood foundation. We show that, even in fields with strong background gradients and markedly inhomogeneous PSFs, the framework achieves sub-pixel astrometric accuracy and few-millimagnitude photometric precision for bright sources. The pipeline is already in production at the telescopes of the Teide Observatory, where it has processed 3.7 million images since 2023, amounting to 1.2 PB of data, at effective end-to-end rates below 15 s per 150-Mpx image, from ingestion of the raw frame to a source catalog with astrometric and photometric solutions. Because the same primitives underlie every stage, the individual algorithms are self-contained and applicable well beyond photometry. They form the basis of a complete, openly developed software package, released publicly with this paper.
Introduction
Wide-field imaging surveys have become the primary engine of discovery in modern optical astronomy. Facilities such as Pan-STARRS ([14]), ATLAS ([42]), ASAS-SN ([22]), Tomo-e Gozen ([36]), the Zwicky Transient Facility (ZTF; [7]), the Dark Energy Camera (DECam; [16]), the Wide Field Survey Telescope (WFST; [12]), and, most recently, the Vera C. Rubin Observatory Legacy Survey of Space and Time (LSST; [20]) repeatedly image large areas of the sky at high cadence, turning the static view of the sky into a dynamic, time-resolved one. This shift has been accompanied by a steep growth in data rates: a single modern mosaic camera delivers hundreds of megapixels per exposure, and a single night can generate from hundreds of gigabytes to terabytes of imaging that must be reduced, increasingly, in near real time, if time-critical phenomena are to be identified while they remain observable. The reduction software, rather than the telescope, is now frequently the bottleneck that sets the scientific throughput of a survey.
At the heart of essentially every such pipeline lies the detection and photometry of point sources, and quantity that governs both is the point spread function (PSF), the response of the atmosphere–telescope–detector system to a point of light. Accurate astrometry and photometry demands a faithful model of the PSF. Over four decades a rich toolbox has been developed for the purpose: aperture photometry, including its optimal, growth-curve and critically-sampled variants [40, 24, 10]; PSF-fitting photometry, from the classical DAOPHOT [39] and DoPHOT [37] to discrete-PSF formulations [27]; integrated detection-and-measurement frameworks such as SExtractor with PSFEx [9] and the Hyper Suprime-Cam/LSST science pipeline [11]; and, more recently, machine-learning approaches [46, 45]. A difficulty common to all of them is that, across a wide field, the PSF is not constant: optical aberrations, detector tilt and atmospheric seeing gradients make it vary systematically over the focal plane. Capturing this variation is essential for both unbiased detection and precise photometry, and has been addressed either by expanding the PSF on a spatial polynomial basis [9, 31] or by describing its variation through a principal-component decomposition [21, 6].
Most of these methods were designed when data volumes were small enough that human supervision, rather than computational throughput, set the pace of the analysis; they typically rely on iterative, per-source least-squares fitting that does not scale to the data rates quoted above. The natural way to close the gap is massively parallel hardware. Graphics Processing Units (GPUs) apply the same operation to many data elements at once and are exceptionally well suited to the array arithmetic and Fast Fourier Transforms (FFTs) that underlie image reduction. Several recent efforts have exploited this: M. Niwano et al. [28] obtained a fortyfold speed-up of a full reduction pipeline by porting it to the GPU with CuPy; L. Cao et al. [13] assembled a GPU-accelerated preprocessing framework for the GWAC survey; and L. Hu et al. (2026) built a real-time DECam transient-detection pipeline around SFFT, a GPU-accelerated, Fourier-domain image-subtraction algorithm. These works demonstrate the value of GPU acceleration, but they tend either to port existing CPU algorithms step by step or to accelerate a single stage, most often image subtraction. What has been missing is a photometry pipeline conceived from the outset so that every stage reduces to the same GPU-friendly primitives, and in which the spatially variable PSF is handled within that framework rather than as an exception to it.
In this paper we present the algorithmic foundation of GPUPhot, a GPU-native software suite for point-source detection and photometry that fills this gap. Its single design principle is that every stage of the reduction is cast either as a convolution with a fixed kernel or as an element-wise operation on full-frame maps, so that the whole reduction runs natively on a GPU even where the underlying problem is not naturally a convolution.
GPUPhot is already in routine operation as the real-time reduction pipeline of the Two-meter Twin Telescope (TTT1), the Transient Survey Telescope (TST2) and ATLAS-Teide [26] at the Teide Observatory, where it processes the data streams of both their CCD and sCMOS cameras and has produced the photometry for a number of published studies (e.g. [33, 32, 35, 2 b,c] (J. Đurech et al. 2025; R. de la Fuente Marcos et al. 2025)). With this paper we release GPUPhot publicly3 as the foundation of a complete, openly developed software suite, so that the wider community can adopt it for its own instruments and surveys. The processing sequence is summarized in Figure 1, the following sections describe its individual stages. Sections 2–6 describe the algorithms of each stage, covering defect correction and background estimation, the PCA-based PSF model, matched-filter detection and aperture photometry. Section 7 validates the pipeline through a controlled injection–recovery experiment and against external catalogs, Section 8 discusses the GPU implementation and its performance and Section 9 summarizes our conclusions.

Figure 1. Overview of the GPUPhot pipeline. Defect correction and background estimation precede isolated-star selection, spatially varying PSF modeling, matched-filter source detection and adaptive aperture photometry. Representative image stamps illustrate the successive stages.
Sensor defect correction
Cosmic rays
Cosmic rays are a common source of contamination in astronomical images, manifesting as high-intensity spikes that can severely compromise photometric precision. We have developed a GPU-optimized algorithm for their detection and mitigation, conceptually related to established methods such as L.A. Cosmic (P. G. van Dokkum 2001), which similarly relies on Laplacian edge detection and iterative filtering.
The algorithm begins by convolving the input image with a discrete Laplace operator, which is highly sensitive to the sharp intensity gradients characteristic of cosmic ray hits. Candidate pixels are flagged where the absolute deviation of the filtered image from its mean exceeds a threshold of times the standard deviation of the Laplacian (default ), producing an initial binary mask. This mask is subsequently dilated with a structuring element to ensure complete spatial coverage of each event. This fixed kernel size is motivated by the sub-pixel to few-pixel spatial extent of typical cosmic ray events on the detectors employed; a larger or parametric kernel would risk encroaching on the wings of point sources in well-sampled images.
Pixels within the dilated mask are set to NaN in a working copy of the image, and an iterative Fast Fourier Transform (FFT)-based interpolation scheme (fill_nan_fft) reconstructs the affected regions by iteratively filling the masked pixels, repeating until no NaN values remain or the count of unfilled pixels is unchanged between successive iterations. The first reconstruction is used only to decide which candidate pixels should be corrected; it does not yet alter the original image. A candidate is corrected only if its reconstructed value lies below the global 95th percentile of the reconstructed image. These candidates are masked in the original image and filled by a second interpolation pass. All other pixels retain their original values. The motivation is that an isolated cosmic ray may interpolate to the background level, whereas the surrounding light of a star may keep its reconstructed core above the threshold. This distinction is only approximate: if the initial mask removes most of a stellar profile, the reconstructed core may also fall below the threshold and be incorrectly corrected. Figure 2a illustrates the result for the example shown.

Figure 2. Defect correction in real astronomical images. In each panel, the upper and middle rows show a stellar source and two affected regions before and after correction. The lower plot compares their pixel-value distributions: dashed outlines denote the original regional distributions and solid outlines the corrected distributions. Circle, square and triangle symbols identify the star and the two defects; hatching identifies only the original full-image distribution (gray), while the corrected distribution is unhatched. Panel (a) shows the two-stage cosmic-ray filter; panel (b) shows the isolated-pixel RTN filter.
Random Telegraph Noise
Random Telegraph Noise (RTN), also referred to as salt-and-pepper noise in the image processing literature, arises from charge trapping and release events in individual pixels of solid-state detectors, producing sporadic positive or negative excursions that are uncorrelated with the local image structure. This phenomenon has been identified in some of the most widely used astronomical sensors, including the Sony IMX455 and IMX411 sCMOS detectors ([5]). Unlike cosmic rays, which tend to affect contiguous pixel groups, RTN typically manifests as isolated single-pixel outliers, making it particularly amenable to identification through local statistical analysis.
Our mitigation algorithm proceeds in three stages. First, a median filter of kernel size (default px) is applied to produce a smooth reference image. The residual map, defined as the difference between the original and the median-filtered image, is then characterized statistically: its median and a robust estimate of its dispersion are computed, the latter derived from the Median Absolute Deviation (MAD) scaled to Gaussian units as
where denotes the residual map. Pixels are flagged as outliers if their residual satisfies
with default thresholds , allowing for asymmetric detection if required.
In a second stage, a morphological isolation criterion is applied: flagged pixels are retained in the mask only if fewer than two of their eight immediate neighbors are also flagged. This condition suppresses the erroneous detection of structured image features–such as the wings of bright point sources or steep background gradients–which would otherwise produce clusters of adjacent outlier pixels. Finally, the value of each surviving masked pixel is replaced by the corresponding value from the median-filtered reference image, effectively reconstructing the affected pixel from its local neighborhood. This algorithm efficiently removes isolated single-pixel outliers characteristic of RTN while leaving structured signals, including stellar profiles, unaffected, as illustrated in Figure 2b.
Background subtraction
Accurate background estimation is a critical prerequisite for reliable source detection and photometry, particularly in crowded fields or images with spatially varying sky levels. Our algorithm produces a smooth, locally representative background map by combining tile-based percentile statistics with FFT-based convolution, and is designed to handle images of arbitrary size and pixel scale. The successive steps are illustrated in Figure 3.

Figure 3. Illustration of the background estimation algorithm applied to a real astronomical image. Top row: full frame view of the original image (left), the estimated background map (center), and the background-subtracted image (right). The large-scale gradient across the field is effectively captured and removed. Bottom rows: step-by-step illustration of the algorithm on the subregion indicated by the white box in the top-left panel: (a) image cutout; (b) local standard deviation map after Gaussian smoothing; (c) coarse percentile threshold map derived from tiles; (d) source mask from pixels exceeding the percentile threshold; (e) morphologically refined mask after erosion and dilation; (f) source-masked image after FFT-based interpolation; (g) final smoothed background map; (h) background-subtracted image cutout.
The algorithm proceeds in four stages. First, the input image (Figure 3a) is convolved with a Gaussian kernel ( px) to suppress pixel-level noise, and a local standard deviation map is computed over a sliding window of radius 2 arcsec (Figure 3b). This map serves as a proxy for the compactness of local emission: because the standard deviation is computed over a kernel smaller than the typical source size, point sources produce sharply elevated values compared to extended emission or smooth background gradients. This is a key distinction with respect to methods such as M. Akhlaghi & T. Ichikawa [1], which aim to separate all signal from the background, including extended emission. Our approach intentionally masks only compact point sources, preserving extended emission as part of the background to be estimated and subtracted.
In the second stage, the image is decomposed into nonoverlapping square tiles of size (default px), and the 75-th percentile of the local standard deviation is computed for each tile, discarding tiles containing NaN values. Per-set tile values are reassigned to their corresponding regions to construct a coarse threshold map at the native image resolution (Figure 3c). Pixels whose local standard deviation exceeds this threshold are identified as source-dominated and masked (Figure 3d). The resulting mask is then morphologically refined through erosion and dilation with a structuring element of size px, where is the plate scale in arcsec px and is a smoothing scale in arcsec (default arcsec), followed by a Gaussian smoothing of the mask boundaries ( px) with a threshold of 0.05 (Figure 3e).
In the third stage, masked pixels are set to NaN and an iterative FFT-based interpolation scheme (fill_nan_fft) reconstructs the source-masked regions using a filling aperture of px (default arcsec), repeating until either no NaN values remain or the count of unfilled pixels is unchanged between successive iterations (Figure 3f). Finally, the reconstructed image is smoothed with an averaging kernel of radius px (default arcsec) to produce the final background map (Figure 3g). The background-subtracted image (Figure 3h) is then used in all subsequent pipeline stages. FFT-based filling accommodates the contiguous holes left by cosmic-ray and source masking. For isolated RTN pixels, the median reference already computed for detection provides a local replacement without an additional filling pass. The expected per-pixel variance is
where denotes the pixel position and all terms are expressed in e. The first term, , is the Poisson variance of the sky background, equal to the local background level in electrons by virtue of Poisson statistics. The second, , is the readout noise variance, with the per-pixel readout noise in e. The third, , is the dark current shot noise for a dark current rate in e and exposure time in seconds; like , it is a Poisson variance whose value equals the number of dark electrons accumulated during the exposure. This noise map encodes the spatially varying detection limit imposed by Poisson fluctuations of the sky background, detector readout and dark current, and is used as the per-pixel significance threshold in the point-source detection stages.
PSF Modeling
Accurate photometry of point sources requires a faithful model of the Point Spread Function (PSF) at every position in the field. Optical aberrations, detector tilt and atmospheric seeing gradients cause the PSF to vary spatially across the focal plane, an effect that becomes significant in wide-field instruments where the field of view samples a substantial portion of the optical beam. Following B. Zackay & E. O. Ofek [47], a background-subtracted image can be modeled as
where is the true source flux distribution in e, is the PSF normalized to unit sum (), is additive noise and denotes convolution. The per-pixel variance of is
combining the sky, read and dark current noise of Equation (3) with the Poisson variance of the source signal at pixel . For an isolated point source of flux at position , the true sky contains a single non-zero pixel, , where indexes the source plane and is the Kronecker delta. Substituting into the convolution collapses the sum to its single non-zero term , and Equation (4) becomes
GPUPhot constructs an empirical model of the PSF in three steps: detection and selection of isolated stars, construction of a position-independent reference PSF and characterization of spatial deviations from the reference via Principal Component Analysis (PCA).
Isolated star detection
PSF modeling requires a set of isolated, unsaturated point sources that adequately sample the spatial extent of the field. Because the PSF has not yet been determined at this stage of the pipeline, we approximate by a fixed Gaussian kernel of width arcsec, and Equation (6) reduces to
To identify candidate sources we treat each discrete pixel-center position across the image as the hypothetical center of a point source and seek the statistic that best separates a real source from a background fluctuation, that is, the one that maximizes the detection signal-to-noise ratio at that position. Assuming background-dominated noise, with negligible source Poisson variance, and Gaussian noise uncorrelated between pixels, that flux is the maximum-likelihood estimate of at fixed (see Appendix § 12 for a full derivation):
The numerator cross-correlates the image with the kernel and the denominator normalizes it to units of flux, both weighting each pixel by its inverse variance so that noisier pixels contribute less; is thus the best-fitting flux of a source of profile centered at . Normalizing this estimate by its own uncertainty yields the detection significance , with , which is by construction the signal-to-noise ratio we sought. Sources are then identified as local maxima of , where the point-source hypothesis is most strongly favored over background noise.
The exact evaluation of requires weighting each pixel by before the cross-correlation, which breaks the convolution structure and precludes efficient FFT-based evaluation. Following B. Zackay & E. O. Ofek [47], we adopt the locally stationary approximation: if varies on spatial scales much larger than the kernel support, then within a region of radius centered on . Under this approximation, the significance reduces to
where is the reflected kernel and is the effective kernel area. In this form, the cross-correlation can be evaluated via FFT. The sensitivity loss from using a fixed Gaussian rather than the true PSF is negligible for the bright, high signal-to-noise (S/N) sources required for PSF modeling. The detection loss is only a few per cent for a moderate () width mismatch [47]. Local maxima of above a preliminary threshold of are extracted as initial candidate detections, shown as red circles in the top panel of Figure 4.

Figure 4. Selection of isolated stars for PSF modeling, illustrated on a representative real astronomical image. a) background-subtracted cutout image stamp with detected sources overlaid. Red circles mark all initial detections with ; blue squares mark candidates that survive the nearest-neighbor distance and saturation criteria; yellow diamonds mark the subset selected for PSF modeling after the central-field, isolation and brightness-ranking cuts. Only three of the 21 stars retained for the full field are visible in this cutout. b) reference PSF obtained by stacking the 21 selected normalized stars with iterative sigma-clipping.
Initial candidates are subsequently filtered by three criteria applied in sequence. First, an isolation criterion requires that each candidate lies at least 10 arcsec from its nearest neighbor. Nearest-neighbor distances are computed via a -d tree [8, 17], which is efficient enough for the typical number of candidates (). Second, a stricter significance threshold is applied to to retain only high-confidence detections. Third, a saturation criterion rejects candidates whose peak pixel value exceeds 80 % of the detector full-well capacity, providing a conservative margin against non-linear response. Sources close to the image edges are additionally excluded, ensuring that the extraction region of every retained candidate lies entirely within the detector. Candidates surviving all filters are marked in blue in Figure 4, and represent the pool of bright, well-isolated point sources from which the PSF model is constructed.
Reference PSF construction
From the isolated star candidates, a subset is selected to build a position-independent reference PSF . Candidates are first ranked by a composite metric combining their signal-to-noise ratio with their nearest-neighbor distance, prioritizing bright, well-isolated sources. For each candidate, a square cutout of on a side is extracted around its centroid. A cutout is retained only if the brightest pixel falls within of the cutout center, and is then normalized by its total flux.
A quality filter is applied to identify stamps that are poorly sampled or anomalously compact, whose brightest pixel exceeds 30% of the total stamp flux. Such stamps are dominated by a single bright pixel, which would bias the reference PSF towards sub-pixel artifacts rather than capturing the true profile. From the surviving stamps, only those lying within the central region are retained, where the PSF is typically most symmetric and least affected by field-dependent aberrations. The 21 highest-S/N central stamps are stacked with iterative sigma-clipping, and the resulting reference PSF is normalized to unit sum, . The reference PSF is shown in the bottom-left panel of Figure 4.
Spatial variations via PCA
The reference PSF constructed in § 4.2 can be used directly as the matched-filter kernel for source detection. Substituting for in Equation (9) yields the analogous detection statistic,
where is the reflected reference PSF and is its effective area. Equation (10) is the optimal matched filter when the PSF is uniform across the image.
In practice, the PSF varies systematically across the field of view: optical aberrations, detector tilt, and atmospheric seeing gradients all introduce position-dependent deformations. Treating as the kernel everywhere therefore induces a position-dependent mismatch between the assumed and the true PSF, which degrades both the detection sensitivity and the photometric accuracy. (10) cannot be generalized by simply replacing by a position-dependent kernel , because the resulting operation is no longer a convolution: a kernel that varies with does not admit the FFT-based evaluation on which efficient detection relies.
To resolve this tension, we model the spatially varying PSF as a sum of fixed templates with position-dependent amplitudes,
where the basis functions (hereafter PSF deviation eigenmodes) are fixed templates determined empirically from the data, and the scalar coefficient maps encode all of the spatial variation. The matched-filter result, which for a position-dependent kernel is no longer a single convolution, then becomes
which can be evaluated as a sum of genuine convolutions (with the fixed kernels and ) multiplied by the precomputed coefficient maps . We introduce the distinct symbol to emphasize that, unlike the convolution , this operation is not formally a convolution when the kernel varies with position.
Construction of the eigenmode basis—For each isolated star found in the image, we compute its deviation from the reference PSF,
where is the unit-sum–normalized stamp of the -th detected isolated star. Because both and are normalized to unit sum (§ 4.2 and § 4), the deviations satisfy
This zero-sum property is preserved under any linear combination of the , and is the foundation of the flux-conservation argument given below.
A direct application of Principal Component Analysis (PCA) to the raw deviations would be dominated by the stars with the largest-amplitude deviations. Because the unit-sum normalization inflates the photon noise of faint stars, these are precisely the low-signal-to-noise stars whose deviations are dominated by noise, which would then contaminate the leading components. To mitigate this, we apply a weighted-PCA approximation: each deviation is first normalized by its own standard deviation,
producing a set of unit-variance deviations in which each star contributes with comparable weight. PCA is then performed on the normalized set. The goal is to find a small set of fixed templates that, combined linearly, reproduce the bulk of the star-to-star PSF variation. Concretely, the eigenmodes are the leading principal components of the centered deviations : a set of mutually orthonormal patterns, ordered so that each successively captures the largest possible fraction of the remaining sample variance. The eigenmodes are, then, ordered by decreasing explained variance and satisfy
GPUPHOT retains the first eigenmodes by default. Examples for a representative image are shown in the left column of Figure 5.

Figure 5. PSF deviation eigenmodes and their spatial coefficient maps. Left column: the first five eigenmodes obtained from the weighted PCA of the noise-normalized PSF deviations , ordered by decreasing variance explained. The color scale is symmetric around zero, with red and blue indicating positive and negative contributions to the local PSF relative to the reference . Right column: the corresponding interpolated coefficient maps across the full field of view, with the positions of the PSF modeling stars overplotted as gray crosses. The coherent large-scale structure in the maps indicates that the eigenmodes capture genuine spatial variations of the PSF rather than stochastic noise.
Projection coefficients and spatial interpolation—Each star’s deviation is projected onto the eigenmode basis. In the normalized space, the coefficient of along is
To recover coefficients in the physical (unnormalized) deviation space, we rescale by ,
so that the original deviation is recovered as up to the truncation residual associated with .
The coefficients are known only at the discrete positions of the PSF modeling stars. To evaluate the PSF at any position, we interpolate each set of coefficients into a continuous spatial map . The image is divided into square tiles of side length 200 arcsec by default, and within each tile the contributing stars are combined with a sigma-clipped mean to produce a single tile-averaged coefficient. Tiles without contributing stars are filled iteratively by FFT-based interpolation from their neighbors. The resulting maps are piecewise-constant on the tile grid; the assumption that the PSF varies smoothly on scales larger than the tile size is justified by the smooth nature of the underlying optical and atmospheric variations. The coefficient maps for the same image are shown in the right column of Figure 5.
Flux conservation of the reconstructed PSF—By construction, the deviations satisfy (Equation (14)), and so do the normalized deviations and their per-pixel mean . The eigenmodes are principal components of the centered deviations , hence linear combinations of zero-sum patterns, and therefore inherit the zero-sum property,
Substituting Equation (19) into the reconstructed PSF model (Equation (11)),
so that the unit-sum normalization is preserved at every position . This is essential for the matched-filter detection statistic, which assumes a flux-normalized PSF, and for the consistency of the photometric calibration.
Validation—Figure 6 shows representative reconstructions for stars distributed across the field: the observed stamp , the flux-scaled model PSF and the residual . For all but the brightest star the residuals exhibit no systematic structure beyond pixel-level photon noise. This shows a faint dipolar residual, a positive and a negative lobe on opposite sides of the center, which is the first-order signature of a small, sub-pixel offset between the model and the stellar centroid, rather than a deficiency of the eigenmode basis. Such an offset is present at some level for every star but is masked by photon noise except at the highest signal-to-noise, where the residual is clean enough for it to become visible; it reflects the limiting positional accuracy rather than the PSF shape, is absorbed in the per-source position fit, and does not affect the shape fidelity tested here. The eigenmode basis with thus captures the spatial PSF variation with sufficient fidelity for accurate detection across the full field of view.

Figure 6. Validation of the PCA-based PSF model. Each row corresponds to a star randomly drawn from the PSF modeling set. Left column: the observed, background-subtracted stamp at the star’s position, in detector units. center column: the reconstructed PSF evaluated at the same position and rescaled by the star’s total flux, with , where the reference PSF provides the bulk of the profile and the eigenmodes , scaled by their local coefficients , add the position-dependent correction that captures the PSF variation across the field. Right column: the residual , shown over the source region on a symmetric color scale.
Source detection
With the spatially varying PSF model in place, source detection in GPUPHOT reduces to applying the matched filter of Equation (12) and identifying local maxima of the resulting significance map. The procedure is the natural generalization of § 4.1 from a fixed Gaussian kernel to the empirical PSF, retaining the same maximum-likelihood foundation under the locally stationary noise approximation.
The detection statistic at each pixel is
where is the spatially varying matched filter of Equation (12), and the position-dependent effective kernel area is
where are the projections of the reference PSF onto the eigenmode basis. The orthonormality of the eigenmodes (Equation (16)) cancels the cross terms for and sets . It does not cancel the projections : the basis is orthonormal within itself and is not orthogonalized against . The are scalars evaluated once per frame, so Equation (22) adds no measurable cost. Both the numerator and the effective area are therefore obtained entirely from FFT-based convolutions: the matched filter as a sum of fixed-kernel convolutions multiplied by the precomputed coefficient maps, and the effective area from the same maps and the precomputed scalars .
Local maxima of above a configurable significance threshold (default ) are identified as source candidates. Two candidates are required to be separated by at least pixels to avoid duplicate detections of the same source split by noise fluctuations. The integer-pixel peak positions are subsequently refined to sub-pixel accuracy by computing the first-moment centroid of within a square window of side around each maximum,
where , and are two-dimensional position vectors and is the centroid window.
Figure 7 illustrates the detection on a representative field. The top row shows a small cutout extracted from the full field, with the same region rendered as: the background-subtracted image with the final source detections overlaid (panel a), the matched-filter significance map (panel b), and the corresponding Pan-STARRS DR1 image ([14]) as an external reference (panel c). The bottom panel (d) shows the full detection cutout with all sources marked. The Pan-STARRS comparison confirms that the algorithm recovers the faint sources visible in the deeper reference survey while introducing no spurious detections beyond what is expected from photon noise.

Figure 7. Source detection on a representative field. Top row: a small cutout extracted from the full detection region, shown from three perspectives. a) background-subtracted image , with the final sub-pixel-refined source positions overlaid as blue circles; b) matched-filter significance map computed with the full spatially varying PSF model; c) corresponding Pan-STARRS DR1 image ([14]), included as an external reference to verify that the detected sources correspond to genuine astronomical objects. Bottom row: (d) the complete detection cutout with all sources marked as blue circles; the white rectangle indicates the location of the small cutout shown in panels a)–c). The horizontal bars indicate angular scales of 20″ in the top row and 1′ in the bottom row. The agreement between the GPUPhot detections and the deeper Pan-STARRS imagery confirms that the algorithm recovers the faint sources visible in the reference survey, while introducing no spurious detections beyond those expected from photon noise.
Photometry
Once all detected sources have been assigned a sub-pixel position by the centroid refinement of Equation (23), GPUphot measures their flux by optimized circular aperture photometry. The signal at each detected source is the sum of the pixel values inside a circular aperture of radius centered on the refined position , plus a small fraction of the flux that falls outside the aperture and which has to be recovered. The procedure can be cleanly decomposed into four parts: the aperture flux measurement itself, the aperture correction that recovers the missing flux, the noise model that propagates the photometric uncertainty and the brightness-dependent rule that selects the optimal aperture radius for each source.
Aperture flux measurement
For a given aperture radius , the measured flux of the source at position is the inner product of the background-subtracted image with a circular top-hat kernel of unit weight inside radius and zero outside,
Apertures are pixel-discrete: a pixel is included in if and only if its integer coordinates satisfy , with no sub-pixel weighting at the aperture boundary. This is a deliberate choice that preserves the matched-filter structure of the rest of the pipeline and allows to be evaluated efficiently for all sources simultaneously via FFT-based cross-correlation,
where by the symmetry of the top-hat. The same FFT pathway used in § 4.1 and § 5 therefore applies, with playing the role of the matched-filter kernel.
In practice, the algorithm does not evaluate Equation (25) at a single radius but at a discrete set of integer radii, in pixels, spanning a range tailored to the local PSF width,
producing for each source a growth curve sampled at radii. The lower bound is set such that the smallest aperture comfortably contains the FWHM core of the PSF, while the upper bound extends well into the wings, beyond the radius at which the aperture correction stabilizes. The area of each aperture is computed exactly from the same top-hat,
and enters the noise model as the number of pixels contributing readout noise and dark current. Because is rotationally symmetric and shared across all sources, both and depend only on and the source position, not on the local PSF shape; all PSF-dependent corrections are deferred to the aperture-correction step that follows.
Aperture correction
The aperture flux defined in Equation (24) systematically underestimates the total source flux because a finite fraction of the PSF lies outside any finite aperture. We define the aperture correction at position as the fraction of the total flux of a unit-normalized PSF that is enclosed within radius ,
so that the calibrated signal of a source at with measured aperture flux is
The quantity is an estimator of the true point-source flux introduced in Equation (6): by construction, as grows beyond the PSF support, so recovers in the limit of large apertures.
Direct evaluation of Equation (28) from the PCA-based PSF model of § 4.3 is in principle possible, but aperture photometry imposes far tighter accuracy requirements on than source detection does. The matched-filter detection statistic of § 5 depends on the global convolution and tolerates percent-level errors in the radial profile of without noticeable degradation, whereas the calibrated signal of
Equation (29) and the optimal-aperture selection of § 6.4 both depend directly on the radial integral and propagate any such error into a percent-level systematic in the final flux. We therefore adopt an empirical approach that bypasses Equation (28) altogether and estimates directly from observed growth curves of isolated stars in the field, which provides the required accuracy by construction.
The procedure has three stages: selection of high-quality aperture calibrators (high-S/N isolated stars), segmentation of the field into spatial clusters, and estimation of the cluster-mean correction together with its uncertainty. The result, illustrated in Figure 8 for a representative field, is a set of piecewise-constant correction curves that capture the smooth spatial PSF variation across the focal plane.

Figure 8. Empirical aperture correction across the field of view. a) Within-cluster growth curves for a single representative spatial cluster: individual normalized growth curves of the retained calibrators (gray), overlaid by the cluster-mean correction (purple). b) Cluster-mean corrections for all clusters in the field, overlaid on a common axis and colored by their value at one FWHM. c) Spatial distribution of the calibrators in the focal plane, each colored by the value of its parent cluster.
The starting point are the isolated stars detected in § 4.1, of which a subset is retained as aperture-correction calibrators by requiring a convolutional signal-to-noise (Equation (21)) exceeding , automatically relaxed to 100 if the resulting sample contains fewer than ten stars. The high threshold ensures that the growth curve of each calibrator is photon-noise limited well into the PSF wings, where the small flux increments per pixel are otherwise dominated by background fluctuations. For each calibrator at position , the growth curve is measured on a discrete grid extending to , beyond the photometric range of Equation (26), and normalized by its own maximum value over that extended range,
By construction each reaches unity at the radius where its own growth curve peaks, so the within-cluster dispersion collapses in the neighbourhood of . Normalizing over the photometric range alone would place this artificial zero at , where it would erase the systematic term from the noise budget and bias the optimal-radius selection of the following section. Extending the normalization to pushes it safely outside the photometric range, leaving finite and informative at every radius actually used for photometry.
The calibrators are then grouped into spatial clusters that divide the field of view. The target number of clusters is set to
where is the same tile size used for the PCA coefficient maps, is the total number of retained calibrators, and is the image size in pixels. This choice adapts naturally to image quality: a sparsely populated or shallow image yields fewer calibrators and therefore fewer clusters, each averaging over a larger area and a more stable mean correction. A floor of calibrators per cluster is enforced so that the within-cluster statistics remain meaningful. Calibrators are assigned to clusters by a -means partition of their pixel coordinates, and within each cluster , outliers more than 2.5 MAD from the median at each radius are iteratively rejected. Panel c) of Figure 8 shows the resulting spatial partition for a representative field: the calibrators are colored by the index of their parent cluster. The cluster-mean correction and its uncertainty are then
where is the number of retained calibrators in the cluster. Two effects contribute to the scatter of the within a cluster: the photon noise of the individual growth curves, which is independent between calibrators, and any residual PSF variation across the cluster area. The second is small by construction, because the number of clusters of Equation (31) is set so that each cluster spans approximately one PCA tile, i.e. the scale over which the PSF is already assumed to be constant in § 4.3; the spread between clusters shown in panel b) of Figure 8 is the fingerprint of the variation that the partition does capture. The dispersion is therefore dominated by the independent photon-noise term and averages down with , which is what Equation (32) assumes.
Panel a) of Figure 8 illustrates the within-cluster statistics for a single representative cluster: the individual normalized growth curves of the retained calibrators are shown in gray, and the cluster-mean correction is overlaid in black. The mean curve approaches unity well within the photometric range, confirming that the upper bound adopted in Equation (26) encompasses essentially the full source flux. Panel b) overlays the cluster-mean corrections for all clusters in the field on a common axis, each curve colored by the index of its cluster as in panel c). Because the top-hat kernel introduced in Equation (24) is identical for all sources, the entire spatial variation of the PSF is absorbed into a position-dependent correction . The non-trivial spread between clusters in panel b) is the direct fingerprint of that variation: as anticipated from the PCA eigenmodes of § 4.3, the PSF core varies more strongly across the field than its wings, so the curves diverge at small radii and converge at large ones.
In the third stage, every source at position is assigned the correction of its nearest cluster centroid.
Noise contributions
The total noise on the aperture flux is the quadrature sum of four physically independent contributions: the source Poisson noise, the sky background Poisson noise, the readout noise and the dark current shot noise,
all expressed in electrons. Each term is evaluated in a way appropriate to its spatial structure. Contributions that can be treated as spatially uniform across the image, such as the readout noise for a single-channel CCD, reduce to a single per-pixel variance multiplied by the area of the aperture defined in Equation (27). Contributions that vary with position, such as the sky background or the dark current noise, are instead obtained by convolving the corresponding per-pixel variance map with the same top-hat kernel used to measure the aperture flux in Equation (25), so that the variance of each term shares the same FFT-based machinery as the photometry itself.
The source noise has two physically distinct contributions, both arising from the propagation of Equation (29): the Poisson noise of the source photons collected within the aperture, amplified by the multiplicative correction, and the systematic uncertainty introduced by itself. The second contribution becomes essential when considering which is the optimal aperture for measuring the total flux. If were taken without uncertainty, the calibrated signal would always favor the smallest possible apertures, since shrinking the aperture reduces all measurement terms while a perfect correction recovers the missing flux at no cost. Empirically this is not what is observed. For a bright source, dominated by source-photon noise, larger apertures that capture essentially all of the flux yield more precise photometry than small apertures recovered through a multiplicative correction, because the correction is never perfect: it inherits the
PSF variability across the field and the limitations of pixel sampling. For a faint source, dominated by background noise, the trade-off reverses, since the cost of integrating more pixels grows faster than the gain from including more source signal. Figure 9 illustrates this asymmetry by dissecting the noise contributions of two representative isolated stars in the same field, spanning more than two orders of magnitude in detection significance: the S/N curves on the secondary axes peak at very different radii on the two panels, large for the bright star and small for the faint one.
Carrying out the propagation explicitly, with from Poisson statistics, gives the source variance as
where is the per-cluster dispersion of Equation (32) for the cluster assigned to the source.
The signal-to-noise ratio at aperture radius follows as
Optimal aperture radius
The two regimes identified in § 6.3 make the dependence of the S/N on aperture radius non-trivial, with the maximum shifting from small to large as source brightness increases. For each source, the optimal aperture is therefore the radius that maximizes the signal-to-noise ratio of Equation (35). Evaluating this for every detected source would require computing all four noise terms of Equation (33) at every aperture radius for every source, a calculation that is straightforward for the isolated stars used to construct the noise model, but expensive when extended to all the detected sources.
Instead, we exploit a quantity already available for every detection: the detection significance of Equation (21), illustrated in panel b) of Figure 7. This statistic captures the ratio between the source signal extracted by the matched filter and the local background noise. It is not equal to the photometric S/N of Equation (35) — is evaluated under the null hypothesis, so it scales linearly with flux, whereas the photometric S/N scales as in the source-dominated regime — but it is a strictly monotonic function of source brightness, computed once during detection, and this is what the empirical calibration below requires. The power-law form of Equation (36) absorbs the difference between the two scalings.
The optimal aperture radius can then be calibrated as a function of . For each isolated star , the photometric S/N curve is evaluated on the grid of Equation (26) and the radius at which it peaks is recorded as , as illustrated in Figure 9. The resulting pairs trace a smooth relation across a wide brightness range, shown in Figure 10. On the log–log plane, this relation is described by a power law,

Figure 9. Noise contributions as a function of aperture radius for two representative isolated stars in the same field. Top: a bright star with detection significance . Bottom: a faint star with . Each panel shows the individual variance contributions to the calibrated signal in electrons: source Poisson (, solid), sky background (, dashed), readout (, dotted) and aperture-correction systematic (, dash-dotted); the total variance is overlaid in black with square symbols. The signal-to-noise ratio is shown on the secondary axis (blue, right) with the maximum marked as a filled circle.

Figure 10. Calibration of the optimal aperture radius. Optimal radius (in units of FWHM) as a function of the convolutional detection significance for the population of isolated calibrators in a representative field. Each point is colored by the spatial cluster to which the source is assigned in the aperture-correction map of § 6.2, with the same color scheme as in Figure 8. The black solid line shows the inverted-binned power-law fit of Equation (36), with the saturated extremes at and excluded from the fit.
fitted to the isolated sources. Two practical aspects of the fit deserve mention. First, is a discrete-valued quantity by construction (an integer pixel radius from the grid of Equation (26)), so a direct ordinary-least-squares fit of on is biased: at fixed brightness, the scatter of is asymmetric because the radii cluster at integer values. We bypass this by binning the calibrators by integer , computing the median within each bin. Second, calibrators whose saturates at either end of the photometric grid are excluded from the fit, since their is bounded by the grid rather than determined by the maximum S/N.
Once Equation (36) is calibrated, it is applied to every detected source by evaluating it at the convolutional significance already available from detection, with the resulting radius rounded to the grid of Equation (26) and clipped to its boundaries. In this way, the optimal radius for every detection is determined from a single quantity already available at detection time, without recomputing the noise model on a source-by-source basis.
This procedure is validated in Figure 11. The left-hand panel compares the photometric S/N as a function of the total signal for the adaptive aperture against four fixed-aperture alternatives. The adaptive curve traces the upper envelope of the fixed apertures across the full dynamic range: at the faint end it follows the small-aperture curves, where a wider aperture would incur an avoidable background penalty; at the bright end it converges with the larger ones, where the aperture-correction systematic is minimized by a near-unit . No single fixed radius is competitive across the full brightness range, which is the basic motivation for the adaptive scheme. The right-hand panel illustrates the result on a representative cutout of the field: each detected source is enclosed by a circle of radius , with bright stars assigned wide apertures that capture the full PSF wings and faint stars assigned compact apertures that minimize background contamination. The photometric dataset produced by this scheme provides the per-source position, total flux and uncertainty .

Figure 11. Photometric performance of the adaptive aperture scheme. Left: Photometric S/N as a function of total signal for the adaptive aperture (open blue circles) compared with four fixed-aperture alternatives at (red-to-purple gradient). The adaptive curve traces the upper envelope of the fixed alternatives across the full dynamic range. Right: Representative cutout of the field with each detected source enclosed by a circle of radius . The aperture size adapts smoothly to source brightness, with the brightest stars receiving wide apertures that minimize the aperture-correction systematic and the faintest receiving compact apertures that limit background contamination.
Results
Synthetic injection–recovery validation
Characterizing the performance of a source-extraction pipeline requires a ground truth against which its output can be compared. On real images the true positions and fluxes of the sources are unknown, so any assessment based on external catalogs is limited by the accuracy, depth and bandpass of the reference data, and cannot probe the faint end where the pipeline is most stressed. We therefore validate GPUPHOT with a controlled injection–recovery experiment, in which synthetic point sources of known position and flux are inserted into images and recovered by running the full pipeline from scratch. This approach provides an exact truth catalog at every brightness, isolates the behavior of the estimators from calibration uncertainties, and allows the false-positive rate to be measured unambiguously.
We carry out this validation on four instruments chosen to span a wide range of plate scales and PSF sampling, so that the spatially varying PSF model is tested across regimes. The TTT-2m telescope, equipped with a CCD, provides a small, well-sampled field ( at ); the TTT-80cm telescope contributes a wider sCMOS field ( at ); the TST is a wide-field sCMOS imager ( at ) with a large field of view and strong PSF variation; and the ATLAS-Teide telescope provides an even wider, undersampled sCMOS field ( at ). Together they cover the full range from small, well-sampled fields to large, undersampled ones.
To avoid the confusion that real sources would introduce and to control the noise properties exactly, the synthetic images are built on a flat background rather than by injecting onto science frames. For each test image we inherit the measured sky level and the noise model of the corresponding real observation (§ 3), and construct a uniform background at the constant level. Point sources are then added using the spatially varying PSF model of § 4: for a source at position the reconstructed PSF is evaluated at that location, shifted to the requested sub-pixel position with a third-order spline, and scaled to the injected flux. The sub-pixel barycenter of the shifted stamp is recorded as the true position, so that the astrometric residuals are measured against the actual center of light rather than the nominal coordinate.
Injected magnitudes are drawn uniformly in instrumental magnitude over a range anchored to the real source population, extending from well above the brightest unsaturated stars down to below the noise floor. Sources are placed at random positions subject to a minimum separation of from any previously injected star, which keeps blending negligible, and no closer than a border margin to the frame edge. For each instrument we generate several independent realizations, adjusting the number of images and the number of sources per image to the field size, for a total of 10,000 synthetic stars per instrument. Each synthetic frame is written to disk and processed by the complete production pipeline with no knowledge of the injected catalog; the recovered detections are then matched to the truth by position, using a tolerance of . The results are summarized in Figure 12 and discussed below.

Figure 12. (a) Completeness (blue) as a function of predicted S/N, with a logistic fit and the (S/N) level marked; the precision (red; TP/(TP + FP)) quantifies the false-positive contamination measured on the same images. (b) Astrometric residuals: recovered minus injected position, in arcseconds, shown as two-dimensional histograms; dashed lines mark pixels. The RMS per axis is quoted in each panel. (c) Photometric precision: recovered minus injected magnitude () versus S/N; gray points are individual sources and blue points show the binned median with error bars. Injection–recovery validation of GPUPhot on synthetic images for the four instruments of the survey. Synthetic stars drawn from a realistic brightness distribution are injected onto a flat background with the measured sky level and noise, using the spatially varying PSF model, and recovered by running the full pipeline from scratch.
Detection completeness
Completeness is defined as the fraction of injected sources that are recovered, as a function of the predicted signal-to-noise ratio computed from the injected flux and the noise model. Panel (a) of Figure 12 shows the completeness (blue) for the four instruments. In all cases the transition is sharp and well described by a logistic function, with a 50% completeness limit (S/N) between 5.2 and 9.3. Above (S/N) the completeness plateaus close to unity in every case.
Because a completeness curve alone can always be improved by lowering the detection threshold at the cost of spurious detections, we characterize the false-positive contamination on the same source-free images. Any detection that does not match an injected source is, by construction, a false positive. We quantify this through the precision (red curve; TP/(TP + FP)), binned by detected S/N. In all instruments the precision rises rapidly and reaches unity for (S/N) : above this level essentially no spurious sources are produced. The contamination is confined to the low-S/N regime near the detection threshold, where it coincides with the incomplete ness region, so that the operating range in which both completeness and precision approach unity is broad and clean. The false positives are somewhat more prevalent near threshold for TST, the instrument with the strongest PSF variation. Nonetheless all four instruments reach a pure sample well within the regime where the survey operates.
Astrometric precision
Panel (b) of Figure 12 shows the astrometric residuals in arcseconds between the recovered and the true
(injected barycenter) positions. The dashed lines mark pixels at the plate scale of each instrument, so that the sub-pixel nature of the recovery is directly apparent. In all four cases the residual cloud is centered close to the origin and is well contained within the half-pixel lines, with per-axis RMS values ranging from 0.11 to 0.38′′. The distributions are compact and approximately isotropic, with only a small residual offset that can be absorbed in the astrometric solution. Some asymmetry is visible for TTT-80cm and ATLAS-Teide as well as TST.
We note that the residuals are quoted in angular units rather than pixels because the instruments differ substantially in plate scale: the undersampled ATLAS camera yields the smallest residual in pixels but not on the sky, and the angular comparison is the physically meaningful one. The larger residuals of TST reflect its wider field and stronger PSF variation, while the well-sampled instruments reach the level.
Photometric precision
Panel (c) of Figure 12 shows the photometric residuals as a function of ; gray points are individual sources and the blue points show the binned median with error bars. In all four instruments the median residual is a small, constant offset of mag that remains flat from the completeness limit all the way to the brightest sources. Being independent of brightness and position, it is fully absorbed in the photometric zero point and does not affect relative photometry. Finite growth-curve normalization and pixel-discrete apertures can contribute, although their individual contributions are not isolated here.
The constancy of across the entire dynamic range is a key result: it shows that the optimal-aperture scheme, which selects the aperture that maximizes the detection on a source-by-source basis, not only improves the photometric as demonstrated in Figure 11, but does so without introducing any brightness-dependent bias in the flux measurement. Bright and faint sources receive different apertures, yet the recovered magnitude offset is the same for all of them, confirming that the adaptive aperture and its correction are self-consistent across brightness. The scatter of the band at high sets the floor of the photometric precision, reaching the few-millimagnitude level for the brightest sources and decreases monotonically with brightness, as expected.
Comparison with catalogs
The synthetic experiment of § 7.1 measures the performance of the estimators against an exact truth catalog, but does not test the calibration of the output onto an absolute reference frame. Two calibration steps are required for that purpose and are applied to every science frame as part of the standard pipeline output: the transformation of the pixel centroids into celestial coordinates and the conversion of the instrumental fluxes into a standard photometric system.
Astrometric calibration
The photometric catalog produced by the pipeline (§ 6) provides, for every detection, a sub-pixel centroid and a detection significance . Astrometric calibration begins by selecting from this catalog a clean subset of high-confidence sources: detections above a minimum signal-to-noise threshold are retained, sorted by decreasing significance, and the brightest are passed to the solver. Restricting the input to the brightest, most reliable centroids both accelerates the asterism matching and minimizes the contamination of the solution by spurious or poorly centroided detections.
The plate solution is obtained with Astrometry.net ([23]), run through a two-tier strategy that favors a fast local solve and resorts to the online service only when necessary. In the first tier the source list is matched against locally stored geometric-hash index files (astrometry.net index series 4100 and 5200, spanning angular scales from a few arcminutes to several degrees) with the reference quad-matching engine. The solve is seeded with two hints derived from the telescope pointing and instrument configuration: a scale hint, bracketing the nominal plate scale and a position hint, restricting the search to a radius about the commanded field center. When the hinted solve fails—for instance, when the pointing metadata are unreliable—a second, blind local solve is attempted without hints, and only if that also fails is the field submitted to the online Astrometry.net server. In practice the hinted local solve succeeds for the overwhelming majority of science frames and the fallbacks are exercised only for anomalous pointings.
A candidate solution is accepted as soon as the log-odds of the best asterism match exceed a threshold of 100, which effectively eliminates false positives. Field distortions are captured by fitting a Simple Imaging Polynomial (SIP; [38]) of order three simultaneously with the linear WCS terms, sufficient to describe the optical distortion of the wide-field instruments to well below the centroiding accuracy. The resulting WCS—the linear CD matrix together with the SIP coefficients—is written to the frame header, and the full source catalog is transformed from pixel to celestial coordinates through it, assigning an pair to every detection.
The accuracy of the solution is assessed by cross-matching the calibrated source positions against the reference catalog and examining the residuals. Figure 13 shows the two-dimensional distribution of the offsets and for a representative field taken with one of the TTT-80cm, together with their marginal histograms. The residual cloud is tightly concentrated about the origin, with per-axis RMS values of and negligible systematic biases in R.A. and Dec., respectively. The absence of any measurable bias confirms that the SIP solution absorbs the field distortion without leaving a coherent offset, while the RMS—a fraction of a pixel at the plate scale of this instrument—sets the astrometric precision of the survey and is consistent with the sub-pixel performance measured in the controlled experiment of § 7.1.2.

Figure 13. Astrometric accuracy of the GPUPhot solution on a representative science frame. Main panel: residuals between the calibrated source positions and their cross-matched counterparts in the reference catalog, in the sense recovered minus catalog, decomposed into and in arcseconds. Top and right panels: marginal histograms of the two residual components. The per-axis RMS and bias are quoted in the main panel and the dotted lines mark the origin. The distribution is compact, approximately isotropic and centered on zero, with a per-axis RMS below the pixel scale of this frame () and no measurable systematic offset.
Photometric calibration
With the WCS in place, the instrumental fluxes are tied to a standard system through a photometric zero point (ZP). GPUPhot first queries, via the VizieR service (F. Ochsenbein et al. [29]), a photometric reference catalog over a cone of radius equal to half the field diagonal centered on the frame. The catalog is selected automatically from the observing filter and the field declination: Pan-STARRS DR1 (K. C. Chambers et al. [14]) for the SDSS-like broad-band filters over the accessible sky, Gaia DR3 (Gaia Collaboration et al. [18]) for the unfiltered configuration and the SkyMapper Southern Survey (C. A. Onken et al. [30]) for fields south of beyond the Pan-STARRS footprint. For each reference star the query returns its celestial coordinates, its magnitude in the band matched to the observation and a color index defined below.
The calibrated sources are cross-matched against the reference catalog by position, using a -d tree with a matching tolerance of . For each matched star the instrumental magnitude is formed from the calibrated flux of § 6, normalized by the exposure time ,
and the zero point is defined by the relation , i.e. as the offset between the catalog and instrumental magnitudes at unit slope.
Before the zero point is fitted, the matched sample is filtered by three criteria designed to isolate a clean, well-behaved set of calibrators, illustrated by the color coding in Figure 14. First, a color cut retains only stars of near-solar color, with mag by default, where is the deviation from the solar color . The index is computed from the catalog photometry through published transformations: the relations of J. L. Tonry et al. [41] for Pan-STARRS and SkyMapper, and a quadratic function of the color for Gaia (M. Riello et al. [34]). This particular choice reflects the origin of GPUPhot, developed to process the large volume of Solar System observations produced by the TTT, TST and ATLAS-Teide surveys, whose targets have approximately solar colors and for which a calibration anchored on solar-type stars is therefore the natural one. The criterion is not intrinsic to the method: the width is a free parameter, the reference color can be set to any value appropriate to the science case and the cut can be disabled altogether—in which case the full color range of the matched sample enters the fit, at the cost of a zero point that absorbs the unfitted color term of the sample as a whole. Second, a signal-to-noise cut, , excludes both faint stars, whose photometry is noise-dominated, and the brightest stars, which may approach the non-linear or saturated regime. Third, a central-region cut keeps only sources within the central portion of the detector, where the PSF is most symmetric and vignetting is negligible.

Figure 14. Photometric zero-point determination on a representative science frame. The difference between the catalog and instrumental magnitudes, , is shown as a function of instrumental magnitude for all cross-matched stars. Points are color-coded by the selection stage that discarded them—signal-to-noise (gray), central region (orange), color (light gray) and the final -clip (red)—while the blue points are the stars retained for the fit. The horizontal blue line marks the adopted zero point, mag, estimated as the sigma-clipped mean of the retained offsets at fixed unit slope. The legend gives the number of stars in each category.
The zero point is then estimated as a robust, sigma-clipped mean of the per-star offsets , holding the slope fixed at unity. Starting from the full surviving sample, the median and standard deviation are computed, and stars deviating from the median by more than (with ) are rejected; the procedure iterates until the retained set is stable or drops below three stars, and never exceeds ten iterations. The zero point and its uncertainty are the mean and standard error of the surviving offsets.
Although a free slope can absorb residual color or non-linearity trends within a single frame, we find empirically—on time series of repeated observations of the same field—that the pure offset yields a markedly more stable zero point from image to image, i.e. a lower scatter in , because it does not couple the calibration to frame-to-frame changes in the calibrator distribution. The color and S/N cuts above already remove the trends that a free slope would otherwise be tuned to capture.
Figure 14 shows the outcome for the same representative field. The offset is plotted against the instrumental magnitude for every matched star, color-coded by the criterion that removed it with the retained calibrators highlighted and the fitted zero point drawn as a horizontal line. The retained points scatter tightly about a constant offset with no discernible trend in magnitude, confirming that the unit-slope assumption holds over the calibrated range.
GPU implementation
Most of the algorithms presented in § 2–§ 6 are not new in their purpose, and several have been used before in whole or in part. What is deliberate here is their reformulation: each has been recast so that it reduces to a convolution with a position-independent kernel or to an element-wise operation on full-frame maps. The justification for that redesign is not the individual algorithm, for which a conventional formulation would often be simpler, but the requirement that the complete pipeline run on a GPU over large numbers of large images. A Graphics Processing Unit applies a single instruction to many data elements concurrently and reaches its nominal throughput only for operations that are uniform across those elements. Under this constraint no stage iterates over individual sources, and no stage has a cost that depends on the number of distinct PSFs present in the field: the position dependence is carried by coefficient maps computed once per frame and applied as element-wise factors. The per-frame cost is set by the number of transforms rather than by the source count, and its distribution across stages follows from the same structure. Constructing the eigenmode basis and interpolating its coefficient maps across the focal plane together account for a small fraction of the per-frame wall-clock time, comparable to that of background estimation, while the per-source growth curves of Equation (25), evaluated at every radius of the grid of Equation (26), dominate in fields of high source density. Describing the PSF empirically as a function of position is therefore not appreciably more expensive than assuming it to be constant.
The algorithms are implemented in GPUPhot, within a framework that handles image and data ingestion and output, the management of computational resources, access to external catalogs and the storage of point-source measurements in a single environment. On a consumer-grade NVIDIA RTX 3060, a CCD frame is reduced in under 7 s and a sCMOS frame of moderate source density in under 25 s, in both cases from the raw frame to the calibrated catalog: defect correction, background and noise-map estimation, PSF modeling, detection, photometry and astrometric and photometric calibration. On an NVIDIA H100 PCIe, a datacenter accelerator intended for high-performance computing workloads, the same frames require approximately 5 s and 8 s, and a (151-Mpx) wide-field image containing more than sources is reduced in under 40 s. These are production timings rather than a controlled CPU-to-GPU comparison. Because the memory footprint of a frame of this size leaves headroom on an 80 GB device, at least four reductions run concurrently on a single accelerator, bringing the effective throughput to better than one wide-field image every 10 s.
GPUPhot has been in routine operation at the Teide Observatory since February 2023, when it began reducing the data stream of the TTT and TST, and since January 2025 for ATLAS-Teide. It has to date reduced 3.7 million frames, amounting to 1.2 PB of imaging, at a sustained average of frames and 1.5 TB per night across all telescopes. A companion paper [25] describes the implementation of the framework and quantifies the execution time of each pipeline stage across image sizes, source densities and a range of GPU platforms, together with the scripts required to reproduce those measurements. It also compares against the CPU tools sep and Photutils, both for the overall tools and for detection on the same input arrays. The former comparison has different pipeline scopes, and the latter still returns different source lists; neither is an identical-output end-to-end speed-up. A fully equivalent benchmark would require matching and optimizing the individual stages, including their accuracy criteria and I/O. The code is publicly available in https://github.com/Light-Bridges/GPUPhot.
Conclusions
We have described the algorithms that make up GPUPhot, covering the analysis of a calibrated frame through to the final catalog: correction of cosmic rays and detector defects, background and noise-map estimation, the construction of an empirical PSF model that varies across the focal plane, matched-filter source detection and adaptive aperture photometry with its empirical correction and noise model. Each is presented as a self-contained procedure, and several are applicable beyond the photometric pipeline in which they are assembled here.
We validated the pipeline through a controlled injection–recovery experiment on four instruments spanning an order of magnitude in plate scale, from the small, well-sampled TTT-2m CCD field to the severely under-sampled ATLAS-Teide sCMOS wide field. The detection is complete and pure over a broad operating range, with 50% completeness limits between and 9 and a precision that reaches unity above . The astrometry is sub-pixel in every case, with per-axis residuals of 0.11–0.38. The photometry shows a constant offset of mag, independent of brightness and position, that is fully absorbed into the zero point, reaching a few-millimagnitude floor for the brightest sources. The agreement with external catalogs confirms this performance on real data: the astrometric solution
reaches a sub-pixel RMS with no measurable bias and the photometric zero point is recovered with millimagnitude precision.
Taken together, these results show that a consistently kernel-based formulation makes the reduction of image archives at the petabyte scale tractable at low computational cost, without sacrificing completeness or astrometric and photometric accuracy.
Acknowledgements
This research made use of storage and computing capacity at ASTROP’OC’s EDGE computing center in Tenerife in the form of Indefeasible Computer Rights (ICR), provided by Light Bridges in cooperation with Bechtle and LENOVO. Additionally, this work is based on observations made with the Two-meter Twin Telescope (TTT) and the Transient Survey Telescope (TST), located at the Teide Observatory of the Instituto de Astrofísica de Canarias (IAC) and operated by Light Bridges in Tenerife, Canary Islands, Spain, using observation time rights (DTO). Dr Antonio Maudes’s economic and legal insights were instrumental in shaping this work. M.R.A. and J.L. We acknowledge financial support through grant PID2024-160618NB-C22, “Hydrated Minerals and Organic Compounds in Primitive Asteroids 2”, funded by MICIU/AEI/10.13039/501100011033 and by ERDF, EU, and through the Severo Ochoa Centre of Excellence accreditation awarded to the Instituto de Astrofísica de Canarias, grant CEX2025-001609-S, funded by MICIU.
Author Contributions
MRA conceptualized the research, designed the core algorithms and software and wrote the original draft of the manuscript. SLP optimized the code and validated the computational results. MSR and JL provided supervision and contributed to methodological discussions. All authors reviewed and edited the manuscript and approved its final version.
Facilities: TTT (FERVOR, COLORS), TST (FERVOR), ATLAS-Teide.
Statistical derivation of the detection statistic
This appendix derives in detail the maximum-likelihood detection statistic introduced in § 4.1. We carry out the derivation for a general point spread function and specialise to the fixed Gaussian kernel used for isolated-star detection only at the end.
Image model and assumptions
We take as our starting point the isolated point-source model of Equation (6),
where is the observed (background-subtracted) value at pixel , is the source flux, is the PSF normalized to unit sum () and centered at the trial position , and is the noise at pixel . We adopt three standard assumptions on the noise :
Gaussianity: , i.e. each follows a Gaussian distribution of zero mean and variance given by Equation (3).
Pixel independence: the noise values at different pixels are statistically uncorrelated, for . This is a reasonable approximation for typical astronomical detectors, where pixel-to-pixel correlations introduced by charge diffusion or readout electronics are negligible relative to the dominant noise sources.
Background-dominated regime: the source Poisson term in Equation (5) is negligible compared to the sky and read-noise contributions, so that . This regime is the natural one for source detection: the null hypothesis is that no source is present, so the source Poisson term does not enter the noise budget.
The likelihood function
Under the Gaussianity assumption, the probability density of observing the value at pixel , given the model parameters , is
Pixel independence implies that the joint probability of observing the entire image factorises as
Taking the logarithm converts the product into a sum, while the per-pixel normalization factors collect into a single additive term :
Maximising this log-likelihood is equivalent to minimising the inverse-variance–weighted sum of squared residuals, i.e. a weighted .
Maximum-likelihood estimator
At fixed trial position , the maximum-likelihood estimate of the flux is obtained by setting the derivative of with respect to to zero. Because the background-dominated assumption makes independent of , the noise variance does not contribute to the derivative, so this yields a single linear equation:
Rearranging,
which yields
With replaced by the Gaussian kernel , Equation (44) is equivalent to Equation (8).
Variance of the estimator
The weights in Equation (44) depend only on the kernel and the noise map, not on the data themselves, so can be written as a linear combination of the image pixels:
For a linear combination of independent random variables, the variance is . Under the background-dominated assumption, , and letting denote the denominator,
Therefore
Physically, this weighting extracts all the information about the flux that the image contains: it matches the filter to the shape of the source through , giving most weight to the pixels where the PSF deposits the most light, and to the reliability of each pixel through , down-weighting those dominated by noise. No alternative way of weighting and combining the pixels yields a lower-variance unbiased estimate of the flux, and the resulting matched-filter form is the reason it is the method of choice for point-source detection.
Locally stationary approximation
The exact detection statistic carries the position-dependent weights inside the sums. These weights break the convolution structure and, therefore, preclude evaluation by FFT-based convolution. We thus adopt the locally stationary approximation: if varies on spatial scales much larger than the kernel size, then within a region of radius comparable to the kernel width centered on , . Substituting this into Equation (44) factors out of both sums, yielding
where is the reflected kernel, is the cross-correlation evaluated at , and is the effective kernel area, independent of . Analogously, the estimator variance becomes
Combining Equations (48) and (49),
For isolated-star detection the PSF is not yet known, and we replace by the fixed Gaussian kernel (, ), recovering Equation (9) of the main text. This result is equivalent to Equation (10) of J. Bosch et al. [11].
References
- [1]Akhlaghi, M., & Ichikawa, T. 2015, ApJS, 220, 1, doi: 10.1088/0067-0049/220/1/1DOI
- [2]Alarcon, M. R., Lemes-Perera, S., Serra-Ricart, M., & Licandro, J. 2026a, Research Notes of the American Astronomical Society, 10, 143, doi: 10.3847/2515-5172/ae7368
- [5]Alarcon, M. R., Licandro, J., Serra-Ricart, M., et al. 2023, PASP, 135, 055001, doi: 10.1088/1538-3873/acd04aDOI
- [6]Bai, Z., Jia, P., Lv, J., et al. 2025, AJ, 169, 88, doi: 10.3847/1538-3881/ad9b2eDOI
- [7]Bellm, E. C., Kulkarni, S. R., Graham, M. J., et al. 2019, PASP, 131, 018002, doi: 10.1088/1538-3873/aaecbeDOI
- [8]Bentley, J. L. 1975, Communications of the ACM, 18, 509
- [9]Bertin, E. 2011, in Astronomical Society of the Pacific Conference Series, Vol. 442, Astronomical Data Analysis Software and Systems XX, ed. I. N. Evans, A. A. Accomazzi, D. J. Mink, & A. H. Rots, 435
- [10]Bickerton, S. J., & Lupton, R. H. 2013, MNRAS, 431, 1275, doi: 10.1093/mnras/stt244DOI
- [11]Bosch, J., Armstrong, R., Bickerton, S., et al. 2018, PASJ, 70, S5, doi: 10.1093/pasj/psx080DOI
- [12]Cai, M., Xu, Z., Fan, L., et al. 2025, arXiv e-prints, arXiv:2501.15018, doi: 10.48550/arXiv.2501.15018DOI
- [13]Cao, L., Jia, P., Li, J., et al. 2025, AJ, 169, 215, doi: 10.3847/1538-3881/adb842DOI
- [14]Chambers, K. C., Magnier, E. A., Metcalfe, N., et al. 2016, arXiv e-prints, arXiv:1612.05560, doi: 10.48550/arXiv.1612.05560DOI
- [16]Flaugher, B., Diehl, H. T., Honscheid, K., et al. 2015, AJ, 150, 150, doi: 10.1088/0004-6256/150/5/150DOI
- [17]Friedman, J. H., Bentley, J. L., & Finkel, R. A. 1977, ACM Transactions on Mathematical Software (TOMS), 3, 209
- [18]Gaia Collaboration, Vallenari, A., Brown, A. G. A., et al. 2023, A&A, 674, A1, doi: 10.1051/0004-6361/202243940
- [20]Ivezić, Ž., Kahn, S. M., Tyson, J. A., et al. 2019, ApJ, 873, 111, doi: 10.3847/1538-4357/ab042cDOI
- [21]Jarvis, M., & Jain, B. 2004, arXiv e-prints, astro, doi: 10.48550/arXiv.astro-ph/0412234DOI
- [22]Kochanek, C. S., Shappee, B. J., Stanek, K. Z., et al. 2017, PASP, 129, 104502, doi: 10.1088/1538-3873/aa80d9DOI
- [23]Lang, D., Hogg, D. W., Mierle, K., Blanton, M., & Roweis, S. 2010, AJ, 139, 1782, doi: 10.1088/0004-6256/139/5/1782DOI
- [24]Lauer, T. R. 1999, PASP, 111, 1434, doi: 10.1086/316460DOI
- [25]Lemes-Perera, S., Alarcon, M. R., Serra-Ricart, M., & Caballero-Gil, P. 2026, arXiv e-prints, arXiv:2609.32375, doi: 10.48550/arXiv.2609.32375
- [26]Licandro, J., Tonry, J., Alarcon, M. R., Serra-Ricart, M., & Denneau, L. 2023, in 2nd NEO and Debris Detection Conference, 2, doi: 10.48550/arXiv.2302.07954DOI
- [27]Mighell, K. J. 2005, MNRAS, 361, 861, doi: 10.1111/j.1365-2966.2005.09208.xDOI
- [28]Niwano, M., Murata, K. L., Adachi, R., et al. 2021, PASJ, 73, 14, doi: 10.1093/pasj/psaa091DOI
- [29]Ochsenbein, F., Bauer, P., & Marcout, J. 2000, A&AS, 143, 23, doi: 10.1051/aas:2000169DOI
- [30]Onken, C. A., Wolf, C., Bessell, M. S., et al. 2024, PASA, 41, e061, doi: 10.1017/pasa.2024.53DOI
- [31]Piotrowski, L. W., Batsch, T., Czyrkowski, H., et al. 2013, A&A, 551, A119, doi: 10.1051/0004-6361/201219230DOI
- [32]Popescu, M. M., Tatsumi, E., Licandro, J., et al. 2025, PSJ, 6, 42, doi: 10.3847/PSJ/ada560DOI
- [33]Reddy, V., Kelley, M. S., Benner, L., et al. 2024, PSJ, 5, 141, doi: 10.3847/PSJ/ad4a6dDOI
- [34]Riello, M., De Angeli, F., Evans, D. W., et al. 2021, A&A, 649, A3, doi: 10.1051/0004-6361/202039587DOI
- [35]Rodríguez Rodríguez, J., Díez Alonso, E., Iglesias Álvarez, S., et al. 2026, PSJ, 7, 15, doi: 10.3847/PSJ/ae2d11DOI
- [36]Sako, S., Ohsawa, R., Takahashi, H., et al. 2018, in Society of Photo-Optical Instrumentation Engineers (SPIE) Conference Series, Vol. 10702, Ground-based and Airborne Instrumentation for Astronomy VII, ed. C. J. Evans, L. Simard, & H. Takami, 107020J, doi: 10.1117/12.2310049
- [37]Schechter, P. L., Mateo, M., & Saha, A. 1993, PASP, 105, 1342, doi: 10.1086/133316DOI
- [38]Shupe, D. L., Moshir, M., Li, J., et al. 2005, in Astronomical Society of the Pacific Conference Series, Vol. 347, Astronomical Data Analysis Software and Systems XIV, ed. P. Shopbell, M. Britton, & R. Ebert, 491
- [39]Stetson, P. B. 1987, PASP, 99, 191, doi: 10.1086/131977DOI
- [40]Stetson, P. B. 1990, PASP, 102, 932, doi: 10.1086/132719DOI
- [41]Tonry, J. L., Stubbs, C. W., Lykke, K. R., et al. 2012, ApJ, 750, 99, doi: 10.1088/0004-637X/750/2/99DOI
- [42]Tonry, J. L., Denneau, L., Heinze, A. N., et al. 2018, PASP, 130, 064505, doi: 10.1088/1538-3873/aabadfDOI
- [45]Winecki, D., & Kochanek, C. S. 2024, ApJ, 971, 61, doi: 10.3847/1538-4357/ad5a0bDOI
- [46]Yang, Z., Liu, M., Yuan, H., et al. 2023, AJ, 166, 210, doi: 10.3847/1538-3881/acfeed
- [47]Zackay, B., & Ofek, E. O. 2017, ApJ, 836, 187, doi: 10.3847/1538-4357/836/2/187DOI