Error of centroid position with noise I would like to know the error of the centroid position of a source on a (sky) map. The point spread function (PSF) of the instrument is known and can be approximated by a Gaussian with standard deviation $\sigma$.
Error estimation in peak location determination by centroid method treats the case without noise / background.
I am looking for an expression taking noise / background into account.
It was suggested that it could scale with the peak/bg ratio but I would like to have some explanations, calculations or references to see how good this estimate is.
 A: One expects the centroid uncertainty to degrade significantly when the number of background counts under the peak ($\sim\sqrt{2\pi}\sigma B$) becomes greater than the signal count ($N_s$), and the problem to grow worse as the square root of the background.
A more precise estimate comes
from equation 14 of Uncertainties in extracted parameters of a Gaussian emission line profile with continuum background by Serge Minin and Farzad Kamalabad.
For a non-linear least squares fit of data to a one dimensional Gaussian peak with a uniform background, 
$$\gamma(x)=p_1+p_2 e^{-(x-p_3)^2/p_4^2},$$ the contribution from noise to the centroid uncertainty is
$$u_{p_3}(\sigma_B) \approx \frac{\sigma_B}{p_2}\sqrt{p_4\,\Delta x}\left(\frac{\pi}{2}\right)^{1/4}.$$
$\Delta x$ is the binning of the data (e.g. histogram or pixel size), and $\sigma_B$ is the (assumed constant) standard deviation of the noise in each data bin.
For a counting experiment, this can be rewritten as 
$$N(x)=B+\frac{N_s}{\sqrt{2\pi}\sigma}e^{-(x-x_0)^2/(2\sigma^2)}$$
where $x_0$, $\sigma$, and $N_s$ are the signal peak centroid, standard deviation, and number of signal counts, and $B$ is the mean background count rate per unit $x$.
If the mean number of background counts per bin ($N_b=B\Delta x$) is large enough that their variations have standard deviation $\sigma_{N_b}\approx \sqrt{N_b}$, then
$$u_{x_0}(B) \approx 2 \pi^{1/4}\,\frac{\sqrt{B}}{N_s}\,\sigma^{3/2}.$$
For $\sqrt{2\pi}\sigma B\gg N_s$, this grows as $\sqrt{B}$ as expected, but also decreases as $1/N_s$.
On the other hand, if there is no background the expected uncertainty is
$$u_{x_0}(S) \approx \frac{\sigma}{\sqrt{N_s}},$$
so I roughly (but not rigorously) expect the total counting uncertainty to be about
$$u_{x_0} \approx \sqrt{u_{x_0}^2(S)+u_{x_0}^2(B)} \approx \frac{\sigma}{\sqrt{N_s}}\left(1+ 2^{3/2}\frac{\sqrt{2\pi}\sigma B}{N_s} \right)^{1/2}.$$
Note that this estimate is best only used as a sanity check for uncertainties obtained from fits to the data using software (e.g. based on SciPy, MatLab, …) that you understand and trust and that can handle diverse signal and background distributions. It is risky to assume that a background is uniform in either intensity or variation without careful thought and testing. Poor fitting or badly understood backgrounds can produce results with non-Gaussian errors much larger than the above estimates. 
