;+ optpsfsub ; Optimizing PSF subtraction routine. ; ; INPUTS: filename1,filename2 filenames of the two fits files to ; subtract. Assumes suffix ".ks_mos.fits" ; OUTPUTS: ; HISTORY: Began by MDP on 2001-07-09 as a wrapper for psfpowell ; ;- PRO optpsfsub,filename1,filename2,unsharp=unsharp,cbox=cbox if n_params() lt 2 then begin print,"ERROR: incorrect number of arguments specified." print," optpsfsub,filename1,filename2 " endif filetail=".ks_mos.fits" img=readfits(filename1+filetail,head0) psf=readfits(filename2+filetail,psfh) print,"Now optimizing subtraction..." psfpowell,img,psf,output,params=params,unsharp=unsharp,cbox=cbox print,"Now writing data to disk." paramtxt=["Amplitude Ratio","Background level","Dx","Dy","Iterations","Boxsize","Unsharp masking","Oversampling","Floating-point tolerance"] sxaddhist,"<< OPTPSFSUB.PRO: "+systime()+ userid()+">>",head0 sxaddhist,"Performed optimizing PSF subtraction on "+filename1+filetail,head0 sxaddhist," Using PSF star "+filename2+filetail,head0 sxaddhist," Subtraction Parameters: ",head0 sxaddhist," "+paramtxt+": "+strc(params),head0 writefits,"sub_"+filename1+".fits",output(*,*,2),head0 end