# How can I calculate the uncertainties in magnitude like the CDS does?

When you check an entry of the Gaia DR2 stellar catalogue in Vizier, for example this one, you can see that there is a value for the G magnitude (in our case 18.0733 mag) and a value for the uncertainty on that (in our case 0.0023 mag). The thing is that the G value is part of Gaia DR2 but the uncertainty is not, it was calculated by the CDS for Vizier (using the values presented for the flux as far as I can understand). I have two small related questions:

1. How does the CDS calculate the value from the uncertainty exactly? at least so that the one given by the CDS and the calculated one agree to the fourth decimal.

2. Is there a way in astropy or astroquery to retrieve the photometric uncertainty value from the catalog? Or do I have to calculate it as in the first question?

Simple error propagation formulae give $$|\Delta G| \simeq \frac{2.5}{\ln 10} \left(\frac{\Delta f}{f}\right),$$ where $$f$$ is the flux in the G band.
This gives $$\Delta G= 0.0023(1)$$ for your example. Other algorithms give almost the same result, e.g. taking the average of the $$\pm \Delta G$$ from using $$\pm \Delta f$$ to calculate the magnitude.
If the difference between the algorithms (they do give differing results when the flux error exceeds $$\sim 10$$%), or the fact that the true error is asymmetric in magnitude are important, then you shouldn't be using the symmetric magnitude error bar from CDS.