Skip to content

Commit

Permalink
FIX: filter with \\beta instead of Dummy
Browse files Browse the repository at this point in the history
* DOC: reorganize plotting code
  • Loading branch information
redeboer committed May 23, 2024
1 parent 76fe5d1 commit c658bd1
Showing 1 changed file with 142 additions and 171 deletions.
313 changes: 142 additions & 171 deletions docs/report/031.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -788,10 +788,10 @@
")\n",
"phsp_momenta = phsp_generator.generate(500_000, rng)\n",
"\n",
"epsilon = 1e-8\n",
"ε = 1e-8\n",
"transformer = SympyDataTransformer.from_sympy(model.kinematic_variables, backend=\"jax\")\n",
"phsp = transformer(phsp_momenta)\n",
"phsp = {k: v + epsilon * 1j if re.match(r\"^m_\\d\\d$\", k) else v for k, v in phsp.items()}"
"phsp = {k: v + ε * 1j if re.match(r\"^m_\\d\\d$\", k) else v for k, v in phsp.items()}"
]
},
{
Expand Down Expand Up @@ -1022,7 +1022,7 @@
"tags": []
},
"source": [
"### Phase"
"### Argand plots"
]
},
{
Expand All @@ -1033,9 +1033,9 @@
},
"outputs": [],
"source": [
"epsilon = 1e-8\n",
"ε = 1e-8\n",
"x = np.linspace(2, 5, num=400)\n",
"plot_data = {\"m_01\": np.sqrt(x + epsilon * 1j)}"
"plot_data = {\"m_01\": np.sqrt(x) + ε * 1j}"
]
},
{
Expand All @@ -1046,16 +1046,16 @@
},
"outputs": [],
"source": [
"total_phase_bw = np.angle(dynamics_func_bw(plot_data))\n",
"sub_phase_bw = {\n",
" p: np.angle(\n",
" compute_sub_intensity(\n",
" dynamics_func_bw,\n",
" plot_data,\n",
" resonances=[p.latex],\n",
" coupling_pattern=r\"Dummy_\",\n",
" )\n",
" )\n",
"total_dynamics_bw = dynamics_func_bw(plot_data)\n",
"sub_dynamics_bw = {\n",
" p: compute_sub_intensity(dynamics_func_bw, plot_data, resonances=[p.latex])\n",
" for symbol, resonances in create_dynamics_symbol.collected_symbols.items()\n",
" for p, _ in resonances\n",
"}\n",
"total_dynamics_fvector = dynamics_func_fvector(plot_data)\n",
"sub_dynamics_fvector = {\n",
" p: compute_sub_intensity(dynamics_func_fvector, plot_data, resonances=[p.latex])\n",
" for symbol, resonances in create_dynamics_symbol.collected_symbols.items()\n",
" for p, _ in resonances\n",
"}"
]
Expand All @@ -1068,18 +1068,134 @@
},
"outputs": [],
"source": [
"total_phase_fvector = np.angle(dynamics_func_fvector(plot_data))\n",
"sub_phase_fvector = {\n",
" p: np.angle(\n",
" compute_sub_intensity(\n",
" dynamics_func_fvector,\n",
" plot_data,\n",
" resonances=[p.latex],\n",
" coupling_pattern=r\"\\\\beta\",\n",
" )\n",
"x1 = np.linspace(2.0, (m_res1**2 + m_res2**2) / 2, num=500)\n",
"x2 = np.linspace((m_res1**2 + m_res2**2) / 2, 5.0, num=500)\n",
"plot_data1 = {\"m_01\": np.sqrt(x1) + ε * 1j}\n",
"plot_data2 = {\"m_01\": np.sqrt(x2) + ε * 1j}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input",
"scroll-input"
]
},
"outputs": [],
"source": [
"y1 = dynamics_func_fvector(plot_data1)\n",
"y2 = dynamics_func_fvector(plot_data2)\n",
"\n",
"fig, axes = plt.subplots(1, 2, figsize=(10, 5))\n",
"ax1, ax2 = axes\n",
"for ax in axes:\n",
" ax.axhline(0, color=\"black\", linewidth=0.5)\n",
" ax.axvline(0, color=\"black\", linewidth=0.5)\n",
"\n",
"colors = [\"red\", \"blue\"]\n",
"for i, (k, v) in enumerate(sub_dynamics_fvector.items()):\n",
" ax2.plot(\n",
" v.real,\n",
" v.imag,\n",
" color=colors[i % len(colors)],\n",
" label=f\"Resonance at {k.mass} GeV $F$-vector\",\n",
" )\n",
" for p, _ in resonances\n",
"}"
"\n",
"ax1.plot(\n",
" y1.real,\n",
" y1.imag,\n",
" label=Rf\"$\\text{{Im}}\\,F(s)$ in domain of {m_res1}-GeV resonance \",\n",
" color=\"red\",\n",
")\n",
"ax1.plot(\n",
" y2.real,\n",
" y2.imag,\n",
" label=Rf\"$\\text{{Im}}\\,F(s)$ in domain of {m_res2}-GeV resonance \",\n",
" color=\"blue\",\n",
")\n",
"ax1.set_xlabel(R\"$\\text{Re}\\,F$\", fontsize=14)\n",
"ax1.set_ylabel(R\"$\\text{Im}\\,F$\", fontsize=14)\n",
"fig.tight_layout()\n",
"ax1.legend(loc=\"upper left\")\n",
"fig.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input",
"scroll-input"
]
},
"outputs": [],
"source": [
"y1 = dynamics_func_bw(plot_data1)\n",
"y2 = dynamics_func_bw(plot_data2)\n",
"\n",
"fig, axes = plt.subplots(1, 2, figsize=(10, 5))\n",
"fig.suptitle(\"Breit-Wigner\")\n",
"ax1, ax2 = axes\n",
"for ax in axes:\n",
" ax.axhline(0, color=\"black\", linewidth=0.5)\n",
" ax.axvline(0, color=\"black\", linewidth=0.5)\n",
"\n",
"colors = [\"red\", \"blue\"]\n",
"for i, (k, v) in enumerate(sub_dynamics_bw.items()):\n",
" ax2.plot(\n",
" v.real,\n",
" v.imag,\n",
" color=colors[i % len(colors)],\n",
" label=f\"Resonance at {k.mass} GeV $F$-vector\",\n",
" )\n",
"\n",
"ax1.plot(\n",
" y1.real,\n",
" y1.imag,\n",
" label=Rf\"$\\text{{Im}}\\,F(s)$ in domain of {m_res1}-GeV resonance \",\n",
" color=\"red\",\n",
")\n",
"ax1.plot(\n",
" y2.real,\n",
" y2.imag,\n",
" label=Rf\"$\\text{{Im}}\\,F(s)$ in domain of {m_res2}-GeV resonance \",\n",
" color=\"blue\",\n",
")\n",
"ax1.set_xlabel(r\"$Re(F)$\", fontsize=14)\n",
"ax1.set_ylabel(r\"$Im(F)$\", fontsize=14)\n",
"plt.tight_layout()\n",
"ax1.legend(loc=\"upper left\")\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Phase"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"total_phase_bw = np.angle(total_dynamics_bw)\n",
"total_phase_fvector = np.angle(total_dynamics_fvector)\n",
"sub_phase_bw = {p: np.angle(v) for p, v in sub_dynamics_bw.items()}\n",
"sub_phase_fvector = {p: np.angle(v) for p, v in sub_dynamics_fvector.items()}"
]
},
{
Expand Down Expand Up @@ -1162,101 +1278,6 @@
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"### Dynamics"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"total_dynamics_bw = dynamics_func_fvector(plot_data)\n",
"sub_dynamics_bw = {\n",
" p: compute_sub_intensity(\n",
" dynamics_func_bw,\n",
" plot_data,\n",
" resonances=[p.latex],\n",
" coupling_pattern=r\"Dummy_\",\n",
" )\n",
" for p, _ in resonances\n",
"}\n",
"total_dynamics_fvector = dynamics_func_fvector(plot_data)\n",
"sub_dynamics_fvector = {\n",
" p: compute_sub_intensity(\n",
" dynamics_func_fvector,\n",
" plot_data,\n",
" resonances=[p.latex],\n",
" coupling_pattern=r\"\\\\beta\",\n",
" )\n",
" for p, _ in resonances\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input",
"scroll-input"
]
},
"outputs": [],
"source": [
"x1 = np.linspace(2.0, (m_res1**2 + m_res2**2) / 2, num=500)\n",
"x2 = np.linspace((m_res1**2 + m_res2**2) / 2, 5.0, num=500)\n",
"\n",
"plot_data1 = {\"m_01\": np.sqrt(x1 + epsilon * 1j)}\n",
"plot_data2 = {\"m_01\": np.sqrt(x2 + epsilon * 1j)}\n",
"\n",
"y1 = dynamics_func_fvector(plot_data1).imag\n",
"y2 = dynamics_func_fvector(plot_data2).imag\n",
"fig, axes = plt.subplots(1, 2, figsize=(10, 5))\n",
"colors = [\"red\", \"blue\"]\n",
"ax1, ax2 = axes\n",
"for i, (k, v) in enumerate(sub_dynamics_fvector.items()):\n",
" ax2.plot(\n",
" v.real,\n",
" v.imag,\n",
" color=colors[i % len(colors)],\n",
" label=f\"Resonance at {k.mass} GeV $F$-vector\",\n",
" )\n",
"\n",
"ax1.plot(\n",
" y1.real,\n",
" y1.imag,\n",
" label=rf\"$Im(F)$ $s$ in domain of {{{m_res1}}} [GeV] resonance \",\n",
" color=\"red\",\n",
")\n",
"ax1.plot(\n",
" y2.real,\n",
" y2.imag,\n",
" label=rf\"$Im(F)$ $s$ in domain of {{{m_res2}}} [GeV] resonance \",\n",
" color=\"blue\",\n",
")\n",
"ax1.set_xlabel(r\"$Re(F)$\", fontsize=14)\n",
"ax1.set_ylabel(r\"$Im(F)$\", fontsize=14)\n",
"ax1.axhline(0, color=\"black\")\n",
"ax1.axvline(0, color=\"black\")\n",
"ax2.axhline(0, color=\"black\")\n",
"ax2.axvline(0, color=\"black\")\n",
"fig.tight_layout()\n",
"ax1.legend(loc=\"upper left\")\n",
"fig.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1330,56 +1351,6 @@
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": [
"hide-input",
"scroll-input"
]
},
"outputs": [],
"source": [
"y1_bw = dynamics_func_bw(plot_data1)\n",
"y2_bw = dynamics_func_bw(plot_data2)\n",
"fig, axes = plt.subplots(1, 2, figsize=(10, 5))\n",
"colors = [\"red\", \"blue\"]\n",
"ax1, ax2 = axes\n",
"for i, (k, v) in enumerate(sub_dynamics_bw.items()):\n",
" ax2.plot(\n",
" v.real,\n",
" v.imag,\n",
" color=colors[i % len(colors)],\n",
" label=f\"Resonance at {k.mass} GeV $F$-vector\",\n",
" )\n",
"\n",
"ax1.plot(\n",
" y1_bw.real,\n",
" y1_bw.imag,\n",
" label=rf\"$Im(F)$ $s$ in domain of {m_res1}-GeV resonance \",\n",
" color=\"red\",\n",
")\n",
"ax1.plot(\n",
" y2_bw.real,\n",
" y2_bw.imag,\n",
" label=rf\"$Im(F)$ $s$ in domain of {m_res2}-GeV resonance \",\n",
" color=\"blue\",\n",
")\n",
"ax1.set_xlabel(r\"$Re(F)$\", fontsize=14)\n",
"ax1.set_ylabel(r\"$Im(F)$\", fontsize=14)\n",
"ax1.axhline(0, color=\"black\")\n",
"ax1.axvline(0, color=\"black\")\n",
"ax2.axhline(0, color=\"black\")\n",
"ax2.axvline(0, color=\"black\")\n",
"plt.tight_layout()\n",
"ax1.legend(loc=\"upper left\")\n",
"fig.show()"
]
}
],
"metadata": {
Expand Down

0 comments on commit c658bd1

Please sign in to comment.