Converting Six-Dimensional FITS Files to Two Dimensions for Keck I LWS Tempel 1 Images, 21 August 2000 Before reducing the LWS data, the six dimensions of the raw FITS image must be properly combined into a co-added, chop-nod, two-dimensional image. To accomplish this, one must combine the frames in each chop-nod cycle into one, then stack the chop-nod cycles. The number of chop-nod cycles is provided by the FITS keyword NAXIS6 or the PDS label keyword AXIS_NAME = "FINAL NOD SETS". The index for the chop beams is provided by the FITS keyword NAXIS3 or the PDS label keyword AXIS_NAME = "CHOP BEAMS", and the index for the nod beams provided by the FITS keyword NAXIS5 or the PDS label keyword NAXIS_NAME = "NOD BEAMS". For more details about the layout of the 6-dimensional FITS files, refer to the instrument catalog file, LWSINST.CAT A description of the conversion process is provided: 1) Read a raw, LWS 6-D FITS image file into the variable im. 2) Combine the image slices for each nod set, i: nod_set_result(i) = target slice - background - (sky - background) where target slice = im(*,*,0,0,1,i) with chop off and nod off background slice = im(*,*,1,0,1,i) with chop on and nod off sky slice = im(*,*,0,0,0,i) with chop off and nod on background slice = im(*,*,1,0,0,i) with chop on and nod on 3) Make the target frame by taking the median or sum of the nod set results, nod_set_result(i). The following IDL code implements the conversion process described above. The code was developed and used by the observers to make a two-dimensional array from a raw, six-dimensional FITS file. The code was not tested by and is not supported by the PDS but is provided to help clarify the conversion process: pro lwsconv, inimage, flag, outimage, outexp, outairm ; Read the 6-D FITS image from LWS and collapse it into one 2-D array. ; The combining algorithm is (nod A - nod B) - (on A - on B): ; ; ( im(*,*,0,0,1,i)-im(*,*,1,0,1,i) ) - ; ( im(*,*,0,0,0,i)-im(*,*,1,0,0,i) ) ; ; Inputs: ; inimage = a string, the name of the FITS image file from LWS. ; flag = integer 0 or 1: 0 for a medianed 2-D array, any other ; integer for a strict summed 2-D array. ; ; Outputs: ; outimage = the collapsed, 2-D image array. ; outexp = the exposure time in seconds, from FITS header ; outairm = the airmass, from FITS header im = readfits(inimage,outhdr) sz = size(im) nx = 128 ny = 128 if (sz(0) eq 5) then nnod=1 if (sz(0) eq 6) then nnod=sz(6) set = fltarr(nx,ny,nnod) for i=0,nnod-1 do $ set(*,*,i) = im(*,*,0,0,1,i) - $ ;Chop off,nod off = target im(*,*,1,0,1,i) - $ ;Chop on, nod off = background (im(*,*,0,0,0,i) - $ ;Chop off,nod on = sky frame im(*,*,1,0,0,i)) ;Chop on, nod on = background outimage = fltarr(128,128) if (flag eq 0) then $ for ii=0,127 do for jj=0,127 do $ outimage(ii,jj)=median(set(ii,jj,*))*nnod if (flag ne 0) then $ for ii=0,127 do for jj=0,127 do $ outimage(ii,jj)=total(set(ii,jj,*)) ;print, 'exp time',sxpar(outhdr, 'OBJTIME') ;Total time on target! ;print, 'airmass', sxpar(outhdr, 'AIRMASS') outexp = sxpar(outhdr, 'OBJTIME') outairm = sxpar(outhdr, 'AIRMASS') return end