9. MODELING THE APERTURES

Before the flat field can be normalized and the program spectra can be "extracted", the locations of the echelle orders (called apertures until the wavelength calibration is complete) need to be mapped on the CCD frames. This modeling is vitally important, since all further processing is based upon how well the 2D positions are modeled.

The proof of the model is the success of the spectral extraction process. If one is using a nearly full format (2000+ columns), then the curved shape of the apertures along the dispersion direction is great enough that even optimal extraction algorithms are sensitive to the aperture model.

Each aperture is simply modeled by 5 parameters:

  1. an identification number,

  2. an ordered pair reference coordinate (col,line) [pix], which defines its cross dispersion centroid position at a reference column of one's choosing,

  3. an upper and a lower size (width) [pix] with respect to the cross dispersion profiles centroid,

  4. a function whose values are ordered pair offsets (Delta_col,Delta_line) from the reference coordinate and which describe fully the locations of each apertures cross dispersion centroids along the dispersion, and

  5. an upper and a lower background region [pix] which are relative coordinates with respect to the aperture centroids.
One must be very willing to work with this step of the reduction. At anytime during later processing, one may discover that the aperture model needs ``tuning". Through experience, many have learned that most problems have been remedied by fine--tuning the aperture model.


GETTING TO KNOW THE APEXTRACT PACKAGE

The noao twodspec apextract package is a series of tasks designed to ``find", ``size", and ``trace" echelle apertures. The meaning of these terms will be revealed in the subsequent discussion.

The help for apextract reads:

                          noao.twodspec.apextract

       apall - Extract 1D spectra (all parameters in one task)
   apdefault - Set the default aperture parameters and apidtable
     apdemos - Various tutorial demonstrations
      apedit - Edit apertures interactively
      apfind - Automatically find spectra and define apertures
       apfit - Fit 2D spectra and output the fit, difference, or ratio
   apflatten - Remove overall spectral and profile shapes from flat fields
      apmask - Create and IRAF pixel list mask of the apertures
 apnormalize - Normalize 2D apertures by 1D functions
  aprecenter - Recenter apertures
    apresize - Resize apertures
   apscatter - Fit and subtract scattered light
       apsum - Extract 1D spectra
     aptrace - Trace positions of spectra
with the additional help topic files:
   apbackground - Background subtraction algorithms
     approfiles - Profile determination algorithms
     apvariance - Extractions, variance weighting, cleaning, and noise model
        package - Package parameters and general description of package
If one really desires to be familiar with the operations involved with aperture modeling, one should peruse the help files. For the process of "finding" apertures, it is helpful to read the center1d help file, which describes an xtool used for locating the centroid of a peaked distribution (like the cross dispersion illumination profile of an echelle aperture!). Additionally, F.~Valdes of NOAO has written The IRAF APEXTRACT Package and several revision summaries. These guides through the apextract package are available via the Internet (ftp://iraf.noao.edu/iraf/docs). There is a plethora of other information as well.

The task apall is a generalized task that lets one avoid a maze of "hidden" parameter settings. It is a driver that invokes the above listed tasks with a single parameter set.

The Aperture Game Plan

Here, the overall plan to obtain "good" models of the apertures is outlined:

  1. Find the apertures. With the center1d algorithm, the apall task will locate the cross dispersion centroids of the apertures along a single "reference" column. This process is sensitive to several input parameters. One can interactively modify (add, delete, recenter, renumber...) the automated result in apall editing mode. However, if one's first attempts are way off, one should bail out and intelligently reset the finding input parameters.

  2. Size the apertures. During the finding process, the aperture cross dispersion widths can either be automatically determined or be "hard--wired" by setting certain input parameters. Again, one can interactively modify the automated result.

  3. Set the aperture background regions. This step requires interactive editing (for the Hamilton). The troughs between apertures contain both background scattered light and a non--negligible percentage of overlap from nearest neighbor apertures. The extraction of the spectra is quite sensitive to the definition of these regions. Also, one sets background fitting parameters, such as sigma rejections, fitting function, etc.

  4. Trace the apertures. Once one is satisfied that the aperture centroids are well determined along the reference column, one needs to map them in the dispersion direction. One aperture at a time, one will be placed in icfit mode with plots of the pixel verses pixel positions of the aperture centroids. One will fit a polynomial or spline curve to these as a model describing the full location of the aperture on the data frame.

Once an aperture "model" is constructed, apall will create a "database" subdirectory in which a file called "apimagename" will store the aperture models. This model may be applied to other images in the data set or even other data sets and then adjusted using apall.

On Filters, Light Paths, and Apertures

For a particular instrumental setting, apertures locations and sizes are a function of the light path through the instrument. If one uses different filters for an exposer, the different light paths will result in slightly shifted apertures. Moreover, the light path for the Quartz Lamp is not identical to that of objects seen through the telescope. In other words, the Quartz apertures will not identically map those of the program data, as illustrated in Fig.~9--1.

\irafplot{fig09-1.ps} \figurecap{9--1}{Several cross dispersion profiles are plotted, showing their locations along column 1100. The Decker setting is the same as used for the program data. Note that the aperture positions of the Quartz frame (solid lines), which was exposed through bg12 and bg13 filters, are shifted from the aperture positions of the water star (dashed lines), which was exposed using no filters.}

Using an Aperture Template Frame

To ensure that the process of locating aperture cross dispersion centroids is robust, one should use a high--signal low--feature frame. Often, the program data do not satisfy these criteria and one may choose to use an "aperture template" frame, one which does satisfy the criteria. However, any aperture template frame should have been exposed with as similar a light path as possible to that of the program data.

The frame that best meets the former criterion is the Quartz frame. However, it is difficult to obtain uniformly high--signal Quartz frames without filters (due to the CCD QE blue roll--off) and the Quartz Lamp light path is not so similar to that of the program data. Thus, the Quartz frame does not meet the latter criterion very well. However, the water star does, and depending upon its spectral features, it may satisfactorily meet the former criterion as well.

Ultimately, the choice for the aperture template is a trade--off of these concerns and the amount of fine tuning of the aperture model one wishes to perform. Aperture models based upon the Quartz frame will require shifting (recentering) when applied to the program data. However, the centroid locations and sizes (widths) will be very robust making the modeling process quick and easy, though the sizes may be slightly large and may also require adjustment. Aperture models based upon the water star may be more difficult and tenuous, since the centroid locations may not be as cleanly determined. Moreover, one must be careful defining the sizes since absorption or emission features located on the reference column will misrepresent the cross dispersion profile sizes.

For the example here, the Quartz frame will be used as the aperture model template. Then, a few fine tuning steps will be performed while applying the model to both the calibration flat field frame (recall, this frame has wide apertures) and the program data. Consider the following steps:

  1. Automatically find and size the apertures of the Quartz frame. Interactively trace the centroids in the dispersion direction. Save the model to the database.

  2. Modify the Quartz model for the calibration flat field frame: interactively size the apertures; interactively set the background parameters. Save this model to the database.

  3. Modify the Quartz model for the water star, program data, and arcs. Using the water star, automatically recenter the aperture reference coordinates, interactively tuning some of these new locations if needed. Interactively edit the sizes as needed. Interactively set the background parameters. Save this model to the database.
The step in which one applies these models to the individual frames is performed during the extraction process.


PREPARING FOR APALL

Before beginning, use display to visually inspect the Quartz frame apertures to estimate the number of apertures, an average aperture separation in pixels, and an average aperture width in pixels. At this point, these values are "defaults", so one should not bother attempting to measure them better than +/- 1 pixel (do not invest a great deal of time determining them). In general, the apertures are closer together in the red and further separated toward the blue.

The important values to obtain before modeling the template apertures are

  1. a good choice of a reference column for the reference coordinate of each aperture (no blemishes or spectral features and few cosmic rays),

  2. a decent measure of the cross dispersion centroid separation (on the reference column) of the two closest apertures, and

  3. the peak value of the lowest signal aperture (on the reference column).
When choosing the reference column, select one near the center of the frame that has no cosmic rays with intensity greater than the lowest signal aperture, if possible.

If one is using the Quartz frame as a template, there is one more useful preliminary measurement. Attempt to determine the relative sizes (widths) of the Quartz and water star apertures. In particular, one may find that the widths of the water star apertures are smaller than those of the Quartz. Quantitatively, the water star widths may be (for example) equal to the 20% peak level widths of the Quartz. In other words, after one "visually" sets the zero point at the interorder values and measure the Quartz widths 20% up to the aperture peaks, one will find that these widths are equivalent to the baseline widths of the water star. When one applies the Quartz frame aperture models to the water star, one may find that this knowledge may save time and interactive editing steps.

Getting the Template Aperture Model

Having obtained the preliminary quantities outlined above, epar into apall and set the parameters: (below is only a partial listing of the pertinent parameters):

PACKAGE = echelle
   TASK = apall

input   =            quartz.bl  List of input images
(output =                     ) List of output spectra
(format =              echelle) Extracted spectra format
(referen=                     ) List of aperture reference images
(profile=                     ) List of aperture profile images

(interac=                  yes) Run task interactively?
(find   =                  yes) Find apertures?
(recente=                   no) Recenter apertures?
(resize =                  yes) Resize apertures?
(edit   =                  yes) Edit apertures?
(trace  =                  yes) Trace apertures?
(fittrac=                  yes) Fit the traced points interactively?
(extract=                   no) Extract spectra?
(extras =                   no) Extract sky, sigma, etc.?
(review =                   no) Review extractions?

(line   =                 1100) Dispersion line
(nsum   =                    5) Number of dispersion lines to sum

                                # DEFAULT APERTURE PARAMETERS

(dispaxi=                    1) Dispersion axis 1=along lines, 2=along columns
(lower  =                  -5.) Lower aperture limit relative to center
(upper  =                   5.) Upper aperture limit relative to center
(apidtab=                     ) Aperture ID table (optional)

                                # DEFAULT BACKGROUND PARAMETERS

(b_funct=             legendre) Background function
(b_order=                    2) Background function order
(b_sampl=                     ) Background sample regions
(b_naver=                   -1) Background average or median
(b_niter=                    3) Background rejection iterations
(b_low_r=                   3.) Background lower rejection sigma
(b_high_=                   3.) Background upper rejection sigma
(b_grow =                   0.) Background rejection growing radius

                                # APERTURE CENTERING PARAMETERS

(width  =                   5.) Profile centering width
(radius =                   5.) Profile centering radius
(thresho=                 250.) Detection threshold for profile centering

                                # AUTOMATIC FINDING AND ORDERING PARAMETERS

nfind   =                   92  Number of apertures to be found automatically
(minsep =                  10.) Minimum separation between spectra
(maxsep =                 100.) Maximum separation between spectra
(order  =           increasing) Order of apertures

                                # RESIZING PARAMETERS

(llimit =                INDEF) Lower aperture limit relative to center
(ulimit =                INDEF) Upper aperture limit relative to center
(ylevel =                  0.2) Fraction of peak intensity for automatic wid
(peak   =                  yes) Is ylevel a fraction of the peak?
(bkg    =                  yes) Subtract background in automatic width?
(r_grow =                   0.) Grow limits by this factor
(avglimi=                   no) Average limits over all apertures?

                                # TRACING PARAMETERS

(t_nsum =                    4) Number of dispersion lines to sum
(t_step =                   15) Tracing step
(t_nlost=                    4) Number of consecutiv times profile is lost
(t_funct=              spline3) Trace fitting function
(t_order=                    3) Trace fitting function order
(t_sampl=                    *) Trace sample regions
(t_naver=                    1) Trace average or median
(t_niter=                    4) Trace rejection iterations
(t_low_r=                  2.5) Trace lower rejection sigma
(t_high_=                  2.5) Trace upper rejection sigma
(t_grow =                   0.) Trace rejection growing radius
The task is run interactively with the params (interac = yes), (find = yes), (edit = yes), (resize = yes), (trace = yes), and (fittrac = yes) set. The "line" parameter is set to column 1100. This is the reference column on which the "search" for the aperture will occur and their centroids will be centered. Recall, that one will need to pay attention to cosmic rays present on this column, for they can fool apall into thinking it has found an aperture (see below). The choice for "line" accounts for good signal strength on all apertures and no CCD blemished along that column. If one leaves "line" as the default `INDEF', then apall uses the center column of the image. The "nsum" parameter gives the number of columns apall should add together centered on "line" while finding the aperture peaks. The larger this number the better the peaks are defined statistically, but "nsum" should be no larger than around 5 so that the curvature of the apertures does not skew the peaks off their true centers.

The default aperture parameters (lower = -5.) and (upper = 5.) set the default widths of the apertures in pixels with respect to the aperture center as determined by apfind and center1d. This choice was made for a 2.5" Decker. These parameters are actually inconsequential, since we are going to let apall determine the sizes of the apertures for us (eg.~"resize = yes"'). However, the defaults parameters should be set to some overall characteristic aperture width. Though the parameter (dispaxi = 1) is already defined in the image header card DISPAXI, provided one instructed lickbase to insert it, set it to `1'.

The default background fitting parameters should be set now. However, leave the "b_sampl" field blank, since we are going to interactively insert these aperture by aperture in the following steps. The background settings are used only during the profile fitting and spectra extraction processes. All other processes claiming to perform "background" subtraction do not key off "b_sampl", they simply use the first local minima in the cross dispersion direction of the current aperture! Set the function to a polynomial with (b_order = 2). Set the rejection iterations to at least (b_niter = 3).

The aperture centering parameters actually are inputs for the xtool package center1d task. This task convolves a saw--tooth function with the aperture cross dispersion profiles (bell--shaped distribution) to determine their centroids. The help file for center1d has a clear graphical illustration of the meaning of the following parameters and explains the centering process very clearly. Together, the params (in pixels) (width = 5.) and (radius = 5.) define the limits of integration for the convolution integral and the limits for determining the continuum "intensity" (background). It is effective to choose "width = average width of apertures" and "radius = width". This forces the centering routine to stay on the aperture while giving it the entire aperture to perform its centering. Too narrow a width results in decreased accuracy. For the 2.5" Decker setting, "width = radius = 5" pixels gives A=7.5 (the +/- limits for determining the surrounding "continuum") and B=12.5 (the limits of the centering convolution integral). This combination seems to result in well centered apertures. Very important is the "thresho" parameter. This should be set to a value significantly less than the peak of the dimmest aperture and (if possible) significantly greater than the height of any cosmic rays present on the reference column, "line".

The automatic finding and ordering parameters include "nfind", which is a query parameter (all parameters in the epar files that do not have a closed ")" are run time query parameters), and should be set equal to or slightly greater than the number of real apertures. It is best to have counted apertures using an image display. The param (minsep = 10.) is set to be about 2/3 the minimum separation of the two closest apertures. This parameter is quite important. If it is set too small, apall tends to locate "apertures" in the interorder regions. If it is too large, apall will simply skip real apertures. The param (maxsep = 100.) may be set to any number greater than the aperture peak to peak separations. The results are quite insensitive to this parameter. For the Hamilton, set (order = increasing). During wavelength calibration, the task ecidentify will attempt to determine the offset between model aperture number and true order number.

The resizing parameters are set such that the width of each aperture will be defined by its width at 20% of the peak value (per the above water star discussion). For this purpose, the params (llimit = INDEF) and (ulimit = INDEF) must be set. The param (ylevel = 0.2) and (peak = yes) dictate the percent of peak intensity at which the width is automatically sized. Critical to success is the param (bkg = yes), which defines the adjacent interorder minima as the zero point for measuring the peak values. The automatic sizing fails without this. (Actually, the routine uses the first local minima in the cross dispersion direction of the current aperture. For this reason, automatic sizing works for the Quartz frame, but not for the wide Decker flat frame. The flat field has structure across the aperture, so this "background" determination fails, resulting in meaningless aperture widths).

The tracing parameters "t_nsum", "t_step", and "t_nlost" are quite important, since these parameters cannot be adjusted during interactive tracing (argh!). Set (t_nsum = 3), which makes tracing more robust near the CCD edges and for weak apertures. Setting "t_nsum" to `1' may result in confusion that cannot be remedied without aborting! Setting "t_nsum" to a much larger number is not recommended since this results in a "blurred" position. The tracing step (t_step = 15) is a critical parameter. Usually, wild difficulties can be remedied by lowering this parameter (but do not rule out enlarging it!). So that the trace doesn't jump orders or behave too crazy, set (t_nlost = 4), never higher. This tells the braille method tracing routine to bail if it is confused as to the position of the present aperture 4 tracing steps in a row. In the interactive tracing mode, one will have the flexibility of modifying the fitting function, the function order, the sample region, the number of points to average, the rejection iterations, the rejection sigma, and the rejection growing radius (see the aptrace help file for definitions). The function param (t_funct = spline3) is a most flexible fitting model with (t_order = 3). One may wish to tighten the sigma to +/- 2.5. It is always good to have several rejection iterations, otherwise bad points will not be excluded from the fit.

(A note about responding to the interactive prompts: These prompts may be answered individually with the lower case responses "yes" or "no" or answered for all further prompts with the responses "YES" or "NO". Note that answering "YES" or "NO" to an aperture prompt applies to all further apertures, whereas such response to a prompt concerning the frame as a whole applies to all further frames. When an aperture is not fit interactively the last set of fitting parameters are used, not the defaults set in the epar file.)

Upon executing apall the following prompts appear with the defaults in ():

Find apertures for quartz.bl?  (yes): 
Number of apertures to be found automatically (92): 
Resize apertures for quartz.bl?  (yes):
Edit apertures for quartz.bl?  (yes):
Just hit [CR] for each of the above. After several seconds the plotting window will display the cut along the reference column "line" with a statement such as
  aperture = 1  beam = 1  center = 16.51   low = -3.92  upper = 3.78
One is now in edit mode. The current aperture is 1, which has reference coordinate (1100,16.51) with automatically determined lower and upper widths of -3.92 and 3.78 pixels, respectively. As shown in Fig.~9--2, the graph will be very busy and compressed. Across the top are aperture markers labeled with the aperture number. Use the "window" commands to navigate about the graph and visually inspect the aperture assignments. Since the keystrokes are now set for apedit, one must actually type "w" to enter into window mode. The most useful window commands are the "we"--"e" (expand) keys. Fig.~9--3 shows a windowed region of Fig.~9--2. Typing "wa" will always return one to the original plot. If IRAF just beeps or the plot starts doing funny things, type [CTRL--C] and then a slow series of "?"s until a beep is heard. Type "wa" or "?". All should be back to normal.

\irafplot{fig09-2.ps} \figurecap{9--2}{A full window plot of the aperture locations centered along column 1100 is very busy. The hash marks across the top are where apall has centered the apertures along the reference column. The "error" bars give the upper and lower widths that apall determined using the "ylevel" resizing parameter.}

\irafplot{fig09-3.ps} \figurecap{9--3}{By using the "window" commands, one can zoom the plot to visually examine the aperture definitions. The model shown here is highly satisfactory.}

The aperture assignments should be satisfactory. With the Quartz frame, the model should be right the first time if the input parameters are set correctly. If they are hopelessly wrong, one can abort (type "I") and reset the apall parameters based upon these results.

If however, the model looks good, but with a few blemishes, one can modify them to one's choosing in the apall editor. To get a list of helpful editing commands, type "?". As with all interactive modes, practice is the key. However, editing the apertures is particularly demanding until one gets the knack. Some most useful commands include:

    ?    Print help
    a    Toggle the ALL flag
    b an Set background fitting parameters
    d an Delete aperture(s)
    g an Recenter aperture(s) (see APRECENTER)
    l ac Set lower limit of current aperture at cursor position
    m    Define and center a new aperture on the profile near the cursor
    n    Define a new aperture centered at the cursor
    o  n Enter desired aperture number for cursor selected aperture and
         remaining apertures are reordered using apidtable and maxsep
         parameters (see APFIND for ordering algorithm)
    q    Quit
    r    Redraw the graph
    u ac Set upper limit of current aperture at cursor position
    w    Window the graph using the window cursor keys
    y an Set aperture limits to intercept the data at the cursor y
         position
    z an Resize aperture(s) (see APRESIZE)
    .    Select the aperture nearest the cursor for current aperture
    +  c Select the next aperture (in ID) to be the current aperture
    -  c Select the previous aperture (in ID) to be the current aperture
    I    Interrupt task immediately.  Database information is not saved.
Some of these prompt for an aperture number, some instantly act upon the "current aperture", and some act upon the aperture nearest the cursor. It is always safest to define the aperture of interest as the current aperture with ".", and then perform an editing operation. After any operation, type "r", to update the plot. To edit all apertures simultaneously, type "a". This key toggles "ALL" mode; any following operation on any single aperture is applied to all apertures. When finished , type "q", following which the prompt will appear
Trace apertures for quartz.bl?  (yes):
Fit traced positions for quartz.bl interactively?  (yes):
Upon [CR]s, apall will trace the apertures along the dispersion direction outputting messages like:
Oct 11  9:49: TRACE - Trace of aperture 1 in quartz.bl lost at col 1940
Oct 11  9:49: TRACE - Trace of aperture 1 in quartz.bl lost at col 1975
Oct 11  9:49: TRACE - Trace of aperture 1 in quartz.bl recovered at col 2010
Oct 11  9:49: TRACE - Trace of aperture 1 in quartz.bl lost at col 2045
Fit curve to aperture 1 of quartz.bl interactively  (yes):
Upon [CR], a line verses column plot of the aperture centroids will be plotted and one will be in interactive mode. One is now in control over the function fit via icfit.

\irafplot{fig09-4.ps} \figurecap{9--4}{The aperture tracing step is performed interactively. One by one, set the fitting parameters to line verses column plots of the apertures. Shown here is how the fit has jumped over a bad region of the CCD along aperture 59. A total of 2 points have been rejected from this 4th iteration on the fit.}

During the tracing process, never change the plotting window via the "graph keys". This seems to confuse the tracing algorithm, and one may be unable to recover. To apply the fit and move to the next aperture, type "q". If one has many apertures, one may wish to allow apall to finish the job automatically. Thus, after doing a few to several apertures, at the next prompt one may type "NO", which will apply the last settings to the remaining apertures. However, it is not recommended one does this if the last aperture "falls" off the frame. In this case, one obtains a "singular solution". This is no problem. The way to handle these partial apertures is to lower the fitting function to a 2nd order polynomial, eliminating wild un--constraint. When apall returns one will be prompted:

Write apertures for quartz.bl to database  (yes):
Upon [CR], the locations, sizes, and tracings of the apertures will be saved in the file "apquartz.bl" in the "database" subdirectory. The entry for each aperture will look something like:
# Fri 21:49:29 10-Sep-93
begin   aperture quartz.bl 1 1100. 16.50628
        image   quartz.bl
        aperture        1
        beam    1
        center  1100. 16.50628
        low     -1099. -3.92
        high    947. 3.78
        background
                xmin -5.
                xmax 5.
                function legendre
                order 2
                sample
                naverage -1
                niterate 3
                low_reject 3.
                high_reject 3.
                grow 0.
        axis    2
        . . .
        . . .
        . . .
followed by the coefficients of the aperture tracing function.

Tailoring the Aperture Model for the Flat Field

Except for the Decker setting, the calibration flat field frame was exposed under the same conditions as the Quartz frame. We will apply the Quartz aperture model to the flat field, but we will interactively define the sizes and background sample regions. The issues at hand are setting the aperture widths accurately, and setting the background sample regions accurately. Again, epar into apall and set the parameters for interactive editing (partial listing -- no finding, centering, sizing or tracing parameters will be invoked since they are all taken from the Quartz model):

PACKAGE = echelle
   TASK = apall
    
input   =             flatcomb  List of input images
(output =                     ) List of output spectra
(format =              echelle) Extracted spectra format
(referen=            quartz.bl) List of aperture reference images
(profile=                     ) List of aperture profile images

(interac=                  yes) Run task interactively?
(find   =                   no) Find apertures?
(recente=                   no) Recenter apertures?
(resize =                   no) Resize apertures?
(edit   =                  yes) Edit apertures?
(trace  =                   no) Trace apertures?
(fittrac=                   no) Fit the traced points interactively?
(extract=                   no) Extract spectra?
(extras =                   no) Extract sky, sigma, etc.?
(review =                   no) Review extractions?
The input frame is the calibration flat field frame and the aperture model is (referen = quartz.bl). Note that only (interac = yes) and (edit = yes). The remainder of the package parameters will not be used. Upon ":g" one will be prompt to edit the aperture parameters. Hit [CR] to obtain a plot similar to Fig.~9--2. Window in closely to see that the aperture widths are too narrow, but that the centers correspond quite well (see Fig.~9--5). Remember, in interactive mode always type keystrokes slowly and deliberately.

Note the jaggies near the aperture peaks. It is due to these "features" that resizing the flat field apertures must be performed interactively. If the resizing routine was more intelligent, meaning it didn't assume that the first local minimum in the cross dispersion direction was the aperture edge, then this entire interactive process could be automated. The resizing routine allows one to automatically set an average width over all apertures, but this has normally results in entirely unsatisfactory normalization of the flat field.

Interactively Resizing Aperture Widths

Stepping through each aperture, one will use the "y" option of the editing keystrokes to set the widths. The most useful apedit commands for this include:

    ?    Print help
    q    Quit
    r    Redraw the graph
    u    Set upper limit(s)    
    l    Set lower limit(s)
    w    Window the graph using the window cursor keys
    I    Interrupt task immediately.  Database information is not saved.
    y    Y level limit(s)
though one may almost exclusively use the "w" and "y" commands.

\irafplot{fig09-5.ps} \figurecap{9--5}{The windowed region of "flatcomb" centered along column 1100 shows the aperture widths. Here, apertures 84, 85, 86, 89, and 90 have been manually resized using the "y" key in edit mode. Apertures 87 and 88 have not yet been edited, and are still the size input by the reference model "quartz.bl".}

As shown in Fig.~9--5, window into a region of 5 or 6 aperture cross sections. Place the cursor within the defined area of a given aperture at the base of the profile, where the intensity level roughly represents the aperture cross dispersion extremes. Type a "y". The "error bar" defining the aperture size will expand to a more appropriate width. Type an "r" to redraw a clean graph. As one proceeds, the apedit output will look something like:

  aperture = 84  beam = 84  center = 1393.65  low = -8.57  upper = 9.33
  aperture = 84  beam = 84  center = 1393.65  low = -8.57  upper = 9.33
  aperture = 85  beam = 85  center = 1416.44  low = -9.04  upper = 9.43
  aperture = 86  beam = 86  center = 1439.42  low = -9.11  upper = 9.46
  aperture = 89  beam = 89  center = 1509.63  low = -8.99  upper = 9.36
  aperture = 90  beam = 90  center = 1533.48  low = -8.38  upper = 8.97
Repeat this step for all apertures. Before moving on to the next step of setting the background, be sure the results are satisfactory.

Interactively Setting Aperture Background

This step is very intensive. One will always need to be well focused on particular regions during this process. As before, center the cursor within the defined area of a given aperture, this time type "b". Now in icfit mode, one will see an expanded plot in relative coordinates with the origin at the aperture center as illustrated in Fig.~9--6. The complaint "Warning: No sample points for fit" will appear (if you left the "b_sampl" parameter blank), which can be ignored. Window this plot to expand around the current aperture. (If one needs to re--window and type "wa", don't be alarmed when the plot is expanded out to the entire aperture format. Simply window back in, step by step.)

\irafplot{fig09-6.ps} \figurecap{9--6}{Following the keystroke "b" within aperture 3, the following plot will appear and one will be in the icfit routine. Use the "s" keystroke to interactively define the "sample" parameter with the cursor. One may perform all the functions of icfit, including examination of the fit, as shown here.}

The background sample should basically be the inter--order minima, as many pixels wide as one deems appropriate. The lower numbered apertures are basically over--lapped, so the sample range may be only a fraction of a pixel! (This works.) To set the background sample region, use the "s" key, setting the lower limit of the region at the cursor position. One will be prompted with "again:". Move the cursor to the upper limit and type "s" again. An sideways "error bar" should appear where the sample has been defined (if the sample is a fraction of a pixel it will be a single vertical bar, as shown in Fig.~9--6). Now repeat, putting a sample region on the other side of the aperture.

At anytime, to undefine the sample closest to the cursor, type "z". To totally clear the sample regions, type ":sample *". Typing ":sample" will output something like

    sample =  -7.948311:-7.287847 7.371423:7.857282
The vertical bar may not always appear. In such cases, upon typing "f", one will note this defined sample will not be included in the fit, even though the sample is clearly defined as revealed by typing ":show" or ":sample". This happens when the selected sample region lies within the upper and lower limits of the current aperture. For the former one may need to "q" out of icfit and back into editing mode to redefine the width with the "y" key, making it a bit narrower, and then type "b" to return to background fitting. This iterative process should result in very well defined aperture widths and background sample regions.

Upon quitting, be sure to save the aperture model to database. If one wishes to get fancy with the background, one may set several samples regions, including more than just the nearest neighbor interorder minima. If so, one may want to change the default fitting parameters to be more flexible than the simple 2nd order polynomial that is used in this example.

Tailoring the Aperture model for the Program Data

Having the same Decker setting and a similar optical path through the telescope and instrument, the low-feature water star is a good frame for adjusting the model apertures for the program data. If one accounted for the relative smaller sizes of the water star apertures when automatically sizing the Quartz apertures, than one does not need to resize. In this step, one will interactively recenter the aperture centroids along the reference column using the water star and set the background sample regions. There is no evidence that one needs to retrace the apertures. The overall curvature in the dispersion direction is seemingly unaffected by slight changes in the light path. Epar into apall and set the parameters (partial listing):

PACKAGE = echelle
   TASK = apall
    
input   =            H2Ostr.bl  List of input images
(output =                     ) List of output spectra
(format =              echelle) Extracted spectra format
(referen=            quartz.bl) List of aperture reference images
(profile=                     ) List of aperture profile images

(interac=                  yes) Run task interactively?
(find   =                   no) Find apertures?
(recente=                  yes) Recenter apertures?
(resize =                   no) Resize apertures?
(edit   =                  yes) Edit apertures?
(trace  =                   no) Trace apertures?
(fittrac=                   no) Fit the traced points interactively?
(extract=                   no) Extract spectra?
(extras =                   no) Extract sky, sigma, etc.?
(review =                   no) Review extractions?
Following ":g" and confirmation of the recentering and editing prompt, window around the edit plot. One may notice that some aperture widths are wider than the base of their cross dispersion profile. For the most part this occurs where an absorption feature has been intercepted (is the peak level lower than the nearest neighbor peak levels?). Be sure to scrutinize thoughts about resizing these apertures. Additionally, be sure to account for this absorption feature effect when setting the background samples; do not get too greedy and push the sample up into the aperture edge.

Follow the steps outlined above for setting the background sample for the flat field. One should be relieved at the relative amount of inter--order real--estate in the blue (large aperture numbers). As mentioned, do not get greedy. Choose only a few pixel wide swath across the minima, as shown in Fig.~9--7. Upon completion, type "q" and save the aperture model to database.

\irafplot{fig09-7.ps} \figurecap{9--7}{There is more real--estate between the apertures for the program Decker setting. Do not over expand these areas, but stay close to the minima. If the present aperture or the nearest neighbor is an absorption feature cross section, take this into account also.}


WHAT IS THE BACKGROUND?

Depending upon one's spectrograph, the meaning and the use of the background can be adjusted. For spectrographs with wide order separations, a proper Decker setting will sample the sky at the aperture cross dispersion extremes. In this case, the "background" setting would be judiciously set to remove the sky spectrum from the program spectrum during the extraction process. Such is not the case for the Hamilton. One cannot properly remove sky contamination from Hamilton data using this technique.

With the Hamilton, as with other echelle spectrographs with tightly packed orders, the "background" could be used to subtract "scattered light" or simply define the intensity zero point (the apscatter task is specifically designed for this approach). Effectively, this is the approach for the flat field frame as presented here (see Section 10.2 for more on this). However, with the Hamilton, the apertures overlap, so the zero point is not accurately modeled using this technique.

If one is measuring absolute quantities, such as equivalent widths, one has a serious problem, since the results will be sensitive to the zero point determination. This will be briefly addressed in Section 12.1 and Section 13 and is discussed in Appendix C. Also, see Churchill and Allen (1995) for details on determining the Hamilton zero point.


|PREVIOUS CHAPTER| |NEXT CHAPTER| |TABLE OF CONTENTS| |CWC HOME|