Using SNEWPY as a Front End for SNOwGLoBES

SNEWPY can be used as a Python front-end for SNOwGLoBES. When installing SNEWPY, it automatically downloads the detector configurations from the latest supported SNOwGLoBES version.

You only need to download SNOwGLoBES manually if you require a custom detector configuration. In that case, run the following commands:

git clone https://github.com/SNOwGLoBES/snowglobes.git
cd snowglobes
git checkout v1.3
# create custom detector configuration
export SNOWGLOBES=${PWD} # or use `SNOwGLoBESdir` parameter as documented below

Usage

The snewpy.snowglobes module contains functions for interacting with SNOwGLoBES.

SNOwGLoBES can estimate detected event rates from a given input supernova neutrino flux. It supports many different neutrino detectors, detector materials and interaction channels. There are three basic steps to using SNOwGLoBES from SNEWPY:

  • Generating input files for SNOwGLoBES:

    There are two ways to do this, either generate a time series or a fluence file. This is done taking as input the supernova simulation model. The first will evaluate the neutrino flux at each time step, the latter will compute the integrated neutrino flux (fluence) in the time bin. The result is a compressed .tar file containing all individual input files.

  • Running SNOwGLoBES:

    This step convolves the fluence generated in the previous step with the cross-sections for the interaction channels happening in various detectors supported by SNOwGLoBES. It takes into account the effective mass of the detector as well as a smearing matrix describing the energy-dependent detection efficiency. The output gives the number of events detected as a function of energy for each interaction channel, integrated in a given time window (or time bin), or in a snapshot in time.

  • Collating SNOwGLoBES outputs:

    This step puts together all the interaction channels and time bins evaluated by SNOwGLoBES in a single file (for each detector and for each time bin). The output tables allow to build the detected neutrino energy spectrum and neutrino time distribution, for each reaction channel or the sum of them.

snewpy.snowglobes.generate_time_series(model_path, model_type, transformation_type, d, output_filename=None, ntbins=30, deltat=None, snmodel_dict={})[source]

Generate time series files in SNOwGLoBES format.

This version will subsample the times in a supernova model, produce energy tables expected by SNOwGLoBES, and compress the output into a tarfile.

Parameters:
  • model_path (str) – Input file containing neutrino flux information from supernova model.

  • model_type (str) – Format of input file. Matches the name of the corresponding class in snewpy.models.

  • transformation_type (str) – Name of flavor transformation. See snewpy.flavor_transformation documentation for possible values.

  • d (int or float) – Distance to supernova in kpc.

  • output_filename (str or None) – Name of output file. If None, will be based on input file name.

  • ntbins (int) – Number of time slices. Will be ignored if deltat is also given.

  • deltat (astropy.Quantity or None) – Length of time slices.

  • snmodel_dict (dict) – Additional arguments for setting up the supernova model. See documentation of relevant SupernovaModel subclass for available options. (Optional)

Returns:

str – Path of NumPy archive file with neutrino fluence data.

snewpy.snowglobes.generate_fluence(model_path, model_type, transformation_type, d, output_filename=None, tstart=None, tend=None, snmodel_dict={})[source]

Generate fluence files in SNOwGLoBES format.

This version will subsample the times in a supernova model, produce energy tables expected by SNOwGLoBES, and compress the output into a tarfile.

Parameters:
  • model_path (str) – Input file containing neutrino flux information from supernova model.

  • model_type (str) – Format of input file. Matches the name of the corresponding class in snewpy.models.

  • transformation_type (str) – Name of flavor transformation. See snewpy.flavor_transformation documentation for possible values.

  • d (int or float) – Distance to supernova in kpc.

  • output_filename (str or None) – Name of output file. If None, will be based on input file name.

  • tstart (astropy.Quantity or None) – Start of time interval to integrate over, or list of start times of the time series bins.

  • tend (astropy.Quantity or None) – End of time interval to integrate over, or list of end times of the time series bins.

  • snmodel_dict (dict) – Additional arguments for setting up the supernova model. See documentation of relevant SupernovaModel subclass for available options. (Optional)

Returns:

str – Path of NumPy archive file with neutrino fluence data.

snewpy.snowglobes.simulate(SNOwGLoBESdir, tarball_path, detector_input='all', verbose=False, *, detector_effects=True)[source]

Calculate expected event rates for the given neutrino flux files and the given (set of) SNOwGLoBES detector(s). These event rates are given as a function of the neutrino energy and time, for each interaction channel.

Parameters:
  • SNOwGLoBESdir (str or None) – Path to SNOwGLoBES directory. Set to None to automatically use the latest supported SNOwGLoBES release.

  • tarball_path (str) – Path of compressed .tar file produced e.g. by generate_time_series() or generate_fluence().

  • detector_input (str) – Name of detector. If "all", will use all detectors supported by SNOwGLoBES.

  • verbose (bool) – [DEPRECATED, DO NOT USE.]

  • detector_effects (bool) – Whether to account for detector smearing and efficiency.

snewpy.snowglobes.collate(SNOwGLoBESdir, tarball_path, detector_input='', skip_plots=False, verbose=False, remove_generated_files=True, *, smearing=True)[source]

Collates SNOwGLoBES output files and generates plots or returns a data table.

Parameters:
  • SNOwGLoBESdir (str or None) – [DEPRECATED, DO NOT USE.]

  • tarball_path (str) – Path of compressed .tar file produced e.g. by generate_time_series() or generate_fluence().

  • detector_input (str) – [DEPRECATED, DO NOT USE. SNEWPY will use all detectors included in the tarball.]

  • skip_plots (bool) – If False, it gives as output the plot of the energy distribution for each time bin and for each interaction channel.

  • verbose (bool) – [DEPRECATED, DO NOT USE.]

  • remove_generated_files (bool) – [DEPRECATED, DO NOT USE.]

  • smearing (bool) – Also consider results with smearing effects.

Returns:

dict – Dictionary of data tables: One table per time bin; each table contains in the first column the energy bins, in the remaining columns the number of events for each interaction channel in the detector.

Low-level interface

The module snewpy.snowglobes_interface contains a low-level Python interface for SNOwGLoBES v1.3.

Note

Users should only use the high-level interface described above. This low-level interface is not guaranteed to be stable and may change at any time without warning, e.g. to support new SNOwGLoBES versions.