def map_S(S): # Make a map rast = spherical.mesh_to_map(X, S.value, 501) import pylab as pl pl.clf() pl.imshow(rast, interpolation='nearest') pl.colorbar()
def map_S(S): # Make a map rast = spherical.mesh_to_map(X,S.value,501) import pylab as pl pl.clf() pl.imshow(rast,interpolation='nearest') pl.colorbar()
for v in scalar_variables: pm.Matplot.plot(v) # Make mean and variance maps burn = 0 thin = 1 resolution = 501 m1 = np.zeros((resolution/2+1,resolution)) m2 = np.zeros((resolution/2+1,resolution)) nmaps = 0 for i in xrange(burn, M._cur_trace_index, thin): M.remember(0,i) # Note, this rasterization procedure is not great. It's using SciPy, which is assuming that the data are on the plane. It would be better to either: # - Take the finite element representation literally, and evaluate it on the grid # - Sample to the interior conditional on the finite element representation. gridded_p = spherical.mesh_to_map(X, M.p.value, resolution) m1 += gridded_p m2 += gridded_p**2 nmaps += 1 mean_map = np.ma.masked_array(m1 / nmaps, mask=gridded_p==np.nan) variance_map = np.ma.masked_array(m2 / nmaps - mean_map**2, mask=gridded_p==np.nan) pl.figure(len(scalar_variables)+1) pl.imshow(mean_map[::-1,:], interpolation='nearest',vmin=0,vmax=1) pl.colorbar() pl.title('Mean map') pl.figure(len(scalar_variables)+2) pl.imshow(variance_map[::-1,:], interpolation='nearest',vmin=0,vmax=1) pl.colorbar()