reader = emcee.backends.HDFBackend(filename) # Algunos valores tau = reader.get_autocorr_time() burnin = int(2 * np.max(tau)) thin = int(0.5 * np.min(tau)) samples = reader.get_chain(discard=burnin, flat=True, thin=thin) print(tau) #%% %matplotlib qt5 graficar_cadenas(reader, labels = ['omega_m','beta','gamma','delta']) #%% #burnin=1500 #thin=50 graficar_contornos(reader,params_truths=sol,discard=burnin,thin=thin, labels = ['omega_m','beta','gamma','delta']) #%% #Ojo, siempre muestra que convergio, aun cuando no #plt.figure() #graficar_taus_vs_n(reader,num_param=0,threshold=1000) #graficar_taus_vs_n(reader,num_param=1,threshold=1000) #%% Printeo los valores! #thin=1 from IPython.display import display, Math samples = reader.get_chain(discard=burnin, flat=True, thin=thin) labels = ['omega_m','beta','gamma','delta'] len_chain,nwalkers,ndim=reader.get_chain().shape print(len_chain) for i in range(ndim): mcmc = np.percentile(samples[:, i], [16, 50, 84]) mcmc[1]=sol[i] #Correción de mati: En vez de percentil 50 poner el mu
filename = "sample_HS_BAO_3params_taylor.h5" reader = emcee.backends.HDFBackend(filename) # Algunos valores tau = reader.get_autocorr_time() burnin = int(2 * np.max(tau)) thin = int(0.5 * np.min(tau)) samples = reader.get_chain(discard=burnin, flat=True, thin=thin) print(tau) #%% %matplotlib qt5 graficar_cadenas(reader, labels = ['omega_m','b','H0']) #%% burnin=50 graficar_contornos(reader,params_truths=sol,discard=burnin,#thin=thin, labels = ['omega_m','b','H0']) #%% #Ojo, siempre muestra que convergio, aun cuando no plt.figure() graficar_taus_vs_n(reader,num_param=0,threshold=1000) graficar_taus_vs_n(reader,num_param=1,threshold=1000) #%% Printeo los valores! from IPython.display import display, Math samples = reader.get_chain(discard=burnin, flat=True, thin=thin) labels = ['omega_m','b','H0'] len_chain,nwalkers,ndim=reader.get_chain().shape print(len_chain) for i in range(ndim): mcmc = np.percentile(samples[:, i], [16, 50, 84]) mcmc[1]=sol[i] #Correción de mati: En vez de percentil 50 poner el mu q = np.diff(mcmc)
tau = reader.get_autocorr_time() burnin = int(2 * np.max(tau)) thin = int(0.5 * np.min(tau)) samples = reader.get_chain(discard=burnin, flat=True, thin=thin) print(tau) #%% %matplotlib qt5 graficar_cadenas(reader, labels = ['$\Omega_{m}$','b',"H0"],title='SN+CC+H0 HS (Taylor)') #%% burnin=300 #burnin = int(2 * np.max(tau)) #thin = int(0.5 * np.min(tau)) graficar_contornos(reader,params_truths=sol,discard=burnin,#thin=thin, labels= ['$\Omega_{m}$','b',"H0"], #title='SN+CC+H0', #title='SN+CC', #poster=True,color='r', ) #%% Printeo los valores! from IPython.display import display, Math samples = reader.get_chain(discard=burnin, flat=True,thin=thin) labels = ['\Omega_{m}','b', 'H_{0}'] len_chain,nwalkers,ndim=reader.get_chain().shape for i in range(ndim): mcmc = np.percentile(samples[:, i], [16, 50, 84]) mcmc[1]=sol[i] #Correción de mati: En vez de percentil 50 poner el mu q = np.diff(mcmc) txt = "\mathrm{{{3}}} = {0:.3f}_{{-{1:.3f}}}^{{{2:.3f}}}" txt = txt.format(mcmc[1], q[0], q[1], labels[i]) display(Math(txt)) #%%
tau = reader.get_autocorr_time() burnin = int(2 * np.max(tau)) thin = int(0.5 * np.min(tau)) samples = reader.get_chain(discard=burnin, flat=True, thin=thin) print(tau) #%% %matplotlib qt5 graficar_cadenas(reader, labels = ['$M_{abs}$','$alpha$','$beta$','$\gamma$'],title='SN HS') #%% burnin=100 #burnin = int(2 * np.max(tau)) #thin = int(0.5 * np.min(tau)) graficar_contornos(reader,params_truths=sol,discard=burnin, #thin=thin, labels = ['$M_{abs}$','$alpha$','$beta$','$\gamma$'], #title='SN+CC HS', poster=False) #%% Printeo los valores! from IPython.display import display, Math samples = reader.get_chain(discard=burnin, flat=True, thin=thin) labels = ['M_{abs}','$alpha$','$beta$','$\gamma$'] len_chain,nwalkers,ndim=reader.get_chain().shape for i in range(ndim): mcmc = np.percentile(samples[:, i], [16, 50, 84]) mcmc[1]=sol[i] #Correción de mati: En vez de percentil 50 poner el mu q = np.diff(mcmc) txt = "\mathrm{{{3}}} = {0:.3f}_{{-{1:.3f}}}^{{{2:.3f}}}" txt = txt.format(mcmc[1], q[0], q[1], labels[i])
tau = reader.get_autocorr_time() burnin = int(2 * np.max(tau)) thin = int(0.5 * np.min(tau)) samples = reader.get_chain(discard=burnin, flat=True, thin=thin) print(tau) #%% %matplotlib qt5 graficar_cadenas(reader, labels = ['$M_{abs}$','$\Omega_{m}$','b'],title='SN+CC HS (Taylor)') #%% #burnin=300 burnin = int(2 * np.max(tau)) thin = int(0.5 * np.min(tau)) graficar_contornos(reader,params_truths=sol,discard=burnin, #,thin=thin labels= ['$M_{abs}$','$\Omega_{m}$','b'] #,title='SN+CC HS (Taylor)' ,poster=True) #%% Printeo los valores! from IPython.display import display, Math samples = reader.get_chain(discard=burnin, flat=True, thin=thin) labels = ['M_{abs}','\Omega_{m}','b'] len_chain,nwalkers,ndim=reader.get_chain().shape for i in range(ndim): mcmc = np.percentile(samples[:, i], [16, 50, 84]) mcmc[1]=sol[i] #Correción de mati: En vez de percentil 50 poner el mu q = np.diff(mcmc) txt = "\mathrm{{{3}}} = {0:.3f}_{{-{1:.3f}}}^{{{2:.3f}}}" txt = txt.format(mcmc[1], q[0], q[1], labels[i])
filename = "sample_HS_BAO_2params_taylor.h5" reader = emcee.backends.HDFBackend(filename) # Algunos valores tau = reader.get_autocorr_time() burnin = int(2 * np.max(tau)) thin = int(0.5 * np.min(tau)) samples = reader.get_chain(discard=burnin, flat=True, thin=thin) print(tau) #%% %matplotlib qt5 graficar_cadenas(reader, labels = ['$\Omega_{m}$','b'],title='BAO HS (Taylor)') #%% burnin=100 graficar_contornos(reader,params_truths=sol,discard=burnin,#thin=thin, labels = ['$\Omega_{m}$','b'],title='BAO HS (Taylor)') #%% #Ojo, siempre muestra que convergio, aun cuando no plt.figure() graficar_taus_vs_n(reader,num_param=0,threshold=1000) graficar_taus_vs_n(reader,num_param=1,threshold=1000) #%% Printeo los valores! from IPython.display import display, Math samples = reader.get_chain(discard=burnin, flat=True, thin=thin) labels = ['omega_m','b'] len_chain,nwalkers,ndim=reader.get_chain().shape print(len_chain) for i in range(ndim): mcmc = np.percentile(samples[:, i], [16, 50, 84]) mcmc[1]=sol[i] #Correción de mati: En vez de percentil 50 poner el mu q = np.diff(mcmc)