From 350e9a3537816653e45528f75cf3cfdc68e66b74 Mon Sep 17 00:00:00 2001 From: Jost Migenda Date: Thu, 15 Aug 2024 18:31:38 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Fischer=5F2020:=20move=20EOS=20and=20Progen?= =?UTF-8?q?itor=20Mass=20into=20metadata=20Since=20there=E2=80=99s=20only?= =?UTF-8?q?=20a=20single=20option=20for=20either,=20those=20shouldn?= =?UTF-8?q?=E2=80=99t=20be=20initialisation=20parameters.=20The=20model=20?= =?UTF-8?q?has=20not=20yet=20appeared=20in=20a=20public=20release,=20so=20?= =?UTF-8?q?this=20doesn=E2=80=99t=20require=20a=20deprecation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/nb/ccsn/Fischer_2020.ipynb | 18 +----------------- python/snewpy/models/ccsn.py | 11 +++++------ 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/doc/nb/ccsn/Fischer_2020.ipynb b/doc/nb/ccsn/Fischer_2020.ipynb index b9f01d8e..16e3b36f 100644 --- a/doc/nb/ccsn/Fischer_2020.ipynb +++ b/doc/nb/ccsn/Fischer_2020.ipynb @@ -36,23 +36,7 @@ "source": [ "## Initialize Models\n", "\n", - "To start, let’s see what progenitors are available for the `Fischer_2020` model. We can use the `param` property to view all physics parameters and their possible values:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "Fischer_2020.param" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In this case, there’s just a single progenitor available; so let’s initialize it. If this is the first time you’re using this progenitor, snewpy will automatically download the required data files for you." + "For the `Fischer_2020` model, there’s just a single progenitor available; so let’s initialize it. If this is the first time you’re using this progenitor, snewpy will automatically download the required data files for you." ] }, { diff --git a/python/snewpy/models/ccsn.py b/python/snewpy/models/ccsn.py index 1d921373..30997718 100644 --- a/python/snewpy/models/ccsn.py +++ b/python/snewpy/models/ccsn.py @@ -44,15 +44,14 @@ class method to get a list of all valid combinations and filter it: from snewpy.models.registry_model import all_models from textwrap import dedent -@legacy_filename_initialization -@RegistryModel( - progenitor_mass= [18 * u.Msun], - eos = ['HS(DD2)'] -) + +@RegistryModel() class Fischer_2020(loaders.Fischer_2020): """Model based on simulations from `Fischer et al. (2020) ` """ - def __init__(self, progenitor_mass:u.Quantity, eos:str): + 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) From c743b689e0c55f031105cb3def91b56da681dcbb Mon Sep 17 00:00:00 2001 From: Jost Migenda Date: Thu, 15 Aug 2024 18:39:51 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Mark=20eos=20parameter=20as=20deprecated=20?= =?UTF-8?q?in=20models=20with=20only=20a=20single=20possible=20value=20Was?= =?UTF-8?q?=20already=20marked=20as=20deprecated=20in=20the=20GarchingArch?= =?UTF-8?q?iveModel=20docstring,=20but=20let=E2=80=99s=20make=20it=20more?= =?UTF-8?q?=20explicit=20here.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/snewpy/models/ccsn.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/snewpy/models/ccsn.py b/python/snewpy/models/ccsn.py index 30997718..3ae5b8d3 100644 --- a/python/snewpy/models/ccsn.py +++ b/python/snewpy/models/ccsn.py @@ -126,6 +126,7 @@ def __init__(self, progenitor_mass:u.Quantity, eos:str): return super().__init__(filename, self.metadata) +@deprecated('eos') @legacy_filename_initialization @RegistryModel( progenitor_mass = [11.2, 20., 27.] * u.Msun, @@ -144,6 +145,8 @@ def __init__(self, *, progenitor_mass:u.Quantity, direction:int): # Metadata is handled by __init__ in _GarchingArchiveModel return super().__init__(filename=filename, metadata=self.metadata) + +@deprecated('eos') @legacy_filename_initialization @RegistryModel( progenitor_mass= [11.2, 27.] * u.Msun, @@ -157,6 +160,8 @@ 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) + +@deprecated('eos') @legacy_filename_initialization @RegistryModel( progenitor_mass = [15.] * u.Msun, @@ -175,6 +180,7 @@ def __init__(self, *, progenitor_mass:u.Quantity, rotation:str, direction:int): return super().__init__(filename=filename, metadata=self.metadata) +@deprecated('eos') @legacy_filename_initialization @RegistryModel( progenitor_mass = [40., 75.] * u.Msun,