Isosurface and a 2D figure with the same scale and origin using mayavi


 
Thread Tools Search this Thread
Top Forums Programming Isosurface and a 2D figure with the same scale and origin using mayavi
# 1  
Old 04-03-2014
Isosurface and a 2D figure with the same scale and origin using mayavi

I am using mayavi to plot an iso surface from a 3D array s using the following piece of code:
Code:
src = mlab.pipeline.scalar_field(s)  
fig=mlab.pipeline.iso_surface(src, color=(1.0,0.0,0.0), contours=[0.1, ], opacity=0.3) 
mlab.pipeline.iso_surface(src, color=(0.0,1.0,1.0),contours=[-0.1, ], opacity=0.3)

Then I want to create a plot within this iso surface representing some geometrical info regarding the isosurface, for that I use a previously defined function called geom_macro(ax) and simply call it by typing:
Code:
geom_macro(fig) 
mlab.show()

But the plot I get, although shows a good view of the isosurface it has an almost invisible plot of geom_macro() function, which not only is size wise not comparable in any way to the iso surface, but is in an 'out of center' location (and with a diferent x,y,z saptial orientation). If I plot the two objects separately I get nice figures of both of them.
Just for completing the picture of what I have, the last part of the defined function (geom_macro()) looks like this (AtPos and Geomlst contains the (x,y,z) coordinates of what I am plotting, and dist_btn_points is another defined function):
Code:
for i in range (1, NCenter+1):     
     xp, yp, zp = AtPos[i-1][0], AtPos[i-1][1], Pos[i-1][2]          
     AtRadii=float(AtRadius[element[i-1]-1])     
     mlab.points3d(xp,yp,zp, color=AtColor[element[i-1]-1], mode='sphere',      
         scale_factor=AtRadii, scale_mode='none')     
     """ Draw connecting lines"""     
     for j in range(i,NCenter):         
         xp_c, yp_c, zp_c = AtPos[j][0], AtPos[j][1], AtPos[j][2]         
         xp_in, yp_in, zp_in = float(Geomlst[i-1][0]), float(Geomlst[i-1][1]),         float(Geomlst[i-1][2])         
         xpc_in, ypc_in, zpc_in = float(Geomlst[j][0]), float(Geomlst[j][1]), float(Geomlst[j][2])         
         if dist_btn_pts(xp_in, yp_in, zp_in, xpc_in, ypc_in, zpc_in) < BondMax:              
            mlab.plot3d([xp,xp_c], [yp,yp_c], [zp,zp_c], color=(1.0,1.0,1.0), tube_radius=0.005)

I have tried changing the extent in the isosurface, using the minimum values of x, y and z, but the isosurface gets distorted -not sure why-) Any help will be highly appreciated. Thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Error of Snapshot origin volumes can be resized only while inactive

Hello, I am trying to increase lvsize however it gives below error what's the way that I can increase this size? # lvextend -L +20G /dev/VGExaDb/volsnap Snapshot origin volumes can be resized only while inactive: try lvchange -an Best regards, Vishal (1 Reply)
Discussion started by: admin_db
1 Replies

2. Shell Programming and Scripting

Help with change significant figure to normal figure command

Hi, Below is my input file: Long list of significant figure 1.757E-4 7.51E-3 5.634E-5 . . . Desired output file: 0.0001757 0.00751 0.00005634 . . . (10 Replies)
Discussion started by: perl_beginner
10 Replies

3. Shell Programming and Scripting

bc scale problem

Dear Experts, I want to use bc to do some multiplication and return me a value with number of decimal places defined by myself. For example: echo "scale=10; 1.65*7" | bc returns me: 11.55 But what I really want is to have is a result with 10 digits after the point which... (4 Replies)
Discussion started by: cristalp
4 Replies
Login or Register to Ask a Question