Re: Xinteranimate problem!! [message #18209] |
Fri, 10 December 1999 00:00 |
dsreyn
Messages: 10 Registered: December 1999
|
Junior Member |
|
|
In article <3850F419.8382746A@leeds.ac.uk>,
mensar@leeds.ac.uk (Scott Reid) writes:
> I would like to thank everyone in the group for the help they have given
> me so far, particularly Liam Gumley. My latest problem is with
> XINTERANIMATE. The program runs, but I seem to be getting an error which
> says that 'only one animation at a time is allowed'. In the window I get
> the error :
>
> % Program caused arithmetic error: Floating divide by 0
>
> I believe the xinteranimate is loading the sequence 22 times. The
> program is :-
>
> pro OnOpen
>
> ; Get the Filename
> openr, 1, 'E:/Temp/batch.rvd'
> datas=fltarr(3,36,49,22)
> readf, 1, datas
> close, 1
> h=rebin(reform(datas[2,*,*,*]), 72, 98, 22)
> loadct, 3
> ; erase
> frames = fltarr(512, 512, 22)
> window, 1, TITLE='Bloodflow animation', xsize=512, ysize=512
> XINTERANIMATE, set=[512,512,22]
> for i=0, 21 do begin shade_surf, h[*,*,i], zrange=[-1,+1] &
> frames[*,*,i]=tvrd() & xinteranimate & end
>
> end
You need to specify two keywords to xinteranimate In the FOR loop that loads
the images into the animation - FRAMES and WINDOW. Here's a simple working
example that displays a running 40 point window of a 500 point data set:
pro anim_test
npts = 500
nshow = 40
nframes = npts - nshow + 1
pdat = sin (indgen(npts) / 5.)
window, 1, xsize = 500, ysize = 200
xinteranimate, set = [500, 200, nframes]
for i = 0, npts - nshow do begin
plot, pdat(i:i+nshow-1), title = strtrim (i,2) + ":" + strtrim (i+nshow-1,2)
xinteranimate, frame = i, window = 1
endfor
xinteranimate
end
Doug
|
|
|
Re: Xinteranimate problem!! [message #18210 is a reply to message #18209] |
Fri, 10 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Scott Reid (mensar@leeds.ac.uk) writes:
> I would like to thank everyone in the group for the help they have given
> me so far, particularly Liam Gumley. My latest problem is with
> XINTERANIMATE. The program runs, but I seem to be getting an error which
> says that 'only one animation at a time is allowed'. In the window I get
> the error :
>
> % Program caused arithmetic error: Floating divide by 0
>
> I believe the xinteranimate is loading the sequence 22 times. The
> program is :-
>
> pro OnOpen
>
> ; Get the Filename
> openr, 1, 'E:/Temp/batch.rvd'
> datas=fltarr(3,36,49,22)
> readf, 1, datas
> close, 1
> h=rebin(reform(datas[2,*,*,*]), 72, 98, 22)
> loadct, 3
> ; erase
> frames = fltarr(512, 512, 22)
> window, 1, TITLE='Bloodflow animation', xsize=512, ysize=512
> XINTERANIMATE, set=[512,512,22]
> for i=0, 21 do begin shade_surf, h[*,*,i], zrange=[-1,+1] &
> frames[*,*,i]=tvrd() & xinteranimate & end
>
> end
Well, your XINTERANIMATE loop is just a bit wrong. I'd
do it like this:
; Get the Filename
openr, 1, 'E:/Temp/batch.rvd'
datas=fltarr(3,36,49,22)
readf, 1, datas
close, 1
h=rebin(reform(datas[2,*,*,*]), 72, 98, 22)
loadct, 3
XINTERANIMAGE, Set=[512, 512, 22], /Showload
FOR j=0,21 DO BEGIN
Shade_Surf, h[*,*,j], ZRange=[-1, 1]
XINTERANIMATE, Frame=j, Window=!D.Window
ENDFOR
XINTERANIMATE
END
> One other small thing that I have also experienced is that the loadct
> command does not seem to load any colour map to my shaded surface. It
> simply appears black and white.
I'd add a DEVICE, DECOMPOSED=0 to the top of the file. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|