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

Vectorize probabilities in `FlavorTransformation` #245

Open Sheshuk opened 1 year ago

Sheshuk commented 1 year ago

Currently FlavorTransformation.prob_ee and similar methods take time and energy as arguments. These arguments can be arrays of values: https://github.com/SNEWS2/snewpy/blob/08c3b84b7ef58d1830f52bf50275011b91301173/python/snewpy/flavor_transformation.py#L39-L52

However the probabilities are often output as scalars, or as vectors only in E.

I suggest making the output universal: it should always be an array of shape (len(t), len(E)) (or scalar if both are scalars), even if the probability doesn't depend on E or t. This will make it easier for vectorized calculations, and more clear to the user.