14.2.4 XP mean spectra
The construction of the XP mean spectra is described in Carrasco et al. (2021) and De Angeli et al. (2023). The latter also discusses the data quality and various issues detected.
Some general properties of the XP mean spectra in the catalogue can be found in Section 17.1.9 and Section 17.2.12.
In this section we describe some tests aiming for internal validation of the XP mean spectra in the catalogue. The tests look at some general properties (Section 14.2.4), the coefficients to the basis functions (Section 14.2.4), the shape of the spectra (Section 14.2.4), the integrated fluxes (Section 14.2.4), and the sampled spectra (Section 14.2.4).
General XP tests
Empty spectra: There is (only) one source with an RP spectrum but no BP spectrum. This source is source_id$=5405570973190252288$. It is a red and faint source ($G=19.81$, ${G}_{\mathrm{BP}}=21.76$ and ${G}_{\mathrm{RP}}=18.26$ mag). Although integrated photometry for BP could be calculated (using 11 observations), it is not surprising that no spectrum could be produced, given the faintness of the source.
Number of transits: As can be seen in Figure 14.9, the number of transits used for building the mean BP spectra is lower than for the mean RP spectra, although the number of observations used to derive the mean photometry is more balanced. This is a known issue, resulting from the fact that BP spectra from the first ten months of mission were rejected due to contamination of the mirrors, cf. Section 1.3.3.
Tests on source coefficients
XP source coefficients absolute value: The absolute value of the XP source coefficients should be smaller (or of the same order of magnitude) than the integrated flux. If we define the XP (either BP or RP) mean spectra coefficients as ${c}_{i}^{\mathrm{XP}}$ and ${F}_{\mathrm{XP}}^{\mathrm{phot}}$ the XP flux derived from the photometric calibration (phot_bp_mean_flux or phot_rp_mean_flux), we flag sources with
$${c}_{i}^{\mathrm{XP}}>{k}_{a}{F}_{\mathrm{XP}}^{\mathrm{phot}}\mathit{\hspace{1em}},$$  (14.1) 
with being ${k}_{a}$ a proportionality factor, adopted here as ${k}_{a}=3$. The index $i$ is running over all coefficients, i.e. $i=1,\mathrm{\dots},55$.
There is only one source failing the test for BP (none for RP), with source_id$=4155650209197703808$. There are two coefficients of its BP spectrum not fulfilling $$ and failing the test. They are coefficients 33 and 37, having ${c}_{33}=152.68$ and ${c}_{37}=121.68$ respectively. This source is a blue and faint object ($G=20.77$ mag, ${G}_{\mathrm{BP}}=21.33$ mag and ${G}_{\mathrm{RP}}=19.95$ mag). As it has very small total flux in BP (${F}_{\mathrm{BP}}^{\mathrm{phot}}=40.24\pm 23.16$ e${}^{}$/s), its mean internal sampled BP spectrum is quite unrealistic (Figure 14.10). In fact, considering the error in the coefficients, they are compatible with zero.
XP source coefficients decreasing: The values of the optimised XP source coefficients (${c}_{i}$) should in general be decreasing with the order of the coefficient ($i$), see Figure 17.58. We consider the first ${N}_{limit}$ coefficients and test the difference
$$X=\sum _{i=1}^{{N}_{limit}}{c}_{i}\sum _{i={N}_{limit}+1}^{{N}_{coefs}}{c}_{i}\mathit{\hspace{1em}}.$$  (14.2) 
Let $m$ be a vector of length ${N}_{coef}$ whose entries at position $i$ are $1$ if ${c}_{i}\ge 0$ and $1$ else. We have to adjust the signs in the covariance matrix of the coefficients, ${\mathrm{\Sigma}}^{c}$, by computing ${\mathrm{\Sigma}}^{c\mathrm{\prime}}=\mathrm{diag}(m){\mathrm{\Sigma}}^{c}\mathrm{diag}(m)$. The error on $X$ is then given by
$${\sigma}_{X}=\sqrt{\sum _{i,j=1}^{{N}_{limit}}{\mathrm{\Sigma}}_{i,i}^{c\mathrm{\prime}}+\sum _{i,j={N}_{limit+1}}^{{N}_{coef}}{\mathrm{\Sigma}}_{i,i}^{c\mathrm{\prime}}2\cdot \sum _{i=1}^{{N}_{limit}}\sum _{j={N}_{limit}+1}^{{N}_{coef}}{\mathrm{\Sigma}}_{i,j}^{c\mathrm{\prime}}}\mathit{\hspace{1em}}.$$  (14.3) 
The test is passed for a source if
$$\frac{X}{{\sigma}_{X}}>k\mathit{\hspace{1em}}.$$  (14.4) 
The suitable choice of the index ${N}_{\mathrm{limit}}$ depends on the basis in which the coefficients are analysed. For the optimised Hermite basis used in the spectra, a value of ${N}_{\mathrm{limit}}=5$ was adopted. For the limit, $k=5$ was used.
In Table 14.1 we show the results of the test.
Coefficients  % Passed  % Failed  Passed  Failed 
BP  199.99%  0.01%  219 171 605  26 037 
RP  100.00%  0.00%  219 192 173  15 470 
In Figure 14.11 we show the percentage of sources failing in a colourmagnitude diagram. Faint sources with extreme colours are the ones that fail the most, specially red sources for the BP test and vice versa.
Truncation of the number of coefficients: We check with this test that proposed truncation of the XP mean spectrum coefficients (according to bp_n_relevant_bases and rp_n_relevant_bases) produce good results.
We derive residuals as a function of the pseudowavelength of the sampled spectra derived using the full set of mean spectrum coefficients (${f}_{\lambda}^{\mathrm{full}}$) and the truncated set of coefficients (${f}_{\lambda}^{\mathrm{trunc}}$). We then compare this residual with the uncertainty in the sampled spectra using the full set of coefficients (${\sigma}_{{f}_{\lambda}^{\mathrm{full}}}$).
$$  (14.5)  
$$  (14.6) 
with the values of ${k}_{mn}$ and ${k}_{mx}$ being the maximum number of standard deviations a spectrum in full representation and truncated representation is accepted to differ in mean and in maximum (we adopted ${k}_{mn}=1$ and ${k}_{mx}=3$).
In the wings, very large relative changes might be acceptable, as the count numbers are very small. The test is therefore done on two ranges of pseudowavelengths, one including the wings, and one without the wings. The sampling in the ranges for the two versions of the test is chosen as ${u}_{i}\in [0,60]$ and ${u}_{i}\in [15,45]$ in pseudowavelength space, using a sampling in 0.5 steps.
The test is passed for a source if it satisfies (14.5).
About $55$–$60\%$ of the sources are considered failing this test when considering the whole XP spectrum and about $35$–$40$% when excluding the wings (see Table 14.2). The location of the failing sources in the sky show some correlation with the scanning law. The high numbers of failing sources is caused by the low threshold applied in this test. Comparing the failure rates with results from simulated data and the theoretical case of normally distributed data, the failure rate is about as expected.
Band  % Passed  % Failed  Passed  Failed 
$[0,60]$  
BP  38.82%  61.18%  185 054 925  134 065 408 
RP  45.84%  54.16%  100 440 777  118 679 557 
$[15,45]$  
BP  64.01%  35.99%  140 256 920  178 863 413 
RP  60.46%  39.54%  132 473 460  186 646 874 
Looking at the number of relevant basis functions for all the spectra, we find:

•
112 348 sources with bp_n_relevant_bases=1

•
0 sources with bp_n_relevant_bases=54

•
22 721 sources with bp_n_relevant_bases=55

•
75 430 sources with rp_n_relevant_bases=1

•
0 sources with rp_n_relevant_bases=54

•
5 sources with rp_n_relevant_bases=55
The first thing to notice is that there are no sources with relevant number of bases equal to 54. This is due a minor oversight and of little consequence. Another thing to notice is that there are very few sources (only 5) with relevant number of bases equal to 55 for RP. In fact, the spectra of sources with 55 relevant bases were checked to be pure noise and they have mostly ${G}_{\mathrm{BP}}{G}_{\mathrm{RP}}>5$ mag. They have no significant coefficients and then the default value (55) is maintained.
Tests on the shape of the spectra
Beta angle: This test defines a set of representative sources located at different wide regions in the HR diagram and determines similarities in the XP spectrum for a given source with those in each of these regions. We use here the concept of ‘$\beta $ angle’, which describes in a single parameter how well a spectrum can be represented as a linear combination of spectra in a set of reference spectra. This angle is thus always with respect to a certain set of reference spectra, and this set may change with application and purpose.
The test consists of selecting different sets of reference spectra, selected from different regions of the HR diagram. For all sources, the beta angle with respect to all selected reference were computed. Sources in the same region of the HR diagram as defined by a reference set should have small beta angles. Sources from different regions should have large beta angles. Nonstellar sources should have very large angles.
The integrated photometry and the parallax can be used to determine the position of sources in the HR diagram, and identify the reference sets for which the beta angle should be small. It is therefore necessary to apply the same selection criterion used for the selection of the reference sets to all test sources, and to classify them with respect to the reference sets.
Assume we have a set of $M$ XP spectra we use as the reference set. Each spectrum is represented by a vector ${\mathbf{c}}_{i}$, $i=1,\mathrm{\dots},N$. To compensate for differences in brightness, we may normalise the spectra. A natural choice for the normalisation is the L2norm. We denote the normalised vectors ${\overline{\mathbf{c}}}_{i}$, with
$${\overline{\mathbf{c}}}_{i}\u2254\frac{{\mathbf{c}}_{i}}{\sqrt{{\mathbf{c}}_{i}^{\U0001d5b3}{\mathbf{c}}_{i}}}\mathit{\hspace{1em}},i=1,\mathrm{\dots},M\mathit{\hspace{1em}}.$$  (14.7) 
We then arrange the $M$ normalised vectors ${\overline{\mathbf{c}}}_{i}$ into the $M\times N$ matrix $\mathbf{C}$ and perform a Singular Value Decomposition on it, e.g.
$$\mathbf{C}=\mathbf{U}\mathbf{\Sigma}{\mathbf{V}}^{\U0001d5b3}\mathit{\hspace{1em}}.$$  (14.8) 
We then use the $N\times N$ matrix $\mathbf{V}$ from this decomposition to construct a new basis for the XP spectra. Since this matrix is orthogonal by construction, i.e. $\mathbf{V}{\mathbf{V}}^{\U0001d5b3}=\mathbb{I}$, we can multiply any spectrum $\mathbf{c}$ with ${\mathbf{V}}^{\U0001d5b3}$, and if the sampled basis functions $\mathbf{\Phi}(\mathbf{u})$ are multiplied with $\mathbf{V}$, then the sampled spectra remain identical for any sampling $\mathbf{u}$,
$$\mathbf{\Phi}(\mathbf{u})\mathbf{c}=\mathbf{\Phi}(\mathbf{u})\mathbb{I}\mathbf{c}=\mathbf{\Phi}(\mathbf{u})\mathbf{V}{\mathbf{V}}^{\U0001d5b3}\mathbf{c}={\left({\mathbf{V}}^{\U0001d5b3}{\mathbf{\Phi}}^{\U0001d5b3}(\mathbf{u})\right)}^{\U0001d5b3}{\mathbf{V}}^{\U0001d5b3}\mathbf{c}\mathit{\hspace{1em}}.$$  (14.9) 
We are thus free to use an orthogonal matrix $\mathbf{V}$ to transform both the coefficients and the basis functions, without changing the representation of the spectra. The use of $\mathbf{V}$ from a SVD has the additional advantage that the new basis functions $\mathbf{\Phi}\mathbf{V}$ are sorted according to the singular values of the matrix $\mathbf{C}$, ensuring that the basis functions are sorted according to their relevance in representing the set of $M$ reference spectra. We may therefore consider a truncation of the representation of the set of reference sources. We denote the number of transformed basis functions required to represent all spectra in the set of reference spectra to a satisfactory degree by ${N}^{\prime}$, with $$. For the reference spectra we thus set coefficients for indices larger than ${N}^{\prime}$ to zero. For a source not within the set of reference spectra, its coefficients for indices larger than ${N}^{\prime}$ in comparison to all the coefficients provides a measure for how well the the spectrum can be represented by linear combinations of the spectra in the reference set.
We denote a coefficient vector in the transformed basis by ${\mathbf{c}}^{\prime}$, i.e.
$${\mathbf{c}}^{\prime}={\mathbf{V}}^{\U0001d5b3}\mathbf{c}\mathit{\hspace{1em}},$$  (14.10) 
and the truncated vector resulting from setting all coefficients in ${\mathbf{c}}^{\prime}$ for indices larger than ${N}^{\prime}$ to zero we denote ${\mathbf{c}}_{tr}^{\prime}$. The scalar product of ${\mathbf{c}}^{\prime}$ and ${\mathbf{c}}_{tr}^{\prime}$ can be expressed by the cosine of the angle between the two vectors, and we have
$$\mathrm{cos}\beta =\frac{{\mathbf{c}}_{tr}^{\mathrm{\prime}\U0001d5b3}{\mathbf{c}}^{\prime}}{\sqrt{{\mathbf{c}}_{tr}^{\mathrm{\prime}\U0001d5b3}{\mathbf{c}}_{tr}^{\prime}{\mathbf{c}}^{\mathrm{\prime}\U0001d5b3}{\mathbf{c}}^{\prime}}}$$  (14.11) 
This $\mathrm{cos}\beta $ is the quantity we are interested in. We may take the inverse cosine to obtain an angle directly. However, this is not strictly necessary and the nonlinear transformation might have unfavourable effects in the computation of the error on $\beta $ for very noisy spectra. We therefore may prefer to use the cosine of $\beta $ instead of $\beta $.
(14.11) simplifies further if we take into consideration that the first ${N}^{\prime}$ elements of ${\mathbf{c}}^{\prime}$ and ${\mathbf{c}}_{tr}^{\prime}$ are identical, and the remaining elements with indices $i={N}^{\prime}+1,\mathrm{\dots},N$ are identical zero. Therefore, ${\mathbf{c}}_{tr}^{\mathrm{\prime}\U0001d5b3}{\mathbf{c}}^{\prime}={\mathbf{c}}_{tr}^{\mathrm{\prime}\U0001d5b3}{\mathbf{c}}_{tr}^{\prime}$, and
$$\mathrm{cos}\beta =\sqrt{\frac{{\mathbf{c}}_{tr}^{\mathrm{\prime}\U0001d5b3}{\mathbf{c}}_{tr}^{\prime}}{{\mathbf{c}}^{\mathrm{\prime}\U0001d5b3}{\mathbf{c}}^{\prime}}}\mathit{\hspace{1em}}.$$  (14.12) 
Graphically, this means the cosine beta is the ratio of the length of the coefficient vector containing only the coefficients required to describe the reference set of spectra, over the total length of the coefficient vector.
A suitable number of basis functions, ${N}^{\prime}$, needs to be chosen for this test. To get this number, first, for all spectra in the reference set the value of $\beta $ can be computed as a function of the number of basis functions used, $n$. Then, three different criteria may be applied to select ${N}^{\prime}$:

•
The lowest $\beta $ in the set should be smaller than ${l}_{1}$.

•
The highest $\beta $ in the set should be smaller than ${l}_{2}$.

•
The median $\beta $ in the set should be smaller than ${l}_{3}$.
The number ${N}^{\prime}$ of basis functions used is the smallest number that satisfies all three conditions together. The values chosen for the three thresholds are ${l}_{1}={1}^{\circ}$, ${l}_{2}={0.2}^{\circ}$, and ${l}_{3}={0.5}^{\circ}$.
We selected sources with good parallax (parallax_over_error$>5$) and computed the median $\beta $ angle of all sources within a cell in colourmagnitude grid with respect to several predefined populations.
The smaller the $\beta $ angle is, it means that a given source has a more similar spectrum with respect to those of the population.
We plot the distributions in the HR diagram in Figure 14.12 (BP) and Figure 14.13 (RP) for the populations: Main Sequence B (MSB), MSA, MSF, MSG, MSK, MSM, Red Clump and Subgiants.
In general lines, all populations can more or less be distinguished from the others based on their XP spectra. Some populations are better detected in one of the bands. For example, MSK and MSM are clearly better detected in the RP spectrum, as only with the BP information one can only say that it is a red source, but not distinguish among different types of red source.
This feature is more exaggerated in the Ultracool case (Figure 14.14), which is completely nondiscriminant in the BP case (with very low $\beta $ values as they are simply confused by faint sources at any colour interval) and improves considerably in the RP one, where low $\beta $ values are only present in the expected ultracool stars region. XP spectra alone cannot distinguish very well between main sequence and giants, as it can be seen with the vertical structures in the HR diagrams. Nevertheless, RP is more useful to distinguish Red Clump and subgiants.
The same procedure was also carried out for White Dwarfs (WD). However, due to their faintness and the fact that they have a similar spectral shape with respect to other kinds of stellar sources, the $\beta $ angle is not enough to distinguish the subtle spectral differences to detect WDs correctly (Figure 14.15).
Small wings: Values at the wings of the spectra should be smaller than in the central parts corresponding the wavelengths with significant response. To evaluate the behaviour of the spectra at the wings at both sides, we may consider the integrals over the spectra over finite intervals in pseudowavelength. We consider the expressions:
${I}_{1}$  $\u2254$  $\underset{\mathrm{\infty}}{\overset{0}{\int}}}f(u)du$  (14.13)  
${I}_{2}$  $\u2254$  $\underset{0}{\overset{5}{\int}}}f(u)du$  (14.14)  
${I}_{3}$  $\u2254$  $\underset{5}{\overset{10}{\int}}}f(u)du\mathit{\hspace{1em}}.$  (14.15) 
And analogously on the other side of the spectrum:
${I}_{4}$  $\u2254$  $\underset{50}{\overset{55}{\int}}}f(u)du$  (14.16)  
${I}_{5}$  $\u2254$  $\underset{55}{\overset{60}{\int}}}f(u)du$  (14.17)  
${I}_{6}$  $\u2254$  $\underset{60}{\overset{\mathrm{\infty}}{\int}}}f(u)du\mathit{\hspace{1em}}.$  (14.18) 
One should find $$ if the wings are decreasing. The integral ${I}_{1}$ tests the behaviour outside the range for which the basis functions have been constructed, and is sensitive to possible overshooting effects. The other side of the spectrum is in analogy, i.e. one should see ${I}_{4}>{I}_{5}>{I}_{6}$, with ${I}_{6}$ testing the overshooting. We therefore consider the differences between pairs of these integrals, normalised to the uncertainty of the difference,
$${x}_{ab}=\frac{{I}_{a}{I}_{b}}{{\sigma}_{ab}}$$  (14.19) 
with
$${\sigma}_{ab}=\sqrt{{\mathrm{\Sigma}}_{a,a}^{I}+{\mathrm{\Sigma}}_{b,b}^{I}2{\mathrm{\Sigma}}_{a,b}^{I}}\mathit{\hspace{1em}}.$$  (14.20) 
Here, ${\mathrm{\Sigma}}^{I}$ denotes the covariance matrix for the integrals. If we assume that the index $a$ refers to the outer interval, and $b$ to the inner one, then ${I}_{a}$ should in general be smaller than ${I}_{b}$ and we can chose a limit about what is acceptable for $x$, say
$$  (14.21) 
with the value $k=5$ adopted in the test.
This same test was repeated using truncated coefficients and the comparison is provided in Figure 14.16.
The failing sources are not specially faint. In general the number of failing sources decrease when considering the truncated case. But it is surprising that for very red (${G}_{\mathrm{BP}}{G}_{\mathrm{RP}}\sim 6$ mag) and bright ($$ mag) sources in RP the amount of failing sources increase when using truncated spectra.
Tests on integrated fluxes
Coherence between photometry and spectra: Integrated flux from XP spectra should be similar to the calibrated mean flux derived from the photometric calibration. See also Section 5.4.2.
Figure 14.17 shows the comparison of integrated photometry from XP spectra in the wavelength/pseudowavelength ranges [680 nm; 330 nm] = [14.223398; 51.402673] for BP and [680 nm; 1050 nm] = [11.228237; 48.919845] for RP (converted to magnitudes with the same zero points as in Gaia EDR3) and the mean photometry as a function of colour and magnitude. The samples for BP and RP contain about 1.0 and 1.7 million random sources brighter than ${G}_{\mathrm{BP}}=15$ mag and ${G}_{\mathrm{RP}}=15$ mag, respectively, and with good phot_bp_rp_excess_factor. Differences in zero points and dependencies with colour are expected (as shown in the top panels) because of the difference of the mean instruments in photometry and spectra. We notice, however, a dip in the RP comparison at about ${G}_{\mathrm{RP}}=9.5$ mag for the red sources (${G}_{\mathrm{BP}}{G}_{\mathrm{RP}}>3.0$; bottom right panel), which is not explained.
The dip at ${G}_{\mathrm{RP}}=9.5$ mag in even deeper in Figure 14.18, where the same difference is shown but now versus the colour and for a larger sample ($$ mag). For ${G}_{\mathrm{BP}}{G}_{\mathrm{RP}}$ between 4 and 5 mag the dip reaches 0.04 mag, but fading away for bluer colours and turning into an excess for very red sources. The plot also shows a population with excess for sources of normal colours. As shown in Figure 14.19, for the same sample, this is predominantly sources disturbed by another source closeby.
In order to do this comparison for all sources in the catalogue with XP spectra, we define ${F}_{\mathrm{XP}}^{\mathrm{phot}}$ as the XP flux (either BP or RP) derived from the photometric passband calibration and ${F}_{\mathrm{XP}}^{\mathrm{spec}}$ the flux derived from the XP calibrated mean spectra. We now compute the ratio
$$r\u2254{F}_{\mathrm{XP}}^{\mathrm{phot}}/{F}_{\mathrm{XP}}^{\mathrm{spec}}$$  (14.22) 
for all sources.
In Figure 14.20 we show the obtained $r$ distribution: both bands show a peak in $r=1$, but in the BP case the tail to larger $r$ values (larger photometric flux than the spectral one) is wider than in the RP case.
The origin of this plateau at large $r$ values for BP could be related with the minimum values for BP fluxes (1 e${}^{}\mathrm{s}^{1}$) imposed in Gaia DR3 photometry (see van Leeuwen 2021; Riello et al. 2021). When plotting the distribution of BP photometric fluxes for those sources having $r>10$, (Figure 14.21) it can be seen that it peaks around $\u27e8F\u27e9=32$ e${}^{}\mathrm{s}^{1}$ instead. This correspond to the mean value expected when you cut half of the distribution when rejecting observations with fluxes smaller than 1 e${}^{}\mathrm{s}^{1}$ ($\u27e8F\u27e9\sim \sqrt{\frac{2}{\pi}}\cdot \sigma $, obtaining $\sigma \sim 40$ e${}^{}\mathrm{s}^{1}$).
Uncertainty of the integrated flux: In this test the integrated flux uncertainty from XP spectra is compared with the uncertainty in the flux derived from the integrated passband calibration.
For this end, we compare the uncertainty in the integrated flux derived from the photometric calibration (${\sigma}_{{F}_{\mathrm{XP}}^{\mathrm{phot}}}$) with the uncertainty in the integrated flux derived from the spectra (${\sigma}_{{F}_{\mathrm{XP}}^{\mathrm{spec}}}$).
$$\kappa \u2254\frac{{\sigma}_{{F}_{\mathrm{XP}}^{\mathrm{phot}}}}{{\sigma}_{{F}_{\mathrm{XP}}^{\mathrm{spec}}}}$$  (14.23) 
In Figure 14.22 we show the obtained distribution showing a peak near ${\mathrm{log}}_{10}(k)=0$, although a bit deviated to positive $k$ values (larger photometric uncertainties). Besides, the widths of the distributions are a bit wide. Taking into account that we plot the logarithm of $k$, we find excessive to have a ratio between the two flux errors of a factor ${10}^{3}{10}^{4}$ larger or smaller.
Negative integrated fluxes in the spectra: Spectra should not have negative fluxes, with the exception of noise for sufficiently faint sources.
We may quantify the degree of ‘negativity’ of a spectrum be the quantity
$$z=\frac{\underset{\mathrm{\infty}}{\overset{\mathrm{\infty}}{\int}}\leftf(u)\rightdu\underset{\mathrm{\infty}}{\overset{\mathrm{\infty}}{\int}}f(u)du}{2\underset{\mathrm{\infty}}{\overset{\mathrm{\infty}}{\int}}\leftf(u)\rightdu}\mathit{\hspace{1em}}.$$  (14.24) 
Here,
$$\underset{\mathrm{\infty}}{\overset{\mathrm{\infty}}{\int}}\leftf(u)\rightdu\equiv {f(u)}_{1}$$  (14.25) 
is the $l1$–norm of the spectrum. If there are no negative fluxes within the spectrum, this value should be zero. If there are only negative values, it gives one. The more negative values there are in a spectrum, the larger this number $z$ should get.
Unusual values of $z$ can be identified by looking at a plot of $z$ against the $l1$–norm. The sources with very high values of $z$ may be affected by an oversubtraction of the sky background. We expect the negativity to follow a logarithmic relation with the norm of the spectrum ${f(u)}_{1}$. We approximated this relation by $0.02+{10}^{1.2(f(u)2)}$ and marked as failed any spectrum above this function. Moreover, any spectrum with more than 90% of negativity is also flagged.
Only 2438 and 550 sources are failing this test, in BP and RP respectively. Figure 14.23 shows the distribution of the spectra in a negativityflux diagram.
Excess flux: This test compares excess flux from the spectra with excess flux from the photometry. The criterion for a failing source is that ${e}^{\mathrm{phot}}{e}^{\mathrm{spec}}>5$, being ${e}^{\mathrm{phot}}$ and ${e}^{\mathrm{spec}}$ the photometric and spectrophotometric excess fluxes, respectively. Only 82 sources are failing this test, being mostly the faintest sources in the sample.
Mean sampled spectra
This test checks that the mean sampled spectra dataset is correctly built from the source coefficients with differences compatible with floating point accuracy. If there is an error in the computation, then it should show in basically all sources. We derive an independent set of sampled spectra and compute their relative difference with respect to the published (sampled) spectra. The maximum absolute value of this relative difference for a source is the quantity of interest. Figure 14.24 shows that value of the discrepancy is very small, concluding that the mean spectra have been correctly built from the coefficients.