Code Monkey home page Code Monkey logo

asteria's People

Contributors

jlazar17 avatar nuberoi avatar rcross2 avatar sgriswol avatar sybenzvi avatar thomahrens avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

nuberoi jlazar17

asteria's Issues

Errors in running simulation with some models

In the simulations of the models: Walk_2018, Walk_2019, and Zha_2021, an error appears as below.

ValueError: `x` must be strictly increasing sequence.

The code and error of each model:

Walk_2018

model = {'name': 'Walk_2018',
         'param':{
             'progenitor_mass': 15 * u.Msun 
            }}

sim = Simulation(model=model,
                 distance=10 * u.kpc, 
                 Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,
                 tmin=0.01*u.s, tmax=0.33*u.s, dt=1*u.ms,
                 mixing_scheme='AdiabaticMSW',
                 hierarchy='normal')
sim.run()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-19-0c41e268116a> in <module>
      4             }}
      5 
----> 6 sim = Simulation(model=model,
      7                  distance=10 * u.kpc,
      8                  Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,

~/IceCube/ASTERIA/python/asteria/simulation.py in __init__(self, config, model, distance, flavors, hierarchy, interactions, mixing_scheme, mixing_angle, E, Emin, Emax, dE, t, tmin, tmax, dt, geomfile, effvolfile)
     57                 _dt = 1 * u.ms
     58 
---> 59             self.source = Source(model['name'], model['param'])
     60             self.distance = distance
     61             self.energy = E

~/IceCube/ASTERIA/python/asteria/source.py in __init__(self, model, model_params)
    107         for flavor in Flavor:
    108             t = self.model.time
--> 109             self._interp_lum.update({flavor: PchipInterpolator(t, self.model.luminosity[flavor], extrapolate=False)})
    110             self._interp_meanE.update({flavor: PchipInterpolator(t, self.model.meanE[flavor], extrapolate=False)})
    111             self._interp_pinch.update({flavor: PchipInterpolator(t, self.model.pinch[flavor], extrapolate=False)})

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in __init__(self, x, y, axis, extrapolate)
    228     """
    229     def __init__(self, x, y, axis=0, extrapolate=None):
--> 230         x, _, y, axis, _ = prepare_input(x, y, axis)
    231         xp = x.reshape((x.shape[0],) + (1,)*(y.ndim-1))
    232         dk = self._find_derivatives(xp, y)

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in prepare_input(x, y, axis, dydx)
     59     dx = np.diff(x)
     60     if np.any(dx <= 0):
---> 61         raise ValueError("`x` must be strictly increasing sequence.")
     62 
     63     y = np.rollaxis(y, axis)

ValueError: `x` must be strictly increasing sequence.

Walk_2019

model = {'name': 'Walk_2019',
         'param':{
             'progenitor_mass': 40 * u.Msun 
            }}

sim = Simulation(model=model,
                 distance=10 * u.kpc, 
                 Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,
                 tmin=0.01*u.s, tmax=0.57*u.s, dt=1*u.ms,
                 mixing_scheme='AdiabaticMSW',
                 hierarchy='normal')
sim.run()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-20-526866286412> in <module>
      4             }}
      5 
----> 6 sim = Simulation(model=model,
      7                  distance=10 * u.kpc,
      8                  Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,

~/IceCube/ASTERIA/python/asteria/simulation.py in __init__(self, config, model, distance, flavors, hierarchy, interactions, mixing_scheme, mixing_angle, E, Emin, Emax, dE, t, tmin, tmax, dt, geomfile, effvolfile)
     57                 _dt = 1 * u.ms
     58 
---> 59             self.source = Source(model['name'], model['param'])
     60             self.distance = distance
     61             self.energy = E

~/IceCube/ASTERIA/python/asteria/source.py in __init__(self, model, model_params)
    107         for flavor in Flavor:
    108             t = self.model.time
--> 109             self._interp_lum.update({flavor: PchipInterpolator(t, self.model.luminosity[flavor], extrapolate=False)})
    110             self._interp_meanE.update({flavor: PchipInterpolator(t, self.model.meanE[flavor], extrapolate=False)})
    111             self._interp_pinch.update({flavor: PchipInterpolator(t, self.model.pinch[flavor], extrapolate=False)})

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in __init__(self, x, y, axis, extrapolate)
    228     """
    229     def __init__(self, x, y, axis=0, extrapolate=None):
--> 230         x, _, y, axis, _ = prepare_input(x, y, axis)
    231         xp = x.reshape((x.shape[0],) + (1,)*(y.ndim-1))
    232         dk = self._find_derivatives(xp, y)

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in prepare_input(x, y, axis, dydx)
     59     dx = np.diff(x)
     60     if np.any(dx <= 0):
---> 61         raise ValueError("`x` must be strictly increasing sequence.")
     62 
     63     y = np.rollaxis(y, axis)

ValueError: `x` must be strictly increasing sequence.

Zha_2021

model = {'name': 'Zha_2021',
         'param':{
             'progenitor_mass': 16 * u.Msun 
            }}

sim = Simulation(model=model,
                 distance=10 * u.kpc, 
                 Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,
                 tmin=-0.21*u.s, tmax=2.02*u.s, dt=1*u.ms,
                 mixing_scheme='AdiabaticMSW',
                 hierarchy='normal')
sim.run()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-21-4f03eb4d6e5c> in <module>
      4             }}
      5 
----> 6 sim = Simulation(model=model,
      7                  distance=10 * u.kpc,
      8                  Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,

~/IceCube/ASTERIA/python/asteria/simulation.py in __init__(self, config, model, distance, flavors, hierarchy, interactions, mixing_scheme, mixing_angle, E, Emin, Emax, dE, t, tmin, tmax, dt, geomfile, effvolfile)
     57                 _dt = 1 * u.ms
     58 
---> 59             self.source = Source(model['name'], model['param'])
     60             self.distance = distance
     61             self.energy = E

~/IceCube/ASTERIA/python/asteria/source.py in __init__(self, model, model_params)
    107         for flavor in Flavor:
    108             t = self.model.time
--> 109             self._interp_lum.update({flavor: PchipInterpolator(t, self.model.luminosity[flavor], extrapolate=False)})
    110             self._interp_meanE.update({flavor: PchipInterpolator(t, self.model.meanE[flavor], extrapolate=False)})
    111             self._interp_pinch.update({flavor: PchipInterpolator(t, self.model.pinch[flavor], extrapolate=False)})

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in __init__(self, x, y, axis, extrapolate)
    228     """
    229     def __init__(self, x, y, axis=0, extrapolate=None):
--> 230         x, _, y, axis, _ = prepare_input(x, y, axis)
    231         xp = x.reshape((x.shape[0],) + (1,)*(y.ndim-1))
    232         dk = self._find_derivatives(xp, y)

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in prepare_input(x, y, axis, dydx)
     59     dx = np.diff(x)
     60     if np.any(dx <= 0):
---> 61         raise ValueError("`x` must be strictly increasing sequence.")
     62 
     63     y = np.rollaxis(y, axis)

ValueError: `x` must be strictly increasing sequence.

In the simulations of the models Warren_2020 and Fornax_2019, an error appears as below.

OSError: Unable to open file

The code and error of each model:

Warren_2020

model = {'name': 'Warren_2020',
         'param':{
             'turb_mixing': 1.23 ,
             'progenitor_mass': 9.25 * u.Msun 
            }}

sim = Simulation(model=model,
                 distance=10 * u.kpc, 
                 Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,
                 tmin=-0.22*u.s, tmax=4.7*u.s, dt=1*u.ms,
                 mixing_scheme='AdiabaticMSW',
                 hierarchy='normal')
sim.run()
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-23-47ddbceda145> in <module>
      5             }}
      6 
----> 7 sim = Simulation(model=model,
      8                  distance=10 * u.kpc,
      9                  Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,

~/IceCube/ASTERIA/python/asteria/simulation.py in __init__(self, config, model, distance, flavors, hierarchy, interactions, mixing_scheme, mixing_angle, E, Emin, Emax, dE, t, tmin, tmax, dt, geomfile, effvolfile)
     57                 _dt = 1 * u.ms
     58 
---> 59             self.source = Source(model['name'], model['param'])
     60             self.distance = distance
     61             self.energy = E

~/IceCube/ASTERIA/python/asteria/source.py in __init__(self, model, model_params)
    100             self.model = init_snewpy_model_from_param(model, **model_params)
    101         else:
--> 102             self.model = init_snewpy_model(model, model_params)
    103         self._interp_lum = {}
    104         self._interp_meanE = {}

~/IceCube/ASTERIA/python/asteria/source.py in init_snewpy_model(model, model_params)
     89         return init_snewpy_model_from_param(model_name=model, base=os.path.join(model_path, f'{model}/'),
     90                                             mass=mass, eos=EOS)
---> 91     return init_snewpy_model_from_param(model_name=model, filename=os.path.join(model_path, model, fname))
     92 
     93 

~/IceCube/snewpy/python/snewpy/models/registry.py in init_model(model_name, download, download_dir, **user_param)
     58 
     59     try:
---> 60         return getattr(module, model_name)(**user_param)
     61     except FileNotFoundError as e:
     62         logger = logging.getLogger()

~/IceCube/snewpy/python/snewpy/models/base.py in _wrapper(self, *arg, **kwargs)
     16     @wraps(init)
     17     def _wrapper(self, *arg, **kwargs):
---> 18         init(self, *arg, **kwargs)
     19         check(self)
     20     return _wrapper

~/IceCube/snewpy/python/snewpy/models/ccsn.py in __init__(self, filename, eos)
    375         """
    376         # Read data from HDF5 files, then store.
--> 377         f = h5py.File(filename, 'r')
    378         simtab = Table()
    379 

/opt/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, **kwds)
    404             with phil:
    405                 fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
--> 406                 fid = make_fid(name, mode, userblock_size,
    407                                fapl, fcpl=make_fcpl(track_order=track_order),
    408                                swmr=swmr)

/opt/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
    171         if swmr and swmr_support:
    172             flags |= h5f.ACC_SWMR_READ
--> 173         fid = h5f.open(name, flags, fapl=fapl)
    174     elif mode == 'r+':
    175         fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (unable to open file: name = '/Users/wxy/.astropy/cache/snewpy/models/Warren_2020/stir_a1.23/stir_multimessenger_a1.23_m9.25.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Fornax_2019

model = {'name': 'Fornax_2019',
         'param':{
             'progenitor_mass': 12 * u.Msun 
            }}

sim = Simulation(model=model,
                 distance=10 * u.kpc, 
                 Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,
                 tmin=-0.21*u.s, tmax=4.49*u.s, dt=1*u.ms,
                 mixing_scheme='AdiabaticMSW',
                 hierarchy='normal')
sim.run()
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-22-56c9df4900cd> in <module>
      4             }}
      5 
----> 6 sim = Simulation(model=model,
      7                  distance=10 * u.kpc,
      8                  Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,

~/IceCube/ASTERIA/python/asteria/simulation.py in __init__(self, config, model, distance, flavors, hierarchy, interactions, mixing_scheme, mixing_angle, E, Emin, Emax, dE, t, tmin, tmax, dt, geomfile, effvolfile)
     57                 _dt = 1 * u.ms
     58 
---> 59             self.source = Source(model['name'], model['param'])
     60             self.distance = distance
     61             self.energy = E

~/IceCube/ASTERIA/python/asteria/source.py in __init__(self, model, model_params)
    100             self.model = init_snewpy_model_from_param(model, **model_params)
    101         else:
--> 102             self.model = init_snewpy_model(model, model_params)
    103         self._interp_lum = {}
    104         self._interp_meanE = {}

~/IceCube/ASTERIA/python/asteria/source.py in init_snewpy_model(model, model_params)
     89         return init_snewpy_model_from_param(model_name=model, base=os.path.join(model_path, f'{model}/'),
     90                                             mass=mass, eos=EOS)
---> 91     return init_snewpy_model_from_param(model_name=model, filename=os.path.join(model_path, model, fname))
     92 
     93 

~/IceCube/snewpy/python/snewpy/models/registry.py in init_model(model_name, download, download_dir, **user_param)
     58 
     59     try:
---> 60         return getattr(module, model_name)(**user_param)
     61     except FileNotFoundError as e:
     62         logger = logging.getLogger()

~/IceCube/snewpy/python/snewpy/models/base.py in _wrapper(self, *arg, **kwargs)
     16     @wraps(init)
     17     def _wrapper(self, *arg, **kwargs):
---> 18         init(self, *arg, **kwargs)
     19         check(self)
     20     return _wrapper

~/IceCube/snewpy/python/snewpy/models/ccsn.py in __init__(self, filename, cache_flux)
    573 
    574             # Open HDF5 data file.
--> 575             self._h5file = h5py.File(filename, 'r')
    576 
    577             # Get grid of model times in seconds.

/opt/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, **kwds)
    404             with phil:
    405                 fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
--> 406                 fid = make_fid(name, mode, userblock_size,
    407                                fapl, fcpl=make_fcpl(track_order=track_order),
    408                                swmr=swmr)

/opt/anaconda3/lib/python3.8/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
    171         if swmr and swmr_support:
    172             flags |= h5f.ACC_SWMR_READ
--> 173         fid = h5f.open(name, flags, fapl=fapl)
    174     elif mode == 'r+':
    175         fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (unable to open file: name = '/Users/wxy/.astropy/cache/snewpy/models/Fornax_2019/lum_spec_12M.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Error in simplemixing_class

In In[4] cell of the notebook simplemixing_class, a TypeError appears. Two plots can't be made. Running at git hash ec1024d.

The code is

fig, axes = plt.subplots(1, 3, figsize=(13,3.5), sharex=True, sharey=True)

ax1, ax2, ax3 = axes
t = np.linspace(-0.1, 1, 201) * u.s

# UNMIXED
for ls, flavor in zip(["-", "--", "-.", ":"], Flavor):
    flux = ccsn.get_flux(t, flavor)
    
    ax1.plot(t, flux, ls, lw=2, label=flavor.to_tex(), alpha=0.7)
    ax1.set_title("Unmixed")
# plt.yscale('log')
# plt.ylim(3e51, 5e53)
ax1.set(xlabel='time - $t_{bounce}$ [s]',
        ylabel='flux')
ax1.legend()

# NORMAL MIXING
nu_list1 = []
i = 0
for flavor in Flavor:
    flux = ccsn.get_flux(t, flavor)
    nu_list1.append(flux)
    
nu_new1 = mix.normal_mixing(nu_list1)

for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new1)), Flavor):
    new_flux1 = nu_new1[i]
    ax2.plot(t, new_flux1, ls, lw=2, alpha=0.7, label=flavor.to_tex())
    ax2.set_title(label="Normal Mixing")

ax2.set(xlabel='time - $t_{bounce}$ [s]',
        ylabel='flux')

ax2.legend()

# INVERTED MIXING
nu_list2 = []
i = 0
for flavor in Flavor:
    flux = ccsn.get_flux(t, flavor)
    nu_list2.append(flux)
    
nu_new2 = mix.inverted_mixing(nu_list1)

for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new2)), Flavor):
    new_flux2 = nu_new2[i]
    ax3.plot(t, new_flux2, ls, lw=2, alpha=0.7, label=flavor.to_tex())
    ax3.set_title(label="Inverted Mixing")

ax3.set(xlabel='time - $t_{bounce}$ [s]',
        ylabel='flux')
ax3.legend()


fig.tight_layout();

The error is:

TypeError                                 Traceback (most recent call last)
<ipython-input-4-5875f39c7122> in <module>
     25 nu_new1 = mix.normal_mixing(nu_list1)
     26 
---> 27 for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new1)), Flavor):
     28     new_flux1 = nu_new1[i]
     29     ax2.plot(t, new_flux1, ls, lw=2, alpha=0.7, label=flavor.to_tex())

TypeError: object of type 'function' has no len()

Attribute Error in Stellar_Distributions Notebook

Error:
AttributeError: 'Rectangle' object has no property 'normed'

Location:
Stellar_Distributions: cell [3]

Error trace:

AttributeError Traceback (most recent call last)
Input In [3], in <cell line: 11>()
8 ax1, ax2 = axes
10 bins = np.linspace(7, 13, 61)
---> 11 ax1.hist(d1.value, bins, normed=True)
12 ax1.set(ylabel='prob. density [kpc$^{-1}$]',
13 xlabel='distance [kpc]',
14 title='$d=${}'.format(fd1.dist))
15 ax1.grid(ls=':')

File ~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/init.py:1412, in _preprocess_data..inner(ax, data, *args, **kwargs)
1409 @functools.wraps(func)
1410 def inner(ax, *args, data=None, **kwargs):
1411 if data is None:
-> 1412 return func(ax, *map(sanitize_sequence, args), **kwargs)
1414 bound = new_sig.bind(ax, *args, **kwargs)
1415 auto_label = (bound.arguments.get(label_namer)
1416 or bound.kwargs.get(label_namer))

File ~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/axes/_axes.py:6791, in Axes.hist(self, x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
6789 if patch:
6790 p = patch[0]
-> 6791 p.update(kwargs)
6792 if lbl is not None:
6793 p.set_label(lbl)

File ~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/artist.py:1064, in Artist.update(self, props)
1062 func = getattr(self, f"set_{k}", None)
1063 if not callable(func):
-> 1064 raise AttributeError(f"{type(self).name!r} object "
1065 f"has no property {k!r}")
1066 ret.append(func(v))
1067 if ret:

AttributeError: 'Rectangle' object has no property 'normed'

Attribute Error in Inverse_Beta_Decay Notebook

Error:
AttributeError: nu_e_bar

Location:
Inverse_Beta_Decay: cell [3]

Error trace:

AttributeError Traceback (most recent call last)
Input In [3], in <cell line: 8>()
6 enu = np.linspace(0., 200., 101) * u.MeV
8 for ibd, style, lab in zip([InvBetaPar(), InvBetaTab()],
9 ['-', '.'],
10 ['Parametric (Eq. 25)', 'Table 1']):
---> 11 xs = ibd.cross_section(Flavor.nu_e_bar, enu)
12 lep = ibd.mean_lepton_energy(Flavor.nu_e_bar, enu)
13 axes[0][0].plot(enu, xs, style, label=lab)

File ~/opt/anaconda3/lib/python3.9/enum.py:429, in EnumMeta.getattr(cls, name)
427 return cls.member_map[name]
428 except KeyError:
--> 429 raise AttributeError(name) from None

AttributeError: nu_e_bar

Using asteria.neutrino.Flavor enum items as hashes in source.py can causes odd errors

The dictionary containing the SciPy interpolation objects in source.py (Link to definition uses the enumeration items of asteria.neutrino.Flavor as keys. More specifically, it uses the object location of those enumeration items as part of those keys.

When the upcoming SimulationHandler parses the simulation flavor configuration, it creates and stores its own instances of <enum 'Flavor'> objects. So, when comparing the instances created by the handler to those used to define the source objects, the equality operator returns false, due to the fact that their location is not the same. According to the Python dict documentation, only hashable (fixed) values should be used as keys. The name and value members of the flavor enumeration items are suitable for this, but in order to use these, the __hash__ and __eq__ methods must be overwritten.

It is not sufficient to only change the keys used to define the dictionaries mentioned above. The attached figures show the expected DOM signal (top), and the DOM signal having changed only the definition of the dictionary keys to use the flavor names (bottom). The cause of this difference is not yet understood.

Expected DOM Signal.
flavorhashing_noerror

DOM Signal having changed only key definitions in source.py
flavorhashing_error

Clean up config Files

Most configuration files lack required fields added in v1.0.0 release, and some contain errors. All config files should point to the correct model file and all should have a simulation field (See default.yaml for example)

Notebooks are out of date

Since the SNEWPY integration, the example notebooks are out of date and do not demonstrate how to configure a simulation using the current interface.

IO module lookup is failing (or is reporting incorrectly)

Running under default configuration, 0 matching simulations found, but FileExistsError thrown - which should only happen if there is an existing file.

Beginning nu_e simulation...       Completed
Beginning nu_e_bar simulation...   Completed
Beginning nu_x simulation...       Completed
Beginning nu_x_bar simulation...   Completed
Found  0
Traceback (most recent call last):
  File "test.py", line 9, in <module>
    sim.save()
  File "/home/sgris/Code/IceCube/ASTERIA/python/asteria/handler.py", line 298, in save
    IO.save(self.conf, E_per_V_1kpc, force)
  File "/home/sgris/Code/IceCube/ASTERIA/python/asteria/IO.py", line 272, in save
    raise FileExistsError("""Simulation exists, Aborting. Use argument 'force = True' to force saving.""")
FileExistsError: Simulation exists, Aborting. Use argument 'force = True' to force saving.

Add improved yaml parsing to declutter config directory

Rather than have a config file for every model Nakazato et al., it would be more convenient to have one config file for all models by Nakazato et al. (e.g. nakazato.yaml) with some way of referring to each model. New Functionality is required to achieve this.

Import Error in Asteria Notebooks

Error:
ImportError: cannot import name 'Flavor' from 'asteria.neutrino'

Locations:
-Detector_Hits: Cell [1]:
-Detector_Hits_File: Cell [1]:
-Detector_Response: Cell [1]:
-Inverse_Beta_Decay: Cell [1]:
-Load_Simulation: Cell [1]:
-Piegsa_Earth_Oscillations: Cell [1]:
-Simplemixing_Class: Cell [1]:
-Simulation_Handling: Cell [1]:
-Supernova_Mixing: Cell [1]:

Error trace from Detector_Hits nb:

ImportError Traceback (most recent call last)
Input In [2], in <cell line: 9>()
6 import matplotlib.pyplot as plt
8 from asteria import config, source, detector
----> 9 from asteria.neutrino import Flavor
11 mpl.rc('font', size=18)

ImportError: cannot import name 'Flavor' from 'asteria.neutrino' (/Users/emmatintinger/ASTERIA/python/asteria/neutrino.py)


Solution:
Change โ€œfrom asteria.neutrino import Flavorโ€ to โ€œfrom snewpy.neutrino import Flavorโ€ in cell [1]

Error in stellar_distributions

In cell In[3] of the notebook stellar_distributions, an error about the plots appears as shown below. The same error appears in cells In[6] and In[7]. Running at git hash ec1024d.

The code of In[3] is:

fd1 = FixedDistance(10*u.kpc)
d1 = fd1.distance(10000)

fd2 = FixedDistance(10*u.kpc, sigma=0.5*u.kpc)
d2 = fd2.distance(10000)

fig, axes = plt.subplots(1,2, figsize=(12,4), sharex=True)
ax1, ax2 = axes

bins = np.linspace(7, 13, 61)
ax1.hist(d1.value, bins, normed=True)
ax1.set(ylabel='prob. density [kpc$^{-1}$]',
        xlabel='distance [kpc]',
        title='$d=${}'.format(fd1.dist))
ax1.grid(ls=':')
ax2.hist(d2.value, bins, normed=True)
ax2.set(xlabel='distance [kpc]',
        title='$d=${}, $\sigma=${}'.format(fd2.dist, fd2.sigma))
ax2.grid(ls=':')
fig.tight_layout()

The error is:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-05fa4a9355ef> in <module>
      9 
     10 bins = np.linspace(7, 13, 61)
---> 11 ax1.hist(d1.value, bins, normed=True)
     12 ax1.set(ylabel='prob. density [kpc$^{-1}$]',
     13         xlabel='distance [kpc]',

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1445     def inner(ax, *args, data=None, **kwargs):
   1446         if data is None:
-> 1447             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1448 
   1449         bound = new_sig.bind(ax, *args, **kwargs)

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_axes.py in hist(self, x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
   6813             if patch:
   6814                 p = patch[0]
-> 6815                 p.update(kwargs)
   6816                 if lbl is not None:
   6817                     p.set_label(lbl)

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in update(self, props)
    994                     func = getattr(self, f"set_{k}", None)
    995                     if not callable(func):
--> 996                         raise AttributeError(f"{type(self).__name__!r} object "
    997                                              f"has no property {k!r}")
    998                     ret.append(func(v))

AttributeError: 'Rectangle' object has no property 'normed'

Attribute Error in Asteria Notebooks

Error:
AttributeError: module 'asteria.source' has no attribute 'initialize'

Locations:
-Detector_Response: cell [3]
-Load_Simulation: cell [3]
-Luminosity: cell [3]
-Simplemixing_Class: cell [2]
-Simulation_Handling: cell [4]
-Supernova_Mixing: cell [2]

Error trace from Detector_Response nb:

AttributeError Traceback (most recent call last)
Input In [3], in <cell line: 2>()
1 conf = config.load_config('../../data/config/default.yaml')
----> 2 ccsn = source.initialize(conf)
3 i3 = detector.initialize(conf)

AttributeError: module 'asteria.source' has no attribute 'initialize'

Tex Errors in Asteria Notebooks

Errors:
FileNotFoundError: [Errno 2] No such file or directory: 'latex'

RuntimeError: Failed to process string with tex because latex could not be found

Locations:

AnalyticModel_DetectorResponse: cell [5]:

Cross_sections: cell [4]

Inverse_Beta_Decay: cell [3]

Note: This is likely an issue with me not having latex properly downloaded but if it is required for these notebooks, it might be good to add a note in the notebook instructions mentioning that it should be downloaded

ASTERIA is Missing Command-line functionality of USSR

(Request from Lutz) In USSR, it was possible to easily iterate through a wide variety of simulation configurations and to take commands from terminal. ASTERIA lacks this functionality

  • Implement command line functionality for ASTERIA
    Potential new Features:
  1. New fields in configuration YAML (OR new top-level config simulation YAML) which describes ALL options of simulation..
  2. New methods (in IO.py) to parse command-line options
  3. New Methods (in IO.py) to parse an iterable of options within yaml file or at command line
  4. New Methods/objects to run the full simulation (Potentially set up methods to individually handle steps outlined in detector_response.ipynb)

ASTERIA lacks unit tests on most features

Only two unit tests are currently written, one of which confirms the version number. All features other than the tabulated Inverse Beta Decay cross section lack unit tests.

Cells from the notebook documentation would provide a good basis for unit tests.

Test suite enhancements

  • Upgrade to (nose2)[https://github.com/nose-devs/nose2]
  • Add code coverage plugin
  • Write test result output and setup for circleci

Error in supernova_mixing

In cells In[5], In[6], In[7], and In[11] of the notebook supernova-mixing, a unit conversion error appears. Running at git hash ec1024d.

The code of In[5] is:

fig1, ax = plt.subplots(1,1, figsize=(7,5))
t = np.linspace(-0.1, 1, 201) * u.s

nu_list = []
i = 0
for flavor in Flavor:
    flux = ccsn.get_flux(t, flavor)
    nu_list.append(flux)

nu_e = [a + b for a, b in zip(nu_list[2], nu_list[3])]  
nu_x = [(a + b + c)/2 for a, b, c in zip(nu_list[0], nu_list[2], nu_list[3])]
nu_e_bar = [a*c2t12 + (b + c)*s2t12 for a, b, c in zip(nu_list[1], nu_list[2], nu_list[3])]
nu_x_bar = [((1.0-c2t12)*a + (1.0+c2t12)*(b + c))/2 for a, b, c in zip(nu_list[1], nu_list[2], nu_list[3])]
nu_new = [nu_e, nu_e_bar, nu_x, nu_x_bar]

for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new)), Flavor):
    new_flux = nu_new[i]
    ax.plot(t, new_flux, ls, lw=2, alpha=0.7, label=flavor.to_tex()), 

# plt.yscale('log')
# plt.ylim(3e51, 5e53)

ax.set(xlabel='time - $t_{bounce}$ [s]',
       ylabel='flux')
ax.legend()
fig1.tight_layout()

The error is:

---------------------------------------------------------------------------
UnitConversionError                       Traceback (most recent call last)
/opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity.py in to_value(self, unit, equivalencies)
    739             try:
--> 740                 scale = self.unit._to(unit)
    741             except Exception:

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/core.py in _to(self, other)
    949 
--> 950         raise UnitConversionError(
    951             f"'{self!r}' is not a scaled version of '{other!r}'")

UnitConversionError: 'Unit("1 / s")' is not a scaled version of 'Unit(dimensionless)'

During handling of the above exception, another exception occurred:

UnitConversionError                       Traceback (most recent call last)
/opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity.py in __float__(self)
   1085         try:
-> 1086             return float(self.to_value(dimensionless_unscaled))
   1087         except (UnitsError, TypeError):

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity.py in to_value(self, unit, equivalencies)
    742                 # Short-cut failed; try default (maybe equivalencies help).
--> 743                 value = self._to_value(unit, equivalencies)
    744             else:

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity.py in _to_value(self, unit, equivalencies)
    661             equivalencies = self._equivalencies
--> 662         return self.unit.to(unit, self.view(np.ndarray),
    663                             equivalencies=equivalencies)

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/core.py in to(self, other, value, equivalencies)
    986         else:
--> 987             return self._get_converter(other, equivalencies=equivalencies)(value)
    988 

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/core.py in _get_converter(self, other, equivalencies)
    917 
--> 918             raise exc
    919 

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/core.py in _get_converter(self, other, equivalencies)
    902         try:
--> 903             return self._apply_equivalencies(
    904                 self, other, self._normalize_equivalencies(equivalencies))

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/core.py in _apply_equivalencies(self, unit, other, equivalencies)
    885 
--> 886         raise UnitConversionError(
    887             "{} and {} are not convertible".format(

UnitConversionError: '1 / s' (frequency) and '' (dimensionless) are not convertible

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-5-f40ec5842608> in <module>
     16 for ls, i, flavor in zip(["-", "--", "-.", ":"], range(len(nu_new)), Flavor):
     17     new_flux = nu_new[i]
---> 18     ax.plot(t, new_flux, ls, lw=2, alpha=0.7, label=flavor.to_tex()),
     19 
     20 # plt.yscale('log')

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_axes.py in plot(self, scalex, scaley, data, *args, **kwargs)
   1741         """
   1742         kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1743         lines = [*self._get_lines(*args, data=data, **kwargs)]
   1744         for line in lines:
   1745             self.add_line(line)

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in __call__(self, data, *args, **kwargs)
    271                 this += args[0],
    272                 args = args[1:]
--> 273             yield from self._plot_args(this, kwargs)
    274 
    275     def get_next_color(self):

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
    387         if len(tup) == 2:
    388             x = _check_1d(tup[0])
--> 389             y = _check_1d(tup[-1])
    390         else:
    391             x, y = index_of(tup[-1])

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/cbook/__init__.py in _check_1d(x)
   1293     """Convert scalars to 1d arrays; pass-through arrays as is."""
   1294     if not hasattr(x, 'shape') or len(x.shape) < 1:
-> 1295         return np.atleast_1d(x)
   1296     else:
   1297         try:

<__array_function__ internals> in atleast_1d(*args, **kwargs)

/opt/anaconda3/lib/python3.8/site-packages/numpy/core/shape_base.py in atleast_1d(*arys)
     64     res = []
     65     for ary in arys:
---> 66         ary = asanyarray(ary)
     67         if ary.ndim == 0:
     68             result = ary.reshape(1)

/opt/anaconda3/lib/python3.8/site-packages/numpy/core/_asarray.py in asanyarray(a, dtype, order, like)
    169         return _asanyarray_with_like(a, dtype=dtype, order=order, like=like)
    170 
--> 171     return array(a, dtype, copy=False, order=order, subok=True)
    172 
    173 

/opt/anaconda3/lib/python3.8/site-packages/astropy/units/quantity.py in __float__(self)
   1086             return float(self.to_value(dimensionless_unscaled))
   1087         except (UnitsError, TypeError):
-> 1088             raise TypeError('only dimensionless scalar quantities can be '
   1089                             'converted to Python scalars')
   1090 

TypeError: only dimensionless scalar quantities can be converted to Python scalars

Another error appears in In[10], which seems can be traced back to In[7].

The code of In[10] is:

fig1, ax = plt.subplots(1, 1, figsize=(15,5), sharex = True, sharey = True)
t = np.linspace(-0.1, 4, 201) * u.s

s2t12_val = np.random.normal(loc = s2t12, scale = s2t12_er, size = 1000)
c2t12_val = 1 - s2t12_val

nu_e2_er = [a*s2t12_val + (b + c)*c2t12_val for a, b, c in zip(nu_list2[0], nu_list2[2], nu_list2[3])] 
std_e, mean_e, sig1_lo_e, sig1_hi_e, sig2_lo_e, sig2_hi_e, sig3_lo_e, sig3_hi_e = errors(nu_e2_er)

ax.fill_between(t, sig1_lo_e, sig1_hi_e, color='g', alpha=0.3, label = r'$1\sigma_{e}$')
ax.fill_between(t, sig2_lo_e, sig2_hi_e, color = 'g', alpha = 0.2, label = '$2\sigma_e$')
ax.fill_between(t, sig3_lo_e, sig3_hi_e, color='g', alpha = 0.1, label = '$3\sigma_e$')
ax.plot(t, mean_e, 'darkgreen', label=r'Mean $\nu_e$')
  
nu_x2_er = [((1.0-s2t12_val)*a + (1.0+s2t12_val)*(b+c))/2 for a, b, c in zip(nu_list2[0], nu_list2[2], nu_list2[3])] 
std_x, mean_x, sig1_lo_x, sig1_hi_x, sig2_lo_x, sig2_hi_x, sig3_lo_x, sig3_hi_x = errors(nu_x2_er)
ax.fill_between(t, sig1_lo_x, sig1_hi_x, color='orange', alpha=0.3, label=r'$1\sigma_x$')
ax.fill_between(t, sig2_lo_x, sig2_hi_x, color = 'orange', alpha = 0.2, label = r'$2\sigma_x$')
ax.fill_between(t, sig3_lo_x, sig3_hi_x, color='orange', alpha = 0.1, label = r'$3\sigma_x$')
ax.plot(t, mean_x, 'r', label=r'Mean $\nu_x$')


ax.set(xlabel='time - $t_{bounce}$ [s]',
        xlim = (0.25, 0.4),
        ylabel='flux',#, yscale ='log',
        ylim=(1.5e55, 3.4e55),
      title = r'$\theta_{12}$ dependent flavor oscillations: Inverted Mixing')
ax.legend()

fig.tight_layout()

The error is:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-10-c62ff99f4e7e> in <module>
      5 c2t12_val = 1 - s2t12_val
      6 
----> 7 nu_e2_er = [a*s2t12_val + (b + c)*c2t12_val for a, b, c in zip(nu_list2[0], nu_list2[2], nu_list2[3])]
      8 std_e, mean_e, sig1_lo_e, sig1_hi_e, sig2_lo_e, sig2_hi_e, sig3_lo_e, sig3_hi_e = errors(nu_e2_er)
      9 

NameError: name 'nu_list2' is not defined

Flavour ordering and fluxes have changed

Last time used ASTERIA (around 19.06.2023) my analyses scripts (icecube/ASTERIA/tree/gen2-sensitivity/docs/my_analysis) were working just fine. Now running the same scripts again I obtain different results.
A first look at the energy deposition of the Tamborra_2014, 20M shows that it is reduced by a factor of about 5 (from 0.7 MeV/m3 [plot 1] to 0.15 MeV/m3 [plot 2] at the peak).
Another thing I noticed is that the order in which the flavours appear changed from NU_E, NU_E_BAR, NU_X, NU_X_BAR to NU_E, NU_X, NU_E_BAR, NU_X_BAR.
Finally, when selecting the Tamborra_2014, 20 M model I now have to define the direction as a model parameter 'direction' = 1 which was previously only the case for the 27 M model as the 20 M and 11 M models have no direction dependency.

image
image (1)

No SNEWPY model registry

Error when running scratch/simulation_example.ipynb, cell 1.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/var/folders/4x/ybm62r_j11q6bnrhlldy8y840000gp/T/ipykernel_38187/1768997762.py in <cell line: 1>()
----> 1 from asteria.simulation import Simulation
      2 import matplotlib.pyplot as plt
      3 import astropy.units as u
      4 from astropy.utils.exceptions import AstropyDeprecationWarning
      5 import numpy as np

~/Desktop/IceCube/ASTERIA/python/asteria/simulation.py in <module>
     19 
     20 from .interactions import Interactions
---> 21 from .source import Source
     22 from .detector import Detector
     23 

~/Desktop/IceCube/ASTERIA/python/asteria/source.py in <module>
      9 """
     10 
---> 11 from snewpy.models.registry import init_model as init_snewpy_model_from_param
     12 from snewpy.neutrino import Flavor
     13 from snewpy import model_path

ModuleNotFoundError: No module named 'snewpy.models.registry'

Attribute Error in Config_Example Notebook

Error:
AttributeError: 'Flavor' object has no attribute 'to'

Location:
Config_Example: cell [2]

Error trace:

AttributeError Traceback (most recent call last)
Input In [2], in <cell line: 6>()
5 fig, ax = plt.subplots(1, figsize = (6,7))
6 for flavor in sim.flavors:
----> 7 ax.plot(sim.time, sim.avg_dom_signal(flavor), label=flavor.name)
8 ax.legend()
9 ax.set(xlabel=r't-t$_{bounce}$ [s]', ylabel='Signal per DOM', xlim=(-0.025, 0.65))

File ~/ASTERIA/python/asteria/simulation.py:377, in Simulation.avg_dom_signal(self, dt, flavor)
375 if not dt:
376 dt = self._res_dt
--> 377 self.rebin_result(dt)
379 if flavor is None:
380 E_per_V = self._total_E_per_V_binned

File ~/ASTERIA/python/asteria/simulation.py:407, in Simulation.rebin_result(self, dt, offset, force_rebin)
404 if self._E_per_V is None or self._total_E_per_V is None:
405 raise RuntimeError("Simulation has not been executed yet, please use Simulation.run()")
--> 407 _dt = dt.to(u.s).value
408 _offset = int(offset.to(u.us).value + 0.5) # This is a guard against floating point errors
409 is_same_rebin = _dt == self._res_dt.to(u.s).value and _offset == int(self._res_offset.to(u.us).value + 0.5)

AttributeError: 'Flavor' object has no attribute 'to'

Add a utility to convert detector hits to source flux

This could be a useful utility for the purposes of presenting ASTERIA's hits in more physical units. Since the Simulation object contains the source luminosity, source distance, and the means to compute the hits, a crude estimate of the flux at the detector and flux at the source should be relatively easy to obtain.

Construction of ASTERIA paths is not robust

Currently, ASTERIA checks for the existence of several directories during installation. If these directories are not found, they are created. This is done using os.path.realpath in the package's __init__.py. This current method is not robust and can lead to the formation of incorrect paths, leading to other issues.

A better way of performing these checks is needed.

use get_initial_spectra from snewpy models

When ASTERIA accesses spectra from snewpy models, it is pulling out the meanE and pinch attributes of the model classes and then computing energy spectra from those. Instead, it should be using the models' native function call

spectra = model.get_initial_spectra(t, E)

Is there a good reason we are not doing this? As written the code is brittle and doesn't respect the encapsulation provided by the model classes.

SNEWPY does not support init_model when called in sim_tester.ipynb

When executing the sim_tester.ipynb file in /scratch I get the following error

`NameError Traceback (most recent call last)
Cell In[1], line 12
3 import astropy.units as u
5 model = {'name': 'Nakazato_2013',
6 'param':{
7 'progenitor_mass': 13u.Msun,
(...)
10 'eos': 'shen'}
11 }
---> 12 sim = Simulation(model=model,
13 distance=10 * u.kpc,
14 Emin=0
u.MeV, Emax=100u.MeV, dE=1u.MeV,
15 tmin=-1u.s, tmax=1u.s, dt=1*u.ms)
16 sim.run()
18 import matplotlib.pyplot as plt

File /usr/local/lib/python3.8/dist-packages/asteria-0.2.0.dev133-py3.8.egg/asteria/simulation.py:62, in Simulation.init(self, config, model, distance, flavors, hierarchy, interactions, mixing_scheme, mixing_angle, E, Emin, Emax, dE, t, tmin, tmax, dt, geomfile, effvolfile)
59 t = np.arange(-1, 1, 0.001) * u.s
60 _dt = 1 * u.ms
---> 62 self.source = Source(model['name'], model['param'])
63 self.distance = distance
64 self.energy = E

File /usr/local/lib/python3.8/dist-packages/asteria-0.2.0.dev133-py3.8.egg/asteria/source.py:32, in Source.init(self, model, model_params)
31 def init(self, model, model_params=None):
---> 32 self.model = init_model(model, **model_params)
33 self._interp_lum = {}
34 self._interp_meanE = {}

NameError: name 'init_model' is not defined`

It appears that the current version of SEWPY no longer supports to import the module function init_model as defined in /python/asteria/source.py

try: from snewpy.models.util import init_model except ModuleNotFoundError: from .util import init_model as init_snewpy_model_from_param

SNEWPY Warren_2020 model errors on initialization

When loading Warren_2020 model in ASTERIA, an error similar to the following is produced. Thanks to @jlazar17 for finding this.
I suspect it is due to a duplicate time entry in the model file, as was the case with SNEWS2/snewpy#210.

~/IceCube/ASTERIA/python/asteria/source.py in __init__(self, model, model_params)
    37         for flavor in Flavor:
    38             t = self.model.time
--> 39             self._interp_lum.update({flavor: PchipInterpolator(t, self.model.luminosity[flavor], extrapolate=False)})
    40             self._interp_meanE.update({flavor: PchipInterpolator(t, self.model.meanE[flavor], extrapolate=False)})
    41             self._interp_pinch.update({flavor: PchipInterpolator(t, self.model.pinch[flavor], extrapolate=False)})

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in __init__(self, x, y, axis, extrapolate)
    232     """
    233     def __init__(self, x, y, axis=0, extrapolate=None):
--> 234         x, _, y, axis, _ = prepare_input(x, y, axis)
    235         xp = x.reshape((x.shape[0],) + (1,)*(y.ndim-1))
    236         dk = self._find_derivatives(xp, y)

/opt/anaconda3/lib/python3.8/site-packages/scipy/interpolate/_cubic.py in prepare_input(x, y, axis, dydx)
     59     dx = np.diff(x)
     60     if np.any(dx <= 0):
---> 61         raise ValueError("`x` must be strictly increasing sequence.")
     62 
     63     y = np.rollaxis(y, axis)

ValueError: `x` must be strictly increasing sequence.

No standard progenitor distance for files saved by IO module

Current operations to save a processed simulation is:

E_per_V_1kpc =  E_per_V * ccsn.progenitor_distance.to(u.kpc).value**2
io.save(conf, Interactions, Hierarchy, Flavor, Enu.value, time.value, \
                                    E_per_V_1kpc, force=True)

IO module should do the conversion to 1kpc so that data files are at a standard distance.

Replace internal `Source` and mass mixing classes with models from snewpy.

Since snewpy has standardized access to a number of CCSN models and flavor transformation scenarios, we should pull it in as a dependency. This would entail deleting the Source class in the source module, but keeping the functionality of the photonic_energy_per_vol member function.

About flavor transformations, we can probably completely remove the oscillations module and use the transformation classes implemented in snewpy.

Installation of ASTERIA failed locally and on cobalt cluster with python 3.10

First tried to install ASTERIA locally with Python 3.8.10:
$ python setup.py install
Failed to install SNEWPY dependency, possibly due to prior installations

Tried to created virtual python environment.
$ python3 -m venv ./venv_asteria
Failed as virtual environment not installed.

Tried to install virtual environmnet.
$ sudo apt install python3.8-venv

libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

Then switched to the cobalt nodes and installed virtual environment.
$ python3 -m venv ./venv_asteria
and activated virtual environment. Configured preinstalled git and cloned ASTERIA repository with HTTPS.
$ git clone https://github.com/icecube/ASTERIA.git
Moved to ASTERIA directory and tried to install program
$ python setup.py install

Traceback (most recent call last):
File "setup.py", line 35, in
setup_keywords['long_description'] = readme.read()
File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 230: ordinal not in range(128)

deactivate and remote virtual environment and execute
$ eval /cvmfs/icecube.opensciencegrid.org/py3-v4.2.0/setup.sh
Python version 3.10.2, reinstall virtual environment and run
$ python setup.py install

Traceback (most recent call last):
File "/home/jbeise/venv_asteria/lib/python3.10/site-packages/setuptools/sandbox.py", line 156, in save_modules
yield saved
File "/home/jbeise/venv_asteria/lib/python3.10/site-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/home/jbeise/venv_asteria/lib/python3.10/site-packages/setuptools/sandbox.py", line 259, in run_setup
_execfile(setup_script, ns)
File "/home/jbeise/venv_asteria/lib/python3.10/site-packages/setuptools/sandbox.py", line 46, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-u7twgl84/tables-3.8.0/setup.py", line 20, in
setup_keywords = dict()
ModuleNotFoundError: No module named 'packaging'

Type Error in Detector Notebook

Error:
TypeError: 'Table' object is not callable

Location:
Detector: cell [3]

Error trace:

TypeError Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 doms = ic86.doms_table()
2 doms

TypeError: 'Table' object is not callable

Error in writing new simulation to file

In the In[7] cell of the document notebook detector_response, an error appears.

The code is:

E_per_V_1kpc =  E_per_V * ccsn.progenitor_distance.to(u.kpc).value**2
try:
    io.save(conf, E_per_V_1kpc)
except FileExistsError as e:
    print(e)

The error is:

Found  None
Writing new simulation to file
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
tables/tableextension.pyx in tables.tableextension.get_nested_field_cache()

KeyError: 'default'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
tables/utilsextension.pyx in tables.utilsextension.get_nested_field()

KeyError: 'default'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
<ipython-input-7-329bea05f4ac> in <module>
      1 E_per_V_1kpc =  E_per_V * ccsn.progenitor_distance.to(u.kpc).value**2
      2 try:
----> 3     io.save(conf, E_per_V_1kpc)
      4 except FileExistsError as e:
      5     print(e)

/opt/anaconda3/lib/python3.8/site-packages/asteria-0.2.0.dev133-py3.8.egg/asteria/IO.py in save(config, result, force)
    253 
    254         row = grp_options.Hierarchy.row
--> 255         row[config.simulation.hierarchy] = True
    256         row.append()
    257         grp_options.Hierarchy.flush()

tables/tableextension.pyx in tables.tableextension.Row.__setitem__()

tables/tableextension.pyx in tables.tableextension.get_nested_field_cache()

tables/utilsextension.pyx in tables.utilsextension.get_nested_field()

KeyError: 'no such column: default'

Pad output beyond times set by model fluxes

When generating a light curve, ASTERIA only returns a time series bound by the times set by a given supernova model. In principle, for returning noisy data, we could have the option to pad the data with background-only counts for times outside the range set by the model.

Value Error in Sim_2_Root Notebook

Error:
ValueError: x and y must have same first dimension, but have shapes (11001,) and (5501,)

Location:
Sim_2_Root: cell [2]

Error trace:

ValueError Traceback (most recent call last)
Input In [2], in <cell line: 27>()
26 fig, ax = plt.subplots(1, figsize = (6,7))
27 for flavor in sim.flavors:
---> 28 ax.plot(sim.time, sim.avg_dom_signal(flavor=flavor), label=flavor.name)
29 ax.legend()
30 ax.set(xlabel=r't-t$_{bounce}$ [s]', ylabel='Signal per DOM', xlim=(-0.025, 0.65))

File ~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/axes/_axes.py:1632, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
1390 """
1391 Plot y versus x as lines and/or markers.
1392
(...)
1629 ('green') or hex strings ('#008000').
1630 """
1631 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1632 lines = [*self._get_lines(*args, data=data, **kwargs)]
1633 for line in lines:
1634 self.add_line(line)

File ~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/axes/_base.py:312, in _process_plot_var_args.call(self, data, *args, **kwargs)
310 this += args[0],
311 args = args[1:]
--> 312 yield from self._plot_args(this, kwargs)

File ~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/axes/_base.py:498, in _process_plot_var_args._plot_args(self, tup, kwargs, return_kwargs)
495 self.axes.yaxis.update_units(y)
497 if x.shape[0] != y.shape[0]:
--> 498 raise ValueError(f"x and y must have same first dimension, but "
499 f"have shapes {x.shape} and {y.shape}")
500 if x.ndim > 2 or y.ndim > 2:
501 raise ValueError(f"x and y can be no greater than 2D, but have "
502 f"shapes {x.shape} and {y.shape}")

ValueError: x and y must have same first dimension, but have shapes (11001,) and (5501,)

Error with Fornax_2019

There is an error in the simulation of Fornax_2019.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [20], in <cell line: 6>()
      1 model = {'name': 'Fornax_2019',
      2          'param':{
      3              'progenitor_mass': 12 * u.Msun 
      4             }}
----> 6 sim = Simulation(model=model,
      7                  distance=10 * u.kpc, 
      8                  Emin=0*u.MeV, Emax=100*u.MeV, dE=1*u.MeV,
      9                  tmin=-0.21*u.s, tmax=4.49*u.s, dt=1*u.ms,
     10                  mixing_scheme='AdiabaticMSW',
     11                  hierarchy='normal')
     12 sim.run()

File ~/IceCube/ASTERIA/python/asteria/simulation.py:59, in Simulation.__init__(self, config, model, distance, flavors, hierarchy, interactions, mixing_scheme, mixing_angle, E, Emin, Emax, dE, t, tmin, tmax, dt, geomfile, effvolfile)
     56     t = np.arange(-1, 1, 0.001) * u.s
     57     _dt = 1 * u.ms
---> 59 self.source = Source(model['name'], model['param'])
     60 self.distance = distance
     61 self.energy = E

File ~/IceCube/ASTERIA/python/asteria/source.py:116, in Source.__init__(self, model, model_params)
    114 for flavor in Flavor:
    115     t = self.model.time
--> 116     self._interp_lum.update({flavor: PchipInterpolator(t, self.model.luminosity[flavor], extrapolate=False)})
    117     self._interp_meanE.update({flavor: PchipInterpolator(t, self.model.meanE[flavor], extrapolate=False)})
    118     self._interp_pinch.update({flavor: PchipInterpolator(t, self.model.pinch[flavor], extrapolate=False)})

AttributeError: 'Fornax_2019' object has no attribute 'luminosity'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.