Skip to content

Commit

Permalink
Added docstring to describe snmodel_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
Selhedri Selhedri committed Jan 12, 2022
1 parent e786eb7 commit 3bc87a4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/snewpy/snowglobes.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def generate_time_series(model_path, model_type, transformation_type, d, output_
Number of time slices. Will be ignored if ``deltat`` is also given.
deltat : astropy.Quantity or None
Length of time slices.
snmodel_dict : dictionary
Keyword arguments for the supernova model, if needed.
Returns
-------
Expand Down Expand Up @@ -166,6 +168,8 @@ def generate_fluence(model_path, model_type, transformation_type, d, output_file
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 : dictionary
Keyword arguments for the supernova model, if needed.
Returns
-------
Expand Down Expand Up @@ -374,13 +378,11 @@ def gen_label(m):
else:
return re_chan_label.sub(gen_label, c)

def collate(SNOwGLoBESdir, tarball_path, detector_input="all", skip_plots=False, verbose=False, remove_generated_files=True):
def collate(tarball_path, detector_input="all", skip_plots=False, verbose=False, remove_generated_files=True):
"""Collates SNOwGLoBES output files and generates plots or returns a data table.
Parameters
----------
SNOwGLoBESdir : str
Path to directory where SNOwGLoBES is installed.
tarball_path : str
Path of compressed .tar file produced e.g. by ``generate_time_series()`` or ``generate_fluence()``.
detector_input : str
Expand Down Expand Up @@ -440,7 +442,6 @@ def do_plot(table, params):
logging.info(f'Reading tables from {cache_file}')
tables = np.load(cache_file, allow_pickle=True).tolist()
#This output is similar to what produced by:
#tables = simulate(SNOwGLoBESdir, tarball_path,detector_input)

#dict for old-style results, for backward compatibiity
results = {}
Expand All @@ -450,6 +451,7 @@ def do_plot(table, params):
for det in tables:
results[det] = {}
for flux,t in tables[det].items():
print(flux)
t = aggregate_channels(t,nc='nc_',e='_e')
for w in ['weighted','unweighted']:
for s in ['smeared','unsmeared']:
Expand All @@ -464,6 +466,8 @@ def do_plot(table, params):
data = table.to_numpy().T
index = table.index.to_numpy()
data = np.concatenate([[index],data])
if "tbin5" in flux and s == 'unsmeared' and w == 'weighted':
print(data[:, abs(data[0] - 0.09826) < 1e-5][1:].T)
results[filename.name] = {'header':header,'data':data}
#optionally plot the results
if skip_plots is False:
Expand Down

0 comments on commit 3bc87a4

Please sign in to comment.