Skip to content
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

definition of speed of light is not consistent within DESI #477

Open
londumas opened this issue Mar 22, 2019 · 3 comments
Open

definition of speed of light is not consistent within DESI #477

londumas opened this issue Mar 22, 2019 · 3 comments
Assignees

Comments

@londumas
Copy link
Contributor

londumas commented Mar 22, 2019

Doing the following simple grep on all the DESI packages, maybe there are other I have not thought of:

  • grep '2\.99' -ri * --include \*.py
  • grep '299' -ri * --include \*.py
  • grep '3e5' -ri * --include \*.py
  • grep '3e8' -ri * --include \*.py
  • grep '299792458' -ri * --include \*.py
  • grep '2\.99792458' -ri * --include \*.py

It shows that different definition of the speed of light is used in the overall desi packages.
It would be very useful to have every package use the same from scipy.constants import speed_of_light or c = 299792458.. This would allow consistency comparison and better definite results.
For Lyman-alpha this also has the possible impact of shifting the Lyman-alpha x QSO cross-correlation along the line-of-sight.

[edit] add option -i

@weaverba137
Copy link
Member

astropy.constants would also work, but we should pick one or the other and stick with it.

Also, be sure to check for 3E5, or use grep -i!

@moustakas
Copy link
Member

Nice catch.

In desitarget.mock.mockmaker we do

try:
    from scipy import constants
    C_LIGHT = constants.c/1000.0
except TypeError: # This can happen during documentation builds.
    C_LIGHT = 299792458.0/1000.0

@londumas
Copy link
Contributor Author

londumas commented Mar 23, 2019

The remaining, I could find, and I need to understand before changing are:

desi/code/desispec/py/desispec/fluxcalibration.py:    ZP_fnu = ZP_flambda * wave**2 / (2.9979e18)  # c in A/s
desi/code/specter/py/specter/throughput.py:        self._hc = 6.62606957e-27 * 2.99792458e8 * 1e10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants