ladsantos / p-winds

Python implementation of Parker wind models for exoplanet atmospheres
https://p-winds.readthedocs.io/
MIT License
10 stars 5 forks source link

bugfix on tools #20

Closed astroshrey closed 3 years ago

astroshrey commented 3 years ago

Hydrogen photoionization calculation fails on an off-by-one error when the nearest index to lambda_0 is > lambda_0 (causing epsilon to be sqrt(negative number) in the hydrogen photoionization cross section). The fix should ensure you're getting the closest index strictly less than lambda_0.

ladsantos commented 3 years ago

Thanks for the bug fix!

ladsantos commented 3 years ago

After some tests, I realized that this bug fix will return an empty array if there are no values in the input array that are below lambda_0, and this creates a bug when I use nearest_index in another part of the code. I will revert back to the previous implementation, and I will implement a quick fix in the calculation of cross-sections that returns zero when lambda[i] > lambda_0.