#Download and unpack megared.tar
#Add the following to your loginuser.cl:
reset megacam = /data/bubba1/bmcleod/Megared/ # Or whatever the
right path is
task $megacam.pkg = megacam$megacam.cl
mscred.instrument=megacam$sao/mmto/mmt/minicam.dat
# Load mscred and megacam packages
mscred
megacam
#For data taken before August 2004, repair broken keywords
fixmosaic *.fits fixmos+
# Initialize the ccdproc parameters
cl < megacam$ccdproc.par
cl < megacam$flatcombine.par
# Overscan correct and trim the flats
ccdproc overscan+ trim+
flatcombine
# Get rid of the "_gblk" from the file name
imrename Flat*_gblk.fits Flat*%_gblk%%.fits
#Change the image header to get rid of the gblk ( this example for
filter="g")
msccmd "hedit $input FILTER g update+ verify- add- del-" Flatg.fits
# Flatten the data
ccdproc overscan+ trim+ flatcor+ flat="Flat?.fits"
# Fix bad pixels (must do this after trimming!)
# First add pointers to all the bad pixel files
addbpm *.fits bpmaskdir = "megacam$Badpix"
ccdproc fixpix+