hstack() not working
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
(Tested with official 4.3.1 Linux binaries)
As described in the User Guide on page 102 the following should work in the Python Calculator:
hstack ([ velocity_x , velocity_y , velocity_z ])
Firstly, hstack() isn't available as a function, although it can be accessed as numpy.hstack(). Secondly, I don't know what it wrong with it but its behaviour is very weird.
Setup:
- Create a Wavelet source
- Create a Python Calculator
Testing some Python expressions:
EXPRESSION:
hstack([1,2,3])
RESULT:
Traceback (most recent call last): File "", line 4, in File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 102, in execute retVal = compute(inputs, expression, ns=variables) File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 74, in compute retVal = eval(expression, globals(), mylocals) File "", line 1, in NameError: name 'hstack' is not defined Traceback (most recent call last): File "", line 4, in File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 102, in execute retVal = compute(inputs, expression, ns=variables) File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 74, in compute retVal = eval(expression, globals(), mylocals) File "", line 1, in NameError: name 'hstack' is not defined
EXPRESSION:
numpy.hstack([1,2,3])
RESULT:
works
EXPRESSION:
numpy.hstack([RTData, RTData, RTData])
RESULT:
Traceback (most recent call last): File "", line 4, in File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 102, in execute retVal = compute(inputs, expression, ns=variables) File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 74, in compute retVal = eval(expression, globals(), mylocals) File "", line 1, in NameError: name 'hstack' is not defined Traceback (most recent call last): File "", line 4, in File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 105, in execute retVal, self.GetArrayName()) File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/vtk/numpy_interface/dataset_adapter.py", line 618, in append narray = narray.flatten() * numpy.ones((arrLength, components)) MemoryError
EXPRESSION:
numpy.hstack([1, 2, RTData])
RESULT:
works
EXPRESSION:
numpy.hstack([1, RTData, RTData])
RESULT:
Traceback (most recent call last): File "", line 4, in File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/calculator.py", line 105, in execute retVal, self.GetArrayName()) File "/home/paulm/software/ParaView-4.3.1-Linux-64bit/lib/paraview-4.3/site-packages/paraview/vtk/numpy_interface/dataset_adapter.py", line 618, in append narray = narray.flatten() * numpy.ones((arrLength, components)) MemoryError