pro avesutr, inputarray, header, outputarray ; NAME: ; avesutr.pro ; ; PURPOSE: ; This program takes an image cube containing multiple samples per read and averages ; the samples together to produce another image cube that has only one plane ; per read. Note that it does not read and write files on disk, but rather ; arrays in memory. ; CALLING SEQUENCE: ; avesutr, inputarray, header, outputarray ; ; INPUTS: ; inputarray is an 3-dimensional multi-elements array containing any number of image planes ; corresponding to any number of Fowler samples per read ; header is the header for inputarray ; outputarray is a 3-dimensional multi-elements array containing one image plane per read ; ; ; KEYWORD PARAMETERS: ; none ; ; ; EXAMPLE ; ; avesutr, inputarray, header, outputarray ; ; ; REFERENCE: ; ; ; MODIFICATION HISTORY: ; Written by: ; Modified: Don Figer, IDTL, May 3, 2002 ; Wrote original program. ;- ; ; load variables containing input image dimensions dims=size(inputarray,/dim) xsize=dims[0] ysize=dims[1] zsize=dims[2] ; load variables containing number of reads and number of samples per read numsamrd=sxpar(header,'NUMSAMRD') numreads=zsize/numsamrd ; define output array outputarray=fltarr(xsize,ysize,numreads) ; load output array with average over samples per read for i=0,numreads-1 do begin sum=intarr(xsize,ysize) for j=0,numsamrd-1 do begin sum(*,*)=sum(*,*)+inputarray(*,*,i*numsamrd+j) endfor outputarray(*,*,i)=sum(*,*)/numsamrd endfor end