Skip to content

Commit

Permalink
DOC: render average polarimeter angles as radians (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer authored Jan 11, 2023
1 parent 8e3bf0a commit 227ffe6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions docs/uncertainties.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,14 @@
},
"outputs": [],
"source": [
"def render_radian_angle_uncertainties(value, stat, syst_min, syst_max) -> str:\n",
" val = f\"{value:+.2f}\"\n",
" stat = f\"{stat:.2f}\"\n",
" syst_min = f\"-{abs(syst_min):.2f}\"\n",
" syst_max = f\"+{abs(syst_max):.2f}\"\n",
" return Rf\"{val} \\pm {stat}_{{{syst_min}}}^{{{syst_max}}}\\;\\mathrm{{rad}}\"\n",
"\n",
"\n",
"def render_angle_uncertainties(value, stat, syst_min, syst_max) -> str:\n",
" value /= np.pi\n",
" stat /= np.pi\n",
Expand All @@ -1790,15 +1798,19 @@
"]\n",
"for i, label in enumerate(labels):\n",
" renderer = (\n",
" render_cartesian_uncertainties if i == 0 else render_angle_uncertainties\n",
" render_cartesian_uncertainties\n",
" if i == 0\n",
" else render_radian_angle_uncertainties\n",
" )\n",
" value_with_uncertainties = renderer(\n",
" args = (\n",
" nominal_weighted_alpha_polar[i],\n",
" stat_weighted_alpha_polar_std[i],\n",
" syst_weighted_alpha_polar_min[i],\n",
" syst_weighted_alpha_polar_max[i],\n",
" )\n",
" src += Rf\" {label} & = & {value_with_uncertainties} \\\\\" \"\\n\"\n",
" src += Rf\" {label} & = & {renderer(*args)} \\\\\" \"\\n\"\n",
" if i > 0:\n",
" src += Rf\" & = & {render_angle_uncertainties(*args)} \\\\\" \"\\n\"\n",
"\n",
"src += R\"\\end{array}\"\n",
"Latex(src)"
Expand Down

0 comments on commit 227ffe6

Please sign in to comment.