5.3.6 BP/RP spectra external calibration
Author(s): Paolo Montegriffo
The two main tasks of the external calibration are: i) provide an instrument model to allow for a physical interpretation of the BP and RP mean spectra, and ii) transform the mean spectra to fully calibrated (flux and wavelength) spectral energy distributions (SEDs).
The external calibration is based on the following main assumptions:
-
•
all differential effects across the focal plane (including variations with time) are completely accounted for by the internal calibration;
-
•
the internal reference system is uniquely defined for all sources, independently of source colours and magnitudes;
-
•
the internal reference system can be represented by an instrument model that is close to the physical instrument at an arbitrary position on the focal plane.
5.3.6.1 Instrument model
The dispersed image of a point-like source in the data space can be expressed as:
| (5.3) |
where:
-
•
is the continuous coordinate in the along scan (AL) direction;
-
•
is the continuous coordinate in the across scan (AC) direction;
-
•
is the telescope pupil area in units of m;
-
•
is the source photon flux distribution (SPD) in units of photons s m nm;
-
•
is the effective monochromatic point spread function (PSF) at wavelength ;
-
•
is the dispersion function;
-
•
is the overall instrument response function.
This model assumes that (i) the dispersion of the prism is perfectly aligned with the AL direction, and (ii) charge transfer inefficiency (CTI) effects can be neglected. The BP and RP spectra originate from collapsing the 2D image along the AC direction, thus giving:
| (5.4) |
where
-
•
is the internally calibrated mean spectrum in units of e s;
-
•
is the effective monochromatic LSF at wavelength .
The classical approach of deriving an instrument response by computing a ratio between the observational spectra and the corresponding SPD over a limited number of featureless calibrators cannot be applied here because of the large LSF width compared to the wavelength scale of response variations. As a consequence, the LSF and dispersion relation must be derived together with the instrument response. This can be achieved in principle using an arbitrarily large number and variety of standard stars (sources with known spectral energy distributions) by tuning the model until a match is obtained between the model prediction and the corresponding observational mean spectra.
However, the stringent criteria set to select reliable flux calibrators (see Section 5.6) led to a selection of stars spanning a limited range in astrophysical parameters, the SED shapes of which are not sufficiently independent of each other, thus leaving a significant number of instrument components undetermined. This limitation is mitigated in two ways: (i) by building the instrument model upon a nominal model based on the pre-launch knowledge of the actual instrument, and (ii) by employing in the calibration process a large set of additional sources that escape the severe selection criteria adopted for the standard flux calibrators, but exhibit narrow emission lines in their spectra (possibly) all along the covered wavelength range. Candidate sources of this kind are QSOs, Be stars and other H emitters, Wolf–Rayet stars, etc.
For Gaia DR4, a total of 200 QSOs were selected from the Milliquas 7.2 catalogue (Flesch 2021) and extended with models to guarantee full coverage across the Gaia 300–1100 nm wavelength range. In addition, spectra of four compact planetary nebulae (PNe) selected by the Euclid mission’s calibration team (Euclid Collaboration et al. 2023) have been included to provide stringent constraints on the instrument dispersion relation (see Section 5.3.6.2).
5.3.6.1.1 LSF model
The monochromatic LSF is obtained by integrating in the AC direction. The LSF model is based on a linear combination of the product of two sets of basis functions modelling respectively the AL and the wavelength dependency; these bases have been derived with generalized principal component analysis (GPCA) on a large set of theoretical LSFs simulated for the nominal instrument. The framework for PSF/LSF simulations, as developed by Lindegren (Lindegren 2006), was applied to the present case of the BP/RP spectra calibration, and is described in detail in the technical note (Montegriffo 2017).
Theoretical PSFs were computed with an accuracy in the AC direction of up to pixels from the centre, and the final wavelength grid contains 100 points distributed between and nm. A total of 5000 sets of PSFs were randomly generated; for each set, a corresponding set of monochromatic LSFs was obtained by summing the PSFs along the AC direction and multiplying by an appropriate scaling factor. Each LSF is then considered twice by reversing the AL axis in order to preserve the intrinsic AL symmetry of the problem.
However, such LSFs only span a limited AL interval of pixels; therefore, a proper model for the wings was derived and applied also in order to correctly normalize the LSFs. The wings for polychromatic and quasi-monochromatic LSF were modelled by a tail function which is strictly zero for , decreases as for (thus reproducing the expected behaviour of a true LSF), and is a fourth-degree polynomial in the interval , where is the AL coordinate in pixels, and , are the values at which the tail function joins the LSF. To make the analytical LSF representation continuous at a proper scaling factor is applied. As an example, the reconstruction of an LSF at nm and nm is shown in Figure 5.11.
The GPCA algorithm is able to preserve the spatial locality of pixels in an image by projecting the images to a vector space that is the tensor product of two lower-dimensional vector spaces. Each simulated LSF is arranged in a matrix of which the columns are the monochromatic LSFs sampled on a given grid; the mean LSF is computed and subtracted from each LSF, and the residuals are arranged in a stack of 10000 matrices which are decomposed through GPCA into a 2D set of bases designated by two matrices and modelling respectively the dependence of LSF in sample and wavelength spaces. The th numerical LSF can be approximated as:
| (5.5) |
or, in extended notation:
| (5.6) |
The above relation represents the implemented model for the LSF representation: it is 2D-interpolated to continuous variables by 1D interpolation of the and bases separately. The interpolation function for the U bases must satisfy the ‘shift-invariant sum’ condition, i.e., preserve the underlying function normalization independently of the sub-pixel position of the sampling grid: the most suitable interpolation method is given by the S-spline representation described in Lindegren (2003). The interpolation for the right basis functions W is achieved with a cubic spline. A complete description of this model can be found in Montegriffo (2017).
This formulation of the LSF model is essentially the same as the one adopted for DR3. However, it proved unable to adequately describe the observed fluxes in the wings of the spectra, which were systematically higher than those predicted by the model. Moreover, these systematic photometric residuals depend on source colours. To account for this wide-angle scattering component, we introduce a diffuse Gaussian halo with width . The total LSF is then expressed as a chromatic mixture of the core model and this wide halo:
| (5.7) |
where the halo fraction is a linear function of the wavelength:
| (5.8) |
The parameters are fitted during the optimization process. The leading multiplicative factor in Equation 5.7 ensures that the total LSF remains properly normalized to unity.
5.3.6.1.2 Dispersion model
For each field of view, dispersion functions are provided for the centre of each CCD in the form of the coefficients of the expansion:
| (5.9) |
where
-
•
denotes the AL image position in mm (in the Y FPRS direction),
-
•
in nm denotes the inverse wavelength, and
-
•
for BP and for RP.
The AL position in pixel units can be obtained by dividing Equation 5.9 by the pixel size of a CCD in the along-scan direction .
The functional form adopted for the dispersion relation in Gaia DR4 depends on three parameters and is given by:
| (5.10) |
where
-
•
is the AL image position in pixel units;
-
•
and represent the wavelength zero-point and the nominal dispersion scale, respectively. By construction, the zero-point corresponds to the AL position at the reference wavelength. The nominal values are , , and .
This dispersion model defines the origin of the monochromatic LSFs as a function of wavelength (see Equation 5.4). However, the origin of the LSF does not necessarily coincide with its centroid, because in general the LSF is not symmetric, its shape can change with the wavelength, and hence it introduces some degeneracy between the chromaticity and the dispersion (Lindegren 2006). This degeneracy does not affect the instrument model because the dispersion model and the LSF origin are consistently defined. However, for a physical interpretation of the data, it is necessary that the dispersion relation provides the centroid of the monochromatic LSF as a function of wavelength. This dispersion relation is provided as a lookup table where at each wavelength the centroid is computed using Tukey’s biweight function by solving the non-linear equation:
| (5.11) |
for , where:
| (5.12) |
The dispersion curve for BP and RP is available from the Gaia DR4 area in the Gaia Cosmos portal.
5.3.6.1.3 Response model
The response model is built as the combination of a model for the nominal response with a parametrized cut-off and a distortion model to account for the deviations with respect to the current response:
| (5.13) |
The nominal photonic response for XP instruments is modelled as the product of the following quantities:
| (5.14) |
where
-
1.
is the telescope (mirrors) reflectivity;
-
2.
is the attenuation due to rugosity and molecular contamination of the mirrors;
-
3.
is the CCD quantum efficiency (QE);
-
4.
is the prism transmittance curve which includes the filter coatings on its surfaces and an additional parameter ().
Figure 5.12 shows the nominal curves, highlighting the photometer transmittance contribution to the overall curves. All these quantities were measured by Airbus DS during on-ground laboratory test campaigns. However, the filter wavelength cut-ons and cut-offs in the prism transmittance curves change over the focal plane due to uneven thickness of the prism coating, producing bandwidth non-uniformity: the expected variation is about 3 nm in the position of the BP cut-off and about 2 nm in the position of the RP cut-on (hereafter for convenience cut-off will be used for both instruments). To account for these effects, the wavelength position of the prism transmittance cut-off is fine-tuned using a single parameter, . This parameter shifts a discrete lookup table from which the transmittance curve is interpolated.
The distortion model in Equation 5.13 is implemented as a linear combination of basis functions in the AL sampling space :
| (5.15) |
which is then transformed into wavelength space through the dispersion relation:
| (5.16) |
The basis functions are Hermite polynomials, so that the width of the higher-order terms overlaps with the wavelength range where the nominal response is non-zero. The response shape parameters and the response cut-off parameter are fitted during the optimization process. In total, 17 parameters are used for the BP response model and 18 parameters for the RP response model.
5.3.6.1.4 Discrete Matrix Formulation and Projection
In the software implementation, the integral in Equation 5.4 is evaluated numerically over a discrete wavelength grid with uniform step and an AL sampling grid . The instrument matrix , which maps the SPD to the pseudo-wavelength pixel space, is defined as:
| (5.17) |
This continuous physical model includes an a posteriori spatial correction factor, : although the dispersion relation, the LSF, and the global instrument response are rigorously parametrized, small localized systematic residuals may remain in the AL pixel space. These residuals typically originate from unmodelled focal-plane anomalies or high-frequency truncation effects associated with the finite basis representation. To absorb these purely spatial systematics and obtain a flat residual baseline, the correction factor is determined empirically from the data once the primary global instrument parameters have converged to a stable solution.
The predicted flux vector in pseudo-wavelength pixel space is computed as:
| (5.18) |
where denotes the SPD vector sampled on the wavelength grid . Since Gaia XP spectra are represented in a coefficient space, the predicted pixel-space flux must be projected onto the basis functions using the pseudo-inverse of the design matrix . The final predicted coefficient vector is given by:
| (5.19) |
where is the Instrument Kernel matrix.
5.3.6.2 Processing
The determination of the instrument model parameters relies on a strict forward-modelling approach. Given the highly non-linear nature of the instrument model formulation (Equation 5.4), the optimal set of global parameters is initially evaluated utilizing a Differential Evolution algorithm (Storn and Price 1997).
The optimization process is bootstrapped starting directly from the nominal instrument model. However, as previously discussed in Section 5.3.6.1, relying solely on the primary Spectro-Photometric Standard Stars (SPSS) leaves certain instrument components heavily under-constrained due to the limited variety of their SED shapes. To overcome this fundamental bottleneck, the calibrator dataset is aggressively extended with a diverse array of auxiliary sources featuring strong emission lines (such as QSOs and PNs) and very red objects selected from the Passband Validation Library (PVL).
Because these additional auxiliary calibrators often exhibit intrinsic flux variability, a customized iterative scheme is implemented during optimization. Each major update of the instrument state is immediately followed by a grey-flux calibration of all non-SPSS sources. During this synchronization step, the overall flux scale of each auxiliary source is gently rescaled to minimize the difference between its predicted and observed flux distribution. This dynamic approach guarantees that the instrument model converges robustly, tightly anchored to the high-resolution SPSS foundation without being artificially biased by the innate variability of the broader extended calibrator sample.
Following the initial convergence of the Differential Evolution algorithm, the parameter space is rigorously sampled using a Markov Chain Monte Carlo (MCMC) algorithm. This probabilistic exploration maps the full uncertainty and degeneracy of the calibration parameters, generating a final, robust ensemble of 1000 accepted instrument models for each photometer (BP and RP).
5.3.6.3 SED reconstruction
Reconstructing the source Spectral Energy Distribution (SED), , from the observed coefficients requires inverting the instrument kernel matrix (see Equation 5.19). Because this projection models a physical smoothing process – driven by the instrument’s Line Spread Function and non-linear dispersion – it inherently attenuates high-frequency spectral information. Mathematically, this rapid decay of singular values makes the projection highly ill-conditioned, rendering direct matrix inversion numerically unstable as it would amplify microscopic observational noise into massive, unphysical structural oscillations.
To stabilize the inversion, rigorous regularization techniques are utilized. In Gaia DR4, distinct calibration schemes are provided. The standard calibration relies on a Hard Quenching approach, which cleanly truncates the basis space to prevent noise amplification. Alternatively, value-added calibrations are available based on hybrid Tikhonov-regularized inverse bases (Ridge Regression). In this two-stage approach, an optimal smoothing parameter is first determined via a second-order derivative penalty to isolate the L-curve corner, and then the final matrix inversion is executed using an unweighted zeroth-order Tikhonov regularization. This directly controls the mathematical stiffness of the reconstruction, offering users the ability to effectively navigate the ill-conditioned nature of the focal plane, particularly within the challenging RP domain.
5.3.6.4 Final products and GaiaXPy
The ultimate products of the external calibration procedure—the comprehensive instrument model ensembles and the corresponding inverse bases—are distributed directly to the astronomical community through the official GaiaXPy software package (Ruz Mieres et al. 2026). Comprehensive documentation and installation instructions can be found at the official GaiaXPy web portal.
GaiaXPy empowers users to interact with the Gaia DR4 XP spectra through two primary operational modes:
-
•
Simulation mode: Utilizes the forward instrument model ensembles (the 1000 MCMC samples per instrument) to predict the Gaia XP spectra, as well as the corresponding covariance matrices, for any arbitrary user-provided spectral energy distribution. This forward modelling fully accounts for the instrument’s Line Spread Function, non-linear dispersion, and global response, accurately propagating their associated uncertainties.
-
•
Calibration mode: Utilizes the provided inverse bases (including both the standard Hard Quenching and the value-added hybrid Tikhonov-regularized schemes) to reliably reconstruct absolute SEDs directly from the observed continuous XP coefficients published in the Gaia DR4 archive.