;+ ; NAME: ; ccdcal ; PURPOSE: ; Batch mode image calibration program (apply bias, dark and flats) ; DESCRIPTION: ; ; CATEGORY: ; CCD data processing ; CALLING SEQUENCE: ; ccdcal,root,num1,num2 ; ; INPUTS: ; root - Root of image file names. The file names are assumed to be in ; the form of root.NNN where NNN is a 3 digit number. ; num1 - first image file to process ; num2 - last image file to process ; OPTIONAL INPUT PARAMETERS: ; ; KEYWORD INPUT PARAMETERS: ; CALIBFILE : Calibration startup file. Default is CALIBPATH/files.cal ; ; CALIBPATH : Path for calibration files. Default is PATH/calib ; ; KEYLIST : Name of a file containing a correspondence list. This list ; associates a set of standard names with the actual keyword ; names found in a FITS file header. If this keyword is ; omitted, a default list is used, as if a file with the ; following contents had been supplied: ; AIRMASS K AIRMASS ; DATE K DATE-OBS ; DATETMPL T DD-MM-YYYY ; EXPDELTA V 0.0 ; EXPTIME K EXPTIME ; FILTER K FILTERS ; FILENAME K CCDFNAME ; OBJECT K OBJECT ; UT K UT ; The middle column is a flag. It may be K, for Keyword, ; T, for Template, or V, for Value. If it is V, the contents ; of the third field on that line should make sense for the ; name in the first field. ; ; PATH : Optional path for raw image and calibration directory. ; If not specified, the current directory is used. ; ; PREFIX : string to prepend to output files. If PATH=OUTPATH the ; default is 'c_', otherwise, the default is no prefix. ; ; OUTPATH : Optional path for location to write final calibrated ; images. Default is the current directory. ; ; OUTPUTS: ; ; KEYWORD OUTPUT PARAMETERS: ; ; COMMON BLOCKS: ; ; SIDE EFFECTS: ; ; RESTRICTIONS: ; ; PROCEDURE: ; ; MODIFICATION HISTORY: ; Written by Marc W. Buie, Lowell Observatory, 1999 Nov 11 ; 2000/02/06, MWB, added .fits optional tag on file name ;- pro ccdcal,root,num1,num2, $ path=path,outpath=outpath,keylist=in_keylist,prefix=prefix, $ calibfile=calibfile,calibpath=calibpath if badpar(path,[0,7],0, $ CALLER='CCDCAL: (PATH) ',DEFAULT='') then return if path ne '' then path=addslash(path) if badpar(outpath,[0,7],0, $ CALLER='CCDCAL: (OUTPATH) ',DEFAULT='') then return if outpath ne '' then outpath=addslash(outpath) if path eq outpath then defprefix='c_' else defprefix='' if badpar(prefix,[0,7],0, $ CALLER='CCDCAL: (PREFIX) ',DEFAULT=defprefix) then return if badpar(calibfile,[0,7],0, $ CALLER='CCDPHOT: (CALIBFILE) ',DEFAULT='files.cal') then return if badpar(calibpath,[0,7],0, $ CALLER='CCDPHOT: (CALIBPATH) ',DEFAULT=path+'calib') then return calibpath=addslash(calibpath) ; Get header correspondence list. if keyword_set( in_keylist ) then $ loadkeys,in_keylist,hdrlist $ else $ loadkeys,'[[DEFAULT]]',hdrlist ldcalib,calibfile,calib,valid,CALIBPATH=calibpath if not valid then begin print,'CCDCAL: Error! Calibration information not found in' print,' ',calibpath+calibfile return endif for num=num1,num2 do begin infile = root+'.'+string(num,format='(i3.3)') outfile = prefix+infile if exists(path+infile+'.fits') then ft='.fits' else ft='' if exists(path+infile+ft) then begin raw=0 image=0 print,'Read ',path+infile+ft raw = readfits(path+infile+ft,header,/silent) parsekey,header,hdrlist,hdrinfo ccdproc,raw,hdrinfo,calib,image print,'Write ',outpath+outfile+ft writefits,outpath+outfile+ft,image,header endif else begin print,path+infile+ft,' not found.' endelse endfor end