def fitCon(confile, confchain, names=None, threads=1, set_plot=False, nwalkers=100, nburn=100, nchain=100, mode="test"): """ fit the continuum model. """ if mode == "run": confile = ".".join([confile, "myrun"]) zydata = get_data(confile, names=names) cont = Cont_Model(zydata, "drw") if mode == "test": print(cont([np.log(sigma), np.log(tau)], set_retq=True)) return (None) elif mode == "show": cont.load_chain(confchain) elif mode == "run": confchain = ".".join([confchain, "myrun"]) cont.do_mcmc(nwalkers=nwalkers, nburn=nburn, nchain=nchain, fburn=None, fchain=confchain, threads=1) if set_plot: cont.show_hist(bins=100, figout="mcmc0", figext=figext) return (cont.hpd)
def fitCon(confile, confchain, names=None, threads=1, set_plot=False, nwalkers=100, nburn=50, nchain=50, mode="test") : """ fit the continuum model. """ if mode == "run" : confile = ".".join([confile, "myrun"]) zydata = get_data(confile, names=names) cont = Cont_Model(zydata, "drw") if mode == "test" : print(cont([np.log(2.), np.log(100)], set_retq=True)) return(None) elif mode == "show" : cont.load_chain(confchain) elif mode == "run" : confchain = ".".join([confchain, "myrun"]) cont.do_mcmc(nwalkers=nwalkers, nburn=nburn, nchain=nchain, fburn=None, fchain=confchain, threads=1) if set_plot : cont.show_hist(bins=100, figout="mcmc0", figext=figext) return(cont.hpd)
# JAVELINE # import matplotlib.pyplot as plt from javelin.zylc import get_data from javelin.lcmodel import Cont_Model, Rmap_Model javdata_con = get_data([ "../data/con_test.txt", ], names=[ "con", ]) javdata_rm = get_data(["../data/con_test.txt", "../data/line_test.txt"], names=["con", "line"]) cont = Cont_Model(javdata_con) #cont.do_mcmc(fchain="mychain0.dat",nwalkers=100, nburn=200, nchain=500) cont.load_chain("mychain0.dat") cont.show_hist(bins=100) cont.get_hpd() conthpd = cont.hpd print(conthpd[1, :]) cont_best = cont.do_pred(conthpd[1, :]) x = cont_best.jlist[:] y = cont_best.mlist[:] + cont_best.blist[:] ey = cont_best.elist[:] plt.plot(x[0], y[0] + javdata_con.cont_mean) plt.fill_between(x[0], y[0] - ey[0] + javdata_con.cont_mean, y[0] + ey[0] + javdata_con.cont_mean, where=None, color='grey')
# 22 Nov 2017 17:14:12 from javelin.lcmodel import Cont_Model, Disk_Model from javelin.zylc import get_data import os.path data0 = get_data(["driver.dat",], names=["Driver",]) data0.plot() cont = Cont_Model(data0, "drw") if os.path.isfile("driver_chain.dat"): print ("cont model chain exists") cont.load_chain('driver_chain.dat') cont.show_hist(bins=100) else: cont.do_mcmc(nwalkers=100, nburn=100, nchain=200, fburn=None, fchain="driver_chain.dat", threads=1) conthpd = cont.hpd print conthpd data1 = get_data(["driver.dat", "wave2.dat", "wave3.dat", "wave4.dat"], names=["Driver", "Wave 2", "Wave 3", "Wave 4"]) data1.plot() disk1 = Disk_Model(data1, effwave=[2000., 4000., 5000., 8000.]) if os.path.isfile("thin_disk_chain.dat"): print ("disk model chain exists") disk1.load_chain('thin_disk_chain.dat') disk1.show_hist() else: disk1.do_mcmc(conthpd=conthpd, nwalkers=100, nburn=100, nchain=500, threads=1, fchain="thin_disk_chain.dat", flogp="thin_disk_flogp.dat", fburn="thin_disk_burn.dat")
# 02 Sep 2021 01:56:41 from javelin.lcmodel import Cont_Model, DPmap_Model from javelin.zylc import get_data import os.path data0 = get_data(['Mrk509Gband.txt'], names=[ "G-band", ]) data0.plot(figout='lc_g', figext='pdf') cont = Cont_Model(data0, "drw") if os.path.isfile("cont_chain.dat"): print("cont model chain exists") cont.load_chain('cont_chain.dat') cont.show_hist(figout='mcmc_con', bins=100, figext='pdf') else: cont.do_mcmc(nwalkers=100, nburn=100, nchain=100, fburn=None, fchain="cont_chain.dat", threads=8) conthpd = cont.hpd print conthpd data1 = get_data(["Mrk509Gband_short.txt", "Mrk509Hband_normalized.txt"], names=["G-band", "H-band"]) data1.plot(figout='lc_gh', figext='pdf') # quit() dust = DPmap_Model(data1)