Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 13, 2025
1 parent a2323d0 commit b734835
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bench/plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5255,8 +5255,8 @@
"print(\n",
" f\"\"\"\\\n",
"benchmark results\n",
" {data['datetime']}\n",
" {data['machine_info']['cpu']['brand_raw']}\n",
" {data[\"datetime\"]}\n",
" {data[\"machine_info\"][\"cpu\"][\"brand_raw\"]}\n",
"\"\"\"\n",
")\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions doc/notebooks/automatic_differentiation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@
"y = -np.arange(len(times))\n",
"plt.barh(y, x)\n",
"for yi, k, v in zip(y, times, x):\n",
" plt.text(v, yi, f\"{v/xmin:.1f}x\")\n",
" plt.text(v, yi, f\"{v / xmin:.1f}x\")\n",
"plt.yticks(y, times.keys())\n",
"for loc in (\"top\", \"right\"):\n",
" plt.gca().spines[loc].set_visible(False)\n",
Expand Down Expand Up @@ -3886,7 +3886,7 @@
"# check fit quality\n",
"chi2 = m.fval\n",
"ndof = len(data_y) - 3\n",
"plt.title(f\"$\\\\chi^2 / n_\\\\mathrm{{dof}} = {chi2:.2f} / {ndof} = {chi2/ndof:.2f}$\");"
"plt.title(f\"$\\\\chi^2 / n_\\\\mathrm{{dof}} = {chi2:.2f} / {ndof} = {chi2 / ndof:.2f}$\");"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/notebooks/binned_vs_unbinned.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10286,7 +10286,7 @@
"y = [v[2] for v in results.values()]\n",
"plt.plot(x, y, \"o\")\n",
"for xi, yi in zip(x[1:], y[1:]):\n",
" plt.text(xi, yi * 1.2, f\"{y[0]/yi:.0f}x\", ha=\"center\")\n",
" plt.text(xi, yi * 1.2, f\"{y[0] / yi:.0f}x\", ha=\"center\")\n",
"plt.xticks(x, [f\"{x}\" for x in results.keys()])\n",
"plt.ylabel(\"time / sec\")\n",
"plt.semilogy();"
Expand Down
4 changes: 2 additions & 2 deletions doc/notebooks/numba.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2232,7 +2232,7 @@
"source": [
"for signature, code in norm_pdf.inspect_asm().items():\n",
" print(\n",
" f\"signature: {signature}\\n{'-'*(len(str(signature)) + 11)}\\n{code[:1000]}\\n[...]\"\n",
" f\"signature: {signature}\\n{'-' * (len(str(signature)) + 11)}\\n{code[:1000]}\\n[...]\"\n",
" )"
]
},
Expand Down Expand Up @@ -2283,7 +2283,7 @@
"from collections import Counter\n",
"\n",
"for signature, code in norm_pdf.inspect_asm().items():\n",
" print(f\"signature: {signature}\\n{'-'*(len(str(signature)) + 11)}\")\n",
" print(f\"signature: {signature}\\n{'-' * (len(str(signature)) + 11)}\")\n",
" instructions = []\n",
" for line in code.split(\"\\n\"):\n",
" instr = line.strip().split(\"\\t\")[0]\n",
Expand Down
16 changes: 8 additions & 8 deletions doc/notebooks/weighted_histograms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6927,13 +6927,13 @@
" lambd1,\n",
" bins=20,\n",
" alpha=0.5,\n",
" label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1)*100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.2f}\",\n",
" label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1) * 100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.2f}\",\n",
")\n",
"plt.hist(\n",
" lambd2,\n",
" bins=20,\n",
" alpha=0.5,\n",
" label=f\"BinnedNLL\\nvalid={np.mean(valid2)*100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.2f}\",\n",
" label=f\"BinnedNLL\\nvalid={np.mean(valid2) * 100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.2f}\",\n",
")\n",
"plt.legend()\n",
"\n",
Expand Down Expand Up @@ -9187,15 +9187,15 @@
"x = np.linspace(0, 100)\n",
"plt.plot(x, chi2(bins - 2).pdf(x))\n",
"plt.title(\n",
" f\"ExtendedBinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n",
" f\"ExtendedBinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n",
")\n",
"\n",
"plt.sca(ax[1])\n",
"plt.hist(minval2, bins=50, density=True)\n",
"x = np.linspace(0, 100)\n",
"plt.plot(x, chi2(bins - 2).pdf(x))\n",
"plt.title(\n",
" f\"BinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n",
" f\"BinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n",
");"
]
},
Expand Down Expand Up @@ -11951,13 +11951,13 @@
" lambd1,\n",
" bins=20,\n",
" alpha=0.5,\n",
" label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1)*100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.3f}\",\n",
" label=f\"ExtendedBinnedNLL\\nvalid={np.mean(valid1) * 100:.0f}%\\nmean = {np.mean(lambd1):.2f}\\nstd.dev. = {np.std(lambd1):.3f}\",\n",
")\n",
"plt.hist(\n",
" lambd2,\n",
" bins=20,\n",
" alpha=0.5,\n",
" label=f\"BinnedNLL\\nvalid={np.mean(valid2)*100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.3f}\",\n",
" label=f\"BinnedNLL\\nvalid={np.mean(valid2) * 100:.0f}%\\nmean = {np.mean(lambd2):.2f}\\nstd.dev. = {np.std(lambd2):.3f}\",\n",
")\n",
"plt.legend()\n",
"\n",
Expand Down Expand Up @@ -14031,15 +14031,15 @@
"x = np.linspace(0, 100)\n",
"plt.plot(x, chi2(bins - 2).pdf(x))\n",
"plt.title(\n",
" f\"ExtendedBinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n",
" f\"ExtendedBinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval1):.2f} median = {np.median(minval1):.2f}\"\n",
")\n",
"\n",
"plt.sca(ax[1])\n",
"plt.hist(minval2, bins=50, density=True)\n",
"x = np.linspace(0, 100)\n",
"plt.plot(x, chi2(bins - 2).pdf(x))\n",
"plt.title(\n",
" f\"BinnedNLL minimum value\\nndf = {bins-2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n",
" f\"BinnedNLL minimum value\\nndf = {bins - 2} mean = {np.mean(minval2):.2f} median = {np.median(minval2):.2f}\"\n",
");"
]
},
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,7 @@ def cdf(r, mx, my, mz, sx, sy, sz):
with pytest.raises(
ValueError,
match=(
'use_pdf="numerical" is not supported '
"for multidimensional histograms"
'use_pdf="numerical" is not supported for multidimensional histograms'
),
):
BinnedNLL(n, xe, pdf, use_pdf=use_pdf)
Expand Down

0 comments on commit b734835

Please sign in to comment.