def parameter_diagnostics(nameString, data, likes, priors, chi2s): percents=np.array([0.5-0.9973/2.0, 0.5-0.9545/2.0, 0.5-0.6827/2.0, \ 0.5, 0.5+0.6827/2.0, 0.5+0.9545/2.0, 0.5+0.9973/2.0]) \ * 100.0 limits=np.array([1.0-0.9973, 1.0-0.9545, 1.0-0.6827, \ 0.6827, 0.9545, 0.9973]) * 100.0 prcresult = np.percentile(data, percents) limresult = np.percentile(data, limits) # Plot for raw data series fig, ax, fsd = press_key_to_close_figure() # Turn off default axis ax.set_visible(False) gs = gridspec.GridSpec(5,5) ax1 = fig.add_subplot(gs[3,:]) ax1.plot(data,'.') #ax1.set_xlabel('Chain Step', size=fsd['labelfontsize']) ax1.set_ylabel(nameString, size=fsd['labelfontsize']) ax1.tick_params('both', labelsize=fsd['tickfontsize'], width=fsd['plotboxlinewidth']/3.0, color=fsd['axiscolor'], length=fsd['plotboxlinewidth']) # Histogram plot nBins = 35 xmin = limresult[0] xmax = limresult[-1] xedges = np.linspace(xmin, xmax, nBins+1) #midx = xedges[:-1] + np.diff(xedges)/2.0 ax2 = fig.add_subplot(gs[0:3,:]) n, xedgesused, patches = ax2.hist(data, xedges, histtype='bar', edgecolor='k', color=fsd['myskyblue'], normed=True) ax2.set_title(nameString, size=fsd['labelfontsize']) ax2.set_ylabel('Prob dbin', size=fsd['labelfontsize']) ax2.tick_params('both', labelsize=fsd['tickfontsize'], width=fsd['plotboxlinewidth']/3.0, color=fsd['axiscolor'], length=fsd['plotboxlinewidth']) # Autocorrelation acfdata = acf(data, 30) ax3 = fig.add_subplot(gs[4,:]) ax3.plot(acfdata,'-k') ax3.set_xlabel('Lag', size=fsd['labelfontsize']) ax3.set_ylabel('ACF', size=fsd['labelfontsize']) ax3.tick_params('both', labelsize=fsd['tickfontsize'], width=fsd['plotboxlinewidth']/3.0, color=fsd['axiscolor'], length=fsd['plotboxlinewidth']) plt.show() return
def parameter_correlations(data, names): sz = data.shape for i in np.arange(sz[1]): for j in np.arange(i+1,sz[1]): xData = data[:,i] xString = names[i] yData = data[:,j] yString = names[j] fig, ax, fsd = press_key_to_close_figure() ax.hexbin(xData, yData, gridsize=50, bins='log', \ mincnt = 3, cmap=plt.cm.YlOrRd_r) ax.set_xlabel(xString, size=fsd['labelfontsize']) ax.set_ylabel(yString, size=fsd['labelfontsize']) ax.tick_params('both', labelsize=fsd['tickfontsize'], width=fsd['plotboxlinewidth']/3.0, color=fsd['axiscolor'], length=fsd['plotboxlinewidth']) plt.show() return