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

Improve `generate_*` functions in `snewpy.snowglobes` #209

Open JostMigenda opened 1 year ago

JostMigenda commented 1 year ago

There are a couple of problems with the generate_fluence and generate_time_series functions in snewpy.snowglobes:

These issues are in principle independent; but they may all require backwards-incompatible changes to resolve, so I think we should try to tackle them in a coordinated fashion to minimise disruption. I have a rough idea how to do that, but want to coordinate with people working on the PRs mentioned above first.

¹ There is an optional snmodel_dict argument, which we could use to fit in all the physics parameters; but that would be quite awkward to use (and we’d still have the (then unused) file path as a required argument).

JostMigenda commented 1 year ago

We discussed this at the SNEWS telecon just now. A quick summary:

jpkneller commented 1 year ago

I like Andrey's suggestion for replacing the model_type and the transformationtype strings with class instances. With the current version of SNEWPY, flavor transformations which require additional parameters beyond the three vacuum mixing angles cannot be used unless the user dives into the generate functions. The two strings are included in the output filenames made by generate_ so we could modify both the flavor transformation and model classes by adding to each a to_tex() method which returns a string with the model or flavor transformation name. This is what is done in the Flavor class. I would also like to suggest we deprecate the generate_time_series function and move to only having a generate_fluence function. For the time being, generate_time_series can be modified so that it creates the list of tstart and tend that then gets passed to generate_fluence.

mcolomermolla commented 1 year ago

Commenting on the second point: I am in favor of keeping only one function to make users life easier, and use generate_fluence. Indeed, I remember it was taking long when using long duration and small binning simulations, but with the better performance after the updates and most of the models not being long, it is affordable. I can provide a computational time if you're interested. It is also true it is more accurate for simulating a lightcurve with "fine" binning.

Sheshuk commented 8 months ago

I think this should be planned for SNEWPY v2.0, so I'll change the milestone