Skip to content

Commit

Permalink
Remove warning filters when running PyMC sampling in Getting Started …
Browse files Browse the repository at this point in the history
…tutorial
  • Loading branch information
vandalt committed Nov 2, 2023
1 parent 06d182e commit 525ed6c
Showing 1 changed file with 38 additions and 44 deletions.
82 changes: 38 additions & 44 deletions docs/tutorials/first.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -340,50 +340,44 @@
"metadata": {},
"outputs": [],
"source": [
"import warnings\n",
"\n",
"with warnings.catch_warnings():\n",
" warnings.filterwarnings(\"ignore\", category=UserWarning)\n",
" warnings.filterwarnings(\"ignore\", category=RuntimeWarning)\n",
"\n",
" import pymc as pm\n",
" from celerite2.pymc import GaussianProcess, terms as pm_terms\n",
"\n",
" with pm.Model() as model:\n",
" mean = pm.Normal(\"mean\", mu=0.0, sigma=prior_sigma)\n",
" log_jitter = pm.Normal(\"log_jitter\", mu=0.0, sigma=prior_sigma)\n",
"\n",
" log_sigma1 = pm.Normal(\"log_sigma1\", mu=0.0, sigma=prior_sigma)\n",
" log_rho1 = pm.Normal(\"log_rho1\", mu=0.0, sigma=prior_sigma)\n",
" log_tau = pm.Normal(\"log_tau\", mu=0.0, sigma=prior_sigma)\n",
" term1 = pm_terms.SHOTerm(\n",
" sigma=pm.math.exp(log_sigma1),\n",
" rho=pm.math.exp(log_rho1),\n",
" tau=pm.math.exp(log_tau),\n",
" )\n",
"\n",
" log_sigma2 = pm.Normal(\"log_sigma2\", mu=0.0, sigma=prior_sigma)\n",
" log_rho2 = pm.Normal(\"log_rho2\", mu=0.0, sigma=prior_sigma)\n",
" term2 = pm_terms.SHOTerm(\n",
" sigma=pm.math.exp(log_sigma2), rho=pm.math.exp(log_rho2), Q=0.25\n",
" )\n",
"\n",
" kernel = term1 + term2\n",
" gp = GaussianProcess(kernel, mean=mean)\n",
" gp.compute(t, diag=yerr**2 + pm.math.exp(log_jitter), quiet=True)\n",
" gp.marginal(\"obs\", observed=y)\n",
"\n",
" pm.Deterministic(\"psd\", kernel.get_psd(omega))\n",
"\n",
" trace = pm.sample(\n",
" tune=1000,\n",
" draws=1000,\n",
" target_accept=0.9,\n",
" init=\"adapt_full\",\n",
" cores=2,\n",
" chains=2,\n",
" random_seed=34923,\n",
" )"
"import pymc as pm\n",
"from celerite2.pymc import GaussianProcess, terms as pm_terms\n",
"\n",
"with pm.Model() as model:\n",
" mean = pm.Normal(\"mean\", mu=0.0, sigma=prior_sigma)\n",
" log_jitter = pm.Normal(\"log_jitter\", mu=0.0, sigma=prior_sigma)\n",
"\n",
" log_sigma1 = pm.Normal(\"log_sigma1\", mu=0.0, sigma=prior_sigma)\n",
" log_rho1 = pm.Normal(\"log_rho1\", mu=0.0, sigma=prior_sigma)\n",
" log_tau = pm.Normal(\"log_tau\", mu=0.0, sigma=prior_sigma)\n",
" term1 = pm_terms.SHOTerm(\n",
" sigma=pm.math.exp(log_sigma1),\n",
" rho=pm.math.exp(log_rho1),\n",
" tau=pm.math.exp(log_tau),\n",
" )\n",
"\n",
" log_sigma2 = pm.Normal(\"log_sigma2\", mu=0.0, sigma=prior_sigma)\n",
" log_rho2 = pm.Normal(\"log_rho2\", mu=0.0, sigma=prior_sigma)\n",
" term2 = pm_terms.SHOTerm(\n",
" sigma=pm.math.exp(log_sigma2), rho=pm.math.exp(log_rho2), Q=0.25\n",
" )\n",
"\n",
" kernel = term1 + term2\n",
" gp = GaussianProcess(kernel, mean=mean)\n",
" gp.compute(t, diag=yerr**2 + pm.math.exp(log_jitter), quiet=True)\n",
" gp.marginal(\"obs\", observed=y)\n",
"\n",
" pm.Deterministic(\"psd\", kernel.get_psd(omega))\n",
"\n",
" trace = pm.sample(\n",
" tune=1000,\n",
" draws=1000,\n",
" target_accept=0.9,\n",
" init=\"adapt_full\",\n",
" cores=2,\n",
" chains=2,\n",
" random_seed=34923,\n",
" )"
]
},
{
Expand Down

0 comments on commit 525ed6c

Please sign in to comment.