# Combine NICFPS dithered exposures # Edit ROOT NAME (INFILE) below # Run from location of data.REDUCED # using "cl < NICFPS_*.cl" # :g /INFILE/s//OUTFILE/g # Rename files for new source !cp ../INFILE.fits . !rm in.txt files *fits > in.txt !rm OBSERVATIONS.txt hselect *.fits[0] $I,FILTER,EXPTIME,OBJNAME yes > OBSERVATIONS.txt ######### Create input list & append extension [0] #### !rm inlist.txt files HH24_South*fits > in.txt !cat in.txt | sed -e '/fits/s//fits\[0\]/' > inlist.txt !rm in.txt ######## Construct sky imdel Sky.fits imcombine @inlist.txt Sky.fits combine=median zero=mode offsets=none ####### Subtract sky from all frames. !rm outlist.txt cp inlist.txt x1 !cat x1 | sed -e '/\[0\]/s///' > x2 !cat x2 | sed -e '/\.fits/s//_sky\.fits/' > outlist.txt !rm x1 x2 imdel @outlist.txt imarith @inlist.txt - Sky.fits @outlist.txt pixtype=real cp outlist.txt ON.txt # Create list of ON source observations cp outlist.txt OFF.txt # Create list of OFF source observations vi ON.txt vi OFF.txt # Combine sky-subtracted images: # Use coordinates generated from a reference star using DS9 !rm offsets.txt vi offsets.txt # Autocentroid region on a star, cut & paste the "image" coord value # Change sign on all coords !!! # e.g. -X, -Y imdel INFILE_ON.fits imdel INFILE_OFF.fits imcombine @ON.txt INFILE_ON .fits combine=median zero=mode offsets=offsets1.txt imcombine @OFF.txt INFILE_OFF.fits combine=median zero=mode offsets=offsets2.txt # imcombine @ON.txt INFILE_ON.fits combine=average zero=mode offsets=offsets.txt ######## Update the WCS for APO 3.5m NICFPS images !rm 1.fits imcopy INFILE_ON.fits 1.fits hedit 1.fits CRVAL1 86.628115 update+ show- ver- hedit 1.fits CRVAL2 -00.072896 update+ show- ver- hedit 1.fits CRPIX1 643.12209 update+ show- ver- hedit 1.fits CRPIX2 745.99015 update+ show- ver- !rm INFILE_ON.fits !mv 1.fits INFILE_ON.fits imcopy INFILE_OFF.fits 1.fits hedit 1.fits CRVAL1 86.615480 update+ show- ver- hedit 1.fits CRVAL2 -00.251618 update+ show- ver- hedit 1.fits CRPIX1 266.566 update+ show- ver- hedit 1.fits CRPIX2 834.017 update+ show- ver- !rm INFILE_OFF.fits !mv 1.fits INFILE_OFF.fits