pro copy_photcorr_posns,bcdlist,photcorrimg,areaimg,OUTLIST = outlist ;+ ; NAME: ; copy_photcorr_posns ; PURPOSE: ; Make a set of BCD correction photometric correction images with ; the correct header information in for mosiacing with MOPEX ; CALLING SEQUENCE: ; copy_photcorr_posns,bcdlist,photcorrimg,areaimg,OUTLIST = outlist ; INPUTS: ; BCDLIST - list of BCDs in a single channel of the AOR, one per line ; (excluding first HDR frame(s)) ; PHOTCORRIMG - photometric correction image for that channel, ; downloaded from ; http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/calibrationfiles/locationcolor/ ; AREAIMG - pixel area correction image for that channel, downloaded from ; http://irsa.ipac.caltech.edu/data/SPITZER/docs/irac/calibrationfiles/solidangles/ ; OUTPUT: ; A set photometric correction images equal in number to the BCDs, with ; matching header information, and, if specified, a list for input to ; mopex. ; OPTIONAL INPUT KEYWORD: ; OUTLIST - if specified, name of an output list of correction images for ; input to MOPEX ; REVISION HISTORY: ; Written M. Lacy, 8/26/08 ;- if N_params() LT 3 then begin print,'Syntax - copy_photcorr_posns,bcdlist,photcorrimg,areaimg,[OUTLIST= ]' return endif dooutlist=1 if N_elements(outlist) LT 1 then dooutlist=-1 phcimg = readfits(photcorrimg,phchdr) areaimg= readfits(areaimg) corrimg = phcimg/areaimg readcol,bcdlist,file,format='a' nfiles = n_elements(file) if (dooutlist gt 0) then openw,lun,outlist,/GET_LUN for i=0,nfiles-1 do begin hdr = headfits(file[i]) sxaddpar,hdr,'COMMENT','Divided by pixel area map for use with Mopex',AFTER='FOVNAME' sxaddpar,hdr,'COMMENT','Photometric correction image',AFTER='FOVNAME' ; parse the name for the AORID, channel and exposure number: info = strsplit(file[i],'_bcd.fits',/EXTRACT,/REGEX) outname = info[0] + '_phc.fits' writefits,outname,corrimg,hdr if (dooutlist gt 0) then printf,lun,outname endfor if (dooutlist gt 0) then free_lun,lun ; write out instructions for what to do next: print,'***************************************************' print,'Outputting photometric correction images *phc.fits.' print,'***************************************************' print,'Mosaic these correction images in MOPEX using the' print,'mosaic_interpolate, mosaic_coadder and mosaic_combiner' print,'modules. Use the same FIF file as you used for your' print,'BCD mosaics, and the same pmasks, imasks. Also use' print,'the rmasks, which should have been created in the' print,'Rmask or Rmask-mosaic subdirectories of your output' print,'directory.' end