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 Jul 6, 2023
1 parent 7707ea7 commit acc12fc
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions docs/examples/notebooks/learn/details_cls.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"\n",
"\n",
"def gpdf(qq, muprime, sig, mu):\n",
" cut = mu ** 2 / sig ** 2\n",
" cut = mu**2 / sig**2\n",
"\n",
" # 1/√(2π)\n",
" standard_pre = 1 / np.sqrt(2 * np.pi)\n",
"\n",
" # compute the arg of the exponential\n",
" muprime_muhat1_minus_over_sig = (\n",
" qq - (mu ** 2 / sig ** 2 - (2 * mu * muprime / sig ** 2))\n",
" qq - (mu**2 / sig**2 - (2 * mu * muprime / sig**2))\n",
" ) / (2 * mu / sig)\n",
" muprime_muhat2_minus_over_sig = np.sqrt(qq) - (mu - muprime) / sig\n",
"\n",
Expand All @@ -49,14 +49,14 @@
"\n",
"\n",
"def testrail_parab(muhat, mu, sigma):\n",
" return (muhat - mu) ** 2 / sigma ** 2\n",
" return (muhat - mu) ** 2 / sigma**2\n",
"\n",
"\n",
"def testrail_flat(muhat, mu, sigma):\n",
" return np.where(\n",
" muhat < 0,\n",
" (muhat - mu) ** 2 / sigma ** 2 - muhat ** 2 / sigma ** 2,\n",
" np.where(muhat < mu, (muhat - mu) ** 2 / sigma ** 2, 0.0),\n",
" (muhat - mu) ** 2 / sigma**2 - muhat**2 / sigma**2,\n",
" np.where(muhat < mu, (muhat - mu) ** 2 / sigma**2, 0.0),\n",
" )\n",
"\n",
"\n",
Expand Down Expand Up @@ -119,7 +119,7 @@
"mumin, mumax = 1e-2, 1.2\n",
"maxsigma = 4\n",
"\n",
"qqspan = np.linspace(0, maxsigma ** 2, 10001)\n",
"qqspan = np.linspace(0, maxsigma**2, 10001)\n",
"muspan = np.linspace(mumin, mumax, 31)\n",
"muhatspan = np.linspace(muhatmin, muhatmax, 1001)\n",
"test_stats = []\n",
Expand Down Expand Up @@ -150,7 +150,7 @@
" model.config.suggested_bounds(),\n",
" model.config.suggested_fixed(),\n",
" )\n",
" sigma = np.sqrt(mu_test ** 2 / asimov_pllr_ts)\n",
" sigma = np.sqrt(mu_test**2 / asimov_pllr_ts)\n",
"\n",
" tstats = [ds.shift, db.shift, ts]\n",
" pvals = [cl_sb, cl_b, cl_s]\n",
Expand Down Expand Up @@ -405,7 +405,6 @@
" test_stats,\n",
" vals,\n",
"):\n",
"\n",
" mutest_at_index = muspan[index]\n",
" means_at_index = -test_stats[index, [1, 0]]\n",
" ts_at_index = -test_stats[index, 2]\n",
Expand Down Expand Up @@ -433,7 +432,7 @@
" tsrail_parab = testrail_parab(muhatspan, mutest_at_index / sigma, sigma=1)\n",
" tsrail_flat = testrail_flat(muhatspan, mutest_at_index / sigma, sigma=1)\n",
"\n",
" tail_span_qq = np.linspace(obs_pllr_ts, maxsigma ** 2, 1001)\n",
" tail_span_qq = np.linspace(obs_pllr_ts, maxsigma**2, 1001)\n",
"\n",
" empirial_muhat_over_sigma = empirial_muhat / sigma\n",
"\n",
Expand All @@ -451,13 +450,13 @@
"\n",
" ax.plot(muhatspan, tsrail_parab, c='grey', linestyle='dashed')\n",
" ax.plot(muhatspan, tsrail_flat, c='grey')\n",
" ax.vlines(0, 0, maxsigma ** 2, colors='green', linestyles='dashed')\n",
" ax.vlines(means_at_index[1], 0, maxsigma ** 2, colors='red', linestyles='dashed')\n",
" ax.vlines(ts_at_index, 0, maxsigma ** 2, colors='black', linestyles='dashed')\n",
" ax.vlines(0, 0, maxsigma**2, colors='green', linestyles='dashed')\n",
" ax.vlines(means_at_index[1], 0, maxsigma**2, colors='red', linestyles='dashed')\n",
" ax.vlines(ts_at_index, 0, maxsigma**2, colors='black', linestyles='dashed')\n",
" ax.vlines(\n",
" empirial_muhat_over_sigma,\n",
" 0,\n",
" maxsigma ** 2,\n",
" maxsigma**2,\n",
" colors='orange',\n",
" linestyles='dashed',\n",
" )\n",
Expand All @@ -473,7 +472,7 @@
" ax.scatter(ts_at_index, obs_pllr_ts, c='black')\n",
" ax.scatter(mutest_at_index / sigma, 0.0, c='grey')\n",
"\n",
" ax.set_ylim(-1, maxsigma ** 2)\n",
" ax.set_ylim(-1, maxsigma**2)\n",
"\n",
" ax = axarr['B']\n",
" ax.set_xlabel(r'$p(\\tilde{q}_\\mu)$')\n",
Expand All @@ -482,7 +481,7 @@
"\n",
" ax.hist(\n",
" qmu_tilde_b,\n",
" bins=np.linspace(0.0, maxsigma ** 2, 30),\n",
" bins=np.linspace(0.0, maxsigma**2, 30),\n",
" density=True,\n",
" histtype='step',\n",
" edgecolor='green',\n",
Expand All @@ -491,7 +490,7 @@
" )\n",
" ax.hist(\n",
" qmu_tilde_s,\n",
" bins=np.linspace(0.0, maxsigma ** 2, 30),\n",
" bins=np.linspace(0.0, maxsigma**2, 30),\n",
" density=True,\n",
" histtype='step',\n",
" edgecolor='red',\n",
Expand All @@ -512,7 +511,7 @@
" ax.hlines(obs_pllr_ts, 0.0, 10.0, colors='black', linestyles='dashed')\n",
" ax.hlines(asimov_pllr_ts, 0.0, 10.0, colors='green', linestyles='dashed')\n",
" ax.set_xlim(1e-3, 1e1)\n",
" ax.set_ylim(-1, maxsigma ** 2)\n",
" ax.set_ylim(-1, maxsigma**2)\n",
"\n",
" ax = axarr['F']\n",
"\n",
Expand Down

0 comments on commit acc12fc

Please sign in to comment.