File qutip-3.1.0-bloch3d.patch of Package python-qutip

--- qutip-3.1.0.orig/qutip/bloch3d.py	2016-03-24 17:34:28.538700206 -0400
+++ qutip-3.1.0/qutip/bloch3d.py	2016-03-24 17:58:08.651691198 -0400
@@ -319,9 +319,11 @@ class Bloch3d():
         """
         if isinstance(vectors[0], (list, np.ndarray)):
             for vec in vectors:
-                self.vectors.append(vec)
+                #Convert to numpy.float64. VTK7 does not recognize int64!
+                self.vectors.append(np.array(vec,dtype='float64'))
         else:
-            self.vectors.append(vectors)
+            #Convert to numpy.float64. VTK7 does not recognize int64!
+            self.vectors.append(np.array(vectors,dtype='float64'))
 
     def plot_vectors(self):
         """
@@ -329,6 +331,10 @@ class Bloch3d():
         """
         from mayavi import mlab
         from tvtk.api import tvtk
+        #Use configure_input for vtk7
+        from tvtk.common import is_old_pipeline
+        if not is_old_pipeline():
+            from tvtk.common import configure_input
         import matplotlib.colors as colors
         ii = 0
         for k in range(len(self.vectors)):
@@ -352,7 +358,13 @@ class Bloch3d():
             cone = tvtk.ConeSource(height=self.vector_head_height,
                                    radius=self.vector_head_radius,
                                    resolution=100)
-            cone_mapper = tvtk.PolyDataMapper(input=cone.output)
+            if is_old_pipeline():
+                #The following won't work with vtk-6 and higher.
+                cone_mapper = tvtk.PolyDataMapper(input=cone.output)
+            else: 
+                #Using new API for vtk-6 and 7
+                cone_mapper = tvtk.PolyDataMapper()
+                configure_input(cone_mapper, cone)
             prop = tvtk.Property(opacity=self.vector_alpha, color=color)
             cc = tvtk.Actor(mapper=cone_mapper, property=prop)
             cc.rotate_z(np.degrees(phi))
openSUSE Build Service is sponsored by