
; subtracts temporal mean and displays raw and sample residual images, 
;  and computes and displays variance (mean-squared residual image)

; display frame 0 in window 0
window,0,retain=2
tvim,data2[*,*,0],/scale,xtitle='x',ytitle='y',title='data2 raw, frame 0'

; display residual frame 0 in window 1
window,1,retain=2
subtract_avg,data2,data2res
tvim,data2res[*,*,0],/scale,xtitle='x',ytitle='y',title='data2 - time avg, frame 0'

; display temporal variance of data in window 2
window,2,retain=2
dsq=data2res^2.
time_avg,dsq,dvar2
tvim,dvar2,/scale,xtitle='x',ytitle='y',title='data2 variance',range=[0,5.e4]

