SNEWS2 / snewpy

A Python package for working with supernova neutrinos
https://snewpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
26 stars 19 forks source link

Add value checks to Warren_2020 model (and others?) #120

Closed sybenzvi closed 2 years ago

sybenzvi commented 3 years ago

From @jpkneller:

A grad student here at NCSU found a negative mean energy in the M=55 a=1.25 Warren_2020 model. It's for the nu-x flavor at t = 0.00959799. The way the Warren_2020 model is written it takes the log of this mean energy, which causes the code to choke. I'm wondering if we should put in a few if statements to return zero if any mean energy or luminosity is <= 0.

Leaving this as an uncaught divide by zero exception or ValueError is not great. I think we could return zero, but we should emit warnings too so that the user isn't quietly getting unexpected output, thinking everything is fine and dandy.