From: Lorenzo I. <lor...@gm...> - 2008-01-10 21:55:01
|
Dear All, I am a newbie in visual Python, so apologies if this is a FAQ. I am interested in using Vpython to investigate the motion of a bunch of particles in space; I save the (x,y,z) coordinates of each particle as a function of time and I can plot easily a snapshot of the system using a code like: #! /usr/bin/env python import scipy as s import numpy as n import pylab as p import visual as v #here I do my stuff to read the configuration of the system #and then I can finally plot a snapshot of the system at a specific time pos_list=s.zeros(3) # I initialize the array to contain the single particle's coordinates my_rad=1.06/2. for i in xrange(0,n_part): #n_part is the number of particles in my system pos_list[0]=x_list[i] #x_list contains a list of the x-coordinate of all the particles in the system at a given time pos_list[1]=y_list[i] pos_list[2]=z_list[i] particle=v.sphere(pos=pos_list,radius=my_rad,color=v.color.blue) and so far so good. However, I am having a hard time in making an animation out of this. In a sense, I have filled the space with the same particle repeated many times, whereas I would like to have an array of particles part[j] whose positions can be updated in time. Does anyone know how to achieve this? The example program: http://www.vpython.org/vpythonprog.htm is very clear but deals with a single object. Furthermore, I am after 2 other things: 1)zooming and selecting a part of the scene (i.e. some specific particle configurations) and generating a pdf or eps or jpg or png file. 2)generating a movie. I saw there is a contributed program which should work only for MacOS and I wonder if there is anything similar available for Linux (I am running Debian testing on my box). I know this is also dealt with in http://www.vpython.org/FAQ.html but this seems to be flying over my beginner's head. Many thanks Lorenzo |