1

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])
Dalek
  • 4,168
  • 11
  • 48
  • 100
  • Do you have code that you've written yourself? Have you made an attempt to program this yourself? – Ffisegydd Feb 03 '14 at 13:41
  • @Ffisegydd, I have written a code for the case when each point in the third dimension has a specific quantity but if each point in the third dimension gets some kind of weight regarding to its probability, I don't know how to code it!! – Dalek Feb 03 '14 at 13:47
  • 6
    People are generally much more happy to help if you post a [**minimal, reproducible example**](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) together with the code you have tried. Thanks! – Henrik Feb 03 '14 at 13:51
  • do you mean topographic? – tacaswell Feb 03 '14 at 21:24
  • @tcaswell I mean projection of one slice in the direction of Z axis with a narrow width dz in a x-y plane. – Dalek Feb 03 '14 at 23:29
  • @Henrik I added the code I have written so far. could you now look at it and give me advice?!! – Dalek Feb 04 '14 at 19:29
  • @Ffisegydd there you go a written piece of code for you!! – Dalek Feb 04 '14 at 19:31

0 Answers0