Skip to content

Commit 673d1f3

Browse files
authored
refactor: remove physics module (#299)
* fix: rename test_interfaces.py
1 parent 71a2ac9 commit 673d1f3

File tree

4 files changed

+24
-102
lines changed

4 files changed

+24
-102
lines changed

docs/usage/step3.ipynb

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@
627627
"cell_type": "markdown",
628628
"metadata": {},
629629
"source": [
630-
"Just like in {ref}`usage/step2:2.2 Generate intensity-based sample`, these _intensity components_ can each be expressed in a computational backend. This can be done with the helper function {func}`.create_intensity_component`. After that we, update the parameters with the optimized parameter values we found in {ref}`usage/step3:Perform fit`. The two components in the example below should be the same:"
630+
"Just like in {ref}`usage/step2:2.2 Generate intensity-based sample`, these _intensity components_ can each be expressed in a computational backend. This can be done with the method {meth}`~ampform.helicity.HelicityModel.sum_components` from the original model and creating a new {class}`.LambdifiedFunction` from that expression. After that we, update the parameters with the optimized parameter values we found in {ref}`usage/step3:Perform fit`. The two components in the example below should be the same:"
631631
]
632632
},
633633
{
@@ -636,17 +636,20 @@
636636
"metadata": {},
637637
"outputs": [],
638638
"source": [
639-
"from tensorwaves.physics import create_intensity_component\n",
640-
"\n",
641-
"from_amplitudes = create_intensity_component(\n",
642-
" model,\n",
639+
"added_components = model.sum_components(\n",
643640
" components=[\n",
644641
" R\"A_{J/\\psi(1S)_{+1} \\to f_{0}(500)_{0} \\gamma_{+1}; f_{0}(500)_{0} \\to \\pi^{0}_{0} \\pi^{0}_{0}}\",\n",
645642
" R\"A_{J/\\psi(1S)_{+1} \\to f_{0}(980)_{0} \\gamma_{+1}; f_{0}(980)_{0} \\to \\pi^{0}_{0} \\pi^{0}_{0}}\",\n",
646643
" R\"A_{J/\\psi(1S)_{+1} \\to f_{0}(1370)_{0} \\gamma_{+1}; f_{0}(1370)_{0} \\to \\pi^{0}_{0} \\pi^{0}_{0}}\",\n",
647644
" R\"A_{J/\\psi(1S)_{+1} \\to f_{0}(1500)_{0} \\gamma_{+1}; f_{0}(1500)_{0} \\to \\pi^{0}_{0} \\pi^{0}_{0}}\",\n",
648645
" R\"A_{J/\\psi(1S)_{+1} \\to f_{0}(1710)_{0} \\gamma_{+1}; f_{0}(1710)_{0} \\to \\pi^{0}_{0} \\pi^{0}_{0}}\",\n",
649-
" ],\n",
646+
" ]\n",
647+
")\n",
648+
"from_amplitudes = LambdifiedFunction(\n",
649+
" model=SympyModel(\n",
650+
" expression=added_components,\n",
651+
" parameters=model.parameter_defaults,\n",
652+
" ),\n",
650653
" backend=\"numpy\",\n",
651654
")\n",
652655
"from_amplitudes.update_parameters(latest_parameters)"
@@ -658,9 +661,14 @@
658661
"metadata": {},
659662
"outputs": [],
660663
"source": [
661-
"from_intensity = create_intensity_component(\n",
662-
" model,\n",
663-
" components=R\"I_{J/\\psi(1S)_{+1} \\to \\gamma_{+1} \\pi^{0}_{0} \\pi^{0}_{0}}\",\n",
664+
"added_components = model.sum_components(\n",
665+
" components=[R\"I_{J/\\psi(1S)_{+1} \\to \\gamma_{+1} \\pi^{0}_{0} \\pi^{0}_{0}}\"]\n",
666+
")\n",
667+
"from_intensity = LambdifiedFunction(\n",
668+
" model=SympyModel(\n",
669+
" expression=added_components,\n",
670+
" parameters=model.parameter_defaults,\n",
671+
" ),\n",
664672
" backend=\"numpy\",\n",
665673
")\n",
666674
"from_intensity.update_parameters(latest_parameters)"
@@ -747,7 +755,13 @@
747755
"logging.basicConfig()\n",
748756
"logging.getLogger().setLevel(logging.ERROR)\n",
749757
"intensity_components = [\n",
750-
" create_intensity_component(model, c, backend=\"numpy\")\n",
758+
" LambdifiedFunction(\n",
759+
" SympyModel(\n",
760+
" expression=model.sum_components([c]),\n",
761+
" parameters=model.parameter_defaults,\n",
762+
" ),\n",
763+
" backend=\"numpy\",\n",
764+
" )\n",
751765
" for c in model.components\n",
752766
" if c.startswith(\"I\")\n",
753767
"]\n",

src/tensorwaves/physics.py

Lines changed: 0 additions & 54 deletions
This file was deleted.
File renamed without changes.

tests/test_physics.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)