How to Make a Median Flat from 6-Dimensional LWS FITS Files =========================================================== For this data set, the detector was flattened by making a median, low-airmass blank sky frame and a high-airmass blank sky frame, then subtracting the two sky frames. This was performed by extracting off-source nod-position beams, defined by image frames (*,*,0,0,1,i), from several observations. For example, for the 21 August 2000 data, the low-airmass blank sky frames were extracted from the DATA/RAW/20000821/LWS0051.FITS and LWS0053.FITS files. The high-airmass blank sky frames were extracted from the LWS0049.FITS and LWS0050.FITS files. The following IDL code was developed and used by the observers to make a medianed flat for the LWS. The code also produces a bad-pixel mask for LWS. The code was not tested by and is not supported by the PDS but is provided to help clarify the process of making a median flat. pro, lwsflat, flat, bpm ; Create a flat field and bad-pixel mask for LWS. ; ; Method: 1. Flat. get off-source nod-position beams of ; a few frames at various airmasses, median them together to get ; a high-airmass stare frame and a low-airmass stare ; frame, and then take the difference of those two. ; ; 2. Mask. just take one of these stare frames and mark ; which pixels are very far (5 sigma) from the median. ;inputs: none. ; ;outputs: just the flatfield, normalized to 1.0, and ; the mask (good pixels 1, bad pixels 0) ;insert the frames here. these are for 21 Aug 2000, lambda=12.5 mu. loair1 = readfits('lws0051.fits') ;12 nodsets. secz=1.25 loair2 = readfits('lws0053.fits') ;12 nodsets. secz=1.25 hiair1 = readfits('lws0049.fits') ;12 nodsets. secz=1.95 hiair2 = readfits('lws0050.fits') ;12 nodsets. secz=1.95 ;NB: combining algorithm: ; ( img(*,*,0,0,1,i)-img(*,*,1,0,1,i) ) - ; ( img(*,*,0,0,0,i)-img(*,*,1,0,0,i) ) ; (nod A - nod B) - (on A - on B) hicomb = fltarr(128,128,24) for i=0,11 do hicomb(*,*,i)=hiair1(*,*,0,0,1,i) for i=12,23 do hicomb(*,*,i)=hiair2(*,*,0,0,1,i-12) locomb = fltarr(128,128,24) for i=0,11 do locomb(*,*,i)=loair2(*,*,0,0,1,i) for i=12,23 do locomb(*,*,i)=loair1(*,*,0,0,1,i-12) hiflat = fltarr(128,128) loflat = fltarr(128,128) hisd = fltarr(128,128) losd = fltarr(128,128) for ii=0,127 do for jj=0,127 do $ hiflat(ii,jj) = median(hicomb(ii,jj,*),/even) for ii=0,127 do for jj=0,127 do $ loflat(ii,jj) = median(locomb(ii,jj,*),/even) for ii=0,127 do for jj=0,127 do $ hisd(ii,jj) = stdev(hicomb(ii,jj,*)) for ii=0,127 do for jj=0,127 do $ losd(ii,jj) = stdev(locomb(ii,jj,*)) flat = (hiflat - loflat)/median(hiflat-loflat) bpm = bytarr(128,128) * 0B + 1B wherebad = where(abs(loflat-median(loflat)) ge 5*stdev(loflat)) bpm(wherebad) = 0B writefits, 'bpm.21jun00.fits', bpm writefits, 'flat.21jun00.fits', flat return end