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

Use astropy.units.equivalencies.spectral to compute wavelengths to energies. #327

Open
wtbarnes opened this issue Sep 30, 2024 · 1 comment
Labels
effort-low Good First Issue The best issues for new people to tackle! refactor

Comments

@wtbarnes
Copy link
Owner

Many places throughout the package, I convert wavelengths to energies through the formula $hc/\lambda$. Instead, we should be using the spectral equivalency provided by astropy units: https://docs.astropy.org/en/stable/units/equivalencies.html#equivalencies.

The easiest way to do this is probably to search on const.h or const.c and find places where this product is divided by a length.

@wtbarnes wtbarnes added effort-low Good First Issue The best issues for new people to tackle! refactor labels Sep 30, 2024
@jwreep
Copy link
Collaborator

jwreep commented Oct 2, 2024

Might need to be careful if this is used for any spectral emissions. The intensity of some emission process $I(\lambda) \neq I(E)$. Instead, $I(\lambda) d\lambda = - I(E) dE$, so there's an extra factor $\frac{dE}{d\lambda} = - \frac{hc}{\lambda^2}$.

This gets me every single time I convert spectra between wavelength and energy space (X-rays). Can / Does astropy deal with this automatically?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort-low Good First Issue The best issues for new people to tackle! refactor
Projects
None yet
Development

No branches or pull requests

2 participants