%pylab inline from isochrones import dartmouth import isochrones.starmodel as sm import numpy as np dar = dartmouth.Dartmouth_Isochrone() mass,age,feh = (1,9.7,0.0) dar(mass,age,feh) ages = np.linspace(9,9.8,200) radii1 = dar.radius(1,ages,0.0) radii2 = dar.radius(1,ages,0.2) radii3 = dar.radius(1,ages,-0.2) plot(ages,radii1,label='feh=0.0') plot(ages,radii2,label='feh=0.2') plot(ages,radii3,label='feh=-0.2') xlabel('log(age)'); ylabel('radius') legend(loc='upper left') ev = dar.evtrack(1.0,dage=0.01) plot((ev['Teff']),ev['logL'],'.') xlabel('Teff') ylabel('logL'); mod = sm.StarModel(dar,Teff=(5770,50),logg=(4.44,0.10),feh=(0.0,0.1)) mod.maxlike() mod.fit_mcmc() mod.plot_samples('radius') mod.plot_samples('mass') mod.plot_samples('age') reload(dartmouth.iso); reload(dartmouth); reload(sm) mags = {'H': (8.4459999999999997,0.08), 'J': (8.7710000000000008,0.08), 'K': (8.3699999999999992,0.08), 'g':(10.33,0.08), 'r':(9.83,0.08)} specprops = dict(Teff=(5626,64),logg=(4.47,0.07),feh=(-.16,0.1)) #smod = sm.StarModel(dar,**mags) smod = sm.StarModel(dar,**specprops) #smod.add_props(**specprops) pars = smod.maxlike() smod.fit_mcmc() smod.plot_samples('radius') smod.plot_samples('mass') #smod.plot_samples('feh') #smod.plot_samples('distance') #smod.plot_samples('AV') mod = StarModel(dar,Teff=(5626,64),logg=(4.47,0.07),feh=(-.16,0.1)) mod.fit_mcmc() mod.plot_samples('radius') mod.plot_samples('mass') reload(dartmouth.iso); reload(dartmouth); reload(sm) smod.properties sm.salpeter_prior(1) from keputils import koiutils as ku ku.KICmags(1) reload(sm) smod = sm.StarModel(dar, Teff=(5783,64),logg=(4.36,0.07),feh=(-0.06,0.10)) smod.maxlike(100) smod.fit_mcmc() smod.plot_samples('radius') smod.plot_samples('mass') from simpledist import distributions as dists mdist = dists.Hist_Distribution(smod.prop_samples('mass',return_values=False), bins=50,name='mass') rdist = dists.Hist_Distribution(smod.prop_samples('radius',return_values=False), bins=50,name='radius') mdist.save_hdf?? mdist.plot() rdist.plot() smod.plot_samples('Teff') smod.plot_samples('AV') from keputils import kicutils as kicu smod.sampler.__dict__ smod.sampler.naccepted/300. smod.sampler.chain.shape import numpy.random as rand wokinds = np.where(smod.sampler.naccepted/smod.sampler.iterations > 0.15)[0] print len(wokinds) inds = rand.randint(len(wokinds),size=200) hist(smod.sampler.chain[wokinds[inds],:,:].mean(axis=1)[:,0]) smod.fit_mcmc?? dists.Hist_Distribution?