From 35b96b1c0abd9a861a33f80a7bf9d4ca46844f0f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 21 Aug 2023 02:03:03 -0500 Subject: [PATCH 1/9] chore: Set track_progress=True by default --- book/Toys.ipynb | 4 ++-- book/UsingCalculators.ipynb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/book/Toys.ipynb b/book/Toys.ipynb index bba90cc..99193d6 100644 --- a/book/Toys.ipynb +++ b/book/Toys.ipynb @@ -87,7 +87,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", @@ -168,7 +168,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", diff --git a/book/UsingCalculators.ipynb b/book/UsingCalculators.ipynb index 9dd266d..750ed43 100644 --- a/book/UsingCalculators.ipynb +++ b/book/UsingCalculators.ipynb @@ -240,7 +240,7 @@ "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", ")" ] }, From fb54957c74eb3d511265de5b215aef09ee4d5802 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 21 Aug 2023 02:06:25 -0500 Subject: [PATCH 2/9] Set track_progress to False in CI --- .github/workflows/deploy-jupyter-book.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/deploy-jupyter-book.yml b/.github/workflows/deploy-jupyter-book.yml index c5a74a7..5691ace 100644 --- a/.github/workflows/deploy-jupyter-book.yml +++ b/.github/workflows/deploy-jupyter-book.yml @@ -35,6 +35,10 @@ jobs: run: | python -m pip list + - name: Set track_progress=False for notebooks + run: | + git grep --name-only "track_progress=True" | xargs sed -i 's/track_progress=True/track_progress=False/g' + - name: Build the book run: | jupyter-book build book/ From 71d59b2350192b2989fedee681a34d887d592c1f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 21 Aug 2023 02:08:15 -0500 Subject: [PATCH 3/9] Use full option name --- .github/workflows/deploy-jupyter-book.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-jupyter-book.yml b/.github/workflows/deploy-jupyter-book.yml index 5691ace..8b46c40 100644 --- a/.github/workflows/deploy-jupyter-book.yml +++ b/.github/workflows/deploy-jupyter-book.yml @@ -37,7 +37,7 @@ jobs: - name: Set track_progress=False for notebooks run: | - git grep --name-only "track_progress=True" | xargs sed -i 's/track_progress=True/track_progress=False/g' + git grep --name-only "track_progress=True" | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - name: Build the book run: | From 26457517a84dbb7746ca634b4062c8dd77593430 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 21 Aug 2023 02:13:03 -0500 Subject: [PATCH 4/9] Try using grep and not git grep --- .github/workflows/deploy-jupyter-book.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-jupyter-book.yml b/.github/workflows/deploy-jupyter-book.yml index 8b46c40..40590ee 100644 --- a/.github/workflows/deploy-jupyter-book.yml +++ b/.github/workflows/deploy-jupyter-book.yml @@ -37,7 +37,8 @@ jobs: - name: Set track_progress=False for notebooks run: | - git grep --name-only "track_progress=True" | xargs sed --in-place 's/track_progress=True/track_progress=False/g' + # git grep --name-only "track_progress=True" | xargs sed --in-place 's/track_progress=True/track_progress=False/g' + grep --files-with-matches --recursive "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - name: Build the book run: | From fd44a3b563a68b0953a33cc806209b6f84f6b86e Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 22 Aug 2023 00:54:32 -0500 Subject: [PATCH 5/9] Remove note on setting track_progress=True --- book/Toys.ipynb | 9 --------- book/UsingCalculators.ipynb | 9 --------- 2 files changed, 18 deletions(-) diff --git a/book/Toys.ipynb b/book/Toys.ipynb index 99193d6..8ed4bc6 100644 --- a/book/Toys.ipynb +++ b/book/Toys.ipynb @@ -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, diff --git a/book/UsingCalculators.ipynb b/book/UsingCalculators.ipynb index 750ed43..a35aae0 100644 --- a/book/UsingCalculators.ipynb +++ b/book/UsingCalculators.ipynb @@ -224,15 +224,6 @@ "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, From d715209137e78c1d40c4adcb656ad5b931bbd445 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 22 Aug 2023 02:16:08 -0500 Subject: [PATCH 6/9] Just list for debug --- .github/workflows/deploy-jupyter-book.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-jupyter-book.yml b/.github/workflows/deploy-jupyter-book.yml index 40590ee..798478b 100644 --- a/.github/workflows/deploy-jupyter-book.yml +++ b/.github/workflows/deploy-jupyter-book.yml @@ -38,7 +38,9 @@ jobs: - name: Set track_progress=False for notebooks run: | # git grep --name-only "track_progress=True" | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - grep --files-with-matches --recursive "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' + # grep --files-with-matches --recursive "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' + # DEBUG: Just list + grep --files-with-matches --recursive "track_progress=True" book - name: Build the book run: | From b8876f81380f5db371d646036347b1e02682c497 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 22 Aug 2023 08:06:38 -0500 Subject: [PATCH 7/9] Revert "Just list for debug" This reverts commit 11ce691b624bc582adffb76aba82d0d872c3e0a0. --- .github/workflows/deploy-jupyter-book.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deploy-jupyter-book.yml b/.github/workflows/deploy-jupyter-book.yml index 798478b..40590ee 100644 --- a/.github/workflows/deploy-jupyter-book.yml +++ b/.github/workflows/deploy-jupyter-book.yml @@ -38,9 +38,7 @@ jobs: - name: Set track_progress=False for notebooks run: | # git grep --name-only "track_progress=True" | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - # grep --files-with-matches --recursive "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - # DEBUG: Just list - grep --files-with-matches --recursive "track_progress=True" book + grep --files-with-matches --recursive "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - name: Build the book run: | From 4da709141025367b1a7745e0850656bf27951ce2 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 25 Aug 2023 11:28:30 +0100 Subject: [PATCH 8/9] remove git grep attempt --- .github/workflows/deploy-jupyter-book.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-jupyter-book.yml b/.github/workflows/deploy-jupyter-book.yml index 40590ee..59a5de8 100644 --- a/.github/workflows/deploy-jupyter-book.yml +++ b/.github/workflows/deploy-jupyter-book.yml @@ -37,7 +37,6 @@ jobs: - name: Set track_progress=False for notebooks run: | - # git grep --name-only "track_progress=True" | xargs sed --in-place 's/track_progress=True/track_progress=False/g' grep --files-with-matches --recursive "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - name: Build the book From 8f51383d9163dee3391de573af94a5b775557b62 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 25 Aug 2023 05:45:38 -0500 Subject: [PATCH 9/9] Use git grep with guard Guard against 'fatal: detected dubious ownership in repository' --- .github/workflows/deploy-jupyter-book.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-jupyter-book.yml b/.github/workflows/deploy-jupyter-book.yml index 59a5de8..f72315b 100644 --- a/.github/workflows/deploy-jupyter-book.yml +++ b/.github/workflows/deploy-jupyter-book.yml @@ -37,7 +37,8 @@ jobs: - 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' + git config --global --add safe.directory /__w/pyhf-tutorial/pyhf-tutorial + git grep --name-only "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g' - name: Build the book run: |