import pickle import matplotlib.pyplot as plt from intmodlib import * #intmodlib is my fitting package pk_path = '/allegro6/matisse/varga/targets_ews2/FU_Ori/modelling/mcmc_samples_9um0_4000_32_gaussian_N_cflux_fixPA_150deg.pk' N_burnin_steps = 1000 sampler,burnin,model1,labels0,list_of_param_keys,init_params,mcmc_param_ranges,priors = pickle.load( open( pk_path, "rb" ) ) #sampler.chain contains the sample values, it is a 3D array with dimensions N_walkers X N_steps X N_parameters #we do not want the first 1000 samples (burnin), so we make a new array without those samples = sampler.chain[:, N_burnin_steps:, :].reshape((-1, model1.ndim)) #samples is an N_samples X N_parameters array, N_samples = N_walkers*(N_steps-N_burnin_steps) print(samples[:,0].shape) plt.figure() plt.hist(x=samples[:,0], bins='auto',rwidth=0.85) plt.savefig(pk_path+'.png')