#README # Skeleton instructions for flattening megacam data 2005.08.02 BAM #Download and unpack megared.YYYY-MM-DD.tar.gz and calib.YYYY-MM-DD.tar.gz # The megared file contains the scripts and the calib file contains # bad pixel masks and a shutter correction file. #There is a lot of experimental stuff in this directory right now. # You can ignore most of it. # Add the following to your .cshrc setenv MEGARED /your/path/Megared #Add the following to your loginuser.cl: reset megacam = /your/path/Megared/ # Or whatever the right path is task $megacam.pkg = megacam$megacam.cl # Start IRAF cl # Copy the subsets file into your directory # If you have filters other than u,g,r,i,z you may need # to edit this file to add your filters. Follow the existing examples. copy megacam$subsets . # Load mscred and megacam packages mscred megacam # Initialize the ccdproc parameters (should normally need to be done only) mscred.instrument=megacam$sao/mmto/mmt/megacam.dat cl < megacam$ccdproc.par cl < megacam$flatcombine.par cl < megacam$megaproc.par #For data taken before August 2004, repair broken keywords fixmosaic *.fits fixmos+ # Overscan correct and trim the flats megaproc overscan+ trim+ # If the flats are less than 1 sec, apply the shutter correction # Only works for binx2 data shutcorr corrfil=megacam$shut20050605.fits # OR for data taken in 36amp mode shutcorr corrfil=megacam$shut20050605m.fits # Combine the flats flatcombine # Flatten the data ccdproc overscan+ trim+ flatcor+ flat="Flat*.fits" # If the data are < 1 sec, apply the shutter correction (see above) shutcorr # Fix bad pixels (must do this after trimming!) # First add pointers to all the bad pixel files # These masks are a first stab. They are appropriate only for binx2 data. addbpm *.fits bpmaskdir="megacam$Badpix" # OR for data taken in 36 amp mode 2006-09 and later addbpm *.fits bpmaskdir="megacam$Badpix_2006_36amp # Then fix them ccdproc fixpix+ # Merge adjacent amplifiers into one fits file. The merge feature in ccdproc has a bug # where the merging ends up with a column of blank pixels. Instead use this script: # It appends the character 'm' after the filename, so e.g. moo.1234.fits becomes moo.1234m.fits # This step is not necessary for data taken in 36 amp mode megamerge *.fits #--------------------------------------------------------------------- #WCS correction # See the file megacamwcs.html for more detailed information Add the following to the front of your path: $MEGARED $MEGARED/bin e.g. set path = ($MEGARED $MEGARED/bin $path) # The WCS written in the image header at the telescope is systematically off by 0.5degrees in rotation. # Adjust the rotation angle so that the WCS solution works better cl> fixmosaic *.fits fixmos- fixrot+ fixcen- rotcorr=-0.5 # Install the WCS distortion terms into the image header cl> zpn *.fits # Determine the WCS megawcs -f $MEGARED/M67.0659.outfinal -c tmc -r 0.002 *.fits # Check that the solution looks good grep Merit *.outfinal # The value should be something like 0.12 (arcsec RMS). Anything larger than 0.15 should be viewed skeptically. # SWARP installation # The out-of-the-box version of swarp does not handle the ZPN wcs properly. # At CfA, a bug-fixed version of swarp can be found in /home/bmcleod/bin.linux # Otherwise, download swarp from terapix and patch it. # This distribution contains patch files for version 2.15, 2.15.6, and 2.15.7 # Here's how I install it: cd swarp-2.15.7 sh $MEGARED/patchswarp-2.15.7 ./configure --prefix=/home/bmcleod --enable-threads make make install # This installs swarp to /home/bmcleod/bin # # # # Making illumination correction images from SDSS photometry sdssmatch file.fits /home/bmcleod/imagesurf/mkillum file.sdss.matched.tab [filter] file.fits Illum.fits Then normalize it manually. Divide the data by the Illum.fits file.