Skip to content

Commit

Permalink
phsp 4-momenta generation via tensorwave
Browse files Browse the repository at this point in the history
  • Loading branch information
shenvitor committed Aug 19, 2024
1 parent c2e5f13 commit ab68d83
Showing 1 changed file with 61 additions and 5 deletions.
66 changes: 61 additions & 5 deletions docs/eta-pi-p/manual.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"mystnb": {
"code_prompt_show": "Import Python libraries"
},
Expand All @@ -55,7 +52,8 @@
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import sympy as sp"
"import sympy as sp\n",
"from tensorwaves.data import TFPhaseSpaceGenerator, TFUniformRealNumberGenerator"
]
},
{
Expand Down Expand Up @@ -251,6 +249,64 @@
"intensity_func"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Phase Space Generation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Mass for $p\\gamma$ system"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"E_lab_gamma = 8.5\n",
"m_proton = 0.938\n",
"m_0 = np.sqrt(2 * E_lab_gamma * m_proton + m_proton**2)\n",
"m_eta = 0.548\n",
"m_pi = 0.135\n",
"m_0"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rng = TFUniformRealNumberGenerator(seed=0)\n",
"phsp_generator = TFPhaseSpaceGenerator(\n",
" initial_state_mass=m_0,\n",
" final_state_masses={1: m_eta, 2: m_pi, 3: m_proton},\n",
")\n",
"phsp_momenta = phsp_generator.generate(100_000, rng)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"pd.DataFrame({\n",
" (k, label): np.transpose(v)[i]\n",
" for k, v in phsp_momenta.items()\n",
" for i, label in enumerate([\"E\", \"px\", \"py\", \"pz\"])\n",
"})"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -401,7 +457,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit ab68d83

Please sign in to comment.