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

Added a dictionary of keyword arguments for SN models + added code for ROOT output #171

Closed soso128 closed 2 years ago

soso128 commented 2 years ago

This pull request contains two commits:

1- Added an argument to generate_time_series and generate_fluence in snowglobes.py: this dictionary allows to give keyword arguments to define SN models (EOS, etc...)

2- Added a new code to get ROOT 2D histograms for the rates, instead of collated text files

JostMigenda commented 2 years ago

Thanks @soso128!

I see you’ve already added the docstrings—excellent! Unfortunately, it looks like you accidentally included some unrelated changes to collate() in 3bc87a4. Once you remove those, I think part 1 looks good.

Regarding part 2: ROOT is a very heavy dependency (in terms of time and disk space to install) and, in my experience, quite fragile when it comes to binary compatibility with different versions of Python. So I would be very hesitant before depending on it for a core feature of SNEWPY. Since this code also appears to duplicate a lot of the code from snewpy.snowglobes.collate(), maybe it would be better to have a sample script in snewpy/python/scripts/ that demonstrates how to take the tables returned by snewpy.snowglobes.collate() and write those to a ROOT file?

soso128 commented 2 years ago

Ok, done. Indeed it would be better to write a code in scripts/ for the ROOT output. I'll do this.

soso128 commented 2 years ago

I just added a script for the ROOT output (and removed the previous code)