Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with volumetric slice plot #26

Open
GoogleCodeExporter opened this issue Mar 15, 2015 · 8 comments
Open

Problem with volumetric slice plot #26

GoogleCodeExporter opened this issue Mar 15, 2015 · 8 comments

Comments

@GoogleCodeExporter
Copy link

I would like to implement a script for representation of a 4D sample, using 
python language. Then I tested the script of Volumetric Slice Plot shown in 
documentation of Easyviz. The program compiles without wrongs, but the graph 
doesn't appear. I used this script: 



from scitools.std import * 

x, y, z, v = flow()
setp(interactive=False)
h = contourslice(x, y, z, v, seq(1,9), [], [0], linspace(-8,2,10))
axis([0, 10, -3, 3, -3, 3])
daspect([1, 1, 1])
ax = gca()
ax.setp(fgcolor=(1,1,1), bgcolor=(0,0,0))
box('on')
view(3)
show()



What version of the product are you using? On what operating system?
I use Ubuntu 12.4 and the version of python is 2.7.3 

Thak you!!


Original issue reported on code.google.com by [email protected] on 2 Jun 2013 at 8:34

@GoogleCodeExporter
Copy link
Author

The code that I was using is actually this:



from scitools.std import * 

x, y, z = ndgrid(seq(-2,2,.2), seq(-2,2,.25), seq(-2,2,.16), sparse=True)
v = x*exp(-x**2 - y**2 - z**2)
xslice = [-1.2, .8, 2]
yslice = 2
zslice = [-2, 0]
slice_(x, y, z, v, xslice, yslice, zslice, colormap=hsv(), grid='off')



Sorry!!

Original comment by [email protected] on 2 Jun 2013 at 9:06

@GoogleCodeExporter
Copy link
Author

Which backend did you use? It works fine for me with the VTK backend - the only 
backend that supports the slice_ command.

Original comment by [email protected] on 3 Jun 2013 at 1:36

@GoogleCodeExporter
Copy link
Author

I installed the backend vtk (VTK 5.10.1) in my computer and when I compiled the 
script, I had the following error:

Original exception was:
Traceback (most recent call last):
  File "sem título1.py", line 2, in <module>
    import vtk
  File "/usr/local/lib/python2.7/dist-packages/vtk/__init__.py", line 41, in <module>
    from vtkCommonPython import *
ImportError: libvtkCommonPythonD.so.5.10: cannot open shared object file: No 
such file or directory


The code is

from scitools.std import * 
import vtk

x, y, z = ndgrid(seq(-2,2,.2), seq(-2,2,.25), seq(-2,2,.16), sparse=True)
v = x*exp(-x**2 - y**2 - z**2)
xslice = [-1.2, .8, 2]
yslice = 2
zslice = [-2, 0]
slice_(x, y, z, v, xslice, yslice, zslice, colormap=hsv(), grid='off')

Thank you!!

Original comment by [email protected] on 10 Jun 2013 at 8:14

@GoogleCodeExporter
Copy link
Author

You should add the path to the location of libvtkCommonPythonD.so.5.10 to 
LD_LIBRARY_PATH. If you installed VTK in /usr/local, this will probably be

export LD_LIBRARY_PATH=/usr/local/lib/vtk-5.10:$LD_LIBRARY_PATH

Original comment by [email protected] on 10 Jun 2013 at 9:06

@GoogleCodeExporter
Copy link
Author

Thanks for your answer...
I checked the location of libvtkCommonPythonD and was really 
/usr/local/lib/vtk-5.10 but anyway, when I add export 
LD_LIBRARY_PATH=/usr/local/lib/vtk-5.10:$LD_LIBRARY_PATH , I had the following 
error:

  File "sem título1.py", line 4
    export LD_LIBRARY_PATH=/usr/local/lib/vtk-5.10:$LD_LIBRARY_PATH 
                         ^
SyntaxError: invalid syntax
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 70, in apport_excepthook
    binary = os.path.realpath(os.path.join(os.getcwdu(), sys.argv[0]))
  File "/usr/lib/python2.7/posixpath.py", line 71, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal 
not in range(128)

Thanks!

Original comment by [email protected] on 15 Jun 2013 at 8:06

@GoogleCodeExporter
Copy link
Author

You need to put the export LD_LIBRARY_PATH statement in your .bashrc file (and 
open a new terminal window) or just run the command in the terminal window 
before running the Python program.

Original comment by [email protected] on 16 Jun 2013 at 3:22

@GoogleCodeExporter
Copy link
Author

I did this and was shown a blank picture, with only the coordinate axes...
And other question: is there any way for hasn't this problem using a IDE?
I was using Geany.

Thanks!!

Original comment by [email protected] on 16 Jun 2013 at 6:28

@GoogleCodeExporter
Copy link
Author

It is not enough to just do "import vtk". You need to tell SciTools to use the 
VTK backend. See "Controlling the Backend" in the Easyviz documentation:

  https://code.google.com/p/scitools/wiki/EasyvizDocumentation

I have never used Geany, but you must make sure to update the environment 
variable LD_LIBRARY_PATH such that the VTK libraries can be found when running 
Geany:

  http://lmgtfy.com/?q=geany+environment+variables

Maybe a solution would be to start Geany from the same terminal as you defined 
the LD_LIBRARY_PATH variable.

Original comment by [email protected] on 18 Jun 2013 at 10:06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant