Skip to content

Commit

Permalink
feat: Add post-tutorial revisions (#3)
Browse files Browse the repository at this point in the history
* Show upperlimit API
  • Loading branch information
matthewfeickert authored Feb 18, 2021
1 parent 7de82cb commit 97ac434
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions book/HelloWorld.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,26 @@
"print(f\"Upper limit (obs): μ = {np.interp(0.05, observed[::-1], poi_values[::-1]):.4f}\")\n",
"print(f\"Upper limit (exp): μ = {np.interp(0.05, expected[::-1], poi_values[::-1]):.4f}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Alternatively, you can also just use the [`upperlimit` API](https://pyhf.readthedocs.io/en/v0.6.0/_generated/pyhf.infer.intervals.upperlimit.html)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"obs_limit, exp_limits, (scan, results) = pyhf.infer.intervals.upperlimit(\n",
" observations, model, poi_values, level=0.05, return_results=True\n",
")\n",
"print(f\"Upper limit (obs): μ = {obs_limit:.4f}\")\n",
"print(f\"Upper limit (exp): μ = {exp_limits[2]:.4f}\")"
]
}
],
"metadata": {
Expand Down

0 comments on commit 97ac434

Please sign in to comment.