In [1]:
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

from isochrones.dartmouth import Dartmouth_Isochrone
from isochrones.starmodel import BinaryStarModel, StarModel
from isochrones.starmodel import TripleStarModel

dar = Dartmouth_Isochrone()

Example: A known EB KIC 6778289, or WISE J192824.57+421508.1 (http://keplerebs.villanova.edu/overview/?k=6778289)


In [2]:
mags = dict( W1=(11.808,0.022), W2=(11.834,0.021), W3=(11.675,0.170), 
            J=(12.119,0.021), H=(11.913,0.017), K=(11.873,0.019))

mod1 = StarModel(dar, maxAV=0.5, **mags)
mod2 = BinaryStarModel(dar, maxAV=0.5, **mags)
mod3 = TripleStarModel(dar, maxAV=0.5, **mags)

In [13]:
#mod1.fit_mcmc()
#mod2.fit_mcmc()
mod3.fit_mcmc(nburn=200, niter=100, nwalkers=300)


Out[13]:
<emcee.ensemble.EnsembleSampler at 0x7f29c6b45d50>

In [4]:
#mod1.triangle_plots();

In [9]:
mod2.triangle_plots();



In [14]:
mod3.triangle_plots();



In [15]:
plt.plot(mod3.sampler.lnprobability.T);



In [8]:
plt.plot(mod2.sampler.lnprobability.T);



In [10]:
mod2.samples['lnprob'].min()


Out[10]:
-166259.7482004466

In [13]:
inds = np.argsort(mod2.sampler.acceptance_fraction)

In [18]:
mod2.sampler.lnprobability.min(axis=1)[inds]


Out[18]:
array([ -8.82407392e+04,  -3.80914817e+04,  -2.84509079e+04,
        -5.74920544e+00,   2.48844002e+00,  -4.99759081e-01,
         1.82551635e+00,  -1.05312583e+00,   2.05311265e+00,
        -3.59541834e+00,  -1.29806719e+00,   2.84733166e-01,
        -3.25435632e+00,   2.09441203e+00,   2.03775610e+00,
        -2.45976947e+00,  -1.07509071e+00,  -4.17168571e-01,
        -1.88337954e+00,  -1.56804300e+00,  -3.01655869e+00,
        -8.17378870e-01,  -5.82865869e+00,  -3.09716595e+00,
         4.76800743e-01,  -3.35666800e+04,  -8.34352352e-01,
        -5.86074368e+00,  -1.19644760e+00,  -2.65834012e+00,
        -6.95430994e+00,  -1.32971590e+00,  -8.42395423e-01,
        -2.33910163e+00,  -3.64685016e+00,  -3.87966309e+00,
        -3.97066822e+00,  -2.32958083e+00,  -4.82025071e+00,
         2.99573062e-01,   4.43838231e-01,  -1.65061422e-01,
        -9.60913794e-01,  -5.52345414e-01,  -1.66259748e+05,
        -4.22179012e+00,  -2.04048041e+00,  -1.25587009e+00,
        -8.76026356e-01,  -2.73934757e+00,  -2.09980949e+00,
        -2.78484045e+00,  -3.34738543e+00,  -3.87683721e+00,
        -9.22048472e-01,   4.39031078e-02,  -4.41216532e+00,
        -2.26274004e+00,  -1.80040522e-01,  -3.65695186e+00,
        -3.44542121e+00,  -8.43533535e-01,  -3.91907013e+00,
        -1.40878725e+00,  -1.60125370e+00,  -1.07783095e+00,
        -1.55365205e+00,  -2.31953458e+00,  -3.25202385e+00,
        -1.55290718e+00,   7.31498116e-01,  -2.72477875e+00,
        -2.24001065e+00,  -1.01801704e+00,  -2.53578659e+00,
        -3.40010474e+00,  -2.55082684e+00,  -1.74035993e+00,
        -5.71295253e-01,  -2.76214527e+00,  -8.23167448e+00,
        -9.06078541e-01,  -6.61649138e+00,  -1.26829375e+00,
        -1.89726973e-01,  -6.00569075e+00,  -1.47141309e+00,
        -5.55054478e+00,  -1.28466925e+00,  -2.08508320e+00,
        -3.27561928e+00,  -2.91092963e+00,  -7.42691078e+00,
        -1.54383627e+00,  -9.73652120e-01,  -1.83971427e+00,
        -4.44296828e+00,  -2.89204026e+00,  -4.01087642e+00,
        -3.11016513e+00,  -5.06106972e+00,  -1.02212996e+00,
        -8.43029416e-01,  -1.23168517e+00,  -2.31626807e+00,
        -1.52485728e+00,  -3.82011365e+00,  -4.85232966e+00,
        -4.30397571e-02,  -1.28781741e+00,  -1.55482028e+00,
        -6.54938995e+00,  -7.26948323e+00,  -2.09020307e+00,
        -1.27359155e+00,  -3.75016474e+00,  -2.95169070e+00,
        -3.51424407e+00,  -1.59118875e+00,  -5.69433421e-01,
        -7.49260777e+00,  -4.46294446e+00,  -3.00644359e+00,
        -2.20411522e+00,  -4.92137164e+00,  -4.55391443e+00,
        -1.64353829e+00,  -2.33394436e+00,  -1.19504961e+00,
        -1.20949459e+00,  -2.17005754e+00,  -1.77969516e+00,
        -1.72348723e+00,  -4.26385524e+00,  -1.22785512e+00,
        -2.73899987e+00,  -3.98473598e+00,  -2.39433839e+00,
        -5.64669538e-01,  -1.29319439e+00,  -4.91099950e+00,
        -3.09904559e+00,  -4.79775676e-01,  -2.06048989e+00,
        -4.01571585e+00,  -5.25273643e+00,  -3.36500639e+00,
        -4.93302820e+00,  -2.30799630e+00,  -2.14770392e+00,
        -4.33473312e+00,  -2.70753289e+00,  -7.66879632e+00,
        -6.44388058e-01,  -4.31354604e+00,  -5.49188338e+00,
        -2.45742165e+00,  -5.13122824e+00,  -2.36486965e+00,
        -3.16773370e+00,  -2.57336114e+00,  -4.79818794e+00,
        -7.61981880e-01,  -1.56916308e+00,  -2.05150240e+00,
         2.41139526e-02,  -3.51042333e+00,  -6.07272845e+00,
        -5.01743004e+00,  -5.13637654e+00,  -8.05200413e+00,
        -1.34231513e+00,  -3.06602389e+00,  -4.80140283e+00,
         7.29236070e-01,  -2.14219924e+00,  -5.19790010e+00,
        -3.18969223e+00,  -6.11875552e+00,  -4.49610294e+00,
        -6.80635183e+00,  -7.13673401e-01,  -3.02386414e+00,
        -4.31334193e+00,  -8.59090585e+00,  -2.77289838e+00,
        -2.06949971e+00,  -3.26356889e+00,  -4.39696551e+00,
        -2.08893029e+00,  -5.13378304e+00,  -2.17088511e+00,
        -5.22689862e+00,  -2.72890240e+00,  -3.77642953e+00,
         2.74210700e-01,  -3.06951225e+00,  -2.84967812e+00,
        -1.06557993e+01,  -8.05104339e+00])

In [9]:
plt.plot(mod1.sampler.lnprobability.T);


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-763be10e8a32> in <module>()
----> 1 plt.plot(mod1.sampler.lnprobability.T);

/u/tdm/anaconda/lib/python2.7/site-packages/isochrones-0.8.3-py2.7.egg/isochrones/starmodel.pyc in sampler(self)
    640             return self._sampler
    641         else:
--> 642             raise AttributeError('MCMC must be run to access sampler')
    643 
    644     def _make_samples(self):

AttributeError: MCMC must be run to access sampler

In [31]:
np.sort(mod1.sampler.acceptance_fraction)


Out[31]:
array([ 0.   ,  0.   ,  0.01 ,  0.015,  0.03 ,  0.035,  0.07 ,  0.08 ,
        0.08 ,  0.105,  0.12 ,  0.125,  0.125,  0.13 ,  0.135,  0.14 ,
        0.145,  0.15 ,  0.15 ,  0.155,  0.16 ,  0.16 ,  0.165,  0.165,
        0.165,  0.165,  0.165,  0.17 ,  0.17 ,  0.175,  0.18 ,  0.18 ,
        0.18 ,  0.185,  0.185,  0.185,  0.185,  0.185,  0.19 ,  0.19 ,
        0.195,  0.195,  0.195,  0.195,  0.195,  0.2  ,  0.2  ,  0.2  ,
        0.205,  0.205,  0.205,  0.21 ,  0.21 ,  0.21 ,  0.21 ,  0.215,
        0.215,  0.22 ,  0.22 ,  0.22 ,  0.225,  0.225,  0.225,  0.225,
        0.225,  0.225,  0.225,  0.225,  0.23 ,  0.23 ,  0.23 ,  0.23 ,
        0.235,  0.235,  0.235,  0.235,  0.24 ,  0.24 ,  0.24 ,  0.24 ,
        0.24 ,  0.24 ,  0.24 ,  0.24 ,  0.24 ,  0.245,  0.245,  0.25 ,
        0.25 ,  0.25 ,  0.25 ,  0.25 ,  0.25 ,  0.25 ,  0.25 ,  0.255,
        0.255,  0.255,  0.255,  0.255,  0.255,  0.255,  0.255,  0.26 ,
        0.26 ,  0.26 ,  0.26 ,  0.26 ,  0.26 ,  0.26 ,  0.265,  0.265,
        0.265,  0.265,  0.265,  0.265,  0.265,  0.265,  0.27 ,  0.27 ,
        0.27 ,  0.27 ,  0.27 ,  0.27 ,  0.27 ,  0.27 ,  0.27 ,  0.275,
        0.275,  0.275,  0.275,  0.275,  0.275,  0.275,  0.28 ,  0.28 ,
        0.28 ,  0.28 ,  0.28 ,  0.28 ,  0.285,  0.285,  0.285,  0.285,
        0.285,  0.285,  0.285,  0.285,  0.285,  0.285,  0.285,  0.285,
        0.285,  0.285,  0.29 ,  0.29 ,  0.29 ,  0.29 ,  0.29 ,  0.29 ,
        0.29 ,  0.29 ,  0.29 ,  0.29 ,  0.295,  0.295,  0.295,  0.295,
        0.295,  0.295,  0.295,  0.295,  0.295,  0.295,  0.295,  0.295,
        0.295,  0.295,  0.295,  0.3  ,  0.3  ,  0.3  ,  0.3  ,  0.3  ,
        0.3  ,  0.3  ,  0.3  ,  0.3  ,  0.3  ,  0.3  ,  0.3  ,  0.3  ,
        0.3  ,  0.305,  0.305,  0.305,  0.305,  0.305,  0.305,  0.305,
        0.305,  0.305,  0.305,  0.31 ,  0.31 ,  0.31 ,  0.31 ,  0.31 ,
        0.31 ,  0.31 ,  0.31 ,  0.31 ,  0.31 ,  0.31 ,  0.31 ,  0.315,
        0.315,  0.315,  0.315,  0.315,  0.315,  0.315,  0.315,  0.315,
        0.315,  0.315,  0.315,  0.315,  0.315,  0.315,  0.32 ,  0.32 ,
        0.32 ,  0.32 ,  0.32 ,  0.32 ,  0.32 ,  0.32 ,  0.32 ,  0.32 ,
        0.32 ,  0.32 ,  0.32 ,  0.32 ,  0.32 ,  0.325,  0.325,  0.325,
        0.325,  0.325,  0.325,  0.325,  0.325,  0.325,  0.325,  0.325,
        0.325,  0.325,  0.33 ,  0.33 ,  0.33 ,  0.33 ,  0.33 ,  0.33 ,
        0.33 ,  0.33 ,  0.33 ,  0.33 ,  0.33 ,  0.335,  0.335,  0.335,
        0.335,  0.335,  0.335,  0.335,  0.335,  0.335,  0.335,  0.335,
        0.335,  0.34 ,  0.34 ,  0.34 ,  0.34 ,  0.34 ,  0.34 ,  0.34 ,
        0.34 ,  0.34 ,  0.34 ,  0.34 ,  0.34 ,  0.34 ,  0.34 ,  0.34 ,
        0.34 ,  0.34 ,  0.345,  0.345,  0.345,  0.345,  0.345,  0.345,
        0.345,  0.345,  0.345,  0.345,  0.345,  0.345,  0.345,  0.345,
        0.345,  0.345,  0.35 ,  0.35 ,  0.35 ,  0.35 ,  0.35 ,  0.35 ,
        0.355,  0.355,  0.355,  0.355,  0.355,  0.355,  0.355,  0.355,
        0.355,  0.355,  0.355,  0.36 ,  0.36 ,  0.36 ,  0.36 ,  0.36 ,
        0.36 ,  0.36 ,  0.36 ,  0.36 ,  0.365,  0.365,  0.365,  0.365,
        0.365,  0.365,  0.365,  0.365,  0.365,  0.365,  0.365,  0.365,
        0.365,  0.365,  0.365,  0.37 ,  0.37 ,  0.37 ,  0.37 ,  0.37 ,
        0.375,  0.375,  0.375,  0.38 ,  0.38 ,  0.38 ,  0.38 ,  0.38 ,
        0.38 ,  0.38 ,  0.385,  0.385,  0.385,  0.385,  0.39 ,  0.39 ,
        0.39 ,  0.39 ,  0.39 ,  0.39 ,  0.395,  0.395,  0.395,  0.395,
        0.395,  0.395,  0.4  ,  0.4  ,  0.4  ,  0.4  ,  0.405,  0.41 ,
        0.41 ,  0.41 ,  0.415,  0.415,  0.42 ,  0.42 ,  0.425,  0.435])

In [ ]: