MDM 8K REDUCTIONS IN 18 EASY STEPS (Ben Johnson, vers. 6/2003) This guide is for obtaining deep images by combining long exposures If you want to do very accurate photometry you should find another guide - the interpolation, scaling, and combining schemes used here will degrade photometric accuracy, and the flatfielding is not extremely rigorous. --------------------------- OBSERVING TIPS: I find that 3 dither positions, each separated from the others by 30 *arc*seconds in RA *and* 30" in Dec cover the gaps quite nicely. Be sure that you take into account cos(dec) (yeah, yeah, but after a few days night schedule ...) This is about 4 big steps on the tvguider at the MDM 2.4m. You can of course come up with something more complicated. A five pointed star would work well, also with 30" difference in RA and Dec, and would help in creating flats. The 30" requirement is both to cover the gaps and to move stars into very different chip locations for making skyflats Take twilight and dawn flats that will have aout as many counts as the targets frames' background, ~600 for 10 min exposures in R band. Better yet take some time to get long exposures on blank sky (high gal lat.) fields during the night. Your flatfields will thank you for it. Landolt standards take ~30 to 120 seconds exposure on the 2.4m, the crowded SA's are good to use. maybe defocus a bit to increase the magnitude range before saturation occurs ----------------------------- #Will use the package mscred ver 2.0 in iraf extensively. # #REFERENCES: #MDM8K Detector - http://www.astro.columbia.edu/~arlin/MDM8K/index.html, http://www-astronomy.mps.ohio-state.edu/~cjburke/ #general reduction - http://www.noao.edu/noao/noaodeep/ReductionOpt/frames.html #for astrometry - http://iraf.noao.edu/projects/ccdmosaic/astrometry/astrom.html #for mention of various bugs - http://www.lowell.edu/users/massey/lgsurvey/splog2.html #other(not as useful) - http://iraf.noao.edu/projects/ccdmosaic/, http://cadcwww.dao.nrc.ca/guides/ #Katy Flint's (very useful) guide - http://www.ciw.edu/flint/ReduxGuides/redux_steps.v3.1 -----1----------- #The first step is to convert all the images into MEF format, #so that the 8 chips are all extensions of a single fits file. #For this you can use the script 'mdmassebletwo.cl' written/modified by Elise/me. #It can be found at http://www.astro.columbia.edu/~bjohnson/temp/mdmassebletwo.cl #Put it in your iraf directory and type (or add to login.cl) task mdmassembletwo = "home$mdmassembletwo.cl" #This task takes a list of image root names #and combines the separate chip images into #a single MEF file. Syntax is: mdmassembletwo @all.list #where all.list has the format # . . . ccd038b/ccd038b ccd039f/ccd039f ccd040f/ccd040f ccd041o/ccd041o ccd042o/ccd042o ccd043o/ccd043o ccd044o/ccd044o . . . -----2----------- #Now move the assembled files to a safe #directory. (they are originally placed in the #individual image subdirectories) mkdir images mv ccd*o/*o.fits images mv ccd*f/*f.fits images mv ccd*b/*b.fits images #Remove the unassembled fits files and their #directories (!be sure to check that you have #moved all assembled images!) rm -r ccd* cd images -----3------------ #Create bias frames, where 'blist' is a list of all bias #images and 'blist1','blist2', etc. are lists of overscan #corrected bias frames for each night. Higher orders in fitting #the overscan region might be useful for short exposures. mscred ccdproc @blist overscan+ trim+ function=legendre order=1 biassec=[2050:2064,2:4128] trimsec=[5:2044,5:4092] interactive- combine @blist1 bias1.fits combine=median rejection=none(i usually don't use rejection unless something looks really bad, or few bias frames)) combine @blist2 bias2.fits ....... . . . #Make sure that in ccdproc all other correction options are set to 'no' #There is sometimes high spatial frequency noise in the bias. Not sure what #to do about this. It changes between one frame and the next. #Bias is usually not stable from night to night (probably even from beginning to end) -----4------------ #Apply overscan correction and bias frames to the list of #flat+object images from one night, 'tobias' ccdproc @tobias output=b@tobias overscan+ trim+ zerocor+ zero=bias1(or 2 or 3 ...).fits function=legendre order=1 biassec=[2050:2064,2:4128] trimsec=[5:2044,5:4092] interactive- -----5------------ #Create flat image. I use minmax rejection instead of #ccdclip since I haven't determined the 8K gain yet. Sigma #clipping on the median might work if there are enough different pointings -n.b. not really. #Here 'makeflat' is a list of bias corrected object frames #in one filter which have been taken over a timescale #shorter than that over which the flatfield changes. 3-4 #days difference doesn't seem to matter. combine @makeflat flat.fits combine=median scale=mode reject=minmax nhi= nlo= #you have to experiment with nlo, nhi until all stars are gone. generally #you will want a very large nhi depending on the number of identical pointings. #I've been thinking about using object masks here as step 5a- seems like an obvious fix #to the problem of flats with stars, but I need to upgrade to iraf v2.12 # #UPDATE The segmentation image output of SExtractor with a high threshold #should work as object masks, except when few dithers (pixel masked in all frames) # #flats are pretty stable, at least to the accuracy that I can make them #from object frames -----6------------ #Apply flat field image to the object frames ccdproc @toflat output=f@toflat flatcor+ flat=flat.fits zerocor- overscan- trim- -----7------------ #Stop. Congratulate yourself on having completed the initial reductions. #Go get some coffee and try to forget that you now have to deal with astrometry #and image stacking. Maybe get some sleep while the flatfielding takes place. #For the next several steps you will need a list of star positions from the #USNO catalog. I find the easiest way to get it is to go to #http://www.noao.edu/gateway/catalogs/ and enter the RA,DEC, and a search #radius of ~18'. Click submit and save the resulting file, removing the html header #and footer. I will refer to this file as 'usnocoords' #NOTE- In the above reductions I have not applied a crosstalk correction or a bad pixel mask #if you have >3 different dither positions then both these effects are reduced, crosstalk almost #to the point of nonexistence. I have aslo not applied a fringe correction. If you want to be #super-accurate that might be a good idea in I and Z band, though I haven't noticed anything too #severe in I. See the latest Mosaic reduction web pages for instructions. #A bad pixel mask would be nice to remove bad columns, which in stacks of only 3 dithers #can look pretty ugly, but I haven't created one yet. You can always interpolate at the end. #Also, using sigclip in the final combining works well (better than minmax) -----8------------ #Okay, the first thing to do is to set up the chips for #creating a WCS. The y-axis of chips 0-3 is upside down. #For some reason ccdproc needs them this way, but we now #have to flip these chips for the WCS generation. hedit f*.fits[im1] detsec [1:2048,8192:4097] hedit f*.fits[im2] detsec [2049:4096,8192:4097] hedit f*.fits[im3] detsec [4097:6144,8192:4097] hedit f*.fits[im4] detsec [6145:8192,8192:4097] #We should also create a pixel scale parameter with the correct value ccdhedit f*.fits paramete=PIXSCAL1 value=0.173 ccdhedit f*.fits paramete=PIXSCAL2 value=0.173 #And add the nominal pointing center of the field. #Doesn't really matter if it's off by 1-2' # #UPDATE - Don't need to do this with new version of mdmassembletwo.cl #and post-2001 images ccdhedit f*.fits paramete=RA value="::" ccdhedit f*.fits paramete=Dec value="::" -----9---------- #Now we apply a WCS from a recent 8K imaging run to #just one of the images (this will be updated and then applied to other images) #An old fit from Feb 2003 run on the 2.4m (R band) is available at #http://www.astro.columbia.edu/~bjohnson/temp/oldfit.db mscsetwcs fb[insert name of specific image here].fits oldfit.db #now display this image and mark the usno stars with msctvmark, #then find the x,y position of a star matching one of the usno stars. #There may be a large offset between the two. Make a note of x,y and ra,dec mscdisplay fb[insert name of specific image here].fits 1 msctvmark usnocoords 1 fields="1,2,1" label+ wcs=world mscexam (and use , to get x,y of star) -----10-------- #There is probably some sort of offset beteen the image wcs and the #usno stars. To remove this use msczero. msczero fb~.fits update+ #hit the 'z' key over the star you noted above. You will be given #the current coordinates of this star and asked for new coords. Enter #the coords from 'usnocoords' and accept the update. Press 'n' to end msczero. -----11a-------- #This is a shortcut that will save LOTS of time IF it works. #You can recheck that msczero worked by redisplaying and marking the #image. If it looks pretty good and you have used a VERY recent astrometric #solution for the original WCS (i.e. from the same run) then you can #try the following: #UPDATE This seems to work fairly well if you have an astrometric soln. from #the same run, even if it's a different band. You will get images that can be #stacked, though the absolute positions of objects may not be correct, i.e. #systematic offsets of up to 5 arcseconds in some parts of the image, but #internal consistency between individual images msccmatch fb~.fits usnocoords fit+ update+ interactive+ #now examine the fit carefully. If there are no sytematic residuals within the chips, #and if you can get the rms under 0.3 (< twice the pixel size) without too much deletion, #then you should be very happy. Go to step 12, except use the now updated 'oldfit.db' #instead of a nonexistent 'newfit.db' #If the fit doesn't work well then go to 11b. msccmatch can do some very basic #corrections to the wcs (stretch,rotate,shift) that can in principle take care of #atmospheric dispersion (so a wcs in one band should be transferable to the #other bands, for smallish fields) and minor detector movements. #In practice . . . well, umm #UPDATE - again, this actually seems to work pretty well. If I get organized #I may write some IDL/SExtractor code to do fitting outside iraf, obviating #the need for iraf altogether, since other steps are easy/better to do outside IRAF. #don't hold you breath. -----11b--------- #If 11a didn't work or you didn't even try then proceed with the following to create #accurate solutions chip by chip - it's a real PITA mscfinder msctpeak fb~.fits usnocoords newfit.db ext=im1 project=tnx function=polynomial xxorder=3 yyorder=3 xyorder=3 yxorder=3 interact+ #This should display the first chip in frame 1, with usno stars marked. Hit the 'a' #key to toggle to all stars, then hit the 'k' key while pointer is over a good star with #a red circle near it. It should then draw blue circles centering all the usno stars. #Delete saturated stars and bulgeless galaxies with the 'd' key. Then hit 'f' to start the fitting #procedure. #Now in the graphics window use the r,s,y,x keys to get different views of #the fit residuals, and use 'd' to remove obvious outliers. You may have to #increase the order of the fit by typing ':xxorder 4' etc. in the graphics #window. This will be obvious from the residuals. rms should be <~0.34 (twice the # pixel size) Needs lots of (un)deleting. #When you are satisfied hit 'q' twice. Repeat as above except ext=im2,im3, etc until you have #a solution for all the chips #If the initial fit is really bad (e.g. msczero hasn't worked) then you may have to go through two #iterations of the above for each chip. In that case use the 'l' key to #mark ~15 stars, create an initial fit, hit 'q' ONCE, then 'r' to redraw, and now #use 'a' and 'k' as above. When done with all chips you will have to go into #the newfit.db file and delete the initial fits by hand (the last solutions for each chip #are the correct ones) -----12---------- #Apply this new wcs to all of the images mscsetwcs fb*.fits newfit.db -----13---------- #Make sure all the images are correctly zeroed #The fit that has been applied to these images has to be corrected to account for the dithering. #Therefore need to set a reference coordinate for these images. #Set them all relative to f~.fits which, by now, has a correct WCS #msczero will display the images 1 at a time. For first image find a good star that will be in #all images. Do a 'z' keystroke over it. The coordinates that appear for this are correct. #hit enter twice. Now a red circle should appear round the star. Hit 'n' for next. #When next image appears hit 'z' over same star. The first line of coordinates are the ones #currently in header. The ones in brackets are what it should be. Should not be too different. #hit enter twice. A red circle should appear round the star. Hit 'n'. Will be given the offset #between the coordinates - accept. Press 'q' to continue #For this task best to have nframes set to 2 so that if need to check which star you are using then can. msczero @allims #where allims is a list of the flattened images of this field, with #the reference image first -----14---------- #Now to account for minor tweaks in the different exposures msccmatch @allims usnocoords -----15--------- #Great!! You are now done with astrometry. On to image combining. #The hard part is over and we're almost done -----16--------- #We want to convert the multi-extension fits images to single fits #images where the chips have been but in the place with respect to each other. #This is done with the task 'mscimage'. I use interp=linear which seems to work #fine, but I've seen people say that using interp=sinc3 (3x3 pixel box) preserves #noise characteristics and fwhm better. See Katy Flint's guide. Don't forget #to choose some random chip in some random image for the reference. mscimage @allims j@allims reference=fb~.fits[0] -----17--------- #This task will determine the scaling parameters that will bring the #images onto a common intensity scale. This task is very unstable/inconsistent/buggy/generally weird #so you have to watch it. Often it is better to ignore the output #of this task and just use mode scaling in step 18 below. Katy Flint's #giude (see ref. at top) has a longer, better way to do this mscimatch j@allims scale+ zero+ #the header parameters 'mscscale' and 'msczero' will be added to the images #as a result of this task -----18--------- #Now for the moment of truth. It pays here to experiment with different combining #algorithms. Results depend on the number of images, how dithered, etc. mscstack j@allims final.fits scale=!mscscale zero=!msczero #I find combine=median rejection=sigclip lsigma=3 hsigma=6 to be a good starting place #You should have a beautiful image. Check for very different sky values in the chip gaps, #you might have to play with image scaling. Any variability in the flat will be #manifest as gradients across the chips. Check that your stars are not doubled (or tripled or worse) #especially at chip edges. If this happens then you will have to go back to step 11b for #the offending images.