From: Kadir H. <kha...@ya...> - 2008-01-11 10:30:11
|
Scott David Daniels wrote: > ... > See Ruth Chabay's contributed program to go from Vpython to POV-Ray > source, then use POV-Ray to go from source to .png image. I am not sure if I am missing anything, but in the Windows environment at least, you can obtain .png files directly from within Vpython, without going through POV-Ray, although it gives a much better photo-realistic output (at a very high cost of raster time). At the moment I am using Windows MovieMaker to make movies from a series of .png files, which results in very large file sizes with low video quality. I have tried several Divx Authoring programs with not much success in terms of file size. I have looked into MNG "movie" format which apparently is not supported in common video player environments. I have not attempted yet installing all those libs to get the .mng output done. Do you have any feeling on the .mng file sizes in relation with .png files, and the output quality? Kadir Haldenbilen ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Visualpython-users mailing list Vis...@li... https://lists.sourceforge.net/lists/listinfo/visualpython-users Scott Davis wrote: ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping |
From: Lorenzo I. <lor...@gm...> - 2008-01-12 11:19:25
|
Hello, and thanks for your help. Probably I'd better make one step at the time. I made some progress in creating an animation; say that I have n_part particles and n_config stored configurations (i.e.snapshots of the system), and that all the particles coordinates in a given configuration are stored in x_list, y_list, z_list, then this is what I can do: 1) read the particle positions from tot_config and plot the initial configuration my_config=0 for i in xrange(0,n_part): x_list[i]=tot_config[my_conf,3*i] y_list[i]=tot_config[my_conf,(3*i+1)] z_list[i]=tot_config[my_conf,(3*i+2)] particles=[v.sphere(pos=loc,radius=my_rad,color=v.color.blue)\ for loc in zip(x_list,y_list,z_list)] 2) Then I can update the particle positions by reading the other configurations and re-using x_list,y_list and z_list: for my_conf in xrange(1,n_config): for i in xrange(0,n_part): x_list[i]=tot_config[my_conf,3*i] y_list[i]=tot_config[my_conf,(3*i+1)] z_list[i]=tot_config[my_conf,(3*i+2)] v.rate(1000) particles[i].pos=(x_list[i],y_list[i],z_list[i]) The problem of doing so is that I am "moving" only a particle at the time, it takes quite some time and the resulting animations looks somehow odd. My idea would be: first generate the particles and locate them as in the initial configuration, then read the second configuration and move all the particles accordingly in a single go and so on and so forth. However, whereas I can directly address e.g. particles[4].pos, I cannot manipulate in one go all the particle positions directly via particles.pos, which is why I am posting again. I am sure that fixing this must be a one-liner, but so far I have not achieved much. Many thanks Lorenzo > > Message: 3 > Date: Thu, 10 Jan 2008 17:52:30 -0800 > From: Scott David Daniels <Sco...@Ac...> > Subject: Re: [Visualpython-users] Generating PDF and Movies in Visual > Python > To: vis...@li... > Message-ID: <fm6hs4$rhj$1...@ge...> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Lorenzo Isella wrote: > >> ... >> 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) >> > > 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. > > Try this (to get all points in the frame): > my_rad = 1.06 / 2. > particles = [v.sphere(pos=loc, radius=my_rad, color=v.color.blue) > for loc in zip(x_list, y_list, z_list)] > > >> 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. >> > See Ruth Chabay's contributed program to go from Vpython to POV-Ray > source, then use POV-Ray to go from source to .png image. > > >> 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). >> > First, you are not asking anything simple when you ask to go to a movie. > Your head needs to get higher if you really want to do this. E-mail me > separately if you have everything solved up through getting .png images, > and I can provide you with "no redistribution; no comercial use" code to > take a bunch of .png files to a .mng file (which is an obscure movie > format, but there _are_ a few readers out there). > > --Scott David Daniels > Sco...@Ac... > > > > > |
From: Bruce S. <Bru...@nc...> - 2008-01-12 15:26:35
|
I suggest you study the VPython example program gas.py, which manipulates Numeric arrays without loops, then updates the pos attributes of all objects in a very tight loop. The key point is that you shouldn't be dealing with individual x, y, and z lists or arrays but rather with arrays of <x,y,z> vectors. Bruce Sherwood P.S. Technical point: The production version of VPython (3.2.9) imports Numeric (so you don't have to explicitly import it yourself), and the beta version (4.beta) imports numpy. Lorenzo Isella wrote: > Hello, > and thanks for your help. > Probably I'd better make one step at the time. > I made some progress in creating an animation; say that I have n_part > particles and n_config stored configurations (i.e.snapshots of the > system), and that all the particles coordinates in a given configuration > are stored in x_list, y_list, z_list, then this is what I can do: > 1) read the particle positions from tot_config and plot the initial > configuration > > my_config=0 > for i in xrange(0,n_part): > > > x_list[i]=tot_config[my_conf,3*i] > y_list[i]=tot_config[my_conf,(3*i+1)] > z_list[i]=tot_config[my_conf,(3*i+2)] > > > > particles=[v.sphere(pos=loc,radius=my_rad,color=v.color.blue)\ > for loc in zip(x_list,y_list,z_list)] > > 2) Then I can update the particle positions by reading the other > configurations and re-using x_list,y_list and z_list: > > for my_conf in xrange(1,n_config): > > > for i in xrange(0,n_part): > x_list[i]=tot_config[my_conf,3*i] > y_list[i]=tot_config[my_conf,(3*i+1)] > z_list[i]=tot_config[my_conf,(3*i+2)] > v.rate(1000) > particles[i].pos=(x_list[i],y_list[i],z_list[i]) > > > The problem of doing so is that I am "moving" only a particle at the > time, it takes quite some time and the resulting animations looks > somehow odd. > My idea would be: first generate the particles and locate them as in the > initial configuration, then read the second configuration and move all > the particles accordingly in a single go and so on and so forth. > However, whereas I can directly address e.g. particles[4].pos, I cannot > manipulate in one go all the particle positions directly via > particles.pos, which is why I am posting again. > I am sure that fixing this must be a one-liner, but so far I have not > achieved much. > Many thanks > > Lorenzo > > > >> Message: 3 >> Date: Thu, 10 Jan 2008 17:52:30 -0800 >> From: Scott David Daniels <Sco...@Ac...> >> Subject: Re: [Visualpython-users] Generating PDF and Movies in Visual >> Python >> To: vis...@li... >> Message-ID: <fm6hs4$rhj$1...@ge...> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> >> Lorenzo Isella wrote: >> >>> ... >>> 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) >>> >> > 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. >> >> Try this (to get all points in the frame): >> my_rad = 1.06 / 2. >> particles = [v.sphere(pos=loc, radius=my_rad, color=v.color.blue) >> for loc in zip(x_list, y_list, z_list)] >> >> >>> 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. >>> >> See Ruth Chabay's contributed program to go from Vpython to POV-Ray >> source, then use POV-Ray to go from source to .png image. >> >> >>> 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). >>> >> First, you are not asking anything simple when you ask to go to a movie. >> Your head needs to get higher if you really want to do this. E-mail me >> separately if you have everything solved up through getting .png images, >> and I can provide you with "no redistribution; no comercial use" code to >> take a bunch of .png files to a .mng file (which is an obscure movie >> format, but there _are_ a few readers out there). >> >> --Scott David Daniels >> Sco...@Ac... >> |