|
43 | 43 | "cell_type": "markdown",
|
44 | 44 | "metadata": {},
|
45 | 45 | "source": [
|
46 |
| - "TensorWaves requires you to first formulate a mathematical {class}`.Model` that you want to fit to your data set. When this model is an amplitude model, it is most convenient to construct it with the {mod}`expertsystem`.\n", |
| 46 | + "TensorWaves requires you to first formulate a mathematical {class}`.Model` that you want to fit to your data set. When this model is an amplitude model, it is most convenient to construct it with {mod}`ampform`.\n", |
47 | 47 | "\n",
|
48 |
| - "This notebook briefly illustrates how to create such an amplitude model with the {mod}`expertsystem` and how to write it to a recipe file that can be understood by {mod}`tensorwaves`. For more control, have a look at {doc}`the usage guides of the PWA Expert System <expertsystem:usage>`." |
| 48 | + "This notebook briefly illustrates how to create such an amplitude model with {mod}`ampform` and how to write it to a recipe file that can be understood by {mod}`tensorwaves`. For more control, have a look at {doc}`the usage guides of AmpForm <ampform:usage>`." |
49 | 49 | ]
|
50 | 50 | },
|
51 | 51 | {
|
|
63 | 63 | "---\n",
|
64 | 64 | "class: dropdown\n",
|
65 | 65 | "---\n",
|
66 |
| - "As {doc}`step3` serves to illustrate usage only, we make the amplitude model here a bit simpler by not allowing $\\omega$ resonances (which are narrow and therefore hard to fit). For this reason, we can also limit the {class}`~expertsystem.reaction.default_settings.InteractionTypes` to {attr}`~expertsystem.reaction.default_settings.InteractionTypes.STRONG`.\n", |
| 66 | + "As {doc}`step3` serves to illustrate usage only, we make the amplitude model here a bit simpler by not allowing $\\omega$ resonances (which are narrow and therefore hard to fit). For this reason, we can also limit the {class}`~qrules.default_settings.InteractionTypes` to {attr}`~qrules.default_settings.InteractionTypes.STRONG`.\n", |
67 | 67 | "```"
|
68 | 68 | ]
|
69 | 69 | },
|
|
73 | 73 | "metadata": {},
|
74 | 74 | "outputs": [],
|
75 | 75 | "source": [
|
76 |
| - "import expertsystem as es\n", |
| 76 | + "import qrules as q\n", |
77 | 77 | "\n",
|
78 |
| - "result = es.generate_transitions(\n", |
| 78 | + "result = q.generate_transitions(\n", |
79 | 79 | " initial_state=(\"J/psi(1S)\", [-1, +1]),\n",
|
80 | 80 | " final_state=[\"gamma\", \"pi0\", \"pi0\"],\n",
|
81 | 81 | " allowed_intermediate_particles=[\"f(0)\"],\n",
|
|
87 | 87 | "cell_type": "markdown",
|
88 | 88 | "metadata": {},
|
89 | 89 | "source": [
|
90 |
| - "As a small goodie, you can use [`graphviz`](https://pypi.org/project/graphviz) to {doc}`visualize <expertsystem:usage/visualize>` the generated graphs:" |
| 90 | + "As a small goodie, you can use [`graphviz`](https://pypi.org/project/graphviz) to {doc}`visualize <qrules:usage/visualize>` the generated graphs:" |
91 | 91 | ]
|
92 | 92 | },
|
93 | 93 | {
|
|
98 | 98 | "source": [
|
99 | 99 | "from graphviz import Source\n",
|
100 | 100 | "\n",
|
101 |
| - "dot = es.io.asdot(result, collapse_graphs=True)\n", |
| 101 | + "dot = q.io.asdot(result, collapse_graphs=True)\n", |
102 | 102 | "Source(dot)"
|
103 | 103 | ]
|
104 | 104 | },
|
105 | 105 | {
|
106 | 106 | "cell_type": "markdown",
|
107 | 107 | "metadata": {},
|
108 | 108 | "source": [
|
109 |
| - "Next we convert the {attr}`~expertsystem.reaction.Result.transitions` into an amplitude model (here: {class}`~expertsystem.amplitude.helicity.HelicityModel`). This can be done with {func}`~expertsystem.amplitude.get_builder` and {meth}`~expertsystem.amplitude.helicity.HelicityAmplitudeBuilder.generate`." |
| 109 | + "Next we convert the {attr}`~qrules.transition.Result.transitions` into an amplitude model (here: {class}`~ampform.helicity.HelicityModel`). This can be done with {func}`~ampform.get_builder` and {meth}`~ampform.helicity.HelicityAmplitudeBuilder.generate`." |
110 | 110 | ]
|
111 | 111 | },
|
112 | 112 | {
|
|
115 | 115 | "metadata": {},
|
116 | 116 | "outputs": [],
|
117 | 117 | "source": [
|
118 |
| - "model_builder = es.amplitude.get_builder(result)\n", |
| 118 | + "import ampform\n", |
| 119 | + "\n", |
| 120 | + "model_builder = ampform.get_builder(result)\n", |
119 | 121 | "model = model_builder.generate()\n",
|
120 | 122 | "display(*model.parameter_defaults)"
|
121 | 123 | ]
|
|
128 | 130 | "1. The coefficients for the different amplitudes are **complex** valued.\n",
|
129 | 131 | "2. By default there is no dynamics in the model, so it still has to be specified.\n",
|
130 | 132 | "\n",
|
131 |
| - "We choose to use {func}`~expertsystem.amplitude.dynamics.lineshape.relativistic_breit_wigner_with_ff` as the lineshape for all resonances and use a {class}`~expertsystem.amplitude.dynamics.lineshape.BlattWeisskopf` form factor factor (no dynamics) for the production decay. The {meth}`~expertsystem.amplitude.helicity.HelicityAmplitudeBuilder.set_dynamics` is a convenience interface for replacing the dynamics for intermediate states." |
| 133 | + "We choose to use {func}`~ampform.dynamics.lineshape.relativistic_breit_wigner_with_ff` as the lineshape for all resonances and use a {class}`~ampform.dynamics.lineshape.BlattWeisskopf` form factor factor (no dynamics) for the production decay. The {meth}`~ampform.helicity.HelicityAmplitudeBuilder.set_dynamics` is a convenience interface for replacing the dynamics for intermediate states." |
132 | 134 | ]
|
133 | 135 | },
|
134 | 136 | {
|
|
137 | 139 | "metadata": {},
|
138 | 140 | "outputs": [],
|
139 | 141 | "source": [
|
140 |
| - "from expertsystem.amplitude.dynamics.builder import (\n", |
| 142 | + "from ampform.dynamics.builder import (\n", |
141 | 143 | " create_non_dynamic_with_ff,\n",
|
142 | 144 | " create_relativistic_breit_wigner_with_ff,\n",
|
143 | 145 | ")\n",
|
|
168 | 170 | "cell_type": "markdown",
|
169 | 171 | "metadata": {},
|
170 | 172 | "source": [
|
171 |
| - "Finally, we can write the {class}`~expertsystem.amplitude.helicity.HelicityModel` to disk via {mod}`pickle`, as well as store the {class}`~expertsystem.reaction.Result` as JSON:" |
| 173 | + "Finally, we can write the {class}`~ampform.helicity.HelicityModel` to disk via {mod}`pickle`, as well as store the {class}`~qrules.transition.Result` as JSON:" |
172 | 174 | ]
|
173 | 175 | },
|
174 | 176 | {
|
|
179 | 181 | "source": [
|
180 | 182 | "import pickle\n",
|
181 | 183 | "\n",
|
182 |
| - "es.io.write(result, \"transitions.json\")\n", |
| 184 | + "q.io.write(result, \"transitions.json\")\n", |
183 | 185 | "with open(\"helicity_model.pickle\", \"wb\") as stream:\n",
|
184 | 186 | " pickle.dump(model, stream)"
|
185 | 187 | ]
|
|
188 | 190 | "cell_type": "markdown",
|
189 | 191 | "metadata": {},
|
190 | 192 | "source": [
|
191 |
| - "Cool, that's it! We now have a template for an amplitude model with which to {doc}`generate data <step2>` and {doc}`perform a fit <step3>`. In the next steps, we will use use this {class}`~expertsystem.amplitude.helicity.HelicityModel` as a fit model template for {mod}`tensorwaves`." |
| 193 | + "Cool, that's it! We now have a template for an amplitude model with which to {doc}`generate data <step2>` and {doc}`perform a fit <step3>`. In the next steps, we will use use this {class}`~ampform.helicity.HelicityModel` as a fit model template for {mod}`tensorwaves`." |
192 | 194 | ]
|
193 | 195 | }
|
194 | 196 | ],
|
|
0 commit comments