View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Defining aperture positions from a text file: apextract, apfind

Frank Valdes wrote on Nov 05, 2001

Q:  I cannot find out how to do the following: I want to define apertures (in
my longslit data) according to my own table. For instance let us say that
I have a long slit spectrum containing a star and its nebula. I want the
5 apertures, with aperture 3 on pixel with y coordinate 500 (where the
star is), and the other apertures sampling the nebula. Each aperture
should be 4 pix wide such that their centres are:

1 492
2 496
3 500
4 504
5 508

And their sides are contigous. Can I provide apfind with an ASCII table of
these coordinates?


A:  The ability to input the locations of apertures is something we are working
on for the future.  However, it is possible to do it by redirecting the
interactive cursor input from a file.  You need to create a file
of the following form

ap> type cursor.dat
70 0 1 n
80 0 1 n
90 0 1 n

where the first column is the aperture position you want (it can a
fractional pixel coordinate), the second
is the y cursor value which is irrelevant for marking apertures, the
third is the graph number which you just fix as 1, and the last is the
key you would type in apedit.  For the key you can use 'n' to just fix
the aperture at the specified point or 'm' to centroid.

You then set the apfind parameters as

ap> lpar apfind
        input = ""              List of input images
        nfind =                 Number of apertures to be found automatically
   (apertures = "")             Apertures
  (references = "")             Reference images\n
 (interactive = yes)            Run task interactively?
        (find = no)             Find apertures?
    (recenter = no)             Recenter apertures?
      (resize = no)             Resize apertures?
        (edit = yes)            Edit apertures?\n
        (line = INDEF)          Dispersion line
        (nsum = 1)              Number of dispersion lines to sum or median
      (minsep = 5.)             Minimum separation between spectra
      (maxsep = 1000.)          Maximum separation between spectra
       (order = "increasing")   Order of apertures
        (mode = "ql")           


Specifically set interactive=yes and edit=yes.  To set the aperture widths
you need to set the limits in the apdefaults parameters.  To then redirect the
cursor input from the file

ap> cl.gcur="cursor.dat"

Finally you run the task

ap> apfind   
List of input images (mf): 
Searching aperture database ...
Edit apertures for mf?  (yes): 
Write database? (yes):

Note that you still get the prompts and the graph.  If you want to
eliminate all the queries do the following first:

ap> apparams.initialize=no
ap> apparams.ansfind="NO"
ap> apparams.ansedit="YES"
ap> apparams.ansdbwrite="YES"

To eliminate the graph run the task with

ap> apfind >G dev$null


Be sure to reset things after you are done to avoid getting confused later.

ap> cl.gcur=""
ap> unlearn apparams

Last post on Nov 05, 2001