View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

APEXTRACT: overplotting the trace on an image

Frank Valdes wrote on May 05, 1999

Q:  What I want to do is to 'recreate' the fitted function from the
output of aptrace and plot onto the actual images using say tvmark, so
that I can directly check to see if I am extracting the right aperture
from the spectrum.

Or do you know a better way of plotting extracted region of
spectra directly onto (overlapped onto ) the ximtool image ?
I would like to have a bit more than these plots generally produced 
in the interactive 'aptrace' process.


A:  Something like what you want, to be able to manipulate the trace result
from APEXTRACT, is one of the most common requests for this package.
Such a task or feature has not yet been added.  However there are
a couple of things I can point you to that you can use.

First of all formulas for evaluating the coefficients are given in
the help page for APTRACE (in recent versions of IRAF).  So you could
write a program or script to generate positions from the trace.

The second thing is a colon command in ICFIT, so it applies in all
tasks including the trace fitting in APEXTRACT, to dump out the
data points and fit.  What you would do is get to the point where you
fit the trace interactively.  Set the parameters and get the fit the
way you want them.  Then dump the points with ":xyshow [file]" where
file is a text file (if no file is given it will appear in the terminal
window).  Below is an example of the output:

ap> head trace.dat
#      X        Y    Y FIT   WEIGHT
      6. 49.48518 49.48663       1.
     16. 49.48693 49.50695       1.
     26. 49.53157 49.52728       1.
     36. 49.50226 49.54761       1.
     46. 49.55039 49.56794       1.
     56. 49.56415 49.58827       1.

Note that X and Y are for the axes in the plot so they may be column vs
line or line vs column.  While it is possible with some sophistication
to get the output non-interactively it would normally have to be done
interactively for each apertures.

You can use this output with TVMARK.  You use the task FIELDS to extract
the columns you want and possibly exchange X and Y or YFIT if the
dispersion axis is 2.  Here is an example that draws a red line for the fit
and blue "points" for the measured postions (where DISPAXIS=2 so the X/Y
columns need to be exchanged):

ap> display test 1 fill+
ap> fields trace.dat 3,1 |tvmark 1 STDIN mark=line color=204
ap> fields trace.dat 2,1 |tvmark 1 STDIN mark=point color=206

All parameters not shown are default values.  Of course the marks will
only be to the nearest pixel since TVMARK works on display pixels.

Last post on May 05, 1999