Re: Animation [message #9820 is a reply to message #5497] |
Tue, 19 August 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Neil Winrow writes:
> Can anyone give me any advice?
> I am trying to Animate a set of surface plots. Each surface plot
> represents the output from a data file. The set of plots represent flux
> at different photon energy, and my boss would like a small animation as
> the photon energies increase. I can read each of the data files into the
> program to display individally, but how can I animate the sequence,
> using the XINTERANIMATE etc. Any advice would be greatly appreicated.
This kind of thing is easily done with XInterAnimate, since
this program can take a "snap-shot" of whatever is in the
current graphics window. With a surface plot, the only
tricky thing is to make sure IDL is not autoscaling. If
you allow autoscaling of axes, the surface will be "jumping"
in the animation, which you don't normally want.
Suppose I had 10 data files named data0.dat to data9.dat
containing 40 by 40 floating point data that I want to
animate. And suppose I know that the maximum value in
all 10 of these data sets is 1500 meters. My code to
animate this data might look like this:
; Set up XInterAnimate
XInteranimate, Set-[300, 300, 10], /Showload
; Open the data sets. Put surface plots in the
; XInterAnimate window and take a snap-shot of them.
FOR j=0,9 DO BEGIN
filename = 'data' + StrTrim(j,2) + '.dat'
OpenR, lun, filename, /Get_Lun
thisSurface = FltArr(40,40)
ReadF, lun, thisSurface
Free_Lun, lun
Surface, thisSurface, ZRange=[0,1500], XStyle=1, $
YStyle=1, ZStyle=1
XInterAnimate, Frame=j, Window=!D.Window
ENDFOR
; Run the surface animation.
XInterAnimate
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
|
|
|