;+ ; NAME: ; get_spe_flat ; ; PURPOSE: (one line) ; return flat field information for reducing an SPE file ; ; DESCRIPTION: ; return flat field information for reducing an SPE file ; ; CATEGORY: ; IMAGES ; ; CALLING SEQUENCE: ; flat = get_spe_flat(ffilename, ferr, fbad, gain, $ ; silent=silent, $ ; ainfo=ainfo) ; INPUTS: ; ffilename : filename of SPE zero-flux (dark+bias) average images ; ; OPTIONAL INPUT PARAMETERS: ; -------- behavior of the routine ------------ ; silent : 1 if the routine is to perform silently. Default = 0, ; print out statements ; ; -------- description of the file the zero file will be applied to ------ ; aexptime : exposure time in seconds ; ainfo: string (filename), array of strings (FITS header) or ; structure (SPE header) ; ; OUTPUTS: ; flat - the average flat field image ; ferr - the error in the average flat image ; fbad - bad pixel image for avg (0 = good) ; gain - electrons per ADU ; ; SIDE EFFECTS: ; ; EXAMPLE: ; ; MODIFICATION HISTORY: ; Written 14 Jun 2007 Leslie Ann Young SwRI ; Modified 13 Sep 2007 LAY ;- function get_spe_flat, ffilename, ferr, fbad, gain, $ silent=silent, ainfo=ainfo, $ fitshead = fitshead, spehead = spehead, exptime=exptime func = 'get_spe_flat' if not keyword_set(silent) then silent = 0b ffn = ffilename[0] ; in case ffilename is array[1] if not silent then begin print, func, ' : reading ', ffn endif flat = readfits(ffn, fhead, /silent) ferr = readfits(ffn, ex=1, /silent) fbad = readfits(ffn, ex=2, /silent) gain = sxpar(fhead, 'GAIN') fitshead = spe_head(fhead, valid, spehead, exptime=exptime) if keyword_set(ainfo) and not silent then begin exempt = ['EXTIMLOC','EXTIMUTC','NFRAMES',$ 'EXPUNITS', 'EXPTIME','EXP_SEC','ADCRATE','ADCTYPE','READOUTT'] if (spe_hdiff(ffn, ainfo, fdiff, adiff, exempt=exempt)) then begin print, func + ' : WARNING - ', ffn, $ ' has imcompatible data information' print, fdiff print, adiff endif end return, flat end