Hello everyone i am trying to animate some data using Mayavi mlab.points3d and having some issues. Here is my code:
import numpy as np
from mayavi import mlab
##Some lists to animate
px=np.arange(0,10000,1)
py=np.arange(0,50000,5)
##Animation function
def run(px,py):
cc = mlab.gcf().scene.camera
cc.position[-1] = 10
T_max = len(px)
delayer=40
@mlab.animate(delay=delayer)
def anim_loc():
f = mlab.gcf()
while True:
for i in np.arange(0,T_max,1):
s=0.5
mlab.points3d(px[i],py[i],s,color=(0,0,0),opacity=1)
mlab.view(distance=50,azimuth=80,elevation=80)
print(px[i],py[i])
yield
b=anim_loc()
run(px,py)
mlab.show()
When i execute this code the animation only lasts for like 40 frames or so and after that it freezes without any error or exception. When i run the animation multiple times the animation freezes at different frames, sometimes after 20 frames and sometimes even after 80 frames. I am hereby not sure whether it is because of the code i wrote, or the computer i use (which should be fast enough for such task) or it is a bug in Mayavi. I am using spyder 3.2.8 with anaconda navigator. I would be very pleased for any help :).