;+ ; NAME: ircal_zeropt ; PURPOSE: ; front-end routine for photometric calibration of IRCAL data ; ; INPUTS: ; KEYWORDS: ; OUTPUTS: ; ; HISTORY: ; Began 2005-08-03 00:39:38 by Marshall Perrin ;- PRO ircal_zeropt,objname,magnitude,errmag,filter=filter,_extra=_extra,$ filename=filename,database=database,aperoffset=aperoffset caldir="./calib" checkdir,caldir,fallback="./" if keyword_set(filename) then begin message,/info,"Reading data from file "+filename hdr = headfits(filename) filter = strc(sxpar(hdr,"FILTER1")) objname = sxpar(hdr,"OBJECT") print, " using filter "+filter ; TODO ; check image plate scale if sxpar(hdr,"CD1_1") ne 0 then pixelscale = abs(sxpar(hdr,"CD1_1")*3600.) else pixelscale=0.754 filter = strc(sxpar(hdr,"FILTER1")) objname = strtrim(sxpar(hdr,"OBJECT"),2) outname = strepex(objname," ","_",/all) ; quick hack for redpol3 files if pixelscale lt 0.07 then if ~(keyword_set(aperoffset)) then aperoffset=60 ;if ~(keyword_set(aperoffset)) then aperoffset = 60 endif else begin if ~(keyword_set(filter)) then filter="H" if not(keyword_set(objname)) then begin objname = "" print,"What object name was the data saved with?" read, 'enter obj name: ', objname endif if ~(keyword_set(magnitude)) then begin print, "Need to enter a magnitude for that star!" stop endif if ~(keyword_set(datadir)) then datadir="./" objname= strc(objname) stokesifn = "./"+objname+"-POL2."+filter+"/"+objname+".stokesI.fits" if ~file_test(stokesifn) then begin stokesifn = "./"+objname+"/"+objname+"."+filter+"_mosaic.fits" if ~file_test(stokesifn) then message,"I can't figure out what file you want!" endif filename=stokesifn endelse image = readfits(filename,hdr) ; get zero point get_zeropt,image[*,*,0],magnitude,errmag=errmag,_extra=_extra, zero=zp,zp_err=zp_err,$ aperoffset=aperoffset,correction=apcor,corr_Radius=apcor_rad apcor_error = apcor*0 ; we don't have errors for this right now. FIXME get some! ; write out to a file. forprint,textout=caldir+"Radprof-"+filter+"-"+outname+".txt",apcor_rad,apcor_rad*pixelscale,apcor,apcor_error,$ comment="#Radius(pixels) Radius(arcsec) Encirc. En. Error in Encirc. En. " print," aperture correction ===> "+"Radprof-"+filter+"-"+outname+".txt" utc = sxpar(hdr,"DATE-OBS") if keyword_set(database) then begin mdb_addzeropoint,objname, "IRCAL", utc, filter, zp,zp_err,$ comment = "IRCAL_GETZEROPT, file "+filename+" ; "+systime() endif end