Skip to content

Commit

Permalink
FEAT: update analysis results with LS-model (#262)
Browse files Browse the repository at this point in the history
* FIX: insert reference to LHCb-PAPER-2022-002
* FIX: make LaTeX commands suitable for copying to GitHub
  • Loading branch information
mmikhasenko authored Nov 25, 2022
1 parent 1f2f840 commit 6fe17f4
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 45 deletions.
2 changes: 1 addition & 1 deletion docs/cross-check.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
"def is_ls_model(model_id: int | str) -> bool:\n",
" if isinstance(model_id, int):\n",
" return model_id == 17\n",
" return \"LS coupling\" in model_id\n",
" return \"LS couplings\" in model_id\n",
"\n",
"\n",
"def get_amplitude_crosscheck_data(model_id: int | str) -> dict[str, complex]:\n",
Expand Down
21 changes: 6 additions & 15 deletions docs/resonance-polarimetry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@
" desc=\"Formulate models\",\n",
" disable=NO_TQDM,\n",
" ):\n",
" if \"LS couplings\" in title:\n",
" continue\n",
" builder = load_model_builder(MODEL_FILE, PARTICLES, title)\n",
" imported_parameters = load_model_parameters(\n",
" MODEL_FILE, builder.decay, title, PARTICLES\n",
Expand Down Expand Up @@ -484,11 +482,10 @@
" stat_array = 1e3 * STAT_WEIGHTED_ALPHA_Z[resonance.name]\n",
" syst_array = 1e3 * SYST_WEIGHTED_ALPHA_Z[resonance.name]\n",
" syst_diff = syst_array[1:] - syst_array[0]\n",
" syst_diff_no_ls = syst_diff[:17]\n",
" value = syst_array[0]\n",
" std = stat_array.std()\n",
" min_ = syst_diff_no_ls.min() # LS-model excluded\n",
" max_ = syst_diff_no_ls.max() # LS-model excluded\n",
" min_ = syst_diff.min() # LS-model excluded\n",
" max_ = syst_diff.max() # LS-model excluded\n",
" src += Rf\"{value:>+.0f} \\pm {std:.0f}_{{{min_:+.0f}}}^{{{max_:+.0f}}}\"\n",
" src += \" & \"\n",
" lhcb = lhcb_values.get(resonance.name)\n",
Expand All @@ -497,11 +494,9 @@
" src += Rf\"{val:+.0f} \\pm {stat:.0f} \\pm {syst:.0f}\"\n",
" for model_id, diff in enumerate(syst_diff, 1):\n",
" diff_str = f\"{diff:>+.0f}\"\n",
" if model_id == 17: # LS-coupling\n",
" src += Rf\" & \\color{{gray}}{{{diff_str}}}\"\n",
" elif diff == syst_diff_no_ls.max():\n",
" if diff == syst_diff.max():\n",
" src += Rf\" & \\color{{red}}{{{diff_str}}}\"\n",
" elif diff == syst_diff_no_ls.min():\n",
" elif diff == syst_diff.min():\n",
" src += Rf\" & \\color{{blue}}{{{diff_str}}}\"\n",
" else:\n",
" src += f\" & {diff_str}\"\n",
Expand Down Expand Up @@ -633,8 +628,7 @@
"def format_average(resonance: str) -> str:\n",
" stat_alpha = 1e3 * STAT_WEIGHTED_ALPHA_Z[resonance]\n",
" syst_alpha = 1e3 * SYST_WEIGHTED_ALPHA_Z[resonance]\n",
" syst_alpha_no_ls = syst_alpha[:17]\n",
" diff = syst_alpha_no_ls[1:] - syst_alpha[0]\n",
" diff = syst_alpha[1:] - syst_alpha[0]\n",
" mean = syst_alpha[0]\n",
" std = stat_alpha.std()\n",
" return f\"{diff.max():+.0f}<br><b>{mean:+.0f}</b>±{std:.0f}<br>{diff.min():+.0f}\"\n",
Expand Down Expand Up @@ -828,10 +822,7 @@
"\n",
"%config InlineBackend.figure_formats = ['svg']\n",
"plot_correlation_xz_mpl(STAT_WEIGHTED_ALPHA_REF1, \"Statistics\")\n",
"plot_correlation_xz_mpl(\n",
" {k: v[:17] for k, v in SYST_WEIGHTED_ALPHA_REF1.items()},\n",
" typ=\"Systematics\",\n",
")"
"plot_correlation_xz_mpl(SYST_WEIGHTED_ALPHA_REF1, \"Systematics\")"
]
},
{
Expand Down
53 changes: 28 additions & 25 deletions docs/uncertainties.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
"reference_subsystem = 1\n",
"with open(model_file) as f:\n",
" model_titles = list(yaml.safe_load(f))\n",
"model_titles.remove(\"Alternative amplitude model obtained using LS couplings\")\n",
"\n",
"models = {}\n",
"for title in tqdm(model_titles, desc=\"Formulating models\", disable=NO_TQDM):\n",
Expand Down Expand Up @@ -1471,23 +1470,24 @@
"np.testing.assert_almost_equal(\n",
" np.array(syst_decay_rates[\"L(1405)\"]),\n",
" [\n",
" 0.07778927,\n",
" 0.0777893,\n",
" 0.0788526,\n",
" 0.07636913,\n",
" 0.07770757,\n",
" 0.07449582,\n",
" 0.06787325,\n",
" 0.10786051,\n",
" 0.05249633,\n",
" 0.07123184,\n",
" 0.06196443,\n",
" 0.07350879,\n",
" 0.07771139,\n",
" 0.05810789,\n",
" 0.07665854,\n",
" 0.07734982,\n",
" 0.07596459,\n",
" 0.07842413,\n",
" 0.0763691,\n",
" 0.0777076,\n",
" 0.0744958,\n",
" 0.0678732,\n",
" 0.1078605,\n",
" 0.0524963,\n",
" 0.0712318,\n",
" 0.0619644,\n",
" 0.0735088,\n",
" 0.0777114,\n",
" 0.0581079,\n",
" 0.0766585,\n",
" 0.0773498,\n",
" 0.0759646,\n",
" 0.0784241,\n",
" 0.070247,\n",
" ],\n",
")"
]
Expand Down Expand Up @@ -1703,25 +1703,26 @@
" )\n",
"\n",
"\n",
"src = R\"\\begin{array}{ccr}\"\n",
"src = R\"\"\"\n",
"\\begin{array}{ccr}\n",
"\"\"\"\n",
"for i in range(3):\n",
" value_with_uncertainties = render_cartesian_uncertainties(\n",
" value = render_cartesian_uncertainties(\n",
" nominal_weighted_alpha[i],\n",
" stat_weighted_alpha_std[i],\n",
" syst_weighted_alpha_min[i],\n",
" syst_weighted_alpha_max[i],\n",
" )\n",
" src += Rf\"\\overline{{\\alpha_{'xyz'[i]}}} & = & {value_with_uncertainties} \\\\\"\n",
" src += Rf\" \\overline{{\\alpha_{'xyz'[i]}}} & = & {value} \\\\\" \"\\n\"\n",
"\n",
"value_with_uncertainties = render_cartesian_uncertainties(\n",
"value = render_cartesian_uncertainties(\n",
" nominal_weighted_alpha_norm,\n",
" stat_weighted_alpha_norm.std(),\n",
" syst_weighted_alpha_norm_diff.min(),\n",
" syst_weighted_alpha_norm_diff.max(),\n",
" plus=False,\n",
")\n",
"src += Rf\"\\overline{{\\left|\\alpha\\right|}} & = & {value_with_uncertainties} \\\\\"\n",
"\n",
"src += Rf\" \\overline{{\\left|\\alpha\\right|}} & = & {value} \\\\\"\n",
"src += R\"\\end{array}\"\n",
"Latex(src)"
]
Expand Down Expand Up @@ -1768,7 +1769,9 @@
" )\n",
"\n",
"\n",
"src = R\"\\begin{array}{ccl}\"\n",
"src = R\"\"\"\n",
"\\begin{array}{ccl}\n",
"\"\"\"\n",
"labels = [\n",
" R\"\\left|\\overline{\\alpha}\\right|\",\n",
" R\"\\theta\\left(\\overline{\\alpha}\\right)\",\n",
Expand All @@ -1784,7 +1787,7 @@
" syst_weighted_alpha_polar_min[i],\n",
" syst_weighted_alpha_polar_max[i],\n",
" )\n",
" src += Rf\"{label} & = & {value_with_uncertainties} \\\\\"\n",
" src += Rf\" {label} & = & {value_with_uncertainties} \\\\\" \"\\n\"\n",
"\n",
"src += R\"\\end{array}\"\n",
"Latex(src)"
Expand Down
8 changes: 4 additions & 4 deletions docs/zz.polarization-fit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
"\n",
"SYST_FIT_RESULTS_FIELD = [\n",
" perform_field_fit(PHSP, i)\n",
" for i in tqdm(range(17), desc=\"Performing fits\", disable=NO_TQDM)\n",
" for i in tqdm(range(18), desc=\"Performing fits\", disable=NO_TQDM)\n",
"]"
]
},
Expand Down Expand Up @@ -445,7 +445,7 @@
"tags": []
},
"source": [
"This is to be compared with the model uncertainties reported by [^1]:\n",
"This is to be compared with the model uncertainties reported by {cite}`LHCb-PAPER-2022-002`:\n",
"\n",
"$$\n",
"\\begin{array}{ccc}\n",
Expand Down Expand Up @@ -549,8 +549,8 @@
"\n",
"SYST_AVERAGED_POLARIMETERS = get_averaged_polarimeters()\n",
"SYST_POLAR_POLARIMETERS = get_averaged_polarimeters(polar=True)\n",
"assert SYST_AVERAGED_POLARIMETERS.shape == (17, 3)\n",
"assert SYST_POLAR_POLARIMETERS.shape == (17, 3)\n",
"assert SYST_AVERAGED_POLARIMETERS.shape == (18, 3)\n",
"assert SYST_POLAR_POLARIMETERS.shape == (18, 3)\n",
"\n",
"diff_rate = compute_differential_decay_rate(*P, SYST_AVERAGED_POLARIMETERS[0], PHSP)\n",
"assert diff_rate.shape == (N_EVENTS,)\n",
Expand Down

0 comments on commit 6fe17f4

Please sign in to comment.