| apfind | noao.twodspec.apextract | apfind |
apfind -- Find spectra and define apertures automatically
apfind input
I/O parameters and the default dispersion axis are taken from the package parameters, the default aperture parameters are taken from the task apdefault , and parameters used for centering and editing the apertures are taken from apedit .
When this operation is performed from the task apall all parameters except the package parameters are included in that task.
For each image in the input image list spectra are identified and default apertures defined. The automatic aperture finding is performed only if 1) there are no apertures defined for the reference image, 2) there are no apertures defined for the input image, 3) the parameter find is yes, and 4) the parameter nfind is greater than zero.
The automatic finding algorithm uses the following steps. First, all local maxima are found. The maxima are sorted by peak value and the weaker of the peaks separated by less than the value given by the parameter minsep are rejected. Finally, at most the nfind strongests peaks are kept. Nfind is a query parameter, so if it is not specified explicitly on the command line, the desired number of spectra to be found is requested. After the peaks have been found the center1d algorithm is used to refine the centers of the profiles. Apertures having the default parameters set with the task apdefault are defined at each center. This algorithm is also available with the f key in the task apedit with the change that existing apertures are kept and count toward the maximum number specified by nfind .
The automatic assignment of aperture numbers, beam numbers, and titles has several options. The simplest is when no aperture identification table, parameter apidtable , is specified and the maximum separation parameter, maxsep , is very large. In this case the aperture and beam numbers are sequential starting from one and numbered either from left-to-right or right-to-left depending on the order parameter. There are no aperture titles in this case. If two adjacent spectra are separated by more than the specified maximum then the aperture numbers jump by the integer part of the ratio of the separation to the specified maximum separation. This is used when the image is expected to have evenly spaced spectra, such as in multifiber spectrographs, in which some may be missing due to broken fibers. Finally, the aperture identification table (either a text file or an image having a set of SLFIBnnn keyowrds) may contain lines with aperture number, beam number, and (optional) title. The sequential numbers are then indices into this table. Note that the skipping of missing spectra and the ordering applies to entries in this table as well.
The ways in which the automatic method can fail for evenly spaced spectra with missing members are when the first spectrum is missing on the side from which the ordering begins and when the expected rather the actual number of spectra is used. In the first case one can use the interactive o key of the aperture editing facility to specify the identity of any aperture and then all other apertures will be appropriately reidentified. If more spectra are sought than actually exist then noise spikes may be mistakenly found. This problem can be eliminated by specifying the actual number of spectra or minimized by using the threshold centering parameter.
The recenter parameter allows recentering apertures if defined by a reference image. Since the purpose of this task is to find new apertures it is usually the case that there are no reference images and recentering is not done. The default apertures are of fixed width. The resize parameter may be used to adjust the widths in a variety of ways. The aperture positions and any other parameters may also be edited with the aperture editing function if selected by the apedit parameter and the task is run interactively.
If the task is interactive the user is queried whether to perform various steps on each image. The queries may be answered with one of the four values "yes", "no", "YES" and "NO", where an upper case response suppresses all further queries to this question.
The aperture finding algorithm may be selected from nearly every task in the package.
cl> apfind image nfind=10
The aperture ID table information may now be contained in the image header under the keywords SLFIBnnn.