Macro Expansion in SAOtng
When adding new file access programs, analysis routines, and scale programs,
SAOtng will macro-expand your command line before executing it. This is
one way in which SAOtng's internal information can be supplied to external
programs.
Macros are of the form $macro or ${macro}: the same
format used for Unix shell variables. SAOtng knows about several classes
of macros:
- Reserved macros
- The following words are reserved as macros:
- block -- block factor at which the image section was extracted
- blocking_preference -- "sum" or "average"
- datamin, datamax -- min and max of the image
- edge -- edge of image to ignore when scaling
- donan -- 1 if NaN checking is enabled, else 0
- filename, imgpath -- pathname of the original image file
- imgname -- file name of the image file (w/o path)
- imgroot, xparoot -- root name of the image file (w/o path or extension)
- min, max -- min and max data value of image section
- ncolors -- number of colors in the colormap (always 200)
- scalemin, scalemax -- scaling limits
- status -- busy or idle
- wcs_string -- the last displayed WCS position and data value
- x, y -- the selected x,y position
- xdim, ydim -- dimensions of the current image section
- xcen ycen -- center of image at which section was extracted
- xpa -- the XPA prefix (i.e., the title used in this instance
of SAOtng)
- Data keywords
- The macro expands to make the raw (unscaled)
FITS data representation of the image section available in a way
suitable for use in a Unix pipe or redirected into a file. For
example, a command line such as:
$data | smooth fits="stdin" ...
will send the raw data into the standard input of a smooth program, while:
$data > foo.fit; smooth fits=foo.fit ...
redirects the raw data into a file and then passes the file to a smooth
program. The $data macro will expand to an xpaget of the unscaled
FITS image from memory, if such data is available. If not, it will expand
to a command to retrieve the appropriate FITS image section from the original
image file.
- FITS keywords
- All keywords contained in the primary FITS header can be expanded as
macros on a command line.
- Region keywords
- The following region keywords are defined when launching analysis
routines:
- region, regions -- all regions
- exclude_region, exclude_regions -- exclude regions
- eregion, eregions -- exclude regions
- include_region, include_regions -- include regions
- iregion, iregions -- include regions
- Specific macros for markers
- For marker analysis commands, the active macro is defined
to return the region of the currently active marker.
- Analysis Keywords
- The macro "idle_saotng" expands to a piped command that tells
SAOtng that its status should be reset to idle. If this macro is added
to an analysis command line, then SAOtng will sense its use and set
its state to busy when executing the command line. The idle_saotng
program will
reset the status after passing on stdout to the next process. It is
useful in cases such as:
doit | $idle_saotng | xtext
where you want SAOtng to be idled after it completes, but without waiting
for xtext to complete.
By default, region macros will return region positions in the current
format (i.e., pixels, degrees, hms/dms). You can specify another format
by appending the following strings to a region macro:
For example, $eregion_degrees will expand to the list of exclude regions,
with the positions returned in degrees.
Return to Advanced Topics Page
Last Updated June 14, 1997