CCD PHOTOMETRY USING IRAF at Gettysburg College and at the National Undergraduate Research Observatory |
|
Introduction
From Raw Images to Magnitudes Images taken with the Gettysburg College telescope are 1k x 1k FITS images produced with the PMIS operating system and a Photometric CH250 thermoelectrically-cooled camera. Images taken at NURO are 512 x 512 images from a Photometric liquid-nitrogen-cooled camera. There are two ways to get images with the NURO telescopes. If they were taken with the PMIS operating system at NURO, they will, like the Gettysburg Images, be in FITS format. If they were taken using the IRAF Control Language interface to the NURO camera, they will be in IRAF format, which consists of two separate files, one containing image headers (.imh) and the other (invisible to the user) containing the pixels. There are two elements to the data reduction. The first is processing the images. The second is measuring the processed images to extract magnitudes. Processing Processing the images follows the following logic. During the course of the evening, one takes images of objects one wants to study. These are called "object" files, but they need to be processed to remove spurious patterns introduced in the CCD camera by electronic readout noise, thermal electrons, and pixel-to-pixel sensitivity variations. To remove these effects, one takes a large number of calibration images during the course of the evening. There are three types of calibration images. (1) Zero (or "bias") frames: Typically 20 to 40 of these are taken each evening to establish the pattern of readout noise across the chip. They are taken with 0 exposure time; the chip is just flushed and read out. (2) Dark frames: Typically 20 to 40 images are taken each evening, with 120 second integration times, but with the shutter closed. This establishes the pattern and rate at which thermal electrons accumulate in the CCD chip. Since dark current is negligible with the nitrogen-cooled camera at NURO, we seldom take dark frames there, but we always take them at GCO. (3) "Flat Field" images: Usually 5 or 10 images through each filter (U,B,V,R, and/or I) are taken while pointing at blank sky near sunset or sunrise. Alternately, a uniformly illuminated screen may be used. The purpose is to determine the pixel-to-pixel pattern caused by sensitivity variations of the pixels or shadowing ("vignetting") by telescope optics or dust particles. We want to apply these calibrations to each object file. To do this use an IRAF command called zerocombine to create a master Zero frame by averaging together all the individual zero frames. Then (only at GCO, where we take dark frames) we use a program called darkcombine to create a master Dark frame by averaging together all the individual dark frames--the program automatically subtracts the master Zero frame from each raw dark frame before averaging. We next use a program called flatcombine to create master Flat frames for each filter, again by averaging together the individual flat-field images, after first subtracting the master Zero frame and the Dark frame (scaled to the exposure time of the Flat). At NURO we also trim the images to a smaller size than that created by the camera, and use the trimmed region, called the "overscan" to remove large-scale patterns from the readout background. Once this is set at the startup of IRAF, however, the "trim" and "overscan" functions are automatic and need not concern us under ordinary circumstances. When master Zero, Dark and Flats are ready, we then run a program called ccdproc that automatically subtracts the Zero and Dark (scaled to exposure time) from each object file, and divides by the appropriate Flat for the filter used. Voila! The object files, zero, dark, and flat -corrected, are ready to be measured. The overall logic of this is shown on Figure 1, at the end of this document. Measurement There are many ways to extract magnitudes from a CCD image. Let us first be clear what we mean by magnitudes. The images of stars on our processed frames, in profile, look like a Gaussian or bell-shaped curve (see Figure 2). We extract magnitudes from the images by measuring the area under the curve, which represents light from both the star and the sky background, subtracting out the sky background, dividing by the exposure time, and taking the log of the result. The final product is a number that represents the brightness of the star---it's a magnitude. (Technically speaking it's an "instrumental magnitude", since it's not referred to a standard star in the sky, but just calculated from the counts you get in your CCD.) FIGURE 2: Radial Profile of a star Produced by IRAF Two IRAF commands we commonly use to extract magnitudes are imexamine and apphot. Both commands essentially let you point the cursor to a star, push a mouse button, and print out an instrumental magnitude. For quick-look, moderate precision measurements we use imexamine, but if we want to insure the best results, we use apphot, which allows the user to set the measuring parameters interactively, insuring that the proper sky background is chosen, that adjacent stars don't contribute to the measured brightness, that a sufficient amount of the star image is sampled, etc. We describe the use of imexamine and apphot in a write-up by Bentley Laaksonen, included as an Appendix IX. STARTING IRAF IRAF is started differently on different machines. But one started, you should see the "command language" prompt. cl> You enter commands just like you do on any Unix or DOS machine. A list of IRAF commands we find useful is listed in Appendix I, but we will assume you knew a bit about computers before you read this manual and can find information on specific IRAF commands by typing help <command>. IRAF commands always have associated with them a "parameter" file, which sets the operating parameters for the file. You need to learn how to set these parameters for your particular needs, using the epar (edit parameters) command. We will give some hints for what parameters to set for good results, but you may find your own particular recipe that works better. Initially, when you start IRAF, you should run the command setinstrument which will set up some of the fundamental parameters you need for your observing site. At GCO, the computer responds to this command by Instrument ID (type ? for a list) (gco): To accept the default, gco, you just press return. At NURO you can type ? to see the list, and pick the obvious choice, the NURO CCD camera. You will find yourself immediately in the editor for several of the parameter files needed for data reduction. The first is the parameter file for the CCD reduction system, ccdred. Usually you don't have to edit this (See Appendix II). To accept the choices, just push the ESC key, type a colon (:), and then type q (or wq). This is the standard procedure for exiting the editor. You will find yourself next in the parameter editor for the program ccdproc, which is the master program that trims your images to size, applies zero, dark, and flatfield corrections if needed, etc. Make sure all the parameters are set to the proper values for your site and your purpose. Sample ccdproc parameter settings for GCO and NURO are shown in Appendix III and IV. The important things to note are that you need to specify the names (and directories) you will use for your Zero, Dark, and Flat field images, and you need to tell the program which processing steps (trim, zero, dark, flat, etc) it should perform on your object files. When you have edited all the ccdproc commands that need setting, you can then type Esc :q to get back to the cl> prompt. You are ready to go. STEPS IN PROCESSING IMAGES 0) Conversion to standard FITS format This step is needed only at NURO, and only when taking images using PMIS, to make sure images are in standard FITS format. Simply type in : !fitscon -nuro <FITS image file names> to convert the raw data files to standard FITS format. (The ! is needed only if you're executing the fitscon command from IRAF. If you've got a separate unix command shell window open, the ! can be omitted when issuing the command from unix.) 1) Conversion from FITS to IRAF internal format This step is not needed if the images were taken using the IRAF Control Language interface at NURO, which produces images directly in IRAF format. Otherwise, your images will be in FITS format, with headers (containing image information like exposure time) and pixels all together in one file. To work on the images we need to split the image headers from the pixels, using the IRAF command rfits. All fits files to be processed by IRAF must first be converted to IRAF format as described in the following. Using the command is simple. Just type rfits. The computer will ask for an input file name. You type the name in: eg: myimage.fts . The computer then asks for an output name. Since IRAF will add a .imh extension to this (meaning "image header") to whatever you type, you simply type myimage for the output file name. The computer will the extract two files from the original FITS file, the image header, which will be named myimage.imh and the myimage.pix. You probably won't see the .pix file on your directory, since IRAF usually stores it elsewhere on the disk. The header knows where the pixels are, and you don't have to worry about it. If you're converting lots of files, which is usually the case, IRAF lets you take lists from a data file. You can make two files, one containing the FITS file names and one containing the output names. I usually call them fitlist and imlist. At the top of the next page we list two sample files: fitlist imlist myimage1.fit myimage1 myimage2.fit myimage2 myimage3.fit myimage3 myimage4.fit myimage4 myimage5.fit myimage5 When IRAF prompts you for an input name you type @fitlist And when it prompts you for an output name you type @imlist The result will be the extraction of headers and pixels from the five files named myimage?.fit, and the appearance on your directory of five files named myimage?.imh. Note that the "at" sign, @, is essential. That indicates that input comes from the file. Otherwise IRAF thinks that fitlist is the name of the file you want converted, and that imlist.imh is to be the output name. 2) Making a master zero frame First make sure you have all your "bias" or "zero" frames in IRAF format. Say they're named bias01.imh, bias02.imh, etc. Then make sure the parameters for the zerocombine command are set (See Appendix V for a sample), using the command epar zerocombine. You can name the output zero file whatever you want, but make sure its the same name you set earlier in the ccdproc parameter file, or edit the ccdproc "zero level calibration image" parameter later to match this name. When the parameters are set properly, exit the editor using Esc :wq and then simply type zerocombine The computer will prompt you for your input file names. You could type bias*.imh in this case, or give it the name of a file that has the list of zero images on it, e.g. @imlist. The computer now reads all your zero frames, averages them, and outputs the results in the file Zero.imh, which is now your master Zero image. If you want to make sure the image came out OK, type imstat *.imh to check the statistics of each image. Or display the image on the screen to make sure the that Zero.imh looks smoother than any of the bias??.imh files. 3) Making a master Dark Frame (only at GCO) The procedure is exactly the same as zerocombine. Use rfits to make sure all your dark frames are in IRAF format. Edit the darkcombine parameters to meet your needs (see Appendix VI for a sample), making sure to give a name, say Dark.imh for the master output name to match your ccdproc darkk image name. Then just type darkcombine and specify the file names or a list. The computer reads all the dark frames, subtracts the master zero frame you created in the last step, and averages them together into a master dark frame, e.g. Dark.imh. 4) Making master Flats Again, the procedure is the same as zerocombine and darkcombine. Use rfits to make sure all your flats are in IRAF format. Edit the flatcombine parameters to meet your needs (See Appendix VII). Note that the IRAF program reads your headers to determine the filters, and will only combine flats for the same filter. Thus the name you give as an output file name is a "root" name, to which the filter name will be added when the master flat is created. For instance, when you specify a root name "Flat", IRAF will name the output files FlatI, FlatR, FlatV, FlatI, etc, depending on the filter. When ready, type flatcombine and then, when asked, the input file names or a list. IRAF then reads all the flatfield images, subtracts Zero and Dark from each, averages together ones of the same filter, and prduces a master flat for each filter. A singe flatcombine command, wonder of wonders, can produce a set of master flats, e.g. FlatB.imh, FlatV.imh, FlatR.imh, and FlatI.imh. Check these images out using the display command to make sure your flats look reasonable. This is a matter of judgment, and as you get more experience in processing you'll learn what to look for. 5) Processing your object files The last step is easy. Make sure any object files you want process are in IRAF format. Assuming that the ccdproc parameters are set properly (see the section on starting IRAF), all you have to do is type ccdproc *.imh and IRAF will completely process any images on your directory. It knows which ones have already been processed, so you simply have to type the general command above to keep up with your data as it comes in. If you get any errors saying it can't find a flat-field, dark, or zero image, make sure that the names for these files in the ccdproc parameter file match the actual master files you have on your directory. You can edit the ccdproc parameter file with the command epar ccdproc. The learning curve here is short, and it's easy to process raw images now with just a few keystrokes. You can display the images to check if the pattern noise has been removed and the background looks relatively smooth. And you are now ready to measure magnitudes using imexamine or apphot, as described in the attached paper (Appendix IX) by Ben Laaksonen. 6) Converting your processed files to FITS format for storage or transfer (optional) Because IRAF format consists of separate image headers and pixel files (with a pointer in the header pointing to the pixel files), you may want to convert your images back to FITS format (which has the header and pixel information all together on one file) before you send them over the internet or put them on tape. To do this, just use the wfits command, which works just like rfits. You can convert files one by one, or use lists as input and output. The parameter file for wfits that we use is shown in Appendix VIII. At GCO we distinguish between raw FITS images and processed images by using a .fit extension for all raw images from the CCD and a .fts extension for all processed images. You may want to compress the images before storing or ftp'ing over the internet. The command compress will do this, creating a file with an added extension .Z, which is the extension for unix compressed files. So file myimage.fts becomes myimage.fts.Z when it is compressed. This saves a fair amount of space on processed images, I've found, but doesn't do much with raw images that don't have a lot of pixels of similar value. There are other compression algorithms (such as gzip) that may be more effective, and which we have used from time to time. Appendix I A LIST OF USEFUL IRAF COMMANDS Command Use help <command name> gives instructions on using the command package lists command packages loaded epar <command name> edit the parameters for the command lpar <command name> list parameters for the command display <image> displays an image in the image window implot <image> plots lines or columns of an image in a graphic window imstat <image> gives statistics, e.g. max, min, sigma, for an image rfits <file name> convert FITS to IRAF header and pixel file wfits <image> convert an IRAF image (header and pixel) to FITS file delete <file name> delete a nonimage file (only deletes headers if used on an IRAF image file. Use imdelete on image files. imcopy <image> <dest> copy an image imrename <image> <dest> rename an image imdelete <image> deletes an image zerocombine processes and combines zero images darkcombine processes and combines dark images flatcombine processes and combines flatfield images ccdproc processes images of objects combine adds together images (useful for coadding several images) imshift shifts images (useful to align images before adding) imexamine handy quick measurement of star positions and magnitudes apphot interactive aperture photometry of star images hedit edit image headers ccdlist list images by type (object, zero, flat, etc) imhead view image headers dir, ls two different ways of listing the directory page view a page at a time of a text file ed edit a text file (using vi; ugh!) setinstrument setup IRAF for a particular site asttimes (part of convert UT or Standard time to Julian Day astutil package) APPENDIX II IRAF SETTINGS FOR CCDRED I R A F Image Reduction and Analysis Facility PACKAGE = imred TASK = ccdred (pixelty= real) Output pixel type (real|short) (verbose= yes) Print log information to the standard output? (logfile= logfile) Text log file (plotfil= plotfile) Log metacode plot file (backup = ) Backup directory or prefix (instrum= ccddb$gco/gco.dat) CCD instrument file NOTE: This will be a different file at NURO (ssfile = subsets) Subset translation file (graphic= stdgraph) Interactive graphics output device (cursor = ) Graphics cursor input (version= 2: October 1987) (mode = ql) APPENDIX III IRAF SETTINGS FOR CCDPROC AT GCO I R A F Image Reduction and Analysis Facility PACKAGE = ccdred TASK = ccdproc images = *.imh List of CCD images to correct (ccdtype= object) CCD image type to correct (max_cac= 0) Maximum image caching memory (in Mbytes) (noproc = no) List processing steps only? (fixpix = no) Fix bad CCD lines and columns? (oversca= no) Apply overscan strip correction? (trim = no) Trim the image? (zerocor= yes) Apply zero level correction? (darkcor= yes) Apply dark count correction? (flatcor= yes) Apply flat field correction? (illumco= no) Apply illumination correction? (fringec= no) Apply fringe correction? (readcor= no) Convert zero level image to readout correction? (scancor= no) Convert flat field image to scan correction? (readaxi= line) Read out axis (column|line) (fixfile= ) File describing the bad lines and columns (biassec= image) Overscan strip image section (trimsec= image) Trim data section (zero = Zero) Zero level calibration image (dark = Dark) Dark count calibration image (flat = /data/images/gcobs/flats/Flat*) Flat field images (illum = ) Illumination correction images (fringe = ) Fringe correction images (scantyp= shortscan) Scan type (shortscan|longscan) (nscan = 1) Number of short scan lines (interac= yes) Fit overscan interactively? (functio= chebyshev) Fitting function (order = 1) Number of polynomial terms or spline pieces (sample = *) Sample points to fit (naverag= 1) Number of sample points to combine (niterat= 1) Number of rejection iterations (low_rej= 3.) Low sigma rejection factor (high_re= 3.) High sigma rejection factor (grow = 1.) Rejection (mode = ql) APPENDIX IV IRAF SETTINGS FOR CCDPROC AT NURO I R A F Image Reduction and Analysis Facility PACKAGE = ccdred TASK = ccdproc images = *.imh List of CCD images to correct (ccdtype= object) CCD image type to correct (max_cac= 0) Maximum image caching memory (in Mbytes) (noproc = no) List processing steps only? (fixpix = no) Fix bad CCD lines and columns? (oversca= yes) Apply overscan strip correction? (trim = yes) Trim the image? (zerocor= yes) Apply zero level correction? (darkcor= yes) Apply dark count correction? (flatcor= yes) Apply flat field correction? (illumco= no) Apply illumination correction? (fringec= no) Apply fringe correction? (readcor= no) Convert zero level image to readout correction? (scancor= no) Convert flat field image to scan correction? (readaxi= line) Read out axis (column|line) (fixfile= ) File describing the bad lines and columns (biassec= [1:512,513:552]) Overscan strip image section (trimsec= [10:502,1:510]) Trim data section (zero = Zero) Zero level calibration image (dark = Dark) Dark count calibration image (flat = Flat*) Flat field images (illum = ) Illumination correction images (fringe = ) Fringe correction images (scantyp= shortscan) Scan type (shortscan|longscan) (nscan = 1) Number of short scan lines (interac= yes) Fit overscan interactively? (functio= chebyshev) Fitting function (order = 1) Number of polynomial terms or spline pieces (sample = *) Sample points to fit (naverag= 1) Number of sample points to combine (niterat= 1) Number of rejection iterations (low_rej= 3.) Low sigma rejection factor (high_re= 3.) High sigma rejection factor (grow = 1.) Rejection growing radius (mode = ql) APPENDIX V IRAF SETTINGS FOR ZEROCOMBINE PACKAGE = ccdred TASK = zerocombine images = @imlist List of zero level images to combine (output = Zero) Output zero level root name (sigma = ) Output sigma image (optional) (combine= avsigclip) Type of combine operation (ccdtype= zero) CCD image type to combine (process= no) Process images before combining? (subsets= no) Combine images by subset parameter? (delete = no) Delete input images after combining? (clobber= no) Clobber existing output image? (exposur= no) Scale by the exposure times? (scale = yes) Scale by the mode? (offset = no) Add offset determined from the mode? (weight = yes) Use a weighted average? (modesec= ) Image section for computing mode (lowreje= 3.) Lower sigma clipping factor (highrej= 3.) Upper sigma clipping factor (mode = ql) APPENDIX VI IRAF SETTINGS FOR DARKCOMBINE PACKAGE = ccdred TASK = darkcombine images = @imlist List of dark count images to combine (output = Dark) Output dark count root name (sigma = ) Output sigma image (optional) (combine= avsigclip) Type of combine operation (ccdtype= dark) CCD image type to combine (process= yes) Process images before combining? (subsets= no) Combine images by subset parameter? (delete = no) Delete input images after combining? (clobber= no) Clobber existing output image? (exposur= yes) Scale by the exposure times? (scale = no) Scale by the mode? (offset = no) Add offset determined from the mode? (weight = yes) Use a weighted average? (modesec= ) Image section for computing mode (lowreje= 3.) Lower sigma clipping factor (highrej= 3.) Upper sigma clipping factor (mode = ql) APPENDIX VII IRAF SETTINGS FOR FLATCOMBINE PACKAGE = ccdred TASK = flatcombine images = flat*.imh List of flat field images to combine (output = Flat) Output flat field root name (sigma = ) Output sigma image (optional) (combine= avsigclip) Type of combine operation (ccdtype= flat) CCD image type to combine (process= yes) Process images before combining? (subsets= yes) Combine images by subset parameter? (delete = no) Delete input images after combining? (clobber= no) Clobber existing output image? (exposur= no) Scale by the exposure times? (scale = no) Scale by the mode? (offset = no) Add offset determined from the mode? (weight = no) Use a weighted average? (modesec= ) Image section for computing mode (lowreje= 3.) Lower sigma clipping factor (highrej= 3.) Upper sigma clipping factor (mode = ql) APPENDIX VIII IRAF SETTINGS FOR WFITS PACKAGE = dataio TASK = wfits iraf_fil= @imlist IRAF images fits_fil= @ftslist FITS filename newtape = Blank tape? (make_im= yes) Create a FITS image? (long_he= no) Print FITS header cards? (short_h= yes) Print short header? (bitpix = 0) FITS bits per pixel (blockin= 1) FITS tape blocking factor (scale = yes) Scale data? (autosca= yes) Auto_scaling? bscale = 1. FITS bscale bzero = 0. FITS bzero
|
|
Go back | Observatory Home Page| Astronomy Home Page | | |
|