GalSim-developers / GalSim

The modular galaxy image simulation toolkit. Documentation:
http://galsim-developers.github.io/GalSim/
Other
224 stars 105 forks source link

Don't abort if wavelengths are outside valid range for absorption #1227

Closed rmjarvis closed 1 year ago

rmjarvis commented 1 year ago

Bekah Polen ran into an edge case where some photons had bad wavelengths being accumulated via the Silicon sensor. They also had flux=0, so the other details didn't matter, but it was raising an exception that the wavelengths weren't valid for the absorption depth table.

This PR fixes this by taking the absorption depth to be the value for the minimum or maximum valid wavelength whenever the wavelength is too blue or too red, respectively.

We could probably add an optimization to check for flux=0 sooner as an optimization, but I didn't do that here.