Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Set track_progress=True by default #66

Merged
merged 9 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/deploy-jupyter-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
run: |
python -m pip list

- name: Set track_progress=False for notebooks
run: |
grep --files-with-matches --recursive "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g'
matthewfeickert marked this conversation as resolved.
Show resolved Hide resolved

- name: Build the book
run: |
jupyter-book build book/
Expand Down
13 changes: 2 additions & 11 deletions book/Toys.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@
"So the question is, does the asymptotic approximation hold in this example? The standard assumption is that you have enough \"statistics\" (meaning enough events) to use the large-N approximation. So let's use the toy-based calculator instead and compute the same values as above and see if they match in the asymptotic case (we certainly hope they mostly do here!)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{note}\n",
"For readability in the Jupyter Book the `hypotest` has `track_progress=False`. If you're running this notebook yourself you might want to set `track_progress=True` to enable the progress bar.\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -87,7 +78,7 @@
" return_expected_set=True,\n",
" calctype=\"toybased\",\n",
" ntoys=1_000,\n",
" track_progress=False,\n",
" track_progress=True,\n",
")\n",
"print(f\" Observed CLs: {CLs_obs:.4f}\")\n",
"for expected_value, n_sigma in zip(CLs_exp, np.arange(-2, 3)):\n",
Expand Down Expand Up @@ -168,7 +159,7 @@
" return_expected_set=True,\n",
" calctype=\"toybased\",\n",
" ntoys=5_000,\n",
" track_progress=False,\n",
" track_progress=True,\n",
")\n",
"print(f\" Observed CLs: {CLs_obs:.4f}\")\n",
"for expected_value, n_sigma in zip(CLs_exp, np.arange(-2, 3)):\n",
Expand Down
11 changes: 1 addition & 10 deletions book/UsingCalculators.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -224,23 +224,14 @@
"Let's create a toy-based calculator and \"throw\" 500 toys."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{note}\n",
"For readability in the Jupyter Book the `ToyCalculator` has `track_progress=False`. If you're running this notebook yourself you might want to set `track_progress=True` to enable the progress bar.\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"toy_calc = pyhf.infer.calculators.ToyCalculator(\n",
" data, model, test_stat=\"qtilde\", ntoys=500, track_progress=False\n",
" data, model, test_stat=\"qtilde\", ntoys=500, track_progress=True\n",
")"
]
},
Expand Down
Loading