params_dict=params_dict, cov_matrix=None, init_params=init_params, epoch=epoch, num_train=num_train, local_samples=None, stepStop_n=stepStop_n) predictor.train(path='SNe_BAO') chain_ann = predictor.chain_ann predictor.plot_steps() predictor.plot_contours(fill_contours=False, show_titles=True) predictor.save_steps() predictor.save_contours() predictor.eco.plot_loss() #%% labels = cosmic_params.ParamsProperty(param_names, params_dict=params_dict).labels plc.Contours(chain_ann).plot(bins=100, smooth=5, labels=labels, fill_contours=False, show_titles=True, best_values=fid_params, show_best_value_lines=True) plt.show()
# %% estimate parameters using ECoPANN randn_num = ; steps_n = 4 predictor = ann.RePredict(union, cov_matrix=None, path='union2.1_fwCDM', randn_num=randn_num, steps_n=steps_n, params_dict=simulator.params_dict) predictor.from_chain() # predictor.from_net() chain_ann = predictor.chain_ann predictor.plot_steps() predictor.plot_contours(fill_contours=False, show_titles=True) predictor.save_steps() predictor.save_contours() predictor.eco.plot_loss() #%% chain_mcmc = np.load('data/MCMC_chains/chain_fwCDM_2params.npy') chain_all = [chain_ann, chain_mcmc] param_names = ['w', 'omm'] plc.Contours(chain_all).plot(labels=cosmic_params.ParamsProperty(param_names).labels,smooth=5, fill_contours=False,show_titles=True,line_width=2,layout_adjust=[0.0,0.0], lims=None,legend=True,legend_labels=['ANN', 'MCMC']) #%% plt.show()
""" =============================== Triangle plot with one data set =============================== Plot triangle plot with one data set using some default settings. """ import coplot.plot_contours as plc import matplotlib.pyplot as plt import numpy as np test1 = np.random.randn(50000, 3) # If you want to use some default settings, you can use it like this: fig = plc.Contours(test1).plot(labels=[r'$a$', r'$b$', r'$c$'], legend=True, subplots_adjust=False) # and you can save the figure like this: # pl.savefig('test_triangle_1.pdf', fig) plt.show()
""" ========================================================== Triangle plot without 1D contours using multiple data sets ========================================================== Plot good figures with multiple data sets using more settings. """ import coplot.plot_contours as plc import matplotlib.pyplot as plt import numpy as np test1 = np.random.randn(50000, 3) test2 = test1 + 1 # If you want to plot good figures, you should use it like this: fig = plc.Contours([test1,test2]).plot_2d(bins=150,labels=[r'$a$', r'$b$', r'$c$'],\ colors=['r','g'],line_styles=['-','--'],fill_contours=False, show_titles=True, smooth=3,best_values=[[0,0,0],[1,1,1]],show_best_value_lines=False,ticks_size=8, legend=True,legend_labels=['Data 1', 'Data 2'], subplots_adjust=False) # and you can save the figure like this: # pl.savefig('test_triangle_3.pdf', fig) plt.show()
param_names, params_dict=params_dict, cov_matrix=None, init_params=init_params, epoch=epoch, num_train=num_train, local_samples=None, stepStop_n=stepStop_n) predictor.train(path='linear') chain_ann = predictor.chain_ann predictor.plot_steps() predictor.plot_contours(bins=50, fill_contours=False, show_titles=True) predictor.save_steps() predictor.save_contours() predictor.eco.plot_loss() #%% labels = cosmic_params.ParamsProperty(param_names, params_dict=params_dict).labels plc.Contours(chain_ann).plot(bins=50, labels=labels, fill_contours=False, show_titles=True, best_values=[a_fid, b_fid], show_best_value_lines=True) plt.show()