As a user I need to build the neutrino spectrum vs. time. I want to be able to calculate this 2d spectra directly from SupernovaModel without constructing loops on the t variable:
#Loading the SN model
model = ccsn.Bollig_2016('models/Bollig_2016/s11.2c')
#time and energy bins
t = np.linspace(0,10,101)<<u.s
E = np.linspace(0,50,51)<<u.MeV
fluxes2d = model.get_initial_spectra(t,E)
assert fluxes2d[0].shape == (101, 51)
#backward compatibility: if we provide a scalar time we get 1D arrays.
#Let's take t[20] as scalar value
fluxes1d = model.get_initial_spectra(t[20],E)
assert fluxes1d[0].shape == (51)
#check that 1d and 2d results are compatible
for flavor in fluxes2d:
assert np.allaclose(fluxes2d[flavor][20], fluxes1d)
What we have now
Currently SupernovaModel.get_initial_spectra and SupernovaModel.get_transformed_spectra can work only with a single t value. As far as I understand, the only limitation is in the implementration of PinchedModel, so it can be easily corrected.
This is in addition to the existing test_snowglobes.py tests, which should work without modification and provide crosscheck with the events table.
Outlook
This should make possible further optimization in snowglobes.generate_* functions - getting rid of the time loops there can speed up computation and make code cleaner.
After implementing #214 we can use NeutrinoFlux class as the return value.
What I want
As a user I need to build the neutrino spectrum vs. time. I want to be able to calculate this 2d spectra directly from
SupernovaModel
without constructing loops on thet
variable:What we have now
Currently
SupernovaModel.get_initial_spectra
andSupernovaModel.get_transformed_spectra
can work only with a singlet
value. As far as I understand, the only limitation is in the implementration ofPinchedModel
, so it can be easily corrected.This is in addition to the existing
test_snowglobes.py
tests, which should work without modification and provide crosscheck with the events table.Outlook
This should make possible further optimization in
snowglobes.generate_*
functions - getting rid of the time loops there can speed up computation and make code cleaner.After implementing #214 we can use
NeutrinoFlux
class as the return value.