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

Speed of light should be from scipy.constants #58

Closed
londumas opened this issue Mar 31, 2019 · 11 comments
Closed

Speed of light should be from scipy.constants #58

londumas opened this issue Mar 31, 2019 · 11 comments
Assignees
Labels

Comments

@londumas
Copy link
Contributor

The speed of light should be 299792458.0 everywhere, there are no reason to make an approximation. Also it can produce such shift of the correlation function, see issue #41.
The best way is to use from scipy.constants import speed_of_light, in order not to hard code it nor to cast it to smaller precision.
Doing simple grep, I get:

<HOME>/Programs/igmhub/LyaCoLoRe> grep '2.99' -ri * --include \*.py
py/lya_mock_functions.py:        c_kms = 2.998e5

This ticket is linked to this more general one: desihub/desisim#477

@londumas
Copy link
Contributor Author

It seems to explain part of the shift of #41 dv = 7.54 km/s.

c = 2.998e5
from scipy.constants import speed_of_light
speed_of_light /= 1000.
dv = c-speed_of_light
print(dv)

@londumas londumas added the bug label Mar 31, 2019
@londumas
Copy link
Contributor Author

@jfarr03, There might be other places where the speed of light is defined that I have not found.

@jfarr03
Copy link
Collaborator

jfarr03 commented Apr 1, 2019

@londumas the speed of light isn't used anywhere explicitly in LyaCoLoRe's scripts to produce the mocks - the instance you found isn't used anywhere other than very old examples. I'll correct it nonetheless but it won't be affecting the realisations.

It is almost certainly used in CoLoRe somewhere, though, so I'll have to check exactly what is used there.

@londumas
Copy link
Contributor Author

londumas commented Apr 1, 2019 via email

@londumas
Copy link
Contributor Author

londumas commented Apr 1, 2019

@jfarr03, is that the one: https://github.com/damonge/CoLoRe?

@londumas
Copy link
Contributor Author

londumas commented Apr 1, 2019

Doing some greps the only thing I found that looks like the speed of light is the following, that seems ok, but has strange units.
https://github.com/damonge/CoLoRe/blob/43abfec9230bd6f37ec3498d499cc61195cb1e5d/src/cosmo_mad.h#L35

@jfarr03
Copy link
Collaborator

jfarr03 commented Apr 1, 2019

Yes sorry that's the right link - it seems like it's ok but you're right, the units are odd!

@londumas
Copy link
Contributor Author

londumas commented Apr 1, 2019

I just open a ticket there: damonge/CoLoRe#38 to better understand what it is.

@londumas
Copy link
Contributor Author

@jfarr03, could you fix the following line, and then we can close:
igmhub/LyaCoLoRe/py/lya_mock_functions.py: c_kms = 2.998e5
I know it is not used, but let's fix that so it does not show up.
Thanks for the help.

@jfarr03
Copy link
Collaborator

jfarr03 commented May 17, 2019

@londumas fixed in commit 4ed3ebf

@londumas
Copy link
Contributor Author

@jfarr03, thanks

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

No branches or pull requests

2 participants