# Information on resource 'Gaia DR3 RP/BP (XP) Monte Carlo sampled spectra'

This is a re-publication the Gaia DR3 RP/BP spectra in the IVOA Spectral
Data Model. It presents the continous spectra in sampled form, using a
Monte Carlo scheme to decorrelate errors, elaborated in this resource's
reference URL. The underlying tables are also available for querying
through TAP, which opens some powerful methods for mass-analysing the data.

In Gaia's DR3, most BP/RP spectra come in “continuous” form only, that is,
as coefficients of Gauss-Hermite polynomials. These can be turned into
a “sampled” representation using GaiaXPy; however, since the errors are
given in the form of covariance matrices for the polynomial coefficients,
the errors in the resulting spectra are strongly correleated, which can
sometimes result in artefacts in the signal.

To get approximately decorrelated errors and hence sampled spectra usable
with less caution, we apply a scheme of Monte Carlo-sampling different
realisations from the error model of the coefficients. Specifically, given
the covariance matrix *C* defined through the Xp_coefficient_errors
and Xp_coefficient_correlations column in the DR3
xp_continuous_mean_spectrum table, and noting that for a unit
normal-distributed random variable *u*

⟨*u*.*u*^{T}⟩ = 1

holds (⟨*x*⟩ denotes the expectation), we can re-write
the covariance matrix using a Cholesky decomposition into *LL*^{T} as

*C* =
*L**L*^{T}
=
*L*⟨*u*.*u*^{T}⟩*L*^{T}
=
⟨*L**u*.*u*^{T}*L*^{T}⟩
=
⟨*x*.*x*^{T}⟩

Hence, *x* = *L**u* is a realisation of the errors satisfying the
covariance matrix. To come up with a sampled spectrum, we now
draw (in this case) 10 samples of the coefficients and have GaiaXPy
convert them to a sampled spectrum.

The source code we used for that is dr3_to_mcsampled.py.

To be on the conservative side of the resolution and the bandwidth,
and also to keep storage requirements modest, we have chosen a
relatively rough grid over the optical band, that is, bins of 10 nm
over the spectral range between 400 and 800 nm.

## Services defined within this resource descriptor

## Tables defined within this resource descriptor

- gdr3spec.spectra – queryable through TAP and ADQL
This table contains the sampled spectra, their errors (as the standard
deviation of the samples between the different realisations), and the
Gaia DR3 source_id. Join this table on source_id with gaia.dr3lite to
obtain information on the sources.

- gdr3spec.ssameta – queryable through TAP and ADQL
SSA Metadata for the Monte Carlo-sampled Gaia DR3 XP spectra

- gdr3spec.withpos – queryable through TAP and ADQL
This table contains the data from gdr3spec.spectra plus position and
photometry from gaia.dr3lite. It is a view, and there is generally no
advantage to using it instead of manually performing the join.

## Copyright, License, Acknowledgements

This data is derived from public Gaia DR3 data. Please take note of
ESAC's guide on how to acknowledge and cite Gaia results.

[Manage RD]