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

Fix flavour check for `PinchedModel` #190

Closed JostMigenda closed 2 years ago

JostMigenda commented 2 years ago

Fixes PinchedModel.__init__() to check whether 'L_NU_X_BAR' is among the column names; previously, it looked for that string in the table entries. (This means that before this fix, SNEWPY would always use NU_X data for NU_X_BAR columns, even if NU_X_BAR data had been provided. In practice, none of the included models did provide NU_X_BAR data separately, so this didn’t have any effects.)

This fixes a FutureWarning (NumPy <=1.22) or TypeError (NumPy 1.23) in the tests and makes them run faster as a side effect. (Comparing the string to a handful of column names, rather than to thousands of table rows, saves a lot of time.)