from fileread import readFile import matplotlib.pyplot as plt from juliantime import juliandate import numpy as np (v1,v2,v3,tdet)=readFile('2015BLG019.txt','2015-02-16T10:05:22') print('======================') t = v1.tolist() m = v2.tolist() print('t0 = '+str(t[m.index(max(m))])) print('peak flux = '+str(max(m))) print('======================') plt.figure() plt.plot(v1-tdet,v2,'k.') plt.title('Light Curve for MOA 2015-BLG019') plt.xlabel('$\Delta t$') #plt.xlim((-80,30)) plt.ylabel('$\Delta F$') plt.show()
from mcmc import MCMC from fileread import readFile import numpy as np import matplotlib.pyplot as plt from progressbar import ProgressBar Nfinal = 70 Npoints = 8 Nrun = np.linspace(0,Nfinal,Npoints) Nr = [int(round(ii))+5 for ii in Nrun] (v1,v2,v3,tdet,s3,Ca0,Cte,t0_actual) = readFile('2015BLG004.txt') Cdt = t0_actual - tdet ba = [] bte = [] bdt = [] mla = [] mlte = [] mldt = [] pbar = ProgressBar() for ii in pbar(Nr): (tdet,ma0,mte,mdt,a0ml,teml,dtml) = MCMC(v1,v2,v3,tdet,s3,Ca0,Cte,t0_actual,ii) ba.append(ma0) bte.append(mte) bdt.append(mdt) mla.append(a0ml) mlte.append(teml) mldt.append(dtml)
a0 = np.exp(2) te = 0.04*np.exp(6) ib = 18 dt = 0.0202*np.exp(6) start = time.time() #Prior distribution parameters: #--------------------------------------------------- DT = [5.558,1.8226] A0 = [0.4023,0.591,0.0124] TE = [0.8284,6.0709,1.4283,0.1716,13.7152,1.3578] IB = [0.1782,7.4511,3.1355,0.6704,18.89,2.0186,0.1514,28.0466,1.5002] #Loading data for event: #--------------------------------------------------- (v1,v2,v3,tdet,s3) = readFile('2015BLG004.txt','2015-02-10T23:31:21') #Calibrating Magnification: #--------------------------------------------------- Ca0 = 12.29 Cte = 60.23 t0_actual = 2457090.20 Cdt = t0_actual - tdet mcal = MT(v1,Ca0,Cte,Cdt,tdet) (a,b) = magfit(v2,mcal) #initialising MCMC: #--------------------------------------------------- theta = [dt,a0,te,ib] thetaN = np.zeros(4) alpha = input('Enter alpha: ')