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

Using time arrays in PinchedModel.get_initial_spectra #222

Closed Sheshuk closed 1 year ago

Sheshuk commented 1 year ago

Closes #221

github-actions[bot] commented 1 year ago

Result of Benchmark Tests

Benchmark Min Max Mean
python/snewpy/test/test_snowglobes.py::test_simulation_chain_benchmark 4.63 4.78 4.73 +- 0.06
JostMigenda commented 1 year ago

Minor note: If t can now also be an array, the type of t in the docstring should be updated accordingly.

Sheshuk commented 1 year ago

Minor note: If t can now also be an array, the type of t in the docstring should be updated accordingly.

astropy.Quantity is an extension of ndarray, so we're actually using them, not ndarray of astropy.Quantity, for example

>>> T = np.linspace(0,10) << u.s
>>> type(T)
astropy.units.quantity.Quantity

so the current docstring is (now even more) correct

Sheshuk commented 1 year ago

Thanks! Yes these variadic generics look like they would make the signatures much cleaner. In general I think it would be good to add the type hints throughout snewpy, but that's a separate task.