-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in the flux-calibration variance calculation #2420
Comments
Assuming that I don't do something stupid here, the effect from this bug is massive I believe. I.e. we are talking about factor of two decrease of S/N for high S/N pixels. |
Just a quick comment that in |
For stars, our model spectra are "always" wrong, so I personally always ignored the increase in chi-square at high S/N, therefore I didn't notice this earlier. |
I am afraid you are correct @segasai . The bug results in underestimating the contribution of the flux calibration statistical error to the calibrated flux variance. It affects the uncertainties of bright spectra. This is why we did not detect this so far in Lya P1D (where the noise was validated down to 1% of variance). |
kind of vaguely related: in Jan. 2023, I did look at sky fibers (in rosette-like observations of tertiary programs) and checked that the |
Yes, thanks, @araichoor , in MWS I also looked at low S/N often and I've been tracking the chi-square close to 1 there, so I think it's clear that low S/N is okay. But I'd expect to see differences from S/N=10-20. I don't have a good intuition how much higher the S/N in fluxcalib is in dark survey if that indeed leads to issues only at higher S/Ns -- that would explain the Lya results @julienguy mentioned. |
BTW |
Hi,
While preparing for #2419,
I've looked into fluxcalibration code and I believe the the current code that compute the ivar's of flux-calibrated frames is not quite correct:
desispec/py/desispec/fluxcalibration.py
Line 1478 in 255647f
Specifically the current code uses this eqn:
where Ivar(C) is the inverse variance of fluxcalib vector, and ivar(F) is the inverse variance of spectra.
The problem here, is that it applies this eqn to already calibrated spectra (i..e original flux divided by C)
see
desispec/py/desispec/fluxcalibration.py
Line 1473 in 255647f
While the equation only applies to original undivided flux.
Derivation:
This is exactly what the current code uses, but instead of F in the second term, it uses
Therefore this leads to incorrect C^2 factor in the second term.
Essentially the current code does:
A quick check shows the typical value of C is ~20-70, so that will lower the second term significantly, reducing the effect from flux-calibration error.
I am expecting that this will affect variances, where flux calibration uncertainty starts to become comparable to the spectrum uncertainty.
I don't know a typical S/N of flux calibration vectors a look at a few random files they can be pretty low, i.e. 20.
Am I missing something here ?
S
The text was updated successfully, but these errors were encountered: