function CSKEYS, Header, $ MEDTOLFW=MEDTOLFW, MEDTOLLO=MEDTOLLO, MEDTOLHI=MEDTOLHI, $ MIAPSTEP=MIAPSTEP, MIMAXAP=MIMAXAP, MIFUNC=MIFUNC, $ SMOOTHFILE=SMOOTHFILE, RESPFILE=RESPFILE ;+ ; NAME: ; CSKEYS ; ; PURPOSE: ; This function adds any missing pipeline keywords to the FITS ; header, and assigns default values. Each may be overridden via ; function keywords. ; ; CATEGORY: ; Comet Nucleus Tour CRISP IR Spectrometer calibration pipeline. ; ; CALLING SEQUENCE: ; ; Header = CSKEYS(Header) ; ; INPUTS: ; Header: FITS header on which to operate. ; ; KEYWORD PARAMETERS: ; (ALL): All keyword parameters override default FITS keyword ; values given in this function. See the code for what ; they modify. ; ; OUTPUTS: ; This function returns the modified header. ; ; PROCEDURE: ; Project defaults are hard-coded here, but they can be ; overridden on the command line with override keywords. ; If the data frame is being passed through a second time ; (presumably with modified values), certain keywords are reset ; and others are left alone. See the code for which. ; Either way, the function adds history entries. FITS keyword ; entries determine the subsequent behavior of the calibration ; pipeline. ; ; EXAMPLE: ; Turn off the bad pixel filter: ; Header = CSKEYS(Header, MEDTOLFW=-1) ; ; MODIFICATION HISTORY: ; Written by: Joseph Harrington, Cornell. 2002 Feb 13 ; jh@oobleck.astro.cornell.edu ;- ; view with a wide screen! header = fitskeyupd(header, 'CSISCAL', 'F', ' is this frame calibrated?') header = fitskeyupd(header, 'CS1ERR', 'none', ' stage of first pipeline error', /ifnew) header = fitskeyupd(header, 'CSSTAT', 'key', ' pipeline status: keywords') specrate = sxpar(header, 'CRS30028') csitime = 1./specrate - 0.0009 ; per Dennis Fort email to jh 11 Feb 2002 header = fitskeyupd(header, 'CSITIME', csitime, ' integration time (sec)') header = fitskeyupd(header, 'CSBADPIX', 0, ' number of bad pixels in mask') header = fitskeyupd(header, 'CSMDTLFW', medtolfw, ' final data median filter half-width (pix)', def=-1) header = fitskeyupd(header, 'CSMDTLLO', medtollo, ' level accepted below median (DN)', def=200) header = fitskeyupd(header, 'CSMDTLHI', medtolhi, ' level accepted above median (DN)', def=200) header = fitskeyupd(header, 'MIAPSTEP', miapstep, ' maskinterp aperture step (pix)', def=1) header = fitskeyupd(header, 'MIMAXAP', mimaxap, ' maskinterp maximum aperture radius (pix)', def=6) header = fitskeyupd(header, 'MIFUNC', mifunc, ' maskinterp interpolation function', def='twoordfit') ; the following come from coutour/doc/IR_Temp_Conv.doc ; formulae cut-and-pasted ; last 2 keywords reversed because values are not right otherwise and ; because they're discussed in the order below DN1 = sxpar(header, 'CRS20093') DN2 = sxpar(header, 'CRS20095') DN = sxpar(header, 'CRS20094') Tb = (9341.4 - DN) / 31.347 Num1 = DN1-0.0002*Tb^3-0.0032*Tb^2+0.138*Tb+21.66 Denom1 = -0.0063*Tb^2+0.1275*Tb+14318 Num2 = DN2-0.0002*Tb^3-0.0125*Tb^2+0.0804*Tb+31.948 Denom2 = -0.0144*Tb^2+0.6896*Tb+13779 T1 = 791.13 - 686.17 * (Num1 / Denom1) T2 = 791.13 - 686.17 * (Num2 / Denom2) Tb = Tb + 273 ; convert to Kelvin if DN1 eq 0 then begin T1 = -1 endif if DN2 eq 0 then begin T2 = -1 endif if DN eq 0 then begin Tb = -1 endif header = fitskeyupd(header, 'CSF1TEMP', T1, ' FPU temp 1 (K)', def=-1) header = fitskeyupd(header, 'CSF2TEMP', T2, ' FPU temp 2 (K)', def=-1) header = fitskeyupd(header, 'CSBTEMP', Tb, ' Board temp (K)', def=-1) header = fitskeyupd(header, 'CSMASKFN', maskfile, ' bad pixel mask filename', def='csbadmask1.fit') header = fitskeyupd(header, 'CSSMTHFN', smoothfile, ' smooth field filename', def='cssmooth1.fit') header = fitskeyupd(header, 'CSRESPFN', respfile, ' responsivity curve filename', def='csresp1.fit') ;header = fitskeyupd(header, , , '', default='') ; FINDME: add ITIME, DATE_OBS, TIME_OBS, ISOTIME, IMSCALE, SPECSCL, ; EXPSTART, EXPEND, EXPDUR, EXPDIV, INSTRUME, SPACECFT, TARGET, ; OBSLOC, IMAGEID user = getenv('USER') sxaddhist, 'Standard FITS entries added ' + systime() + ' ' + user, header return, header end