Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
f95e790
Update snowglobes.py
jpkneller Jun 22, 2026
0589db9
Update snowglobes.py
jpkneller Jun 22, 2026
2ab9f9e
Update ccsn_loaders.py
jpkneller Jun 22, 2026
2590d14
Update presn_loaders.py
jpkneller Jun 22, 2026
c3de41c
Update snowglobes.py
jpkneller Jun 22, 2026
fac75fa
Update snowglobes.py
jpkneller Jun 22, 2026
153a0ae
Update snowglobes.py
jpkneller Jun 22, 2026
1140110
Update snowglobes.py
jpkneller Jun 22, 2026
660aae4
Update snowglobes.py
jpkneller Jun 22, 2026
a0043e6
Update snowglobes.py
jpkneller Jun 22, 2026
f692fd6
Update snowglobes.py
jpkneller Jun 23, 2026
3ccabd3
Update utils.py
jpkneller Jun 23, 2026
b0348a0
Update snowglobes.py
jpkneller Jun 23, 2026
1c87136
Update snowglobes.py
jpkneller Jun 23, 2026
dfd3350
Update snowglobes.py
jpkneller Jun 23, 2026
fb641d6
Update utils.py
jpkneller Jun 23, 2026
12b401e
Update snowglobes.py
jpkneller Jun 23, 2026
345a369
Update snowglobes.py
jpkneller Jun 23, 2026
69268d8
Update snowglobes.py
jpkneller Jun 23, 2026
db91441
Update rate_calculator.py
jpkneller Jun 23, 2026
87186ca
Update snowglobes.py
jpkneller Jun 23, 2026
ae43580
Update snowglobes.py
jpkneller Jun 23, 2026
be05d0a
Update base.py
jpkneller Jun 23, 2026
019f11e
Update rate_calculator.py
jpkneller Jun 23, 2026
b9d8143
Update snowglobes.py
jpkneller Jun 23, 2026
659d386
Update snowglobes.py
jpkneller Jun 23, 2026
a194c87
Update snowglobes.py
jpkneller Jun 23, 2026
9709678
Update rate_calculator.py
jpkneller Jun 23, 2026
1e0d16d
Update snowglobes.py
jpkneller Jun 23, 2026
1408a4a
Update snowglobes.py
jpkneller Jun 23, 2026
60110e8
Update snowglobes.py
jpkneller Jun 23, 2026
461b4fd
Update utils.py
jpkneller Jun 23, 2026
cc333f9
Update snowglobes.py
jpkneller Jun 23, 2026
7aca097
Update snowglobes.py
jpkneller Jun 23, 2026
d7f0ffe
Update snowglobes.py
jpkneller Jun 24, 2026
cac6463
Update snowglobes.py
jpkneller Jun 24, 2026
6cb2d82
Update snowglobes.py
jpkneller Jun 24, 2026
1002771
Update snowglobes.py
jpkneller Jun 24, 2026
6cdf4fa
Update snowglobes.py
jpkneller Jun 24, 2026
6686f6f
Update snowglobes.py
jpkneller Jun 24, 2026
c4cfe42
Update snowglobes.py
jpkneller Jun 24, 2026
a0aad4b
Update snowglobes.py
jpkneller Jun 24, 2026
8f055a6
Update snowglobes.py
jpkneller Jun 24, 2026
0552b06
Update snowglobes.py
jpkneller Jun 25, 2026
0c5065c
Update snowglobes.py
jpkneller Jun 25, 2026
b924d92
Update snowglobes.py
jpkneller Jun 25, 2026
27c21f0
Update snowglobes.py
jpkneller Jun 25, 2026
a8dbbce
Update snowglobes.py
jpkneller Jun 25, 2026
f86001c
Update snowglobes.py
jpkneller Jun 25, 2026
b9d784c
Update snowglobes.py
jpkneller Jun 25, 2026
759590e
Update snowglobes.py
jpkneller Jun 26, 2026
d2d2e9e
Update snowglobes.py
jpkneller Jun 26, 2026
a0e254c
Update snowglobes.py
jpkneller Jun 26, 2026
5494325
Update snowglobes.py
jpkneller Jun 26, 2026
08244c5
Update snowglobes.py
jpkneller Jun 26, 2026
d8585b2
Update snowglobes.py
jpkneller Jun 26, 2026
bbed4bc
Update snowglobes.py
jpkneller Jun 27, 2026
67e5c6f
Update snowglobes.py
jpkneller Jun 29, 2026
d71183f
Update snowglobes.py
jpkneller Jun 29, 2026
8a73328
Update snowglobes.py
jpkneller Jun 29, 2026
4fa6de4
Update snowglobes.py
jpkneller Jun 29, 2026
6acd996
Update snowglobes.py
jpkneller Jun 29, 2026
ed97cd3
Update snowglobes.py
jpkneller Jun 29, 2026
06277bd
Update snowglobes.py
jpkneller Jun 29, 2026
e9bc2a2
Update snowglobes.py
jpkneller Jun 29, 2026
f26c98e
Update snowglobes.py
jpkneller Jun 29, 2026
2bb9c50
Update flux.py
jpkneller Jun 29, 2026
7ffb17b
Update snowglobes.py
jpkneller Jun 29, 2026
c6e4870
Update flux.py
jpkneller Jun 29, 2026
7196049
Update snowglobes.py
jpkneller Jun 29, 2026
3e28b71
Update snowglobes.py
jpkneller Jun 29, 2026
3c78e76
Update flux.py
jpkneller Jun 29, 2026
87bcca4
Update flux.py
jpkneller Jun 29, 2026
de00ab2
Update flux.py
jpkneller Jun 29, 2026
1dd2910
Update flux.py
jpkneller Jun 29, 2026
4452aad
Update flux.py
jpkneller Jun 30, 2026
dfd9705
Update flux.py
jpkneller Jun 30, 2026
4b411fe
Update snowglobes.py
jpkneller Jun 30, 2026
f85e4ec
Update snowglobes.py
jpkneller Jun 30, 2026
2c97b15
Update snowglobes.py
jpkneller Jun 30, 2026
809880c
Update snowglobes.py
jpkneller Jun 30, 2026
430437a
Update snowglobes.py
jpkneller Jun 30, 2026
0036b89
Update snowglobes.py
jpkneller Jun 30, 2026
f720175
Update snowglobes.py
jpkneller Jun 30, 2026
e1f2c03
Update snowglobes.py
jpkneller Jun 30, 2026
98e7d73
Update snowglobes.py
jpkneller Jul 1, 2026
68f3334
Update snowglobes.py
jpkneller Jul 1, 2026
d1a306a
Update ccsn_loaders.py
jpkneller Jul 1, 2026
30028b8
Update presn_loaders.py
jpkneller Jul 1, 2026
3fc2bf1
Update snowglobes.py
jpkneller Jul 1, 2026
8bf2ace
Update base.py
jpkneller Jul 1, 2026
76ebcc4
Update ccsn.py
jpkneller Jul 1, 2026
8183650
Update presn.py
jpkneller Jul 1, 2026
bc3b8dd
Update base.py
jpkneller Jul 1, 2026
83d1183
Update base.py
jpkneller Jul 1, 2026
ef70ce2
Update snowglobes.py
jpkneller Jul 1, 2026
38ded72
Update ccsn.py
jpkneller Jul 2, 2026
3563a8d
Update ccsn_loaders.py
jpkneller Jul 2, 2026
75a0787
Update presn.py
jpkneller Jul 2, 2026
7989dee
Update presn_loaders.py
jpkneller Jul 2, 2026
c2c95d6
Update snowglobes.py
jpkneller Jul 2, 2026
4743f2e
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
cd99062
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
2ccb5cb
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
434e08e
Update snowglobes.py
jpkneller Jul 2, 2026
3bf3d85
Update ccsn_loaders.py
jpkneller Jul 2, 2026
65c86a6
Update simplerate_integrationtest.py
jpkneller Jul 2, 2026
2b275d8
Update utils.py
jpkneller Jul 2, 2026
fc210f3
Update _rate_crosscheck_table.py
jpkneller Jul 2, 2026
a429ad4
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
37e53b4
Update utils.py
jpkneller Jul 2, 2026
f0a0854
Update utils.py
jpkneller Jul 2, 2026
a5a2a53
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
05e723e
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
996ae1b
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
6a98ac0
Update utils.py
jpkneller Jul 2, 2026
acd2dd9
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
b492c53
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
78ee2b4
Update test_05_snowglobes.py
jpkneller Jul 2, 2026
63c62d0
Update model_files.yml
jpkneller Jul 2, 2026
5f92d32
Update model_files.yml
jpkneller Jul 2, 2026
65fbbf5
Update utils.py
jpkneller Jul 6, 2026
183a289
Update snowglobes.py
jpkneller Jul 6, 2026
eb2fd1a
Update _rate_crosscheck_table.py
jpkneller Jul 6, 2026
d83f645
Update _rate_crosscheck_table.py
jpkneller Jul 6, 2026
e876ec1
Update utils.py
jpkneller Jul 6, 2026
1278a7a
Update flavor.py
jpkneller Jul 6, 2026
631b35c
Update utils.py
jpkneller Jul 6, 2026
14e8608
Update snowglobes.py
jpkneller Jul 6, 2026
15600ce
Update test_05_snowglobes.py
jpkneller Jul 6, 2026
9db7c2a
Update test_05_snowglobes.py
jpkneller Jul 6, 2026
6797228
Update presn_loaders.py
jpkneller Jul 6, 2026
00471ed
Update model_files.yml
jpkneller Jul 6, 2026
f6fc1e5
Update model_files.yml
jpkneller Jul 6, 2026
ada867e
Update test_05_snowglobes.py
jpkneller Jul 6, 2026
fcabcf3
Update simplerate_integrationtest.py
jpkneller Jul 6, 2026
8c9816d
Update test_presn_rates.py
jpkneller Jul 6, 2026
99ad4cd
Update snowglobes.py
jpkneller Jul 6, 2026
46e9985
Update snowglobes.py
jpkneller Jul 6, 2026
d9c1c6c
Update snowglobes.py
jpkneller Jul 6, 2026
1ae7929
Update snowglobes.py
jpkneller Jul 6, 2026
829403f
Update snowglobes.py
jpkneller Jul 6, 2026
7701ecb
Update snowglobes.py
jpkneller Jul 7, 2026
2c8ce77
Update snowglobes.py
jpkneller Jul 7, 2026
2a96180
Merge branch 'main' into jpkneller-new-generate
jpkneller Jul 8, 2026
803b19e
Update simplerate_integrationtest.py
jpkneller Jul 8, 2026
6ea317b
Update test_05_snowglobes.py
jpkneller Jul 8, 2026
24020a8
Update simplerate_integrationtest.py
jpkneller Jul 8, 2026
46fe0a7
Update snowglobes.py
jpkneller Jul 8, 2026
27735a8
Update snowglobes.py
jpkneller Jul 9, 2026
094ad10
Update snowglobes.py
jpkneller Jul 9, 2026
28f3f77
Update test_presn_rates.py
jpkneller Jul 9, 2026
00e13e5
Update snowglobes.py
jpkneller Jul 9, 2026
605ec55
Update snowglobes.py
jpkneller Jul 9, 2026
b6f6230
Update snowglobes.py
jpkneller Jul 9, 2026
290c988
Update simplerate_integrationtest.py
jpkneller Jul 9, 2026
bad7dae
Update snowglobes.py
jpkneller Jul 9, 2026
92f669c
Update simplerate_integrationtest.py
jpkneller Jul 9, 2026
3a25e50
Update snowglobes.py
jpkneller Jul 9, 2026
af38a51
Update ccsn.py
jpkneller Aug 10, 2026
c1a8054
Update ccsn_loaders.py
jpkneller Aug 10, 2026
2e1519a
Update snowglobes.py
jpkneller Aug 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/snewpy/flavor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import enum
import numpy as np
import typing
import snewpy.utils
from snewpy.utils import expand_dimensions_to

class FlavorEnumMeta(enum.EnumMeta):
"""Meta class for setting flavor enums.
Expand Down Expand Up @@ -198,7 +198,7 @@ def __matmul__(self, other):
try:
m0, m1 = self.array, other.array
ndims = max(m0.ndim, m1.ndim)
m0,m1 = [snewpy.utils.expand_dimensions_to(m, ndim=ndims) for m in [m0,m1]]
m0,m1 = [expand_dimensions_to(m, ndim=ndims) for m in [m0,m1]]
array = np.einsum('ij...,jk...->ik...',m0,m1)
return FlavorMatrix(array, self.flavor_out, from_flavor = other.flavor_in)
except Exception as e:
Expand Down
19 changes: 19 additions & 0 deletions python/snewpy/flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,25 @@ def __eq__(self, other:'Container')->bool:
all([np.allclose(self.axes[ax], other.axes[ax]) for ax in list(Axes)[1:]])
return result

def __add__(self,other:'Container'):
# Overload the + operator.
# Don't compare the flavors, only that they have the same number
if self.__class__==other.__class__ and \
self.unit == other.unit and \
self.flavor_scheme==other.flavor_scheme and \
len(self.flavor)==len(other.flavor) and \
all([np.allclose(self.axes[ax], other.axes[ax]) for ax in list(Axes)[1:]]):
array = self.array+other.array
axes = list(self.axes)
return Container(array,*axes)
else:
return NotImplemented

def __radd__(self,other):
if other == 0:
return self
return self.__add__(other)

def _is_full_flavor(self):
return all(self.flavor==list(self.flavor_scheme))

Expand Down
10 changes: 6 additions & 4 deletions python/snewpy/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def __init__(self, time, metadata):
"""
self.time = time
self.metadata = metadata
for entry in metadata:
self.name += f"-{metadata[entry]}"

def __repr__(self):
"""Default representation of the model.
Expand Down Expand Up @@ -132,10 +134,10 @@ def get_initial_spectra(self, t, E):
A container with the information about the initial neutrino spectra
"""
spectra_dict = self._get_initial_spectra_dict(t, E, flavors=ThreeFlavor)
initial_spectra = flux.Container['1/(MeV*s)'].from_dict(spectra_dict,
time=t,
energy=E,
flavor_scheme=ThreeFlavor)
initial_spectra = flux.Spectrum.from_dict(spectra_dict,
time=t,
energy=E,
flavor_scheme=ThreeFlavor)
return initial_spectra

def get_transformed_spectra(self, t, E, flavor_xform):
Expand Down
41 changes: 20 additions & 21 deletions python/snewpy/models/ccsn.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(self):
self.metadata["EOS"] = "HS(DD2)"
self.metadata["Progenitor mass"] = 18 * u.Msun
filename='Fischer_2020.tar.gz'

return super().__init__(filename, metadata=self.metadata)

@RegistryModel(
Expand Down Expand Up @@ -78,6 +79,7 @@ def __init__(self, progenitor_mass:u.Quantity, revival_time:u.Quantity, metallic
filename = f"nakazato-{eos}-BH-z{metallicity}-s{progenitor_mass:3.1f}.fits"
#modify metadata if needed...
#self.metadata['name']=value

return super().__init__(filename, self.metadata)


Expand All @@ -93,6 +95,7 @@ def __init__(self, progenitor_mass:u.Quantity, eos:str):
filename = f'sukhbold-{eos}-z{progenitor_mass.value:3.1f}.fits'
else:
filename = f'sukhbold-{eos}-s{progenitor_mass.value:3.1f}.fits'

return super().__init__(filename, self.metadata)


Expand All @@ -111,6 +114,7 @@ class Tamborra_2014(loaders.Tamborra_2014):
def __init__(self, *, progenitor_mass:u.Quantity, direction:int):
filename = f's{progenitor_mass.value:3.1f}c_3D_dir{direction}'
# Metadata is handled by __init__ in _GarchingArchiveModel

return super().__init__(filename=filename, metadata=self.metadata)

@RegistryModel(
Expand All @@ -123,6 +127,7 @@ class Bollig_2016(loaders.Bollig_2016):
"""
def __init__(self, progenitor_mass:u.Quantity, eos:str='LS220'):
filename = f's{progenitor_mass.value:3.1f}c'

return super().__init__(filename=filename, metadata=self.metadata)

@RegistryModel(
Expand All @@ -139,6 +144,7 @@ class Walk_2018(loaders.Walk_2018):
def __init__(self, *, progenitor_mass:u.Quantity, rotation:str, direction:int):

filename = f's{progenitor_mass.value:3.1f}c_3D_{rotation}rot_dir{direction}'

return super().__init__(filename=filename, metadata=self.metadata)


Expand All @@ -156,6 +162,7 @@ class Walk_2019(loaders.Walk_2019):
"""
def __init__(self, * ,progenitor_mass:u.Quantity, direction:int):
filename = f's{progenitor_mass.value:3.1f}c_3DBH_dir{direction}'

return super().__init__(filename=filename, metadata=self.metadata)


Expand All @@ -173,6 +180,7 @@ class OConnor_2013(loaders.OConnor_2013):
def __init__(self, eos:str, progenitor_mass:u.Quantity):
# Load from Parameters
filename = f'{eos}_timeseries.tar.gz'

return super().__init__(filename=filename, metadata=self.metadata)

@RegistryModel(
Expand All @@ -185,6 +193,7 @@ def __init__(self, progenitor_mass:u.Quantity):
self.metadata["EOS"] = "LS220"
# Filename is currently the same regardless of parameters
filename = 'M1_neutrinos.dat'

return super().__init__(filename, self.metadata)

@RegistryModel(
Expand All @@ -198,6 +207,7 @@ class Zha_2021(loaders.Zha_2021):
def __init__(self, *, progenitor_mass:u.Quantity):
self.metadata["EOS"] = "STOS_B145"
filename = f's{progenitor_mass.value:g}.dat'

return super().__init__(filename, self.metadata)

@RegistryModel(
Expand Down Expand Up @@ -225,6 +235,7 @@ def __init__(self, *, progenitor_mass, turbmixing_param):
fname = f'stir_a{turbmixing_param:3.2f}/stir_multimessenger_a{turbmixing_param:3.2f}_m{progenitor_mass.value:.1f}.h5'
else:
fname = f'stir_a{turbmixing_param:3.2f}/stir_multimessenger_a{turbmixing_param:3.2f}_m{progenitor_mass.value:g}.h5'

return super().__init__(fname, self.metadata)

@RegistryModel(
Expand All @@ -241,6 +252,7 @@ class Kuroda_2020(loaders.Kuroda_2020):
def __init__(self, *, rotational_velocity, magnetic_field_exponent):
self.metadata["EOS"] = "LS220"
filename = f'LnuR{int(rotational_velocity.value):1d}0B{int(magnetic_field_exponent):02d}.dat'

return super().__init__(filename, self.metadata)

@RegistryModel(
Expand All @@ -261,6 +273,7 @@ def __init__(self, cache_flux=False, *, progenitor_mass):
filename = f'lum_spec_{int(progenitor_mass.value):d}M_r250.h5'
else:
filename = f'lum_spec_{int(progenitor_mass.value):d}M.h5'

return super().__init__(filename, self.metadata, cache_flux=cache_flux)

@RegistryModel(
Expand All @@ -277,6 +290,7 @@ def __init__(self, progenitor_mass:u.Quantity):
filename = f'lum_spec_{int(progenitor_mass.value):2d}M_r10000_dat.h5'
else:
filename = f'lum_spec_{progenitor_mass.value:.2f}M_r10000_dat.h5'

return super().__init__(filename, self.metadata)


Expand Down Expand Up @@ -316,6 +330,7 @@ def __init__(self, progenitor_mass:u.Quantity):
progenitor = self._mass_to_progenitor[progenitor_mass]
self.metadata['Black hole'] = progenitor.endswith('.bh')
filename = f'lum_spec_{progenitor}_dat.h5'

return super().__init__(filename, self.metadata)


Expand All @@ -341,6 +356,7 @@ def __init__(self, progenitor_mass:u.Quantity):
progenitor = self._mass_to_progenitor[progenitor_mass]
self.metadata['Black hole'] = progenitor == '12.25' or progenitor == '14' or progenitor == '19.56' or progenitor == '40'
filename = f'lum_spec_{progenitor}_dat.h5'

return super().__init__(filename, self.metadata)


Expand Down Expand Up @@ -393,6 +409,7 @@ def __init__(self, axion_mass:u.Quantity, axion_coupling:u.Quantity):

# Set the metadata.
self.metadata['PNS mass'] = pns_mass*u.Msun

return super().__init__(filename, self.metadata)


Expand Down Expand Up @@ -467,6 +484,7 @@ def __init__(self, *, Bfield:str, direction:str, rotation:int=None, grav:str=Non
filename = f'{Bfield}_b12_dipdecay_3d_grav{grav}_snewpy_{direction}.dat'
if Bfield=='L1':
filename = f'{Bfield}_b12_3d_{rotation}deg_snewpy_{direction}.dat'

return super().__init__(filename=filename, metadata=self.metadata)

class SNOwGLoBES:
Expand All @@ -479,6 +497,8 @@ def __init__(self, tarfilename):
tarfilename: str
Absolute or relative path to tar archive with SNOwGLoBES files.
"""
self.name = self.__class__.__name__

self.tfname = tarfilename
tf = tarfile.open(self.tfname)

Expand Down Expand Up @@ -547,25 +567,4 @@ def get_fluence(self, t):

return fluence

class Analytic3Species(PinchedModel):
"""An analytical model calculating spectra given total luminosity,
average energy, and rms or pinch, for each species.
"""

param = "There are no input files available for this class. Use `doc/scripts/Analytic.py` in the SNEWPY GitHub repo to create a custom input file."

def get_param_combinations(cls):
print(cls.param)
return []

def __init__(self, filename):
"""
Parameters
----------
filename : str
Absolute or relative path to file with model data.
"""

simtab = Table.read(filename,format='ascii')
self.filename = filename
super().__init__(simtab, metadata={})
Loading