Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions python/snewpy/models/ccsn.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ def __init__(self, progenitor_mass:u.Quantity):

_fornax_2022_masses = [float(p.strip('.bh')) for p in _fornax_2022_progenitors] << u.Msun


@RegistryModel(progenitor_mass = _fornax_2022_masses )
class Fornax_2022(loaders.Fornax_2022):
"""Model based on 2D simulations of 100 progenitors from Tianshu Wang, David Vartanyan, Adam Burrows, and Matthew S.B. Coleman, MNRAS 517:543, 2022.
Expand All @@ -429,6 +430,31 @@ def __init__(self, progenitor_mass:u.Quantity):
return super().__init__(filename, self.metadata)


_fornax_2024_progenitors = [
'u8.1', '9a', '9b', '9.25', '9.5',
'z9.6', '11', '12.25', '14', '15.01',
'16.5', '16', '17', '18', '18.5',
'19', '19.56', '20', '21.68', '23',
'24', '25', '40', '60', '100']

_fornax_2024_masses = [float(re.sub('[A-Za-z]', '', p)) for p in _fornax_2024_progenitors] << u.Msun
Comment on lines +433 to +440
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will map both 9a and 9b progenitors to 9.0 * u.Msun; so the latter would override the former when creating the _mass_to_progenitor dict later and we wouldn’t be able to access the 9a progenitor.

The two both appear to be based on the 9 Msol progenitor from Sukhbold et al. 2016; with the caption of fig. 7 in arXiv:2401.06840 explaining:

The only difference between models 9(a) and 9(b) is the imposition of slight velocity perturbations upon infall in the former (Wang & Burrows 2023a).

Since none of the other progenitors have these velocity perturbations, do you think we should just drop the 9a progenitor and document that 9 Msol corresponds to 9b? Or is it worth the small extra effort to support both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A late answer to this question: I think it's OK to drop the 9a progenitor, justified by the fact that the velocity perturbations are not present in any other model.

Your proposal is just to remove '9a' from the progenitors list?



@RegistryModel(progenitor_mass = _fornax_2022_masses )
class Fornax_2024(loaders.Fornax_2024):
"""Model based on 3D simulations of 25 progenitors using the Fornax code.
Data available at https://www.astro.princeton.edu/~burrows/nu-emissions.3d.update/
"""
#a mapping of mass to the progenitor
_mass_to_progenitor = dict(zip(_fornax_2024_masses,_fornax_2024_progenitors))

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)


@RegistryModel(
_param_validator = lambda p: \
(p['axion_mass'] == 0 and p['axion_coupling'] == 0) or \
Expand Down
47 changes: 47 additions & 0 deletions python/snewpy/models/ccsn_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,53 @@ def __init__(self, filename, metadata={}):
self.luminosity[flavor] = np.sum(dLdE*dE, axis=1) * factor * 1e50 * u.erg/u.s


class Fornax_2024(Fornax_2021):
def __init__(self, filename, metadata={}):
"""
Parameters
----------
filename : str
Absolute or relative path to HDF5 file with model data.
"""
# Open the requested filename using the model downloader.
datafile = self.request_file(filename)
# Set up model metadata.
self.progenitor = os.path.splitext(os.path.basename(filename))[0].split('_')[2]
self.progenitor_mass = float(re.sub('[A-Za-z]', '', self.progenitor))

self.metadata = metadata

# Open HDF5 data file.
_h5file = h5py.File(datafile, 'r')

self.metadata['PNS mass'] = _h5file.attrs['Mpns'] * u.Msun
self.time = _h5file['nu0'].attrs['time'] * u.s

self.luminosity = {}
self._E = {}
self._dLdE = {}
for flavor in Flavor:
# Convert flavor to key name in the model HDF5 file
key = {Flavor.NU_E: 'nu0',
Flavor.NU_E_BAR: 'nu1',
Flavor.NU_X: 'nu2',
Flavor.NU_X_BAR: 'nu2'}[flavor]

self._E[flavor] = np.asarray(_h5file[key]['egroup'])
self._dLdE[flavor] = {f"g{i}": np.asarray(_h5file[key][f'g{i}']) for i in range(12)}

# Compute luminosity by integrating over model energy bins.
dE = np.asarray(_h5file[key]['degroup'])
n = len(dE[0])
dLdE = np.zeros((len(self.time), n), dtype=float)
for i in range(n):
dLdE[:, i] = self._dLdE[flavor][f"g{i}"]

# Note factor of 0.25 in nu_x and nu_x_bar.
factor = 1. if flavor.is_electron else 0.25
self.luminosity[flavor] = np.sum(dLdE*dE, axis=1) * factor * 1e50 * u.erg/u.s


class Mori_2023(PinchedModel):
def __init__(self, filename, metadata={}):
"""
Expand Down
4 changes: 4 additions & 0 deletions python/snewpy/models/model_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
config:
- &snewpy "https://github.com/SNEWS2/snewpy/raw/v{snewpy_version}/models/{model}/{filename}"
- &ccsn_repository "https://github.com/SNEWS2/snewpy-models-ccsn/raw/v0.3/models/{model}/{filename}"
- &fnx_repository "https://github.com/SNEWS2/snewpy-models-ccsn/raw/fornax-2024-update/models/{model}/{filename}"
- &presn_repository "https://github.com/SNEWS2/snewpy-models-presn/raw/v0.2/models/{model}/{filename}"

models:
Expand All @@ -21,6 +22,9 @@ models:
Fornax_2022:
repository: *ccsn_repository

Fornax_2024:
repository: *fnx_repository

Kuroda_2020:
repository: *ccsn_repository

Expand Down
Loading