|
627 | 627 | "cell_type": "markdown", |
628 | 628 | "metadata": {}, |
629 | 629 | "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:" |
631 | 631 | ] |
632 | 632 | }, |
633 | 633 | { |
|
636 | 636 | "metadata": {}, |
637 | 637 | "outputs": [], |
638 | 638 | "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", |
643 | 640 | " components=[\n", |
644 | 641 | " 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", |
645 | 642 | " 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", |
646 | 643 | " 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", |
647 | 644 | " 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", |
648 | 645 | " 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", |
650 | 653 | " backend=\"numpy\",\n", |
651 | 654 | ")\n", |
652 | 655 | "from_amplitudes.update_parameters(latest_parameters)" |
|
658 | 661 | "metadata": {}, |
659 | 662 | "outputs": [], |
660 | 663 | "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", |
664 | 672 | " backend=\"numpy\",\n", |
665 | 673 | ")\n", |
666 | 674 | "from_intensity.update_parameters(latest_parameters)" |
|
747 | 755 | "logging.basicConfig()\n", |
748 | 756 | "logging.getLogger().setLevel(logging.ERROR)\n", |
749 | 757 | "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", |
751 | 765 | " for c in model.components\n", |
752 | 766 | " if c.startswith(\"I\")\n", |
753 | 767 | "]\n", |
|
0 commit comments