SNEWS2 / snewpy

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

times broadcasting in `get spectra` #259

Closed KaraMelih closed 3 months ago

KaraMelih commented 1 year ago

When getting the initial spectra of different models, if the user passes multiple time entries the Fornax2021 model cannot handle it where the others (that I have tested) can.

minimal example to reproduce;

from snewpy.neutrino import Flavor
from astropy import units as u
from snewpy.models.ccsn import Bollig_2016, Fornax_2021

bollig = Bollig_2016(filename=snewpy_models_path+"Bollig_2016/s11.2c")
fornax = Fornax_2021(filename=snewpy_models_path+"Fornax_2021/lum_spec_13M_r10000_dat.h5")

print(fornax.get_initial_spectra(t=[10]*u.s, E=10*u.MeV, flavors=[Flavor.NU_E])[Flavor.NU_E])
print(bollig.get_initial_spectra(t=[10]*u.s, E=10*u.MeV, flavors=[Flavor.NU_E])[Flavor.NU_E])

print(bollig.get_initial_spectra(t=[10, 12]*u.s, E=10*u.MeV, flavors=[Flavor.NU_E])[Flavor.NU_E])
print(fornax.get_initial_spectra(t=[10, 15]*u.s, E=10*u.MeV, flavors=[Flavor.NU_E])[Flavor.NU_E])

Multiple t's work for Bollig but not for the Fornax model.

The snewpy version I use is snewpy==1.3

This issue was also mentioned in #221