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

Fix bug with log-determinant in marginal likelihood #87

Merged
merged 10 commits into from
Oct 20, 2019
64 changes: 19 additions & 45 deletions docs/examples/astrometric-orbit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import astropy.coordinates as coord\n",
Expand Down Expand Up @@ -48,9 +46,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"origin = coord.SkyCoord(ra='22 53 16.73352', dec='-14 15 49.3186', \n",
Expand All @@ -63,9 +59,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"m1 = 0.320*u.Msun\n",
Expand Down Expand Up @@ -94,9 +88,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"n_data = 31\n",
Expand All @@ -112,9 +104,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"data = RVData(t=t, rv=rv, stddev=err)\n",
Expand All @@ -133,12 +123,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"params = JokerParams(P_min=8*u.day, P_max=256*u.day, anomaly_tol=1E-11)"
"params = JokerParams(P_min=8*u.day, P_max=256*u.day, \n",
" linear_par_Lambda=np.diag([1e2, 1e2]),\n",
" anomaly_tol=1E-11)"
]
},
{
Expand All @@ -151,9 +141,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
Expand All @@ -173,9 +161,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1, 1, figsize=(8,5)) \n",
Expand All @@ -194,9 +180,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"mean_sample = samples.mean()\n",
Expand All @@ -213,9 +197,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"barycenter_frame = coord.SkyOffsetFrame(origin=barycenter.origin)"
Expand All @@ -224,9 +206,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1, 1, figsize=(5, 5))\n",
Expand Down Expand Up @@ -266,9 +246,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"origin_pm = coord.SkyCoord(ra='22 53 16.73352', dec='-14 15 49.3186', \n",
Expand All @@ -283,9 +261,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1, 1, figsize=(5, 5))\n",
Expand Down Expand Up @@ -313,16 +289,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [default]",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -336,7 +310,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
14 changes: 11 additions & 3 deletions docs/examples/continue-with-emcee.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
"metadata": {},
"outputs": [],
"source": [
"params = JokerParams(P_min=2*u.day, P_max=1024*u.day)\n",
"params = JokerParams(P_min=2*u.day, P_max=1024*u.day,\n",
" linear_par_Lambda=np.diag([1e2, 1e2])**2)\n",
"joker = TheJoker(params)\n",
"joker_samples = joker.rejection_sample(data, n_prior_samples=2**19)"
]
Expand Down Expand Up @@ -262,11 +263,18 @@
"plt.axvline(true_P.value, zorder=100, color='tab:orange')\n",
"plt.xlabel('period, $P$ [day]')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [default]",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -280,7 +288,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
14 changes: 11 additions & 3 deletions docs/examples/custom-prior-sampling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"metadata": {},
"outputs": [],
"source": [
"params = JokerParams(P_min=2*u.day, P_max=1024*u.day)\n",
"params = JokerParams(P_min=2*u.day, P_max=1024*u.day,\n",
" linear_par_Lambda=np.diag([1e2, 1e2]))\n",
"joker = TheJoker(params)"
]
},
Expand Down Expand Up @@ -174,11 +175,18 @@
"source": [
"samples"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [default]",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -192,7 +200,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
Binary file modified docs/examples/mcmc_results.pkl
Binary file not shown.
47 changes: 16 additions & 31 deletions docs/examples/multiproc-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"from astropy.time import Time\n",
Expand Down Expand Up @@ -47,9 +45,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"t0 = Time(2450546.80, format='jd', scale='utc')\n",
Expand Down Expand Up @@ -77,9 +73,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"n_data = 6\n",
Expand All @@ -102,9 +96,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"data = RVData(t=t, rv=rv, stddev=err)\n",
Expand All @@ -121,12 +113,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"params = JokerParams(P_min=8*u.day, P_max=256*u.day, anomaly_tol=1E-11)"
"params = JokerParams(P_min=8*u.day, P_max=256*u.day, \n",
" linear_par_Lambda=np.diag([1e2, 1e2]),\n",
" anomaly_tol=1E-11)"
]
},
{
Expand All @@ -139,15 +131,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"with schwimmbad.MultiPool() as pool:\n",
" joker = TheJoker(params, pool=pool)\n",
" samples = joker.rejection_sample(data, n_prior_samples=2**18)"
" samples = joker.rejection_sample(data, n_prior_samples=2**18)\n",
" print(len(samples))"
]
},
{
Expand All @@ -160,9 +151,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"fig, axes = plt.subplots(1, 2, figsize=(8, 4), sharey=True)\n",
Expand Down Expand Up @@ -198,9 +187,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1, 1, figsize=(8,5)) \n",
Expand All @@ -212,17 +199,15 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -236,7 +221,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
Loading