Regarding my former question I posted, my idea was quite vague and I was a bit confused how I can illustrate my quantities.
I have three dimensional data set. In one of the dimension, I have a probability distribution regarding each point in that axis. For example a point with (X_0,Y_0)
coordinate has a probability that for given Z_0
has P(Z_0)=0.21
and Z varies between [0,1.5]
. For instance, I would like to plot a tomographic map at Z=0.8
.
How could I add probability distribution which is a 2-D array- e.g. one column Z between [0,1.5] and the other column p(z)- to each point and then make a 3D plot plus a tomography map at one given Z ?
I gridded my data in a 3D array. Then I counted the number of points in the x-y plane. In the z direction, I added the probability of z in each point in each cell from 0 to 1.5 and then I normalized it to the number of points in each grid cell in the x-y plane.
Now I don't know how I can make a contour plot which I would like to project the probability of z, stored in each cell at z=0.8 for a slice perpendicular to the z direction with the upper and lower limits of [0.75,0.85]. Any suggestion???
nx=200;ny=200
z=np.arange(0.0001,1.501,0.001)
xi = np.linspace(min(Xpos)-1, max(Xpos)+1, nx)
yi = np.linspace(min(Ypos)-1, max(Ypos)+1, ny)
mesh=np.zeros((nx-1,ny-1,len(z)),float)
print "gridding data:"
print mesh.shape
NP_mesh=[[0]*(ny-1)]*(nx-1)
NP_mesh=np.asarray(NP_mesh)
num_gal=0
for ii in range(len(Xpos)):
num_gal+=1
for i in range(nx-1):
for j in range(ny-1):
if ((Xpos[ii]>=xi[i]) and (Xpos[ii]<xi[i+1]) and (Ypos[ii]>=yi[j]) and (Ypos[ii]<yi[j+1])):
NP_mesh[i,j]+=1.0
for k in range(len(z)):
mesh[i,j,k]+=PDF[ii,k+1]
new_mesh=np.zeros((nx-1,ny-1,len(z)),float)
for i in range(nx-1):
for j in range(ny-1):
if (NP_mesh[i,j]!=0):
new_mesh[i,j,:]=mesh[i,j,:]/float(NP_mesh[i,j])