Making animated GIF movies
Posted: 17 Jul 2008, 11:39
Here's how to make an animated GIF movie from data from elegant. You'll need the ImageMagick programs in order to do this.
Imagine that you are tracking many turns and want to make a movie of the particle distribution turn-by-turn.
In the .lte file, you need a watch point set up to record particle coordinates. E.g.,
W1: watch,filename="run.w1",mode="coordinate"
...
ring: line=(...,W1)
(Note that the W1 element is at the end of the beamline)
After running the simulation, use sddsplot to make a bunch of png files, one for each pass (this part was worked out by Bob Soliday). In this example, I'm looking at longitudinal phase space.
% sddsplot -device=png,template=frame%04d.png -column=t,p run.w1 -graph=dot -split=page -separate=page -sameScales \
-offset=xparameter=PassCentralTime,xinvert,yparameter=pCentral,yinvert \
-factor=yparameter=pCentral,yinvert -ylabel="delta"
(the -offset and -factor arguments are used to suppress the revolution time and to convert p to delta)
% convert -loop 1 -delay 10 frame????.png movie.gif
(convert is from ImageMagick)
% \rm frame????.png
You can now display movie.gif using a web browser.
--Michael
Imagine that you are tracking many turns and want to make a movie of the particle distribution turn-by-turn.
In the .lte file, you need a watch point set up to record particle coordinates. E.g.,
W1: watch,filename="run.w1",mode="coordinate"
...
ring: line=(...,W1)
(Note that the W1 element is at the end of the beamline)
After running the simulation, use sddsplot to make a bunch of png files, one for each pass (this part was worked out by Bob Soliday). In this example, I'm looking at longitudinal phase space.
% sddsplot -device=png,template=frame%04d.png -column=t,p run.w1 -graph=dot -split=page -separate=page -sameScales \
-offset=xparameter=PassCentralTime,xinvert,yparameter=pCentral,yinvert \
-factor=yparameter=pCentral,yinvert -ylabel="delta"
(the -offset and -factor arguments are used to suppress the revolution time and to convert p to delta)
% convert -loop 1 -delay 10 frame????.png movie.gif
(convert is from ImageMagick)
% \rm frame????.png
You can now display movie.gif using a web browser.
--Michael