diff --git a/.vscode/settings.json b/.vscode/settings.json index abbfca7a..e0db188a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -65,10 +65,10 @@ "telemetry.enableCrashReporter": false, "telemetry.enableTelemetry": false, "yaml.schemas": { - "https://raw.githubusercontent.com/ComPWA/expertsystem/master/expertsystem/schemas/yaml/amplitude-model.json": [ + "https://raw.githubusercontent.com/ComPWA/expertsystem/0.6.4/src/expertsystem/schemas/yaml/amplitude-model.json": [ "*recipe.y*ml" ], - "https://raw.githubusercontent.com/ComPWA/expertsystem/master/expertsystem/schemas/yaml/particle-list.json": [ + "https://raw.githubusercontent.com/ComPWA/expertsystem/0.6.4/src/expertsystem/schemas/yaml/particle-list.json": [ "*particle.y*ml" ] } diff --git a/docs/conf.py b/docs/conf.py index 6aef4a71..93d5aa08 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -135,7 +135,7 @@ # Intersphinx settings intersphinx_mapping = { "expertsystem": ( - "https://pwa.readthedocs.io/projects/expertsystem/en/0.6.3", + "https://pwa.readthedocs.io/projects/expertsystem/en/0.6.4", None, ), "iminuit": ("https://iminuit.readthedocs.io/en/latest", None), diff --git a/docs/install.md b/docs/install.md index 6f9a17a1..557bb10b 100644 --- a/docs/install.md +++ b/docs/install.md @@ -33,7 +33,7 @@ This goes as follows: 3. Install the project in {ref}`'editable installation' ` with - {ref}`additional dependencies ` for the + {ref}`additional dependencies ` for the developer: ```shell diff --git a/docs/usage/1_create_model.ipynb b/docs/usage/1_create_model.ipynb index 07ee212e..83e62786 100644 --- a/docs/usage/1_create_model.ipynb +++ b/docs/usage/1_create_model.ipynb @@ -92,6 +92,24 @@ "list(model.parameters)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Note that we have to specify the dynamics for the resonances. We choose to use {class}`~expertsystem.amplitude.model.RelativisticBreitWigner` for all resonances:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for name in result.get_intermediate_particles().names:\n", + " model.dynamics.set_breit_wigner(name)\n", + "{name: type(dyn) for name, dyn in model.dynamics.items()}" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/docs/usage/3_perform_fit.ipynb b/docs/usage/3_perform_fit.ipynb index 2e9a5691..011c0d9f 100644 --- a/docs/usage/3_perform_fit.ipynb +++ b/docs/usage/3_perform_fit.ipynb @@ -140,9 +140,9 @@ "initial_parameters = {\n", " \"Phase_J/psi(1S)_to_f(0)(1500)_0+gamma_1;f(0)(1500)_to_pi0_0+pi0_0;\": 0.0,\n", " \"Width_f(0)(500)\": 0.1,\n", - " \"Mass_f(0)(980)\": 0.9,\n", - " \"Mass_f(0)(1500)\": 1.55,\n", - " \"Mass_f(0)(1710)\": 1.8,\n", + " \"Position_f(0)(980)\": 0.9,\n", + " \"Position_f(0)(1500)\": 1.55,\n", + " \"Position_f(0)(1710)\": 1.8,\n", " \"Width_f(0)(1710)\": 0.3,\n", "}" ] diff --git a/examples/intensity-recipe.yaml b/examples/intensity-recipe.yaml index 700c5511..9d1b2fce 100644 --- a/examples/intensity-recipe.yaml +++ b/examples/intensity-recipe.yaml @@ -61,6 +61,16 @@ Parameters: - Name: &par16 Phase_J/psi_to_f0(1500)_0+gamma_-1;f(0)(1500)_to_pi0_0+pi0_0; Type: Phase Value: 0.0 + - Name: &par17 MesonRadius_J/psi + Value: 1.0 + - Name: &par18 MesonRadius_f(0)(980) + Value: 1.0 + - Name: &par19 MesonRadius_f(2)(1270) + Value: 1.0 + - Name: &par20 MesonRadius_f(0)(1500) + Value: 1.0 + - Name: &par21 MesonRadius_f(2)(1950) + Value: 1.0 Intensity: Class: NormalizedIntensity @@ -1165,28 +1175,28 @@ Dynamics: Type: NonDynamic FormFactor: Type: BlattWeisskopf - MesonRadius: 1.0 + MesonRadius: *par17 f(0)(980): Type: RelativisticBreitWigner FormFactor: Type: BlattWeisskopf - MesonRadius: 1.0 + MesonRadius: *par18 f(2)(1270): Type: RelativisticBreitWigner FormFactor: Type: BlattWeisskopf - MesonRadius: 1.0 + MesonRadius: *par19 f(0)(1500): Type: RelativisticBreitWigner FormFactor: Type: BlattWeisskopf - MesonRadius: 1.0 + MesonRadius: *par20 f(2)(1950): Type: RelativisticBreitWigner FormFactor: Type: BlattWeisskopf - MesonRadius: 1.0 + MesonRadius: *par21 diff --git a/setup.cfg b/setup.cfg index d5555989..9cd94693 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,7 +42,7 @@ setup_requires = setuptools_scm install_requires = amplitf==0.0.1a2 - expertsystem==0.6.3 + expertsystem==0.6.4 iminuit==1.4.5 numpy==1.18.0 pandas==1.0.5 @@ -114,7 +114,7 @@ tox = tox==3.20.1 tools = jupyterlab==2.2.9 - jupyterlab_code_formatter==1.3.6 + jupyterlab_code_formatter==1.3.8 labels==20.1.0 dev = %(doc)s diff --git a/src/tensorwaves/physics/helicity_formalism/amplitude.py b/src/tensorwaves/physics/helicity_formalism/amplitude.py index ecd2f90f..e43e3ce0 100644 --- a/src/tensorwaves/physics/helicity_formalism/amplitude.py +++ b/src/tensorwaves/physics/helicity_formalism/amplitude.py @@ -155,9 +155,6 @@ def create_dynamics( """Create a dynamics function callable.""" if self._dynamics is None: raise ValueError("Dynamics has not yet been set") - - if decaying_state.name not in self._dynamics: - self._dynamics.set_breit_wigner(decaying_state.name) decay_dynamics = self._dynamics[decaying_state.name] kwargs = {} @@ -615,7 +612,7 @@ def _create_dynamics( DynamicsProperties( orbit_angular_momentum=orbit_angular_momentum, resonance_mass=builder.register_parameter( - f"Mass_{particle.name}", + f"Position_{particle.name}", particle.mass, ), resonance_width=builder.register_parameter( diff --git a/tests/conftest.py b/tests/conftest.py index 51b42331..6e81d593 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,4 +34,7 @@ def __create_model(formalism: str) -> AmplitudeModel: allowed_interaction_types=["EM", "strong"], number_of_threads=1, ) - return es.generate_amplitudes(result) + model = es.generate_amplitudes(result) + for name in result.get_intermediate_particles().names: + model.dynamics.set_breit_wigner(name) + return model diff --git a/tests/recipe/test_amplitude_creation.py b/tests/recipe/test_amplitude_creation.py index 1c423f39..adb82df7 100644 --- a/tests/recipe/test_amplitude_creation.py +++ b/tests/recipe/test_amplitude_creation.py @@ -33,7 +33,17 @@ def test_helicity(helicity_model: es.AmplitudeModel): builder = IntensityBuilder(model.particles, kinematics, phsp_sample) intensity = builder.create_intensity(model) - assert len(intensity.parameters) == 9 + assert set(intensity.parameters) == { + "strength_incoherent", + "Position_J/psi(1S)", + "Width_J/psi(1S)", + "MesonRadius_J/psi(1S)", + "Magnitude_J/psi(1S)_to_f(0)(980)_0+gamma_1;f(0)(980)_to_pi0_0+pi0_0;", + "Phase_J/psi(1S)_to_f(0)(980)_0+gamma_1;f(0)(980)_to_pi0_0+pi0_0;", + "Position_f(0)(980)", + "Width_f(0)(980)", + "MesonRadius_f(0)(980)", + } def test_canonical(canonical_model: es.AmplitudeModel): @@ -43,4 +53,14 @@ def test_canonical(canonical_model: es.AmplitudeModel): phsp_sample = _generate_phsp(model, NUMBER_OF_PHSP_EVENTS) builder = IntensityBuilder(particles, kinematics, phsp_sample) intensity = builder.create_intensity(model) - assert len(intensity.parameters) == 9 + assert set(intensity.parameters) == { + "strength_incoherent", + "Position_J/psi(1S)", + "Width_J/psi(1S)", + "MesonRadius_J/psi(1S)", + "Magnitude_J/psi(1S)_to_f(0)(980)_0+gamma_1;f(0)(980)_to_pi0_0+pi0_0;", + "Phase_J/psi(1S)_to_f(0)(980)_0+gamma_1;f(0)(980)_to_pi0_0+pi0_0;", + "Position_f(0)(980)", + "Width_f(0)(980)", + "MesonRadius_f(0)(980)", + }