Spectroscopy Reductions using IRAF 1 Data needed for spectroscopy As for imaging, all the spectroscopy images have to be correctly processed, which means we apply bias, dark and flat corrections. The zero and the dark corrections remain the same. However, before dividing the object frame by the super-flat (produced by dome flats combined with flatcombine) we have to first correct the“super-flat” image by the response function, included in noao.twodspec.longslit, to remove wavelength dependence of the lamp spectrum. Then, we can apply the flat correction with ccdproc. A dome flat taken with an incondescent lamp shining on a screen is shown in Figure 1 This image has been corrected for dark and bias, and has already been trimmed. This Figure 1: Reduced Dome Flat image means that overscan region is not in the image anymore. In order to use response function correctly, you need to specify the region by image name[x 0 :x 1 , y 0 :y 1 ]. To do this, you can 1
27
Embed
Spectroscopy Reductions using IRAF - Union Collegebarrv/CPATH/Courses/AST230/Spectroscopy.pdf · Spectroscopy Reductions using IRAF ... Number of points in sample averaging (function
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Spectroscopy Reductions using IRAF
1 Data needed for spectroscopy
As for imaging, all the spectroscopy images have to be correctly processed, which meanswe apply bias, dark and flat corrections. The zero and the dark corrections remain thesame. However, before dividing the object frame by the super-flat (produced by dome flatscombined with flatcombine) we have to first correct the“super-flat” image by the responsefunction, included in noao.twodspec.longslit, to remove wavelength dependence of thelamp spectrum. Then, we can apply the flat correction with ccdproc.
A dome flat taken with an incondescent lamp shining on a screen is shown in Figure1 This image has been corrected for dark and bias, and has already been trimmed. This
Figure 1: Reduced Dome Flat image
means that overscan region is not in the image anymore. In order to use response functioncorrectly, you need to specify the region by image name[x0 : x1, y0 : y1]. To do this, you can
1
find the appropriate coordinates using display in ds9. In our picture, we will use the regionbounded by the red lines. If you haven’t trimmed the overscan region, then region has beset so overscan is not included in it. The parameters we used are:
(interactive = yes) Fit normalization spectrum interactively?
(threshold = INDEF) Response threshold
(sample = "*") Sample of points to use in fit
(naverage = 1) Number of points in sample averaging
(function = "spline3") Fitting function
(order = 8) Order of fitting function
(low_reject = 3.) Low rejection in sigma of fit
(high_reject = 3.) High rejection in sigma of fit
(niterate = 1) Number of rejection iterations
(grow = 0.) Rejection growing radius
(graphics = "stdgraph") Graphics output device
(cursor = "") Graphics cursor input
(mode = "ql")
Note, that first two fields calibration, normalization are always the same and thethird is the name of final normalized image produced by this function. When we runresponse, it asks us if we want to fit the normalization spectrum interactively. After an-swering yes, a new window will pop up and we will be in interactive fitting mode. As in theusual IRAFterm window, we can list all possible commands by hitting ?. In this case, theonly parameters we want to change are either :function which can be followed by its type(chebyshev, spline, spline3, legendre) and :order, followed by number. For the latter, weused :order 8. After changing these parameters, you always have to hit key f that appliesre-fit of the function and redraws this new fit on the screen. Figures 2 and 3 show the fitwith the default parameters and then after interactive fitting, including a higher order fit.
After correcting the super-flat image by the response function, the final normalized super-flat is shown in Figure 4.
Now, you are ready to normalize your images with this super-flat. First, we start withmaking list of images that we want to process. This means that this list should containimages of spectra of objects and reference spectra, such as lamps. Note that you can notuse the same image as object and reference as well. If the object and reference spectra areon the same image, a copy needs to be made so IRAF can work with separate images.
2
Figure 2: Response function fitting using de-faults. We can see that the fit is notvery good.
Figure 3: Response function fitting withhigher order fitting function :order
8. The fit is almost perfect.
Figure 4: Normalized Dome Flat image using response function.
3
2 Aperture finding
Of course spectroscopy data are only present on a specific region of the ccd which images theslit in one direction and the dispersion on the perpendicular. The target object may not fillthe slit, so we define an aperture which is a subset of the spectroscopy data. This aperturecontains signal from our target as well as a small region of sky or background to each side.Our final output will be a one dimensional spectrum whose axes are counts versus column,after integrating vertically across the aperture.
This is done via task apall that can be found in package imred.kpnoslit. Before startingthis task, IRAF needs to know the direction of dispersion axis. IRAF reads this from theimage header so we must use hedit to modify the headers of spectral images that we wantto process. Add the field DISPAXIS with value 1 (1 stands for dispersion axis running alonglines and 2 along columns).
In this paper, we will extract apertures of a spectrum of the star SAO120648, shown inFigure 5, and then some reference spectra of the lamps. Then, we are going to do wavelengthcalibration using reference spectra. Finally, we will flux calibrate our images using spectraof standard stars.
Figure 5: Spectrum of SAO120648, trimmed image.
After loading packages imred and kpnoslit,we set the apall task to its defaults usingunlearn. Apall has these parameters:
input = "" List of input images
nfind = 1 Number of apertures to be found automatically
(output = " ") List of output spectra
(apertures = "") Apertures
(format = "multispec") Extracted spectra format
(references = "") List of aperture reference images
(profiles = "") List of aperture profile images\n
(interactive = yes) Run task interactively?
(find = yes) Find apertures?
(recenter = yes) Recenter apertures?
(resize = yes) Resize apertures?
(edit = yes) Edit apertures?
(trace = yes) Trace apertures?
(fittrace = yes) Fit the traced points interactively?
(extract = yes) Extract spectra?
4
(extras = yes) Extract sky, sigma, etc.?
(review = yes) Review extractions?\n
(line = INDEF) Dispersion line
(nsum = 10) Number of dispersion lines to sum or median\n\n
(lower = -5.) Lower aperture limit relative to center
(upper = 5.) Upper aperture limit relative to center
(apidtable = "") Aperture ID table (optional)\n\n# DEFAULT BACKG
(b_function = "chebyshev") Background function
(b_order = 1) Background function order
(b_sample = "-10:-6,6:10") Background sample regions
(pfit = "fit1d") Profile fitting type (fit1d|fit2d)
(clean = no) Detect and replace bad pixels?
(saturation = INDEF) Saturation level
(readnoise = "0.") Read out noise sigma (photons)
(gain = "1.") Photon gain (photons/data number)
(lsigma = 4.) Lower rejection threshold
(usigma = 4.) Upper rejection threshold
(nsubaps = 1) Number of subapertures per aperture
(mode = "ql")
You don’t need to worry about most these parameters, as you are going to modify theminteractively. The only parameter that can save you some work is ylevel which automati-cally defines the aperture width based on the ratio of peak intensity and this user-suppliedvalue. Depending on background level, a sensible value should be chosen. For our spectra,apertures are typically automatically defined too narrow so you want to modify ylevel tosmaller value within the order of 0.01 or similar. You will find a good value after someexperience with apall. You can always modify it interactively, but it is good to have thisvalue correct so you don’t to do many modifications during reduction. Don’t forget to setGAIN and READOUTNOISE correctly according to our ccd chip. For the AP7, gain is 5 andreadout noise is 15.
When running apall on our image, answer yes to find aperures (or y) and then it needs toknow how many apertures you want (normally one). Type yes to the remaining questions.The IRAFterm window pops up and we are in editing mode. You may list all possiblecommands with ?. In Figure 6
you can see the aperture found by IRAF, which is bounded by two white bars and tinybackground regions. If you want to change the size of this aperture, you may move themouse to the new left boundary and hit u, followed by hitting u on the new boundary onthe right. To delete it and start over, move your mouse near the existing aperture anddelete by typing d. Then, new aperture is found by hitting f and you may start over withresizing. To fit background, you hit b and you proceed to background fitting. For objects,background is usually well-determined and you can leave it as it is. However, the backgroundof reference spectrum usually needs some modifications. To change background regions,in the irafterm window type: :sample valueleft,min : valueleft,max, valueright,min : valueright,max
and then followed by hitting f to see changes on the screen. Once you are satisfied withbackground region, we exit with q and you are back in aperture finding window. As well,after aperture is set properly, continue by hitting q.
Answer yes to questions if you want to trace aperture interactively and if you want tofit traced positions. Now, you can a function to the aperture in IRAFterm. If you examine
6
Figure 6: Spectra aperture extracting
Figure 7 in detail, you may see that y axis corresponds to lines and x axis to columns.This means that you are correcting for misalignments of camera and spectrograph. In otherwords: by that, we correct if the slit was not placed orthogonally according to the image.Thus, this fit has to be always linear
Sometimes, if the fit of the spectrum contains many error points, you may want modifyfitting by adding some extra points. We are showing example of spectra which went reallybad in Figures 9 and 10. The left side of these images contains a lot of error points thatnegatively influence the fit and fit gives us irrational values. Original image, where theregions of error points is labeled is shown in Figure 8
The areas where new points were added are indicated in Figure 10. To do this, you movemouse over the regions that are at the ends of the line and at each region, you add newfitting point by hitting a and then typing weight. Weight has to be very big in order toaffect fit, values in order of hundreds may work well, or you may add more points at theregion. To delete points hit d and nearest point to the cursors will be deleted. This anotherway how to fix tracing. To see how new points affected the fit, hit f and re-fit will be doneand replotted on the screen.
7
Figure 7: Aperture fitting window
Figure 8: The region that negatively influenced fit for tracing the aperture
When the fit is OK, you may exit with q. You will be asked if you want to write apertureto the database and your answer should yes. Next question is if want to extract aperturespectra for this image, answering yes pops up last question if you want to review extractedspectra. Type yes and you can see extracted absorption spectra which is not calibrated yes.Spectra extracted from the image shown in Figure 5 is shown in the Figure 11. This is nota final spectra because it is not wavelength calibrated yet.
8
Figure 9: Tracing of aperture of spectra with many error points on the left side wherespectrum is very weak
9
Figure 10: To correct for error points that negatively influence the fit, we need to add someextra points with very high weight
10
Figure 11: Extracted uncalibrated spectra
11
2.1 Aperture finding for lamp spectra
First, we need to reduce our reference spectra (given by our Hg and Ne lamps) in thesame way as we did object spectra. A reference image is shown in Figure 12. The strong
Figure 12: Reference spectra image; lamp spectra are marked
spectraum in the middle of the image is the absorption spectrum of Saturn, but in thiscase, we are going to extract lamp spectra of dispersion lines either above or below Saturn’sspectrum. We can use IRAF to define image regions to extract lamp spectra even if thereis a strong object spectrum in the image. In this particular case, we found that the upperlamp spectra is roughly between lines(rows) 190 - 240 so we specified apall input images as:image name[*,190:240]. Doing the same procedure as with object spectra, up to the pointof resizing the default apertures. In Figure 13, the results IRAF found can not be used atall, and we need to modify them interactively. Using u, we change the aperture width andusing b, we jump to background fitting mode. There, by using the :sample command, wemodify the background region, with results shown in Figure 14.
Next, we need to trace the appertue: fitting the function that describes rotation (mis-alignment) of the dispersion axis. As previously mentioned, this fit should always be linear.In Figure 15, we show the fit of this trace. In this Figure, notice that it is not necessaryto fit all the points. It is more important to fit the trend or slope of the aperture. In thisexample, we see that the center of the aperture is rising from line 11, at column 0, to line17, at column 500. This gives a slope of 1.6%. The result can be seen in Figure 16, showingthe spectrum of the Neon lamp.
12
Figure 13: Extracting aperture of lamp spectra, automatic results need to be manuallymodified
Figure 14: Extracting aperture of lamp spectra, final fit after corrections
13
Figure 15: Tracing aperture of lamp spectra
Figure 16: Review of extracted spectra of the reference Neon lamp
14
3 Wavelength calibration
Wavelength calibration provides a transformation bewteen coordinate along the dispersionaxis in units of pixels to wavelength values in units of Angstroms or nm. For our spectra, thedispersion axis is horizontal, so wavelength calibration means transforming column numberto wavelength. For wavelength calibration, we begin with reference or lamp spectra and weassign correct wavelength values to two or more peaks (assuming emmision line spectra).Naively, there would be a linear relationship, but in practice, a higher order fit is usuallyneeded. Many lines are not needed because IRAF has line lists and only needs a head start.
3.1 Identify spectral lines
Function which is used to assign wavelength values to peaks in object spectra is calledidentify and we can find it in package noao.onedspec. When the aperture of the spectrais found and traced, these information are stored in the image with extension .ms anddatabase folder. We used CCD Image 33.fit so we will run identify CCD Image 33.ms.Running identify pops up the same window as in Figure 16 and we are able to assignwavelength values to lamp spectral lines. Note that we need to provide IRAF a list ofspectral lines in the field coordlist of parameters of identify. You can find it in directorywith scripts. Move the mouse cursor near to spectral line and hit m, identify asks you forwavelength, type its value and hit enter. You can do that for some other lines and then typef to fit the wavelength calibration function. If there are some points that do not agree withfit you may remove them (hitting d deletes the nearest line to the cursor) or reconsider ifidentification of lines was correct and if not, modify it. When satisfied, you exit with q andinformation about spectra is written to database. Parameters used are shown here:
After finding dispersion solution for the lamps spectra, we need to apply it to object images.The link is provdided by keyword REFSPEC1=comparison image name in the header of objectimages. What you need to do is to prepare a list of images containing object spectra (with.ms extension)and then modify their header by hedit, adding name of the image containingcomparison spectrum(with .ms extension as well!).
3.3 Apply dispersion solution to objects
Once the object images have link to reference spectra, we can apply a dispersion solutionto them and finally calibrate them for wavelength. The only thing you need to do is to runtask dispcor on .ms images of objects. You can view your solution by using splot task.Our solution is shown in Figure 17.
16
Figure 17: Wavelength calibrated spectra
17
4 Flux calibration
We are going to flux calibrate our images using spectrum of Standard stars. We assumethat object spectra (including standard stars) are already wavelength calibrated. We loadpackage imred and then we edit task kpnoslit with epar. We need to tell it folder ofstandard stars data. As a calibration here, we use star Alkaid, with identification numberHR5191 or SAO120648. In the Appendix A, you can find lists of standard stars and theirfolders. Our values of kpnoslit are shown here;
Running this task pops up fitting window, shown in Figure 18.
Figure 18: Sensitivity function fitting
We do a fit as usual until we are satisifed with our results. List of all possible commandsis given by hitting ?. Once the fit is done, you exit hitting q and we are ready to maka afinal step: run fucntion calibrate. All you need is to prepare a list of images (dispersioncorrected) and then using epar calibrate tell it to process this list, possibly adding someextension to the output images.