Skip to content

Commit d752f15

Browse files
fix: Use correct model for low stats demonstration (#64)
* Use the correct model (`model_low`) for demonstration of the difference between the asymptotics based and toy based calculators. - Amends PR #1 * Use 5000 pseudo-experiments to demonstrate the difference more effectively. * Use underscores in numeric literals (5_000) for better readability. - c.f. https://peps.python.org/pep-0515/
1 parent d45792c commit d752f15

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

book/Toys.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
" test_stat=\"qtilde\",\n",
8787
" return_expected_set=True,\n",
8888
" calctype=\"toybased\",\n",
89-
" ntoys=1000,\n",
89+
" ntoys=1_000,\n",
9090
" track_progress=False,\n",
9191
")\n",
9292
"print(f\" Observed CLs: {CLs_obs:.4f}\")\n",
@@ -136,8 +136,8 @@
136136
"source": [
137137
"CLs_obs, CLs_exp = pyhf.infer.hypotest(\n",
138138
" 1.0, # null hypothesis\n",
139-
" [5.0, 7.0] + model.config.auxdata,\n",
140-
" model,\n",
139+
" [5.0, 7.0] + model_low.config.auxdata,\n",
140+
" model_low,\n",
141141
" test_stat=\"qtilde\",\n",
142142
" return_expected_set=True,\n",
143143
" calctype=\"asymptotics\",\n",
@@ -151,7 +151,7 @@
151151
"cell_type": "markdown",
152152
"metadata": {},
153153
"source": [
154-
"And now throwing 2000 toys:"
154+
"And now throwing 5000 toys:"
155155
]
156156
},
157157
{
@@ -162,12 +162,12 @@
162162
"source": [
163163
"CLs_obs, CLs_exp = pyhf.infer.hypotest(\n",
164164
" 1.0, # null hypothesis\n",
165-
" [5.0, 7.0] + model.config.auxdata,\n",
166-
" model,\n",
165+
" [5.0, 7.0] + model_low.config.auxdata,\n",
166+
" model_low,\n",
167167
" test_stat=\"qtilde\",\n",
168168
" return_expected_set=True,\n",
169169
" calctype=\"toybased\",\n",
170-
" ntoys=1000,\n",
170+
" ntoys=5_000,\n",
171171
" track_progress=False,\n",
172172
")\n",
173173
"print(f\" Observed CLs: {CLs_obs:.4f}\")\n",
@@ -185,7 +185,7 @@
185185
],
186186
"metadata": {
187187
"kernelspec": {
188-
"display_name": "Python 3",
188+
"display_name": "Python 3 (ipykernel)",
189189
"language": "python",
190190
"name": "python3"
191191
},
@@ -199,7 +199,7 @@
199199
"name": "python",
200200
"nbconvert_exporter": "python",
201201
"pygments_lexer": "ipython3",
202-
"version": "3.8.7"
202+
"version": "3.10.4"
203203
}
204204
},
205205
"nbformat": 4,

0 commit comments

Comments
 (0)