aboutsummaryrefslogtreecommitdiff
path: root/pkg/proto/doc
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/proto/doc
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/proto/doc')
-rw-r--r--pkg/proto/doc/binfil.hlp71
-rw-r--r--pkg/proto/doc/bscale.hlp151
-rw-r--r--pkg/proto/doc/epix.hlp55
-rw-r--r--pkg/proto/doc/fields.hlp65
-rw-r--r--pkg/proto/doc/fixpix.hlp190
-rw-r--r--pkg/proto/doc/hfix.hlp79
-rw-r--r--pkg/proto/doc/imalign.hlp328
-rw-r--r--pkg/proto/doc/imcentroid.hlp247
-rw-r--r--pkg/proto/doc/imcntr.hlp61
-rw-r--r--pkg/proto/doc/imextensions.hlp235
-rw-r--r--pkg/proto/doc/imfunction.hlp130
-rw-r--r--pkg/proto/doc/imreplace.hlp62
-rw-r--r--pkg/proto/doc/imscale.hlp43
-rw-r--r--pkg/proto/doc/interp.hlp84
-rw-r--r--pkg/proto/doc/irafil.hlp106
-rw-r--r--pkg/proto/doc/joinlines.hlp127
-rw-r--r--pkg/proto/doc/mimstat.hlp179
-rw-r--r--pkg/proto/doc/mkglbhdr.hlp114
-rw-r--r--pkg/proto/doc/mskexpr.hlp454
-rw-r--r--pkg/proto/doc/mskregions.hlp279
-rw-r--r--pkg/proto/doc/ringavg.hlp83
-rw-r--r--pkg/proto/doc/rskysub.hlp234
-rw-r--r--pkg/proto/doc/suntoiraf.hlp226
-rw-r--r--pkg/proto/doc/text2mask.hlp90
-rw-r--r--pkg/proto/doc/wcsedit.hlp422
-rw-r--r--pkg/proto/doc/wcsreset.hlp272
26 files changed, 4387 insertions, 0 deletions
diff --git a/pkg/proto/doc/binfil.hlp b/pkg/proto/doc/binfil.hlp
new file mode 100644
index 00000000..beee0c81
--- /dev/null
+++ b/pkg/proto/doc/binfil.hlp
@@ -0,0 +1,71 @@
+.help binfil Jul86 proto
+.ih
+NAME
+binfil -- create a 16 bit binary raster file from an IRAF image
+.ih
+USAGE
+binfil input
+.ih
+PARAMETERS
+.ls input
+The list of input images to be converted.
+.le
+.ls scale_fact = 1.0
+A multiplicative scale factor to be applied to each pixel during the
+conversion process. This parameter provides the means to minimize loss
+of precision when converting from the dynamic range of the IRAF image
+pixels to the dynamic range of the output 16-bit signed integer,
+-32768 to 32767.
+.le
+.ls header = no
+Prepend a short descriptive header to the output binary raster file?
+.le
+.ih
+DESCRIPTION
+BINFIL generates a simple signed 16-bit binary raster file
+from IRAF images. BINFIL can be useful when programs other than IRAF
+applications are to be used to examine the data. The format of the resulting
+file is a simple string of pixels, with the exception that the first
+90 bytes or 45 words may optionally form a minimal header.
+
+The header elements are stored as follows:
+
+.nj
+.nf
+ word 1 : nrows
+ word 2 : ncols
+ word 3 : IRAF pixel type flag
+ word 4-13 : reserved space
+ word 14-45: image title (ASCII 64 bytes)
+.fi
+.ju
+
+Pixels from the input images are converted to short integers after scaling
+by the scale_fact parameter. The resultant pixel values are limited to the
+maximum range of a short integer and then written to the binary file.
+
+The output binary file assumes the name of the input image with an appended
+".b" to indicate binary.
+.ih
+EXAMPLES
+
+Convert the IRAF image irafimage to the binary file irafimage.b.
+
+.nj
+.nf
+cl> binfil irafimage scale=0.01
+.fi
+.ju
+
+.ih
+TIME REQUIREMENTS
+.ih
+BUGS
+Only the first 64 characters of the image title are placed in the binary file
+header.
+
+There is no way to specify the output binary file names.
+.ih
+SEE ALSO
+irafil
+.endhelp
diff --git a/pkg/proto/doc/bscale.hlp b/pkg/proto/doc/bscale.hlp
new file mode 100644
index 00000000..af5647f8
--- /dev/null
+++ b/pkg/proto/doc/bscale.hlp
@@ -0,0 +1,151 @@
+.help bscale Aug91 proto
+.ih
+NAME
+bscale -- linearly transform the intensity scales of a list of images
+.ih
+USAGE
+bscale input output
+.ih
+PARAMETERS
+.ls input
+List of images to be transformed.
+.le
+.ls output
+List of output transformed images. If the output list is the same as the input
+list the input images are overwritten.
+.le
+.ls bzero = "0."
+The zero point to be subtracted before applying the scale factor.
+The options are a numerical value, "mean", "median", or "mode".
+.le
+.ls bscale = "1."
+The scale factor to be applied. The options are a numerical value,
+"mean", "median", or "mode".
+.le
+.ls section = ""
+The image section to be used for computing the image statistics. If section
+is "", \fIstep\fR is used to define the default image section. \fISection\fR
+is used to confine the computation of the mean, median, and mode
+to a specific region of the image.
+.le
+.ls step = 10
+The step size in pixels which defines the default image section to be used
+for computing the mean, median, and mode.
+In image section notation the default section is equivalent to [*:10,*:10,...].
+\fIStep\fR is used if
+the sampling along an axis is not defined by \fIsection\fR.
+Subsampling can significantly reduce the memory and
+time required for the computation of the mean, median, and mode.
+.le
+.ls upper = "INDEF"
+Upper intensity limit to be used for computing the mean, median, and mode.
+.le
+.ls lower = "INDEF"
+Lower intensity limit to be used for computing the mean, median, and mode.
+.le
+.ls verbose = yes
+Print messages about actions taken by the task?
+.le
+
+.ih
+DESCRIPTION
+
+The specified input images \fIinput\fR are linearly transformed in intensity
+and written to the list of output images \fIoutput\fR, using the
+zero point specified by \fIbzero\fR and the scale factor specified by
+\fIbscale\fR. If the output image list
+is the same as the input image list the input images will be overwritten.
+
+The expression defining the linear transformation is listed below.
+
+ NEW = (OLD - BZERO) / BSCALE
+
+OLD is the input pixel brightness, NEW is the output
+pixel brightness, BZERO is the zero point offset, and BSCALE is the
+scale factor. The values of the scaling parameters \fIbzero\fR and
+\fIbscale\fR
+may be specified explicitly or the mean, median, or mode of the image
+may be used for either quantity. If the input image pixel type
+is short, integer, or long, overflow or truncation may occur.
+
+When one of the scaling parameters is the image mean, median,
+or mode, then the image mean, median, and mode are calculated. The statistics
+computation can be restricted to a section of the input image by setting
+the parameter
+\fIsection\fR. Otherwise the parameter \fIstep\fR is used to
+define a default image section.
+Subsampling the image can significantly reduce the memory
+and time requirements for computing the statistics of large images.
+If numerical values for both the scaling parameters are specified, then
+the image statistics are not computed. The statistics computation can
+be limited to given intensity range by setting the parameters
+\fIlower\fR and \fIupper\fR.
+
+The mean, median, and mode are computed using the following algorithm.
+Note that this algorithm requires that all the data to used for computing
+the statistics must be in memory.
+
+.nf
+1. The data in the specified image section is read into a buffer.
+2. The data is sorted in increasing order of intensity.
+3. The points outside upper and lower are excluded.
+4. The median is set to the data value at the midpoint of the remaining
+ data.
+5. The mean and sigma of the remaining data are computed.
+6. The histogram bin width (.1*sigma) and separation (.01*sigma) are
+ computed.
+7. The location of the bin containing the most data points is determined.
+8. The median of the data values in that bin is used to estimate the mode.
+.fi
+
+.ih
+EXAMPLES
+
+1. Use the mode to subtract a constant background from a list of images.
+Overwrite the input images.
+
+.nf
+ cl> bscale *.imh *.imh bzero=mode
+.fi
+
+2. Scale a list of images to a unit mean. Overwrite the input images.
+
+.nf
+ cl> bscale *.imh *.imh bscale=mean
+.fi
+
+3. Scale a list of images to the intensity range 0 to 511,
+where 234. and 1243. are the original data range. Overwrite the input
+images. This example uses the CL to calculate bscale.
+
+.nf
+ cl> bscale.bzero = 234.
+ cl> bscale.bscale = (1243. - 234.) / 512.
+ cl> bscale *.imh *.imh
+.fi
+
+4. Scale an image using a user specified bzero and bscale and create a new
+output image:
+
+.nf
+ cl> bscale imagein imageout bzero=0.0 bscale=1.10
+.fi
+
+5. Median subtract a list of input images using the percent replace facility to
+create the output image names.
+
+.nf
+ cl> bscale images*.imh %i%outi%*.imh bzero=median bscale=1.0
+.fi
+
+6. Repeat the previous example but use the @ file facility for specifying
+the input and output image lists.
+
+.nf
+ cl> bscale @infile @outfile bzero=median bscale=1.0
+.fi
+
+.ih
+SEE ALSO
+imarith,imcombine
+.endhelp
diff --git a/pkg/proto/doc/epix.hlp b/pkg/proto/doc/epix.hlp
new file mode 100644
index 00000000..e47afe5e
--- /dev/null
+++ b/pkg/proto/doc/epix.hlp
@@ -0,0 +1,55 @@
+.help epix Jun84 proto
+.ih
+NAME
+epix -- edit pixels in an image
+.ih
+USAGE
+epix image_name x y new_value
+.ih
+PARAMETERS
+.ls image_name
+Name of image or image section to be edited.
+.le
+.ls xcoord, ycoord
+The coordinates of the pixel to be edited.
+.le
+.ls new_value
+The new value of the pixel.
+.le
+.ls boxsize = 3
+The width of a square subraster surrounding the pixel to be edited over which
+the rejection mean and the median will be computed.
+.le
+.ls ksigma = 0.0
+The pixel rejection threshold for the iterative rejection algorithm used
+to compute the mean. If zero, a rejection threshold will be computed based
+on the size of the sample using Chauvenet's relation.
+.le
+.ls edit_image = yes
+Set the pixel value to \fInew_value\fR? If editing is disabled the mean
+and median may still be computed, and the subraster may still be printed.
+.le
+.ls verbose = yes
+Print the values of the pixels in the subraster surrounding the image,
+and compute the rejection mean and the median.
+.le
+.ih
+DESCRIPTION
+A subraster \fIboxsize\fR pixels square is extracted centered on the pixel
+(xcoord,ycoord). If the \fIverbose\fR flag is enabled the values
+of the pixels in the subraster are printed on the standard output along with
+the rejection mean and median of the subraster. If \fIedit_image\fR is yes
+the program will ask for the \fInew_value\fR and edit the image.
+.ih
+EXAMPLES
+1. Replace the specified pixels with a value of zero.
+
+.nf
+ cl> epix M92 400 87 0.0
+ cl> epix M92 45 300 0.0
+ cl> epix M92 207 300 0.0
+.fi
+.ih
+SEE ALSO
+imedit
+.endhelp
diff --git a/pkg/proto/doc/fields.hlp b/pkg/proto/doc/fields.hlp
new file mode 100644
index 00000000..8118a6fd
--- /dev/null
+++ b/pkg/proto/doc/fields.hlp
@@ -0,0 +1,65 @@
+.help fields Jan86 proto
+.ih
+NAME
+fields -- extract selected fields from a list.
+.ih
+USAGE
+fields files fields
+.ih
+PARAMETERS
+.ls files
+File or files from which the fields are to be extracted.
+.le
+.ls fields
+The fields to be extracted.
+.le
+.ls lines = "1-"
+The lines from which the fields are to be extracted. If multiple files are
+being extracted, the same lines apply to each file.
+.le
+.ls quit_if_missing = no
+This flag determines the task behavior when a field is missing from the
+specified line. If \fBquit_if_missing\fR = yes, the task exits and an error
+is reported.
+.le
+.ls print_file_names = no
+If \fBprint_file_name\fR = yes, the first string of each output line of
+extracted fields is the file name.
+.le
+.ih
+DESCRIPTION
+The list processing tool \fIfields\fR is used to extract whitespace
+separated fields from the specified files and lines.
+The input to this task can be either the standard input or a list of
+files; output is a new list of the extracted fields.
+
+The fields of a line are numbered from 1 up to a newline character; those
+fields to be extracted are specified as a range of numbers.
+If a specified field is missing from a selected
+line the action taken is determined by the \fBquit_if_missing\fR flag;
+\fIfields\fR will either continue processing after printing a warning
+message, or call an error and exit.
+.ih
+EXAMPLES
+1. Reverse the order of the 5 columns in list file "list".
+.nf
+
+ cl> fields list 5-1 > newlist
+.fi
+
+2. Extract columns 1 and 3 from file "newlist" and pipe them to task
+\fIgraph\fR.
+.nf
+
+ cl> fields newlist 1,3 | graph
+.fi
+.ih
+REVISIONS
+.ls FIELDS V2.11
+The default value for the \fIlines\fR parameter was changed to an open
+upper limit.
+.le
+.ih
+SEE ALSO
+joinlines, xtools.ranges
+.endhelp
diff --git a/pkg/proto/doc/fixpix.hlp b/pkg/proto/doc/fixpix.hlp
new file mode 100644
index 00000000..89f8c99b
--- /dev/null
+++ b/pkg/proto/doc/fixpix.hlp
@@ -0,0 +1,190 @@
+.help fixpix Aug96 proto
+.ih
+NAME
+fixpix -- fix pixels identified by a bad pixel mask, image, or file
+.ih
+USAGE
+.nf
+fixpix images masks
+.fi
+.ih
+PARAMETERS
+.ls images
+List of two dimensional images to be "fixed" (modified) by
+linear interpolation.
+.le
+.ls masks
+List of bad pixel masks, images, or files (collectively called masks)
+identifying the bad pixels. The list of masks must either match the
+list of input images in number or a single mask may be specified to apply
+to all images. The special name "BPM" may be specified to select a mask
+specified by the header keyword "BPM" in the input image. The possible
+mask formats are given in the DESCRIPTION section.
+.le
+.ls linterp = "INDEF", cinterp = "INDEF"
+Normally interpolation is performed across the narrowest dimension spanning
+the bad pixels with interpolation along image lines if the two dimensions are
+equal. However specific values in the mask may be used to
+identify the desired interpolation direction. The value in the mask
+specifying line interpolation is given by the \fIlinterp\fR parameter and
+the value specifying column interpolation is given by the \fIcinterp\fR
+parameter. Any values which are do not match one of these parameters
+results in interpolation along the narrowest dimension. Note that a
+text file mask always has 2 for pixels with narrow dimension along
+lines and 3 for pixels with narrow dimension along columns.
+.le
+.ls verbose = no
+If this parameter is set to yes a line identifying each image and
+associated mask is printed. If the \fIpixels\fR parameter is
+set then a list of the pixels modified is also printed.
+.le
+.ls pixels = no
+List the pixels modified? This is only done if this parameters and
+the \fIverbose\fR parameter are set.
+.le
+.ih
+DESCRIPTION
+Pixels in a list of images identified by bad pixel masks, images, or text
+files (collectively called masks here) are replaced by linear interpolation
+along lines or columns using the nearest good pixels. The list of input
+images, specified by the \fIimages\fR parameter, are matched with a list of
+masks, specified by the \fImasks\fR parameter. The list of masks must
+match the list of input images or a single mask name may be given to apply
+to all input images. The special mask name "BPM" may be used to
+select a mask name given in the input image header under the keyword
+"BPM".
+
+There are three types of masks which may be used. The preferred type
+is a bad pixel mask given as a "pixel list" image. Pixel list images
+have the extension ".pl" signifying a special compact file of integer
+values ideal for identifying sets of pixels. For a bad pixel mask the
+good pixels have a value of zero and bad pixels have positive integer
+values.
+
+The second type is any image format. The image will be internally
+converted to a bad pixel mask. Note that real image values will be
+truncated to integers. Again good pixels will have values of zero and bad
+pixels will have positive values.
+
+The final format is a text file with lines giving the integer coordinates
+of a single pixel or a rectangular region. A single pixel is specified by
+a column and line number. A region is specified by a starting column, an
+ending column, a starting line, and an ending line. Internally this file
+is turned into a bad pixel mask of the size of the input image with values
+of zero for non-specified pixels, a value of two for pixels with narrowest
+interpolation direction along lines, and three for pixels with narrowest
+interpolation direction along columns.
+
+As noted previously, bad pixels are "fixed" by replacing them with values
+by linear interpolation to the nearest pixels not identified as bad.
+Normally interpolation is performed across the narrowest dimension spanning
+bad pixels with interpolation along image lines if the two dimensions are
+equal. However specific values in the mask may be used to identify the
+desired interpolation direction. The value in the mask specifying line
+interpolation is given by the \fIlinterp\fR parameter and the value
+specifying column interpolation is given by the \fIcinterp\fR parameter.
+Any values which are do not match one of these parameters results in
+interpolation along the narrowest dimension. Note that a text file mask
+always has 1 for pixels with narrow dimension along lines and 2 for pixels
+with narrow dimension along columns.
+
+The \fIverbose\fR allows printing a line giving the task name, the
+image name, and the mask name. In addition, if the \fIpixels\fR
+parameter is set the pixels modified are listed. The list of pixels
+consists of the column and line of the pixel, the original
+and replaced pixel values, and the column and line of the one or two
+pixels used for the interpolation. If the bad pixel region has no
+pixels at one end, that is there are bad pixels all the way to one edge
+of the image, then the single pixel used is printed.
+
+Normally the input images and the masks will have the same dimension.
+However, this task matches bad pixels in the masks with the input images
+based on physical coordinates. Thus, the mask image may be bigger or
+smaller than the input image and image sections may be used with either
+the input images or the bad pixel mask or image mask images. If the
+input image is the result of extracting a subsection of a bigger image
+the coordinates of the pixels will be those of the original image
+and the matching coordinates of the mask will be applied. This has
+the effect of allowing image sections to be applied to images having
+a bad pixel mask specified in the image and still having the bad pixel
+mask be valid.
+
+Mask images may be made in a variety of ways. Any task which produces
+and modifies image values may be used. Some useful tasks are
+\fBimexpr, imreplace, imcopy,\fR and \fBmkpattern\fR. If a new image
+is specified with the explicit ".pl" extension then the pixel mask
+format is produced. Two other ways to make masks are with the
+tasks \fBtext2mask\fR and \fBccdmask\fR. The former uses an input
+text file consisting of rectangular region. This is the old
+"fixpix" format. The task \fBccdmask\fR is specialized to make a mask
+of bad pixels from flat fields or, even better, from the ratio of
+two flat fields of different exposure levels.
+.ih
+EXAMPLES
+1. A list of images have bad pixel masks defined in the image header.
+To replace the bad pixels by interpolation along the narrowest
+dimension:
+
+.nf
+ cl> fixpix obj* BPM
+.fi
+
+2. A simple mask of 0s and 1s defines bad columns in spectral data
+with dispersion along the lines. To interpolate along the lines:
+
+.nf
+ cl> fixpix spec00*h ccdmask linterp=1 v+
+ FIXPIX: image spec001.imh with mask ccdmask
+ FIXPIX: image spec002.imh with mask ccdmask
+ ...
+.fi
+
+3. A text file of bad pixels is used and the modified pixels are printed
+with:
+
+.nf
+ cl> type mask.dat
+ 1 2 1 1
+ 25 26 25 25
+ 26 27 27 27
+ 49 50 50 50
+ 10 10
+ 20 21 20 20
+ cl> fixpix myimage mask.dat v+ p+
+ FIXPIX: image myimage with mask mask.dat
+ 1 1 1. 1. 1 2
+ 2 1 1. 1. 2 2
+ 10 10 1. 1. 9 10 11 10
+ 20 20 1. 1. 20 19 20 21
+ 21 20 1. 1. 21 19 21 21
+ 25 25 1. 1. 25 24 25 26
+ 26 25 1. 1. 26 26 26 28
+ 26 27 1. 1. 26 26 26 28
+ 27 27 1. 1. 27 26 27 28
+ 49 50 1. 1. 49 49
+ 50 50 1. 1. 50 49
+.fi
+
+4. Because a text file input automatically sets the mask values to
+2 or 3 you may need to set the linterp and cinterp parameters to
+force the direction. In particular, to apply FIXPIX to a 1D image,
+say a spectrum, if you have regions described by ranges in columns
+the mask interpolation values will be assigned as 3. This means
+it is trying to interpolation between line 0 and line 2 which is
+obviously not what is intended. To make this work set linterp to
+3:
+
+.nf
+ cl> fixpix myimage mask.dat linterp=3
+.fi
+.ih
+REVISIONS
+.ls FIXPIX V2.11
+This task replaces the old task (now obsolete.ofixpix) and works with the
+more general pixel mask facilities. It also provides greater flexibility
+in choosing the interpolation direction.
+.le
+.ih
+SEE ALSO
+epix, imedit, ccdproc, text2mask, obsolete.ofixpix
+.endhelp
diff --git a/pkg/proto/doc/hfix.hlp b/pkg/proto/doc/hfix.hlp
new file mode 100644
index 00000000..1549ffeb
--- /dev/null
+++ b/pkg/proto/doc/hfix.hlp
@@ -0,0 +1,79 @@
+.help hfix Nov91 proto
+.ih
+NAME
+hfix -- fix image headers with a user specified command
+.ih
+USAGE
+hfix images
+.ih
+PARAMETERS
+.ls images
+List of images whose headers are to be fixed. If \fIupdate\fR is yes then
+the user must have write permission on the image headers.
+.le
+.ls command = "edit $fname"
+Command to be applied to a file containing the image header. The command
+may be any CL command which includes escapes to host commands. The file
+containing the header in text form is specified by the special string
+"$fname". The command should modify this file to the desired form. The
+default is to invoke a text editor but there are many other possibilities.
+The image name may also be specified with "$image". See the EXAMPLES
+section for some ideas.
+.le
+.ls update = yes
+Update the image header with the modified header.
+.le
+.ih
+DESCRIPTION
+This task allows you to extract the image headers into a text file,
+modify this file with a specified command, and update the image header
+with the modified file. The command to be applied is specified with
+the \fIcommand\fR parameter. In this command the text file containing
+the header to be acted upon is referenced with the string "$fname".
+If it is desired to update the image header with the modified file
+the \fIupdate\fR switch must be set. You must have write permission
+to update the image headers.
+
+A common command, which is the default, is to use a text editor.
+Other possibilities are to save the file, use a non-interactive host
+command such as \fBsed\fR in UNIX, or write your own program or
+script.
+
+This task does very little processing on the header after you are finished
+editing. It checks for legal FITS characters in the first 8 columns and if
+there is an '=' in column 9 then there must be a ' ' (blank) in column 10.
+Lines violating these checks are skipped. It also sets each line in the
+header to the correct length. Because you have total freedom to change the
+header parameters while in the text editor, you must make sure that the
+header has a legal format after you are through editing it. In particular,
+be sure each field in the header parameters that you add or change begin in
+the proper columns.
+.ih
+EXAMPLES
+1. Edit the header of the image test.imh:
+
+.nf
+ cl> hfix test.imh
+ <Edit the header text>
+.fi
+
+2. Get the header of a single image and save the file:
+
+.nf
+ cl> hfix myim command="copy $fname save" update-
+.fi
+
+3. A image header was created with an incorrect format such that the
+equal sign is in column 10 instead of 9:
+
+.nf
+ cl> hfix *.imh \
+ >>> command="!sed 's/ =/=/' $fname >temp;mv temp $fname"
+.fi
+
+Note that this example should not be tried on a valid header where the
+equal sign is in column 9.
+.ih
+SEE ALSO
+images.hedit noao.artdata.mkheader
+.endhelp
diff --git a/pkg/proto/doc/imalign.hlp b/pkg/proto/doc/imalign.hlp
new file mode 100644
index 00000000..bf666b6c
--- /dev/null
+++ b/pkg/proto/doc/imalign.hlp
@@ -0,0 +1,328 @@
+.help imalign Feb90 proto
+.ih
+NAME
+imalign -- register a list of images
+.ih
+USAGE
+imalign images coords
+.ih
+PARAMETERS
+.ls images
+The list of images to be shifted and trimmed. This list should
+normally contain the \fIreference\fR to include its borders in the
+calculation of the trim section as well as to preserve the image
+alignment following trimming.
+.le
+.ls coords
+A text file containing the coordinates of the registration objects to
+be centered in each image, one object per line with the x and y
+coordinates in columns one and two respectively. These coordinates
+should be measured in the frame of the reference image.
+.le
+.ls reference
+The reference image to which the \fIimages\fR will be aligned. Note
+that \fIreference\fR is a query parameter to IMALIGN, but a hidden
+parameter to IMCENTROID.
+.le
+.ls shifts = ""
+A text file containing the initial estimate for each image of the
+shift in each axis relative to the \fIreference\fR image. These
+estimates are used to modify the coordinates of the registration
+objects prior to centering. The format of the file is one image per
+line with the (fractional) x and y shifts in columns one and two
+respectively. The sense of the shifts is such that:
+\fIXshift=Xref-Xin\fR and \fBYshift=Yref-Yin\fR. If \fIshifts\fR
+is null, a coarse centering pass will be made to attempt to determine
+the initial shifts.
+.le
+.ls prefix = "rg"
+The output images will have root names that are prefixed by this
+string. If \fIprefix\fR is null, the input \fIimages\fR will be
+overwritten.
+.le
+.ls shiftimages = yes
+If \fIshiftimages\fR is yes, the IMSHIFT task will be used to align the
+images. If \fIshiftimages\fR is no, the images will not be aligned but
+only centered.
+.le
+.ls trimimages = yes
+If \fItrimimages\fR is yes, the output images will be trimmed to
+include only the region over which they all overlap. The
+trim section that is actually used may differ slightly from that
+reported by IMCENTROID. A correction may be applied to compensate for
+the boundary extension "contamination" due to multi-pixel (e.g.,
+\fIinterp_type\fR = poly5) interpolation near the edges of the images.
+.le
+.ls verbose = yes
+Print the centers, shifts, and trim section?
+.le
+.ls boxsize = 7
+The size in pixels of the box to use for the final centering, during
+which all the sources in \fIcoords\fR are recentered in each image
+using the initial estimate of the relative shift for each image.
+Care should be taken to choose an appropriate value for this parameter,
+since it is highly data dependent.
+.le
+.ls bigbox = 11
+The size in pixels of the box to use for coarse centering. The coarse
+pass through the centering algorithm is made with the box centered at
+the nominal position of the first source in the coordinate list.
+Coarse centering is performed only if \fIshifts\fR is null.
+Care should be taken to choose an appropriate value for this parameter,
+since it is highly data dependent. Large value should be suspect until
+the final results are checked to see that the centering did not converge
+on the wrong coordinates, although the usual result for an inappropriate
+\fIbigbox\fR size is that the algorithm fails to converge and the task
+aborts.
+.le
+.ls negative = no
+Are the features negative?
+.le
+.ls background = INDEF
+The absolute reference level for the marginal centroid calculation.
+If \fIbackground\fR is INDEF, this is set to the mean value (between the
+thresholds) of the individual sources.
+.le
+.ls lower = INDEF
+The lower threshold for the data. Individual pixels less than this
+value will be given zero weight in the centroids.
+.le
+.ls upper = INDEF
+The upper threshold for the data. Individual pixels greater than this
+value will be given zero weight in the centroids.
+.le
+.ls niterate = 2
+The maximum number of centering iterations to perform. The centering
+will halt when this limit is reached or when the desired \fItolerance\fR
+is achieved.
+.le
+.ls tolerance = 0
+The tolerance for convergence of the centering algorithm. This is the
+integral shift of the centering box from one iteration to the next.
+.le
+.ls interp_type = "spline3"
+The interpolation function type for the IMSHIFT task. See the help
+page for IMSHIFT for more information.
+.le
+.ls boundary_type = "constant"
+The boundary extension type for the IMSHIFT task. See the help page
+for IMSHIFT for more information.
+.le
+.ls constant = 0.
+The constant to be used if \fIboundary_type\fR is "constant". See the
+help page for IMSHIFT for more information.
+.le
+.ih
+DESCRIPTION
+IMALIGN measures the X and Y axis shifts between a list of images,
+\fIimages\fR and a reference image, \fIreference\fR, that is, the
+shifts that should be added to the input image coordinates to convert
+them into the reference coordinates. By default it will apply the
+measured shifts and then trim the \fIimages\fR to consistent borders.
+The task is meant to address the class of two dimensional image
+registration problems in which the images have the same pixel scale,
+are shifted relative to each other by simple translations and contain
+enough high signal/noise, point-like sources in common to form good
+average positions. The basic operation of the task is to find centers
+for the list of registration objects or features in the coordinate
+frame of each image and then to subtract the corresponding centers
+found in the reference image. The shifts of the registration objects
+are averaged for each image.
+
+IMALIGN is a simple script front end for IMCENTROID, IMSHIFT, and
+IMCOPY (which is used to perform the trimming). Other scripts
+can be constructed for similar purposes. You can type: `help
+imalign option=source' to view the script.
+
+A list of the X and Y coordinates of the registration objects should be
+provided in the parameter \fIcoords\fR. The registration objects do not
+all have to be common to each frame, rather only that subset of the
+objects that is contained within the bounds of a given image will be
+centered. Only the objects that are common to both the given image and
+the reference will be used to calculate the shifts. The coordinates
+should be measured in the frame of the \fIreference\fR. If coarse
+centering is to be done, which is to say, if no \fIshifts\fR file is
+provided, then the first registration source should be separated from
+other sources by at least the maximum expected relative shift.
+
+An initial estimate of the shifts between each of the \fIimages\fR and
+the \fIreference\fR is required for the centering algorithm (a marginal
+centroid) to work. This estimate can be explicitly supplied in a file
+\fIshifts\fR (\fIXshift=Xref-Xin\fR and \fIYshift=Yref-Yin\fR) or can
+be generated from the images by measuring the relative shift of the
+first source listed in \fIcoords\fR for each image. This coarse
+centering pass requires that the first source be detached from other
+sources and from the border of each image by a distance that is at
+least the maximum shift between the \fIreference\fR and an image. This
+source should be point-like and have a high signal to noise ratio. The
+value of the \fIbigbox\fR parameter should be chosen to include the
+location of the source in each of the images to be aligned while
+excluding other sources. Large values of \fIbigbox\fR should be held
+suspect until the final convergence of the centering algorithm is
+verified, although given a small value for the \fItolerance\fR, the
+quality of the final centers is independent of the estimate for the
+initial shifts. Better convergence may also be obtained by increasing
+the \fIniterate\fR parameter, although the default value of three
+should work for most cases. \fINiterate\fR should be kept small to
+avoid runaway.
+
+The \fIboxsize\fR parameter controls the size of the centering box for
+the fine centering passes and should be chosen so as to exclude sky
+background and other sources while including the wings of the point
+spread function. The sense of the shifts that are calculated is
+consistent with the file supplied to the \fIshifts\fR parameter and
+with that used with the IMSHIFT task.
+
+If \fIshiftimages\fR is yes the images will actually be shifted using
+the IMSHIFT task. Note that if \fIinterp_type\fR is "nearest" the
+effect on the images is the same as if the shifts were rounded to
+integral values. In this case, the pixels will be shifted without
+interpolation. This can be used for data in which it is more important
+to preserve the pixel values than it is to achieve perfect
+registration.
+
+If \fItrimimages\fR is yes, the output images will be trimmed to
+include only the region over which they all overlap. The trim section
+that is actually used may differ slightly from that reported by
+IMCENTROID. A one or two pixel correction may be applied to each edge
+to compensate for the boundary extension "contamination" due to
+multi-pixel (e.g., \fIinterp_type\fR = poly5) interpolation near the
+edges of the images.
+
+IMALIGN may be used with a set of \fIimages\fR which vary in size.
+This can result in vignetting of the calculated overlap region because
+of the nature of the IMSHIFT task to preserve the size of an input
+image. To visualize this, imagine a large reference image and a single
+small image to be aligned to it, both containing the same registration
+object which is at the center of each image. IMALIGN will cause the
+small image to be shifted such that the object is positioned at the same
+pixel location as in the reference. In performing the shift, a large
+fraction of the area of the small image may be shifted outside of its
+own borders, whereas the physical overlap of the large and small images
+includes ALL of the pixels of the small image. In the case of such
+vignetting, IMALIGN will print a warning message and refuse to proceed
+with the trimming although the vignetting will occur whether or not the
+images are trimmed. Note that the vignetting will not occur if the
+small image is used as the \fIreference\fR.
+
+The vignetting message may also be printed if the \fIimages\fR are all
+the same size but the \fIreference\fR is not included in the list.
+This will occur if the sense of the measured shifts in a coordinate are
+all positive or all negative since in this case the border of the
+\fIreference\fR would have provided one of the limits to the trim
+section. The reality of this vignetting depends on your point of view.
+
+Trimming will also not be performed if the entire overlap region vanishes.
+
+Note that many of these difficulties are due to the intrinsically fuzzy
+nature of the process of image registration. This all leads to a few
+"rules of thumb":
+
+.nf
+ o Include the \fIreference\fR as one of the \fIimages\fR
+
+ o Use the smallest image as the \fIreference\fR
+
+ o Choose the \fIreference\fR such that the \fIimages\fR are
+ scattered to either side in the shifts in each axis
+
+ o Align images that are the same size, OR
+
+ o Pad dissimilar sized images with blanks to
+ the largest size and disable trimming
+.fi
+.ih
+CENTERING ALGORITHM
+The algorithm is a "marginal" centroid in which the fit for each axis
+is performed separately upon a vector created by collapsing the
+centering box perpendicular to that axis. The centroid is calculated
+with respect to the level specified by \fIbackground\fR. If
+\fIbackground\fR is INDEF, the reference level for each source in each
+image is the local mean for those pixels that lie between the
+\fIlower\fR and \fIupper\fR thresholds. The thresholds are set to the
+local data minimum or maximum if \fIlower\fR or \fIupper\fR,
+respectively, are INDEF. If \fInegative\fR is yes, than the marginal
+vector will be inverted before being passed to the centroid algorithm.
+
+The maximum number of centering iterations and the tolerance for
+convergence are controlled by \fIniterate\fR and \fItolerance\fR. Note
+that the tolerance is an integer value that represents the maximum
+movement of the centering box between two successive iterations. The
+default value of 0 requires that the centroid lie within the center
+pixel of the centering box which is \fIboxsize\fR in extent (note that
+\fIboxsize\fR must be an odd number). This should normally be the case
+for bright, circularly symmetric point sources in images with a flat
+sky background. If the registration sources are not circular symmetric
+try increasing the tolerance gingerly. A sky level that varies across
+the image should be removed before processing. The centering and
+calculation of the shifts may be performed with \fIshiftimages\fR = no
+(or directly with IMCENTROID) and the calculated shifts applied to the
+images directly with IMSHIFT.
+.ih
+EXAMPLES
+1. Align three images to the first using the list of registration star
+coordinates in the file "x1.coords".
+
+.nf
+ cl> imalign x1,x2,x3 x1.coords refer=x1
+.fi
+
+2. Align a list of images contained in the file "imlist", overwriting the
+original images with the shifted and trimmed images:
+
+.nf
+ cl> imalign @imlist x1.coords refer=x1 prefix=""
+.fi
+
+3. Align the images leaving the output images the same size as the input
+images:
+
+.nf
+ cl> imalign @imlist x1.coords refer=x1 trimimages-
+.fi
+
+4. Perform the centering but not the shifts:
+
+.nf
+ cl> imalign @imlist x1.coords refer=x1 shiftimages-
+.fi
+
+5. Perform the centering, don't calculate the shifts at all (i.e., don't
+supply a reference image):
+
+.nf
+ pr> imalign @imlist x1.coords shiftimages-
+.fi
+
+6. Take previously measured shifts and apply them directly:
+
+.nf
+ pr> imshift @imlist shiftfile=x1.shifts
+.fi
+.ih
+BUGS
+The images being shifted must be in the current directory.
+
+The coarse centering portion of the algorithm can be fooled if the
+first source on the list is not well separated from other sources, or
+if the first source has a low signal to noise ratio, or if there is a
+complicated shape to the background.
+
+The task can produce output images that do not contain the entire
+overlap region. This can only occur if the images are of varying sizes.
+This behavior is caused by the action of the IMSHIFT task to preserve the
+size of an input image, thus implicitly "trimming" the image. A work
+around is to use IMCOPY to place the images into subsections of blank
+images that are the size (in each dimension) of the largest image(s)
+and use IMALIGN with \fItrimimages\fR set to no. The borders of the output
+images can be trimmed manually. This is discussed above in more detail.
+
+If \fIimages\fR does not contain the \fIreference\fR and \fItrimimages\fR
+is set to yes then the set of shifted and trimmed images may no longer
+be aligned to the reference. This occurs because any place holder
+pixels at the bottom and left edges of the images will be trimmed off.
+This is also discussed above.
+.ih
+SEE ALSO
+imcentroid, center, imshift, geomap, geotran
+.endhelp
diff --git a/pkg/proto/doc/imcentroid.hlp b/pkg/proto/doc/imcentroid.hlp
new file mode 100644
index 00000000..2bedc548
--- /dev/null
+++ b/pkg/proto/doc/imcentroid.hlp
@@ -0,0 +1,247 @@
+.help imcentroid Feb90 proto
+.ih
+NAME
+imcentroid -- center sources in images, optionally find shifts
+.ih
+USAGE
+imcentroid images coords
+.ih
+PARAMETERS
+.ls images
+The list of images within which sources are to be centered. If a
+\fIreference\fR image is specified, IMCENTROID will calculate the mean
+X and Y shifts between the centered sources within each image and those
+same sources within the \fIreference\fR. The list of \fIimages\fR
+should normally include the \fIreference\fR so that its borders are
+used in the calculation of the trim section for the overlap region of
+the list of \fIimages\fR.
+.le
+.ls coords
+A text file containing the coordinates of the registration objects to
+be centered in each image, one object per line with the x and y
+coordinates in columns one and two respectively. These coordinates
+should be measured in the frame of the reference image.
+.le
+.ls reference = ""
+The reference image to which the \fIimages\fR will be aligned. If
+a \fIreference\fR is specified the mean X and Y shifts between each of
+the \fIimages\fR and the \fIreference\fR will be calculated, otherwise
+only the centers for the individual sources will be reported.
+.le
+.ls shifts = ""
+A text file containing the initial estimate for each image of the
+shift in each axis relative to the \fIreference\fR image. These
+estimates are used to modify the coordinates of the registration
+objects prior to centering. The format of the file is one image per
+line with the (fractional) x and y shifts in columns one and two
+respectively. The sense of the shifts is such that:
+\fIXshift=Xref-Xin\fR and \fIYshift=Yref-Yin\fR.
+ If \fIshifts\fR is null, a coarse centering pass will be made to
+attempt to determine the initial shifts.
+.le
+.ls boxsize = 7
+The size in pixels of the box to use for the final centering, during
+which all the sources in \fIcoords\fR are recentered in each image
+using the initial estimate of the relative shift for each image.
+Care should be taken to choose an appropriate value for this parameter,
+since it is highly data dependent.
+.le
+.ls bigbox = 11
+The size in pixels of the box to use for coarse centering. The coarse
+pass through the centering algorithm is made with the box centered at
+the nominal position of the first source in the coordinate list.
+Coarse centering is performed only if \fIshifts\fR is null.
+Care should be taken to choose an appropriate value for this parameter,
+since it is highly data dependent. Large value should be suspect until
+the final results are checked to see that the centering did not converge
+on the wrong coordinates, although the usual result for an inappropriate
+\fIbigbox\fR size is that the algorithm fails to converge and the task
+aborts.
+.le
+.ls negative = no
+Are the features negative?
+.le
+.ls background = INDEF
+The absolute reference level for the marginal centroid calculation.
+If \fIbackground\fR is INDEF, this is set to the mean value (between the
+thresholds) of the individual sources.
+.le
+.ls lower = INDEF
+The lower threshold for the data. Individual pixels less than this
+value will be given zero weight in the centroids.
+.le
+.ls upper = INDEF
+The upper threshold for the data. Individual pixels greater than this
+value will be given zero weight in the centroids.
+.le
+.ls niterate = 2
+The maximum number of centering iterations to perform. The centering
+will halt when this limit is reached or when the desired \fItolerance\fR
+is achieved.
+.le
+.ls tolerance = 0
+The tolerance for convergence of the centering algorithm. This is the
+integral shift of the centering box from one iteration to the next.
+.le
+.ls verbose = yes
+Print the centers for the individual objects? If \fIverbose\fR is no
+only the shifts relative to the reference coordinates will be reported.
+If no \fIreference\fR image is supplied, \fIverbose\fR is automatically
+set to yes.
+.le
+.ih
+DESCRIPTION
+IMCENTROID measures the X and Y coordinates of a list of sources in a
+list of images. Optionally, IMCENTROID will find the mean X and Y
+shifts between the \fIimages\fR and a \fIreference\fR image, that is,
+the shifts that should be added to the input image coordinates to
+convert them into the reference coordinates. The task is meant to
+address the class of two dimensional image registration problems in
+which the images have the same pixel scale, are shifted relative to
+each other by simple translations in each axis and contain enough high
+signal-to-noise, point-like sources in common to form good average
+positions. The basic operation of the task is to find centers for the
+list of registration objects in the coordinate frame of each image and
+then to subtract the corresponding centers found in the reference
+image. The shifts of the objects are averaged for each image.
+
+The IMALIGN task is a simple script front end for IMCENTROID, IMSHIFT,
+and IMCOPY (which is used to perform the trimming). Other scripts can
+be constructed for similar purposes. You can type: `help imalign
+option=source' to view the script.
+
+A list of the X and Y coordinates of the registration objects should be
+provided in the parameter \fIcoords\fR. The registration objects do not
+all have to be common to each frame, rather only that subset of the
+objects that is contained within the bounds of a given image will be
+centered. Only the objects that are common to both the given image and
+the reference will be used to calculate the shifts. The coordinates
+should be measured in the frame of the \fIreference\fR. If coarse
+centering is to be done, which is to say, if no \fIshifts\fR file is
+provided, then the first registration source should be separated from
+other sources by at least the maximum expected relative shift.
+
+An initial estimate of the shifts between each of the \fIimages\fR and
+the \fIreference\fR is required for the centering algorithm (a marginal
+centroid) to work. This estimate can be explicitly supplied in a file
+\fIshifts\fR (\fIXshift=Xref-Xin\fR and \fIYshift=Yref-Yin\fR)
+or can be generated from the images by measuring the relative shift of
+the first source listed in \fIcoords\fR for each image. This coarse
+centering pass requires that the first source be detached from other
+sources and from the border of each image by a distance that is at
+least the maximum shift between the \fIreference\fR and an image. This
+source should be point-like and have a high signal to noise ratio. The
+value of the \fIbigbox\fR parameter should be chosen to include the
+location of the source in each of the images to be aligned while
+excluding other sources. Large values of \fIbigbox\fR should be held
+suspect until the final convergence of the centering algorithm is
+verified, although given a small value for the \fItolerance\fR, the
+quality of the final centers is independent of the estimate for the
+initial shifts. Better convergence may also be obtained by increasing
+the \fIniterate\fR parameter, although the default value of three
+should work for most cases. \fINiterate\fR should be kept small to
+avoid runaway.
+
+The \fIboxsize\fR parameter controls the size of the centering box for
+the fine centering pass and should be chosen so as to exclude sky
+background and other sources while including the wings of the point
+spread function. The sense of the shifts that are calculated is
+consistent with the file supplied to the \fIshifts\fR parameter and
+with that used with the IMSHIFT task.
+
+IMCENTROID may be used with a set of \fIimages\fR which vary in size.
+This can result in vignetting of the calculated overlap region because
+of the nature of tasks such as IMSHIFT to preserve the size of an input
+image. To visualize this, imagine a large reference image and a single
+small image to be aligned to it, both containing the same registration
+object which is at the center of each image. IMCENTROID will cause the
+coordinate system of the small image to be shifted such that the object
+will be positioned at the same pixel location as in the reference. If
+the shift is performed, a large fraction of the area of the small image
+may be shifted outside of its own borders, whereas the physical overlap
+of the large and small images includes ALL of the pixels of the small
+image. In the case of such vignetting, IMCENTROID will print a warning
+message and both the vignetted and unvignetted trim sections. Note
+that the vignetting will not occur if the small image is used as the
+\fIreference\fR.
+
+The vignetting message may also be printed if the \fIimages\fR are all
+the same size but the \fIreference\fR is not included in the list.
+This will occur if the sense of the measured shifts in a coordinate are
+all positive or all negative since in this case the border of the
+\fIreference\fR would have provided one of the limits to the trim
+section. The reality of this vignetting depends on your point of view.
+
+Note that many of these difficulties are due to the intrinsically fuzzy
+nature of the process of image registration. This all leads to a few
+"rules of thumb":
+
+.nf
+ o Include the \fIreference\fR as one of the \fIimages\fR
+
+ o Use the smallest image as the \fIreference\fR
+
+ o Choose the \fIreference\fR such that the \fIimages\fR are
+ scattered to either side in the shifts in each axis
+
+ o Align images that are the same size, OR
+
+ o Pad dissimilar sized images with blanks to the largest size
+.fi
+.ih
+CENTERING ALGORITHM
+The algorithm is a "marginal" centroid in which the fit for each axis
+is performed separately upon a vector created by collapsing the
+centering box perpendicular to that axis. The centroid is calculated
+with respect to the level specified by \fIbackground\fR. If
+\fIbackground\fR is INDEF, the reference level for each source in each
+image is the local mean for those pixels that lie between the
+\fIlower\fR and \fIupper\fR thresholds. The thresholds are set to the
+local data minimum or maximum if \fIlower\fR or \fIupper\fR,
+respectively, are INDEF. If \fInegative\fR is yes, than the marginal
+vector will be inverted before being passed to the centroid algorithm.
+
+The maximum number of centering iterations and the tolerance for
+convergence are controlled by \fIniterate\fR and \fItolerance\fR. Note
+that the tolerance is an integer value that represents the maximum
+movement of the centering box between two successive iterations. The
+default value of 0 requires that the centroid lie within the center
+pixel of the centering box which is \fIboxsize\fR in extent (note that
+\fIboxsize\fR must be an odd number). This should normally be the case
+for bright, circularly symmetric point sources in images with a flat
+sky background. If the registration sources are not circular symmetric
+try increasing the tolerance gingerly. If the sky background is not
+flat, but varies across the image, it can be removed before processing.
+.ih
+EXAMPLES
+1. Calculate the shifts between three images using the list of
+registration star coordinates in the file "x1.coords".
+
+.nf
+ pr> imcentroid x1,x2,x3 x1.coords refer=x1
+.fi
+
+2. Calculate the shifts between a list of images contained in the file
+"imlist":
+
+.nf
+ pr> imcentroid @imlist x1.coords refer=x1
+.fi
+
+3. Perform the centering, don't calculate the shifts, i.e., don't
+supply a reference image. Note that the \fIinput\fR list of shifts,
+or a coarse centering pass are still needed:
+
+.nf
+ pr> imcentroid @imlist x1.coords
+.fi
+.ih
+BUGS
+The coarse centering portion of the algorithm can be fooled if the
+first source on the list is not well separated from other sources, or
+if the first source has a low signal to noise ratio, or if there is a
+complicated shape to the background.
+.ih
+SEE ALSO
+imalign, center, imshift, geomap, geotran
+.endhelp
diff --git a/pkg/proto/doc/imcntr.hlp b/pkg/proto/doc/imcntr.hlp
new file mode 100644
index 00000000..b715fefd
--- /dev/null
+++ b/pkg/proto/doc/imcntr.hlp
@@ -0,0 +1,61 @@
+.help imcntr Dec85 proto
+.ih
+NAME
+imcntr -- locate the center of a stellar image
+.ih
+USAGE
+imcntr input x_init y_init
+.ih
+PARAMETERS
+.ls input
+The list of images which contain the star to be centered.
+.le
+.ls x_init
+The approximate column coordinate as a starting point for the centering.
+.le
+.ls y_init
+The approximate line (row) coordinate as a starting point for the centering.
+.le
+.ls cboxsize = 5
+The size of the extraction box to be used during the centering process.
+.le
+.ih
+DESCRIPTION
+Given the approximate coordinates of the center of an object, (x_init, y_init),
+IMCNTR will compute a more accurate center using the algorithms described in
+the Kitt Peak publication "Stellar Magnitudes from Digital Images" under
+the Mountain Photometry Code section. Briefly, this algorithm computes
+the sum of all the rows and the sum of all the columns in the extraction
+box. These are called "marginal distributions". The center in x (column
+value) is then the center of gravity of the row marginal, and the center
+in y is the center of gravity of the column marginal.
+If the resultant x or y center value deviates from the original input
+approximate starting points by more than 1 pixel, the process is repeated
+once more around the new center. Only one iteration is attempted to
+avoid runaway if a bright star is nearby.
+
+Because the centers are computed independently for x and y, the result
+may be considered inferior to a true two-dimensional centering algorithm.
+Nevertheless, in practice the results appear to be very usable.
+
+The value for the box size should be an odd value. If chosen too large,
+nearby objects will affect the result. If too small, the center will be
+poorly defined.
+.ih
+EXAMPLES
+1. The following example locates the center of a star near (123, 234)
+in 3 images.
+.sp 1
+.nj
+.nf
+cl> imcntr m92red,m92blu,m92grn 123 234
+.fi
+.ju
+.ih
+BUGS
+The routine will probably fail if the desired object is within 2 or 3 pixels
+of the image boundary.
+.ih
+SEE ALSO
+pradprof
+.endhelp
diff --git a/pkg/proto/doc/imextensions.hlp b/pkg/proto/doc/imextensions.hlp
new file mode 100644
index 00000000..d67c961f
--- /dev/null
+++ b/pkg/proto/doc/imextensions.hlp
@@ -0,0 +1,235 @@
+.help imextensions Jul97 proto
+.ih
+NAME
+imextensions -- make a list of image extensions
+.ih
+USAGE
+.nf
+imextensions input
+.fi
+.ih
+PARAMETERS
+.ls input
+List of input files containing image extensions to be listed. This list
+may not contain any image kernel but it can contain an image section. The
+image filename extension, such as ".fits", is optional in the same way as
+with other IRAF image tasks.
+.le
+.ls output = "file" (none|list|file)
+Output type for the list of image extensions. The choices are:
+
+.nf
+ none - no output
+ list - a list as a single line
+ file - a list of one image extension per line
+.fi
+
+The "none" output is used to just set the number of image extensions in the
+\fInimages\fR parameter. The "list" output is used for a short list that
+can be scanned into a CL variable. The "file" output is used for a long
+list and to be redirected to a file for use as an "@file". If "list"
+output is selected and the list length exceeds 255 characters (the
+size of a CL string) the task will abort with an error.
+.le
+.ls index = "1-"
+Extension index range list. The range list syntax is specified under the
+help topic \fBranges\fR. Note that the range list may be specified that
+includes 0 to select the primary image header in FITS files.
+.le
+.ls extname = ""
+Extension name pattern. If a null string is specified then there is
+no check on the extension name. If a pattern is specified then only
+image extensions with an extension name matching the pattern will be
+selected. The pattern syntax is described under the help topic \fImatch\fR.
+.le
+.ls extver = ""
+Extension version range list. If a null list is specified then there is
+no check on the extension version. If a list is given then only image
+extensions with extension versions in the list will be selected.
+The range list syntax is described under the help topic \fBranges\fR.
+.le
+.ls lindex = yes
+List the image extensions with the extension index? If the value is
+"no" then the extension index will not be listed if the extension
+name and/or the extension version is listed. If there is no
+extension name or extension version then the extension index is
+always listed regardless of the value of this parameter.
+.le
+.ls lname = no
+List the image extensions with the extension name if there is one?
+.le
+.ls lver = no
+List the image extensions with the extension version if there is one?
+.le
+.ls ikparams = ""
+Include the specified image kernel parameters in the image extension
+names. The image kernel parameters are specific to the various
+IRAF image formats.
+.le
+
+.ls nimages
+This is an output parameter which is set to the number of image extensions
+selected in the last execution of the task. Note that if the task
+is run as a background job this parameter will not be set in the
+disk parameter file though it can be made available in a background
+script using this task by caching the parameter set; i.e.
+include the command "cache imextensions" at the beginning of the script.
+.le
+.ih
+DESCRIPTION
+\fBImextensions\fR selects and lists image extensions in files. Image
+extensions currently occur in multi-extension FITS files and multi-group
+Geiss (STF format) files. The image extension names are given in proper
+syntax for IRAF image names for use in tasks expecting image names.
+The output format type may be a one line list, a list of one image
+extension name per line, or no output. These options allow capturing
+the expanded list in a CL string variable, in a file for use as
+an "@file", or to simply count the number of image extensions matching
+the selection criteria. Note that if the "list" output type is selected
+and the list of image extensions exceeds 255 characters (the limit
+for a CL string) then the task aborts with an error.
+
+Image extensions may be selected by index value (the position in the file),
+by extension name (keyword EXTNAME used in FITS image extensions), and by
+extension version number (keyword EXTVER). The numeric selection uses
+range lists and the extension name selection uses pattern matching. The
+primary image in a multi-extension FITS file may also be selected by
+including an index value of 0 in the index range list.
+
+The output image extension names may be given with the index value and/or
+the image kernel specification. The image kernel specification, which is
+image type dependent, may include the extension name, extension version,
+and other kernel parameters. Note that if the image does not have an
+extension name or version then the index value is always given whether or
+not the \fIlindex\fR parameter is set to insure that a proper image name is
+generated.
+
+.ih
+EXAMPLES
+1. Get a list of image extensions in a CL string and use it to select
+header keywords. This illustrates the use of the "list" output and
+a CL variable.
+
+.nf
+ cl> imext obj001 output=list | scan (s1)
+ cl> = s1
+ obj001[1],obj001[2],obj001[3]
+ cl> if (imext.nimages > 0)
+ >>> hselect (s1, "$I,title", yes)
+ obj001[1] Alpha Leo
+ obj001[2] Beta Leo
+ obj001[3] Gamma Leo
+.fi
+
+2. Do the same thing as in the first example using an "@file".
+
+.nf
+ cl> imext obj001 output=file > list.dat
+ cl> type list.dat
+ obj001[1]
+ obj001[2]
+ obj001[3]
+ cl> if (imext.nimages > 0)
+ >>> hselect @list.dat $I,title yes
+ obj001[1] Alpha Leo
+ obj001[2] Beta Leo
+ obj001[3] Gamma Leo
+.fi
+
+3. Create a list selecting only the first and third extension and using the
+image extension name, version, and an image kernel section.
+
+.nf
+ cl> imext obj*[1:100,1:100] index=1,3 lindex- lname+ lver+ ikparams=expand
+ obj001.fits[aleo,1,expand][1:100,1:100]
+ obj003.fits[gleo,1,expand][1:100,1:100]
+ obj002.fits[im1,1,expand][1:100,1:100]
+ obj002.fits[im3,1,expand][1:100,1:100]
+ cl> = imext.nimages
+ 4
+.fi
+
+4. List only the primary images in a set of multi-extension FITS files.
+A primary image need not contain image data; i.e. this will select
+global headers with NDIM=0 as well as headers with image data.
+
+.nf
+ cl> imext *.fits index=0
+ abc.fits[0]
+ def.fits[0]
+ ghi.fits[0]
+.fi
+
+5. Use this task in a script to test on the existence of extension name
+"joy". This example shows the use of the pattern matching and of the
+\fBcache\fR command to insure the script works as a background task.
+
+.nf
+ procedure example (image)
+
+ file image {prompt="Image"}
+
+ begin
+ file im
+
+ cache imextensions
+ im = image
+
+ imextensions (im, output="none", extname="joy")
+ if (imextensions.nimages == 0)
+ call printf ("No joy found with %s\n", im)
+ end
+.fi
+
+Note that proper script programming would make all the hidden parameters
+explicit.
+
+
+6. Example of the extension name pattern matching.
+
+.nf
+ cl> imext obj.fits extname=joy lindex- lname+
+ obj.fits[joy]
+ obj.fits[nojoy]
+ obj.fits[joyfull]
+ cl> imext obj.fits extname="^joy$" lindex- lname+
+ obj.fits[joy]
+ cl> imext obj.fits extname="{joy}$" lindex- lname+
+ obj.fits[joy]
+ obj.fits[Joy]
+ obj.fits[nojoy]
+.fi
+
+The first example matches "joy" anywhere in the extension name, the
+second requires an exact match with the begin and end string characters,
+and the last example ignores the case and requires the name end with
+joy.
+
+7. An example with a Geiss file.
+
+.nf
+ cl> imext y00vk102r.d0h index="x5"
+ y00vk102r.d0h[1]
+ y00vk102r.d0h[6]
+ y00vk102r.d0h[11]
+ y00vk102r.d0h[16]
+ y00vk102r.d0h[21]
+ y00vk102r.d0h[26]
+ y00vk102r.d0h[31]
+ y00vk102r.d0h[36]
+.fi
+
+.ih
+REVISIONS
+.ls IMEXTENSIONS V2.11.?
+Image sections are now allowed in the input names.
+.le
+.ls IMEXTENSIONS V2.11
+This task is new in this release.
+.le
+.ih
+SEE ALSO
+.nf
+files, sections, ranges, match
+.fi
+.endhelp
diff --git a/pkg/proto/doc/imfunction.hlp b/pkg/proto/doc/imfunction.hlp
new file mode 100644
index 00000000..6b663384
--- /dev/null
+++ b/pkg/proto/doc/imfunction.hlp
@@ -0,0 +1,130 @@
+.help imfunction Aug91 proto
+.ih
+NAME
+imfunction -- Apply a function to the image pixel values
+.ih
+USAGE
+imfunction input output function
+.ih
+PARAMETERS
+.ls input
+The input image list.
+.le
+.ls output
+Output image list. The number of output images must match the number of
+input images. If the output image list equals the input image list
+the input images are overwritten.
+.le
+.ls function
+Function to be applied to the input pixels. The options are:
+.ls log10
+Take the logarithm to base 10 of an image. Negative and zero-valued
+pixels will be assigned the value -MAX_EXPONENT.
+.le
+.ls alog10
+Taken the antilogarithm to base 10 of the image. Positive out-of-bounds
+pixel values will be assigned the value MAX_REAL, negative out-of-bounds
+pixel values will be assigned the value 0.0.
+.le
+.ls ln
+Take the natural logarithm of an image. Negative and zero-valued pixels
+will be assigned the value - ln (10.) * MAX_EXPONENT.
+.le
+.ls aln
+Take the antilogarithm to base e of an image. Positive out-of-bounds pixel
+values will be assigned the value MAX_REAL, negative out-of-bounds
+pixel values will be assigned the value 0.0
+.le
+.ls sqrt
+Take the square root of an image. Negative pixel values will be assigned
+the value 0.0.
+.le
+.ls square
+Take the square of an image.
+.le
+.ls cbrt
+Take the cube root of an image.
+.le
+.ls cube
+Take the cube of an image.
+.le
+.ls abs
+Take the absolute value of an image.
+.le
+.ls neg
+Take the negative of an image.
+.le
+.ls cos
+Take the cosine of an image.
+.le
+.ls sin
+Take the sine of an image.
+.le
+.ls tan
+Take the tangent of an image.
+.le
+.ls acos
+Take the arc-cosine of an image. The output pixels will lie between
+0.0 and PI.
+.le
+.ls asin
+Take the arc-sine of an image. The output pixels will lie between -PI/2
+and +PI/2.
+.le
+.ls atan
+Take the arc-tangent of an image. The output pixels will lie between
+-PI/2 and +PI/2.
+.le
+.ls hcos
+Take the hyperbolic cosine of an image. Positive or negative
+out-of-bounds pixels will be assigned the value MAX_REAL.
+.le
+.ls hsin
+Take the hyperbolic sine of an image. Positive and negative out-of-bounds
+pixel values will be assigned the values MAX_REAL and -MAX_REAL respectively.
+.le
+.ls htan
+Take the hyperbolic tangent of an image.
+.le
+.ls reciprocal
+Take the reciprocal of an image. Zero-valued pixels will be assigned
+the output value 0.0
+.le
+.le
+.ls verbose = yes
+Print messages about actions taken by the task?
+.le
+
+.ih
+DESCRIPTION
+
+The selected function \fIfunction\fR is applied to the pixel values of all
+the input images \fIinput\fR to create the pixel values of the output
+images \fIoutput\fR. The number of output images must equal the number of
+input images. If the output image name is the same as the input image name
+the input image will be overwritten.
+
+If the input image is type real or double the output image will
+be of type real or double respectively. If the input image is type
+ushort then the output image will be type real. If the input image is one of
+the remaining integer data types, then the output image will be type
+real, unless function is "abs" or "neg", in which case the output
+data type will be the same as the input data type.
+
+Values of the machine dependent constants MAX_REAL and MAX_EXPONENT can be
+found in the file "hlib$mach.h".
+
+.ih
+EXAMPLES
+
+1. Take the logarithm of the pixel values of images in1 and in2 and write
+the results to out1 and out2.
+
+.nf
+ cl> imfunction in1,in2 out1,out2 log10
+.fi
+
+.ih
+SEE ALSO
+imarith,imreplace
+.endhelp
diff --git a/pkg/proto/doc/imreplace.hlp b/pkg/proto/doc/imreplace.hlp
new file mode 100644
index 00000000..444f7562
--- /dev/null
+++ b/pkg/proto/doc/imreplace.hlp
@@ -0,0 +1,62 @@
+.help imreplace Jul95 proto
+.ih
+NAME
+imreplace -- replace pixels in a window by a constant
+.ih
+USAGE
+imreplace images value lower upper
+.ih
+PARAMETERS
+.ls images
+Images in which the pixels are to be replaced.
+.le
+.ls value
+Replacement value for pixels in the window.
+.le
+.ls imaginary = 0.
+Replacement value for pixels in the window for the imaginary part of
+complex data.
+.le
+.ls lower = INDEF
+Lower limit of window for replacing pixels. If INDEF then all pixels
+are above \fIlower\fR. For complex images this is the magnitude
+of the pixel values. For integer images the value is rounded up
+to the next higher integer.
+.le
+.ls upper = INDEF
+Upper limit of window for replacing pixels. If INDEF then all pixels
+are below \fIupper\fR. For complex images this is the magnitude
+of the pixel values. For integer images the value is rounded down
+to the next lower integer.
+.le
+.ih
+DESCRIPTION
+The pixels in the \fIimages\fR between \fIlower\fR and \fIupper\fR
+are replaced by the constant \fIvalue\fR. The special value INDEF in
+\fIlower\fR and \fIupper\fR corresponds to the minimum and maximum
+possible pixel values, respectively.
+
+For complex images the replacement value is specified as separate
+real and imaginary and the thresholds are the magnitude. For
+integer images the thresholds are used as inclusive limits
+so that, for example, the range 5.1-9.9 affects pixels 6-9.
+.ih
+EXAMPLES
+1. In a flat field calibration which has been scaled to unit mean replace
+all response values less than or equal to 0.8 by 1.
+
+ cl> imreplace calib 1 upper=.8
+
+2. Set all pixels to zero within a section of an image.
+
+ cl> imreplace image[1:10,5:100] 0
+.ih
+REVISIONS
+.ls IMREPLACE V2.11
+The lower value is now rounded up for integer images so that a range
+like 5.1-9.9 affects pixels 6-9 instead of 5-9.
+.le
+.ih
+SEE ALSO
+imexpr
+.endhelp
diff --git a/pkg/proto/doc/imscale.hlp b/pkg/proto/doc/imscale.hlp
new file mode 100644
index 00000000..1f8a4a2a
--- /dev/null
+++ b/pkg/proto/doc/imscale.hlp
@@ -0,0 +1,43 @@
+.help imscale Aug84 proto
+.ih
+NAME
+imscale -- Scale an image to a specified windowed mean
+.ih
+USAGE
+imscale input output mean
+.ih
+PARAMETERS
+.ls input
+Input image to be scaled.
+.le
+.ls output
+Output scaled image.
+.le
+.ls mean
+Scale the output image to this mean value.
+.le
+.ls lower = INDEF
+Lower limit of window for calculating the input image mean. INDEF corresponds
+to the minimum possible pixel value.
+.le
+.ls upper = INDEF
+Upper limit of window for calculating the input image mean. INDEF corresponds
+to the maximum possible pixel value.
+.le
+.ls verbose = no
+Print the calculated input and output image means.
+.le
+.ih
+DESCRIPTION
+The mean of the \fIinput\fR image between the limits \fIlower\fR
+and \fIupper\fR is computed. The image is then scaled to the
+specified output \fImean\fR.
+.ih
+EXAMPLES
+To scale an image to a unit mean excluding deviant points below
+1000 and above 5000.
+
+.nf
+ cl> imscale calib flat 1 lower=1000 upper=5000
+.fi
+.endhelp
diff --git a/pkg/proto/doc/interp.hlp b/pkg/proto/doc/interp.hlp
new file mode 100644
index 00000000..d6492369
--- /dev/null
+++ b/pkg/proto/doc/interp.hlp
@@ -0,0 +1,84 @@
+.help interp Jan85 proto
+.ih
+NAME
+interp -- compute an interpolated value from a table of x,y pairs
+.ih
+USAGE
+interp tbl_file
+.ih
+PARAMETERS
+.ls tbl_file
+Text file containing X,Y pairs comprising the table.
+The pairs must be in either ascending or descending order.
+.le
+.ls curve_gen = no
+If set to no, x-values are read from the file(s) specified by the parameter
+"input". If set to yes, the parameters x1, x2, and dx are used to create
+a list of new x,y pairs interpolated at x1, x1+dx, ... x2.
+.le
+.ls input = STDIN
+File(s) containing x-values for the interpolation
+.le
+.ls int_mode = 'linear'
+The interpolation mode may be either 'linear' or 'spline'.
+.le
+.ls x1
+The starting x-value for generating a series of new x,y pairs.
+.le
+.ls x2
+The ending x-value of the generated series of pairs.
+.le
+.ls dx
+The difference by which the x-values are incremented during the
+series generation.
+.le
+.ih
+DESCRIPTION
+The pairs of X,Y values are read from the tbl_file. There must be
+at least 1 pair in the file. The table is then used to interpolate
+or extrapolate new y-values for given x-values. The x-values may come
+from a file including STDIN (if curve_gen=no), or they may be
+internally generated (if curve_gen=yes) to produce a finely sampled
+version of the table. This may be useful for plotting a smooth curve
+through a series of points.
+
+The table X,Y values must be in a monotonic order, either ascending
+or descending. No restriction is made on spacing.
+
+If only one point is present in the table, all returned interpolated
+values will have the value at that point. If only two points are
+present, linear interpolation (or extrapolation) will be used.
+If additional points are present, an obscure but reliable algorithm
+is used to interpolate (or extrapolate).
+
+.ih
+EXAMPLES
+
+1. The following command reads the X,Y table from file testdata and waits for
+ x-values from the terminal.
+
+.nf
+ cl> interp testdata STDIN
+.fi
+
+
+2. The following command generates points to plot (by piping to graph) in the
+ range from x=10 to x=20 at intervals of 0.1 (10.0, 10.1 ... 19.9, 20.0).
+
+.nf
+ cl> interp testdata curve_gen=yes x1=10 x2=20 dx=.1 | graph
+.fi
+
+3. The curve will be displayed and the original points from the table
+ may be overlaid by:
+
+.nf
+ cl> graph testdata pointmode=yes append=yes
+.fi
+
+.ih
+BUGS
+If a blank (null) table filename is entered, a floating divide error
+occurs.
+
+.endhelp
diff --git a/pkg/proto/doc/irafil.hlp b/pkg/proto/doc/irafil.hlp
new file mode 100644
index 00000000..be4f603b
--- /dev/null
+++ b/pkg/proto/doc/irafil.hlp
@@ -0,0 +1,106 @@
+.help irafil mar86 proto
+.ih
+NAME
+irafil -- converts a binary file containing pixel values to an IRAF image
+.ih
+USAGE
+irafil input nrows ncols
+.ih
+PARAMETERS
+.ls input
+the input file names to be converted
+.le
+.ls nrows
+the number of rows of data in the image
+.le
+.ls ncols
+the number of columns of data in the image
+.le
+.ls bits = 16
+the number of data bits per pixel. This must be either 8 or 16
+.le
+.ls signed = yes
+the pixels are assumed to be signed integers if the bits parameter is 16,
+and unsigned if the bits parameter is 8. If signed is set to no, then
+the 16 bit pixels will be treated as unsigned integers and the resultant
+image will be of type long integers.
+.le
+.ls tb_flip = no
+This parameter allows the image to be "top-to-bottom" flipped during
+conversion.
+.le
+.ls skip = 0
+the number of bytes to skip prior to reading pixel data. This allows
+skipping of header data which is otherwise not translatable and would
+be confused with the pixel data.
+.le
+.ih
+DESCRIPTION
+The specified files are read as integers and converted to IRAF images.
+The specified number of header bytes will be skipped, and the specified
+data format, 8 or 16 bit pixels, at the rate of ncols by nrows will be
+read. Signed data or 8 bit data will be placed into images having data
+type short. Unsigned 16 bit pixels will be converted into images of
+type long.
+
+The resultant images will be assigned the same name as the input file,
+but with ".i" appended to indicate IRAF format.
+
+The tb_flip parameter should be set to yes when converting the "snap"
+format files from the Compaq image display station, or other devices
+which refer to the first row as inverted from the usual IRAF notation.
+
+This utility is capable of converting a large number of strange
+image formats to IRAF images. By skipping any initial header, and specifying
+a value for ncols equal to either the row length of the image, or the
+number of pixels used in the foreign internal format, almost any
+16-bit format can be read. For example, FORTH pictures can be read
+by skipping the initial 2048 bytes and reading the pixels assuming
+a row length of 1024, even if the actual row length is shorter. There
+will be garbage pixels at the end of each row which can be trimmed
+with IMCOPY using picture sections. An absurd example is to read an
+IRAF pixel file by skipping 1024 bytes and reading with a row length of
+1024 [at least for the 800 pixel image I tried].
+
+Since no byte swapping is performed, a foreign tape format must be byte swapped
+if necessary prior to using IRAFIL. This may be done with REBLOCK in the
+dataio package.
+.ih
+EXAMPLES
+
+1. Say you've deleted your header file to an IRAF image. The pixel file
+is pix3034x. Assuming the pixels are short integers, the image is
+10 rows by 800 columns:
+
+.nj
+.nf
+lo> irafil pix3034x 10 1024 skip=1024
+lo> imcopy pix3034x.i[1:800,*] phoenix
+.fi
+.ju
+
+The first line creates the IRAF image pix3034x.i which is readable
+by IRAF tasks, but has 1024 pixels per row. The real image only
+has 800 pixels per row, but we had to read it this way because of the
+way pixels are stored in IRAF images. So we IMCOPY the good part of
+the picture to the new IRAF image we call phoenix.
+
+2. To read the "snap" format pictures from the Compaq station:
+
+.nj
+.nf
+lo> irafil m82.snp 512 512 tb_flip+ bits=8
+.fi
+.ju
+
+This will create the IRAF image m82.snp.i which can then be run
+through CRTPICT to make a Dicomed hardcopy.
+.ih
+TIME REQUIREMENTS
+.ih
+BUGS
+There is no way to explicitly specify the output image name.
+.ih
+SEE ALSO
+binfil,imcopy,reblock
+.endhelp
diff --git a/pkg/proto/doc/joinlines.hlp b/pkg/proto/doc/joinlines.hlp
new file mode 100644
index 00000000..90818095
--- /dev/null
+++ b/pkg/proto/doc/joinlines.hlp
@@ -0,0 +1,127 @@
+.help joinlines Feb90 proto
+.ih
+NAME
+joinlines -- join input text files line by line.
+.ih
+USAGE
+joinlines list1 [list2]
+.ih
+PARAMETERS
+.ls list1
+List of input text files to be joined. It is an error if a file does
+not exist. The special file "STDIN" may be used to read from the
+terminal, redirected input, or a pipe.
+.le
+.ls list2
+Optional second list of input text files to be combined with the
+first list. This only applies when two lists are specified on
+the command line otherwise this parameter is ignored.
+.le
+.ls output = "STDOUT"
+Output filename. The result of joining the input lines is appended
+to the specified file. The special file "STDOUT" selects the standard
+output stream, which is usually the terminal but which may be redirected.
+.le
+.ls delim = " "
+The delimiter placed between joined input lines. The default is a space
+(note that this will not be visible when viewed with \fBeparam\fR).
+.le
+.ls missing = "Missing"
+This string is substituted for missing lines when going beyond the end
+of shorter input files.
+.le
+.ls maxchars = 161
+Maximum number of characters in output lines. Longer output lines will
+be truncated and a warning may be given. Note that this number always
+includes the final newline character.
+.le
+.ls shortest = yes
+Stop at the end of the shortest file? If the input files are of unequal
+number of lines then this option provides for stopping at the end
+of the shortest file or the end of the longest file. In the latter case
+the string specified by the parameter \fImissing\fR is used for input
+from the shorter files.
+.le
+.ls verbose = yes
+Warnings are printed to the standard error stream giving the number
+of lines exceeding the maximum number of output characters, the number
+of lines exceeding the IRAF line length limit, and the number of files
+completed in case the files are of unequal length. If verbose is no
+then no warnings are printed.
+.le
+.ih
+DESCRIPTION
+The task \fBjoinlines\fR reads lines from each of the input text files and
+joins them into one line separated by the specified delimiter. This is useful
+for making multicolumn files from individual files. The output may
+be directed to the standard output, the default, or appended to a
+file.
+
+The list of input files may be given in either \fIlist1\fR or with
+\fIlist2\fR. The second list is only used if two arguments are given
+on the command line. This feature is provided for compatibility with
+an earlier version of this task which only joined two files given separately.
+
+There is no limit to the possible number of characters per output line but
+the parameter \fImaxchars\fR may be used to truncate long lines. This
+can be important because many IRAF tasks read files a line at a time
+with a fixed sized line buffer. Also other tasks and host programs
+(for example UNIX/vi) have line limits as well. If an input line
+exceeds these limits incorrect results may occur. The IRAF limit is
+SZ_LINE characters (see hlib$iraf.h) and so the default for the maximum
+number of output characters is set at the current value. One may
+chose to go beyond this limit.
+
+If the input files do not all have the same number of lines then there
+are two courses of action. If the \fIshortest\fR parameter is set
+then the join operation is terminated with the last line from the
+shortest file. If it is not set then the string from the parameter
+\fImissing\fR is substituted for input from the shorter files until
+the end of the longest file is reached. Note that the delimiter will
+still be placed between input lines even when such lines are missing.
+
+There are three types of warnings which may be produced if the verbose
+flag is set. These are warnings for the number of lines exceeding the
+specified maximum number of characters resulting in truncated output,
+the number of lines exceeding the IRAF line buffer limit, and a warning
+when some input files are shorter than others. The
+warnings are printed on the standard error stream so that redirection
+of the standard output will still leave the warnings on the user's
+terminal. To redirect the warnings one must include the standard error
+stream in the redirection syntax. See the examples for how to do
+this.
+.ih
+EXAMPLES
+1. Join the two files "names" and "titles", redirecting the output into a third
+file "personnel_file".
+
+.nf
+ cl> joinlines names titles > personnel_file
+.fi
+
+2. Join a set of magnitudes given in separate files and place the
+output in "allmags". Separate the columns by tabs.
+
+.nf
+ cl> joinlines mags* out=allmags delim=" "
+.fi
+
+3. Join a set of files into long lines and redirect the error output
+to a log file. Set missing lines to INDEF value.
+
+.nf
+ cl> joinlines tables* out=jointbls miss=INDEF short- ver+ >& log
+.fi
+
+4. Join the second column from the output of a program to the previous
+results. This illustrates the use of pipes.
+
+.nf
+ cl> myprog | fields STDIN 2 | joinlines last STDIN > new
+.fi
+.ih
+BUGS
+.ih
+SEE ALSO
+fields
+.endhelp
diff --git a/pkg/proto/doc/mimstat.hlp b/pkg/proto/doc/mimstat.hlp
new file mode 100644
index 00000000..c6c389ea
--- /dev/null
+++ b/pkg/proto/doc/mimstat.hlp
@@ -0,0 +1,179 @@
+.help mimstatistics Sep01 proto
+.ih
+NAME
+mimstatistics -- compute and print image pixel statistics using iterative
+rejection and masks
+.ih
+USAGE
+imstatistics images
+.ih
+PARAMETERS
+.ls images
+The input images or image sections for which pixel statistics are to be
+computed. Image sections are automatically applied to the input masks
+\fIimasks\fR if input masks are not mask sections.
+.le
+.ls imasks = ""
+The list of input masks or input mask sections associated with \fIimages\fR.
+Good and bad data values are assumed to be presented by mask values of 0 and
+1 respectively. The number of input masks must be 0, 1, or equal to the number
+of input images. Input mask sections if present override the input image
+sections.
+.le
+.ls omasks = ""
+The list of output masks which are a combination of the input mask if any
+and pixels rejected using the good data limits and / or iterative clipping.
+Data used to compute the statistics are represented by 0 in the output mask,
+rejected data by zero. The number of output masks must be 0 or equal to
+the number of input images.
+.le
+.ls fields = "image,npix,mean,stddev,min,max"
+The statistical quantities to be computed and printed.
+.le
+.ls lower = INDEF
+The minimum good data limit. All pixels are above the default value of INDEF.
+.le
+.ls upper = INDEF
+The maximum good data limit. All pixels are above the default value of INDEF.
+.le
+.ls nclip = 0
+The maximum number of iterative clipping cycles. By default no clipping is
+performed.
+.le
+.ls lsigma = 3.0
+The low side clipping factor in sigma.
+.le
+.ls usigma = 3.0
+The high side clipping factor in sigma.
+.le
+.ls binwidth = 0.1
+The width of the histogram bins in sigma used for computing the midpoint
+(estimate of the median) and the mode.
+.le
+.ls format = yes
+Label the output columns and print the results in fixed format ? If format
+is "no" no column labels are printed and the output is in free format.
+.le
+.ls cache = no
+Cache the image data in memory ? This can increase the efficiency of the
+task if nclip > 0 or if either of the midpt or mode statistics is computed.
+.le
+.ih
+DESCRIPTION
+The statistical quantities specified by the parameter \fIfields\fR are
+computed and printed for each image in the list specified by \fIimages\fR.
+The results are printed in tabular form with the fields listed in the order
+they are specified in the fields parameter. The available fields are the
+following:
+
+.nf
+ image - the image name
+ mask - the mask name
+ npix - the number of pixels used to do the statistics
+ mean - the mean of the pixel distribution
+ midpt - estimate of the median of the pixel distribution
+ mode - the mode of the pixel distribution
+ stddev - the standard deviation of the pixel distribution
+ skew - the skew of the pixel distribution
+ kurtosis - the kurtosis of the pixel distribution
+ min - the minimum pixel value
+ max - the maximum pixel value
+.fi
+
+The mean, standard deviation, skew, kurtosis, min and max are computed in a
+single pass through the image using the expressions listed below.
+Only the quantities selected by the fields parameter are actually computed.
+
+.nf
+ mean = sum (x1,...,xN) / N
+ y = x - mean
+ variance = sum (y1 ** 2,...,yN ** 2) / (N-1)
+ stddev = sqrt (variance)
+ skew = sum ((y1 / stddev) ** 3,...,(yN / stddev) ** 3) / (N-1)
+ kurtosis = sum ((y1 / stddev) ** 4,...,(yN / stddev) ** 4) / (N-1) - 3
+.fi
+
+The midpoint and mode are computed in two passes through the image. In the
+first pass the standard deviation of the pixels is calculated and used
+with the \fIbinwidth\fR parameter to compute the resolution of the data
+histogram. The midpoint is estimated by integrating the histogram and
+computing by interpolation the data value at which exactly half the
+pixels are below that data value and half are above it. The mode is
+computed by locating the maximum of the data histogram and fitting the
+peak by parabolic interpolation.
+
+Pixels are rejected from the initial statistics computation by specifying an
+input mask \fIimasks\fR or by setting the good data limits \fIlower\fR
+and \fIupper\fR. Iterative rejection can be performed by setting the
+clipping parameters \fInclip\fR, \fIlsigma\fR, and \fIusigma\fR.
+
+The input masks \fIimasks\fR can be specified in a variety of ways as
+shown below.
+
+.nf
+ "" - empty mask, use all the pixels
+ EMPTY - empty mask, use all the pixels
+ !KEYWORD - use mask specified by header keyword KEYWORD
+ !^KEYWORD - use inverse of mask specified by header keyword KEYWORD
+ mask - use specified mask
+ ^mask - use inverse of specified mask
+.fi
+
+In all cases the mask values are assumed to be 0 in good data regions and
+non-zero in rejected data regions. The input masks may in pixel list, e.g.
+".pl" format, or integer images format, e.g. ".imh", ".fits", etc.
+
+
+.ih
+EXAMPLES
+1. Find the number of pixels, mean, standard deviation and the minimum
+and maximum pixel value of a bias region in an image.
+
+.nf
+ cl> mimstat flat*[*,1] ""
+ # IMAGE NPIX MEAN STDDEV MIN MAX
+ flat1[*,1] 800 999.5 14.09 941. 1062.
+ flat2[*,1] 800 999.4 28.87 918. 1413.
+.fi
+
+The string "flat*" uses a wildcard to select all images beginning with the
+word flat. The string "[*,1]" is an image section selecting row 1.
+
+2. Compute the mean, midpoint, mode and standard deviation of a pixel
+distribution.
+
+.nf
+ cl> mimstat m51 "" fields="image,mean,midpt,mode,stddev"
+ # IMAGE PIXELS MEAN MIDPT MODE STDDEV
+ M51 262144 108.3 88.75 49.4 131.3
+.fi
+
+3. Compute the image statistics in an image section using a mask.
+
+.nf
+ cl> mimstat m51[200:400,200:400] imasks=M51.bpm.pl
+
+ cl> mimstat m51[200:400,200:400] imasks=M51.bpm.pl[200:400,200:400]
+
+ cl> mimstat m51[200:400,200:400] imasks=M51.crm.pl[1:201,1:201]
+.fi
+
+Note that the first two examples are equivalent so there is no need to
+specify the input mask section in the second case.
+
+4. Compute the image statistics using interactive rejection and save the
+rejected pixel mask.
+
+.nf
+ cl> mimstat m51 omasks=m51.rej.pl nclip=3
+.fi
+
+.ih
+BUGS
+When using a very large number of pixels the accumulation of the sums
+of the pixel values to the various powers may encounter roundoff error.
+This is significant when the true standard deviation is small compared
+to the mean.
+.ih
+SEE ALSO
+.endhelp
diff --git a/pkg/proto/doc/mkglbhdr.hlp b/pkg/proto/doc/mkglbhdr.hlp
new file mode 100644
index 00000000..1a2415ff
--- /dev/null
+++ b/pkg/proto/doc/mkglbhdr.hlp
@@ -0,0 +1,114 @@
+.help mkglbhdr Feb09 proto
+.ih
+NAME
+mkgblhdr -- make a global header
+.ih
+USAGE
+mkgblhdr input output
+.ih
+PARAMETERS
+.ls input
+List of input images.
+.le
+.ls output
+Output global dataless image.
+.le
+.ls reference = ""
+Optional reference image defining the allowed keywords, order, and
+blank cards. If no reference image is specified the first image in
+the input list serves as the reference image.
+.le
+.ls exclude = ""
+List of keywords to be excluded from the global header even if present
+in the reference header and with common values in all the input images.
+The case of the keywords in the list is ignored and the are matched to
+the headers in uppercase. Typically the list would be specified as an
+@file; i.e. the contents of a file with keywords on separate lines.
+Note that one may use the output of a header listing without editing
+since only the first eight characters of each line are used.
+.le
+.ih
+DESCRIPTION
+\fBMkgblhdr\fR makes a global (dataless) header with keywords common to a
+set of \fIinput\fR images. Common means present in all headers and
+with identical card records (value, formatting, and comments). The
+purpose of this thask is to allow appending the images using the FITS
+"inherit" convention into a multi-extension file.
+
+The set of keywords which are allowed to appear in the global header are
+those in a reference image which are not in the \fIexclude\fR list and
+which have identical card records in all images. The reference image is
+that specified by the \fIreference\fR parameter. If the value of that
+parameter is a null string then the first image in the \fIinput\fR list
+is used. The \fIreference\fR image also determines the order of the cards
+including blank cards.
+
+The way the task works is that the header card records are read from
+the reference image. Keywords in the excluded list are eliminated.
+Then reference card records which are not exactly matched in the input
+headers, independent of position, are eliminated. Finally any leading
+blank cards are removed and consecutive blank cards are reduced to single
+blank lines.
+
+.ih
+EXAMPLES
+
+1. An initial multi-extension file with inherited global keywords is split
+into separate images. The headers of the separate images are the union
+of the global and extension headers as is the convention for inheritance.
+After operating on the separate images it is desired to recreate a new
+MEF without having recourse to the original global header.
+
+.nf
+ cl> type images
+ image1
+ image2
+ cl> mkglbhdr @images newimage
+ cl> imcopy image1 newimage[im1,append,inherit]
+ cl> imcopy image2 newimage[im2,append,inherit]
+.fi
+
+To check the headers separately use the "noinherit" flag.
+
+.nf
+ cl> imhead newimage[0] l+
+ cl> imhead newimage[im1,noinherit] l+
+.fi
+
+Note that if the global header of the original MEF is available it is
+probably better to use that header instead of \fBmkglbhdr\fR as follows.
+
+.nf
+ cl> imcopy mefimage[0] newimage
+ cl> imcopy image1 newimage[im1,append,inherit]
+ cl> imcopy image2 newimage[im2,append,inherit]
+.fi
+
+It is important to understand how inheritance works when appending extensions.
+The IRAF FITS "kernel" eliminates keywords from the extension header when
+they have the same value as the global header. If there are common
+keywords but with different values then they are both present and any
+task that read the union of the global and extension headers will see
+the value from the extension.
+
+2. The following example uses an exclusion list.
+
+.nf
+ cl> type exclude.dat
+ CTYPE1
+ CTYPE2
+ CRVAL1
+ CRVAL2
+ CRPIX1
+ CRPIX2
+ CD1_1
+ CD1_2
+ CD2_1
+ CD2_2
+ cl> mkglbhdr @images newimage exclude="@exclude.dat"
+.fi
+
+.ih
+SEE ALSO
+mscsplit, mscjoin
+.endhelp
diff --git a/pkg/proto/doc/mskexpr.hlp b/pkg/proto/doc/mskexpr.hlp
new file mode 100644
index 00000000..9209b625
--- /dev/null
+++ b/pkg/proto/doc/mskexpr.hlp
@@ -0,0 +1,454 @@
+.help mskexpr Dec01 proto
+.ih
+NAME
+mskexpr -- General mask expression evaluator
+.ih
+USAGE
+mskexpr expr masks refimages
+.ih
+PARAMETERS
+.ls expr
+The expression to be evaluated. This may be the actual expression, or the
+string "@file" in which case the expression is taken from the named file.
+.le
+.ls masks
+The output masks. The size of the output masks defaults to the size of
+the reference image if any, the size of the reference mask if any, or the
+value of the dims parameter, in that order.
+.le
+.ls refimages
+The optional list of reference images. If the reference image list is defined
+there must be one reference image for every output mask. The reference image
+operand name is "i" and the associated reference image keywords are
+referred to as "i.<keyword>".
+.le
+.ls refmasks
+The optional list of reference masks. If the reference mask list is defined
+there must be one reference mask for every output mask. The reference mask
+operand name is "m" and the associated reference image keywords are
+referred to as "m.<keyword>".
+
+If both a reference image and reference mask are defined the reference mask will
+be matched to reference image as described by the help topic \fBpmmatch\fR.
+The application default is a match in "logical" coordinates which is
+effectively a trim or pad operation to match the size of the reference image.
+However, by use of the "pmmatch" environment variable one may match in
+"physcial" or "world" coordinates. Note that the simple expression
+"m" may be used to create an output mask file from the internal matching.
+.le
+.ls dims = "512,512"
+The default output mask dimensions. The value of dims is a comma delimited
+list of dimensions.
+.le
+.ls depth = 0
+The output mask depth in bits. The maximum depth and current default is
+27.
+.le
+.ls exprdb = "none"
+The file name of an optional expression database. An expression database
+may be used to define symbolic constants or a library of custom function
+macros.
+.le
+.ls verbose = yes
+Print task status messages ?
+.le
+
+.ih
+DESCRIPTION
+
+Mskexpr evaluates a mask expression \fIexpr\fR and writes the results to an
+output mask \fImasks\fR image. If expr is preceded by an "@" sign then
+the expression is read from the named file. The size of the output mask is
+determined by the reference image \fIrefimages\fR if any, the reference masks
+\fIrefmasks\fR if any, or the values of the \fIdims\fR parameter, in that
+order of precedence.
+
+The output mask is an integer image. Therefore any mask expression must
+evaluate to an integer value. The depth of the output mask in bits is defined
+by the \fIdepth\fR parameter. The default value is 27 bits.
+
+Evaluation of the mask expression is carried out one line at a time. This
+is efficient and permits operations on masks with large reference images
+to be carried out efficiently without using excessive memory. The entire
+expression is evaluated once per line of the output mask.
+
+\fBReference Images and Masks\fR
+
+In most cases one wants to make output masks to associate with images.
+The reference image list provides a reference image which is used to
+define the size and some of the header for the output mask. Note that
+a reference mask may be used for this purpose if no reference image
+is specified.
+
+Sometimes one may want to merge previous mask information into the output
+mask. The reference mask can be used for this purpose using the operand
+"m" in the expressions.
+
+When both a reference image and a reference mask are specified another
+useful feature is provided. This consists of matching the reference
+mask to the reference image even when the two are of different sizes or
+are related not "pixel-by-pixel" but through various transformations.
+The matching feature is described in the help topic \fBpmmatch\fR.
+(Note that the default for matching in world coordinates results in
+boolean mask values so if the actual mask values are needed the pmmatch
+setting must be set appropriately.) The application default is a match
+in "logical" coordinates which is effectively a trim or pad operation to
+match the size of the reference image. However, by use of the "pmmatch"
+environment variable one may match in "physcial" or "world" coordinates.
+
+This task is one way to create a matched mask for tasks that do not
+do the matching. The simple expression "m" when both a reference image
+and reference mask are specified will output a mask from for the reference
+image that is match in logical pixel space.
+
+\fBOperands\fR
+
+Input operands are represented symbolically in the input expression. Use of
+symbolic operands allows the same expression to be used with different data
+sets, simplifies the expression syntax, and allows a single input image
+to be used several places in the same expression.
+
+The following operands are recognized:
+
+.nf
+ i reference image
+ i.itime reference image keyword
+ m reference mask
+ m.itime reference mask keyword
+ 1.2345 numeric constant
+.fi
+
+Finally, there is a special builtin type of operand used to represent the
+mask pixel coordinates in a mask expression. These operands have the
+special reserved names "I", "J", "K", etc., up to the dimensions of the
+output image. The names must be upper case to avoid confusion to with the
+input operands "i" and "m".
+
+.nf
+ I x coordinate of pixel (column)
+ J y coordinate of pixel (line)
+ K z coordinate of pixel (band)
+.fi
+
+\fBOperators\fR
+
+The expression syntax implemented by mskexpr provides the following
+set of operators:
+
+.nf
+ ( expr ) grouping
+ + - * / arithmetic
+ ** exponentiation
+ // concatenate
+ expr ? expr1 : expr2 conditional expression
+ @ "name" get operand
+
+ && logical and
+ || logical or
+ ! logical not
+ < less than
+ <= less than or equal
+ > greater than
+ >= greater than or equal
+ == equals
+ != not equals
+ ?= substring equals
+
+ & bitwise and
+ | bitwise or
+ ^ bitwise exclusive or
+ ~ bitwise not
+.fi
+
+The conditional expression has the value \fIexpr1\fR if \fIexpr\fR is true,
+and \fIexpr2\fR otherwise. Since the expression is evaluated at every pixel
+this permits pixel-dependent operations such as checking for special pixel
+values, or selection of elements from either of two vectors. For example,
+the command
+
+ (i > -10 && i < 32000) ? 0 : 1
+
+has the constant value 0 if the reference image is greater than -10 and less
+than 32000, and 1 otherwise. Conditional expressions are general expressions
+and may be nested or used anywhere an expression is permitted.
+
+The concatenation operator applies to all types of data, not just strings.
+Concatenating two vectors results in a vector the combined length of the
+two input vectors.
+
+The substring equals operator "?=", used for string comparisons, is like
+"==" but checks for the presence of a substring, rather than exact equality
+of the two strings.
+
+\fBRegion Functions\fR
+
+Mskexpr supports a group of boolean region functions which can be used to set
+values inside or outside of certain geometric shapes. The routines may be
+called in two ways. The first way assumes that the output masks are two-
+dimensional. The second way assumes that they are multi-dimensional and
+specifies which dimensions the geometric operator applies to.
+
+.nf
+ point (x1, y1)
+ circle (xc, yc, r)
+ ellipse (xc, yc, r, ratio, theta)
+ box (x1, y1, x2, y2)
+ rectangle (xc, yc, r, ratio, theta)
+ vector (x1, y1, x2, y2, width)
+ pie (xc, yc, theta1, theta2)
+ polygon (x1, y1, ..., xn, yn)
+ cols (ranges)
+ lines (ranges)
+ cannulus (xc, yc, r1, r2)
+ eannulus (xc, yc, r1, r2, ratio, theta)
+ rannulus (xc, yc, r1, r2, ratio, theta)
+ pannulus (width, x1, y1, ..., xn, yn)
+
+ point (I, J, x1, y1)
+ circle (I, J, xc, yc, r)
+ ellipse (I, J, xc, yc, r, ratio, theta)
+ box (I, J, x1, y1, x2, y2)
+ rectangle (I, J, xc, yc, r, ratio, theta)
+ vector (I, J, x1, y1, x2, y2, width)
+ pie (I, J, xc, yc, theta1, theta2)
+ polygon (I, J, x1, y1, .., xn, yn)
+ cols (I, ranges)
+ lines (J, ranges)
+ cannulus (I, J, xc, yc, r1, r2)
+ eannulus (I, J, xc, yc, r1, r2, ratio, theta)
+ rannulus (I, J, xc, yc, r1, r2, ratio, theta)
+ pannulus (I, J, width, x1, y1, ..., xn, yn)
+
+ xc,yc - center coordinates in pixels
+ r1,r2 - semi-major axis lengths in pixels
+ ratio - ratio of semi-minor / semi-major axes
+ theta[n] - position angle in degrees
+ x1,y1 - starting coordinates in pixels
+ x2,y2 - ending coordinates in pixels
+ x[n],y[n] - vertices of a polygon
+ ranges - string defining a range, e.g. "100-200,300,400-500"
+.fi
+
+\fBOther Functions\fR
+
+Where it makes sense all intrinsic functions support all datatypes, with
+some restrictions on \fIbool\fR and \fIchar\fR. Arguments may be scalars or
+vectors. Scalar and vector arguments may be mixed in the same function
+call. Arguments are automatically type converted upon input as necessary.
+Some functions support a variable number of arguments and the details of
+the the operation to be performed may depend upon how many arguments are
+given.
+
+Functions which operate upon vectors are applied to the \fIlines\fR of an
+image. When applied to an image of dimension two or greater, these
+functions are evaluated separately for every line of the multidimensional
+image.
+
+Standard Intrinsic Functions
+
+.nf
+ abs (arg) absolute value
+ max (arg, 0.0, ...) maximum value
+ min (arg1, arg2, ...) minimum value
+ mod (arg1, arg2) modulus
+ sqrt (arg) square root
+.fi
+
+Mathematical or trigonometric functions
+
+.nf
+ acos (arg) arc cosine
+ asin (arg) arc sine
+ atan (arg [,arg2]) arc tangent
+ atan2 (arg [,arg2]) arc tangent
+ cos (arg) cosine
+ cosh (arg) hyperbolic cosine
+ exp (arg) exponential
+ log (arg) natural logarithm
+ log10 (arg) logarithm base 10
+ sin (arg) sine
+ sinh (arg) hyperbolic sine
+ tan (arg) tangent
+ tanh (arg) hyperbolic tangent
+.fi
+
+The trigonometric functions operate in units of radians. The \fIdeg\fR and
+\fIrad\fR intrinsic functions (see below) can be used to convert to and from
+degrees if desired.
+
+Type conversion functions
+
+.nf
+ bool (arg) coerce to boolean
+ short (arg) coerce to short
+ int (arg) truncate to integer
+ nint (arg) nearest integer
+ long (arg) coerce to long (same as int)
+ real (arg) coerce to real
+ double (arg) coerce to double
+ str (arg) coerce to string
+.fi
+
+The numeric type conversion functions will convert a string to a number if
+called with a character argument. The \fIstr\fR function will convert any
+number to a string.
+
+Projection functions
+
+.nf
+ len (arg) length of a vector
+ hiv (arg) high value of a vector
+ lov (arg) low value of a vector
+ mean (arg [,ksigma]) mean of a vector
+ median (arg) median of a vector
+ stddev (arg [, ksigma]) standard deviation
+ sum (arg) sum of a vector
+.fi
+
+The projection functions take a vector as input and return a scalar value as
+output. The functions \fImean\fR and \fIstddev\fR, used to compute the mean
+and standard deviation of a vector, allow an optional second argument which
+if given causes a K-sigma rejection to be performed.
+
+Miscellaneous functions
+
+.nf
+ deg (arg) radians to degrees
+ rad (arg) degrees to radians
+ median (arg1, arg2, arg3, ...) vector median of 3-5 vectors
+ repl (arg, n) replicate
+ sort (arg) sort a vector
+ shift (arg, npix) shift a vector
+.fi
+
+The \fImedian\fR function shown here computes the vector median of several
+input vectors, unlike the projection median which computes the median value
+of a vector sample. \fIsort\fR sorts a vector, returning the sorted vector
+as output (this can be useful for studying the statistics of a sample).
+\fIshift\fR applies an integral pixel shift to a vector, wrapping around at
+the endpoints. A positive shift shifts data features to the right (higher
+indices).
+
+The \fIrepl\fR (replicate) function replicates a data element, returning a
+vector of length (n * len(a)) as output. For example, this can be used to
+create a dummy data array or image by replicating a constant value.
+
+\fBThe Expression Database\fR
+
+The \fImskexpr\fR expression database provides a macro facility which can be
+used to create custom libraries of functions for specific applications. A
+simple example follows.
+
+.nf
+ # Sample MSKEXPR expression database file.
+
+ # Constants.
+ SQRTOF2= 1.4142135623730950488
+ PI= 3.1415926535897932385
+
+ # Simple bad data functions.
+ bdata1 (i < -100 || i > 25000)
+ bdata2 (i < -100 || i > 32000)
+
+ # New regions functions.
+ cmpie(xc,yc,r,t1,t2) circle (xc, yc, r) && (! pie (xc, yc, t1, t2))
+.fi
+
+The complete syntax of a macro entry is as follows:
+
+ <symbol>['(' arg-list ')'][':'|'='] replacement-text
+
+The replacement text may appear on the same line as the macro name or may
+start on the next line, and may extend over multiple input lines if necessary.
+If so, continuation lines must be indented. The first line with no whitespace
+at the beginning of the line terminates the macro. Macro functions may be
+nested. Macro functions are indistinguishable from intrinsic functions in
+expressions.
+
+
+.ih
+EXAMPLES
+
+1. Create a 0-valued 512 x 512 mask and set all the pixels inside a circular
+annulus to 1.
+
+.nf
+cl> type expr.dat
+cannulus (256., 256., 20., 40.) ? 1 : 0
+cl> mskexpr @expr.dat mask.pl ""
+.fi
+
+2. Repeat the previous example but set all the pixels outside the circular
+annulus to 1.
+
+.nf
+cl> type expr.dat
+! cannulus (256., 256., 20., 40.) ? 1 : 0
+cl> mskexpr @expr.dat mask.pl ""
+.fi
+
+3. Create a 0-valued 512 x 512 mask and set all the pixels inside the
+intersection of 2 circles to 1.
+
+.nf
+cl> type expr.dat
+circle (220., 220., 50.) && circle (240., 220., 50.) ? 1 : 0
+cl> mskexpr @expr.dat mask.pl ""
+.fi
+
+4. Create a 0 valued mask and set all the pixels outside the good
+data range 0 <= pixval <= 10000 in the reference image and outside
+a circle to 1. Note that the i character defines the reference image
+operand.
+
+.nf
+cl> type expr.dat
+i < 0 || i > 10000 || circle (256., 256., 50.) ? 1 : 0
+cl> mskexpr @expr.dat mask.pl dev$pix
+.fi
+
+5. Create a 0 valued 512 x 512 mask and set all the pixels inside a circle
+excluding a wedge shaped region to 1. The expression cmpie is used defined
+and stored in the expression database "myexpr.db"
+
+.nf
+cl> type myexpr.db
+# Sample MSKEXPR expression database file.
+
+# Constants.
+SQRTOF2= 1.4142135623730950488
+PI= 3.1415926535897932385
+
+# Simple bad data functions.
+bdata1 (i < -100 || i > 25000)
+bdata2 (i < -100 || i > 32000)
+
+# New regions functions.
+cmpie(xc,yc,r,t1,t2) circle (xc, yc, r) && (! pie (xc, yc, t1, t2))
+
+cl> type expr.dat
+cmpie (256., 256., 50., 0., 30.) ? 1 : 0
+
+cl> mskexpr @expr.dat mask.pl "" exprdb=myexpr.db
+.fi
+
+6. A set of dithered images have been transformed to a common world
+coordinate system, stacked, and a mask created for the sources. To
+create a boolean mask for one of the images from the deep source mask:
+
+.nf
+cl> set pmmatch="world"
+cl> mskexpr "m" mask1.pl exp1 refmask=stackmask
+.fi
+
+
+.ih
+TIME REQUIREMENTS
+
+.ih
+BUGS
+
+.ih
+SEE ALSO
+imexpr, mskregions, pmmatch
+.endhelp
diff --git a/pkg/proto/doc/mskregions.hlp b/pkg/proto/doc/mskregions.hlp
new file mode 100644
index 00000000..ed397d8a
--- /dev/null
+++ b/pkg/proto/doc/mskregions.hlp
@@ -0,0 +1,279 @@
+.help mskregions Dec01 proto
+.ih
+NAME
+mskregions -- Create mask from a list of region specifications
+.ih
+USAGE
+mskregions regions masks refimages
+.ih
+PARAMETERS
+.ls regions
+The list of input regions files. The number of regions files must be one or
+equal to the number of output mask images. Regions files contain a list of
+region specifications one region per line. The region specifications may be
+a simple region description, e.g. "circle 100. 100. 50.", or a region
+expression, e.g. "circle (100., 100., 50.) && circle (125., 100., 50.)".
+.le
+.ls masks
+The output masks. The size of the output masks defaults to the size of
+the reference image or the value of the dims parameter in that order of
+precedence.
+.le
+.ls refimages
+The optional list of reference images. If the reference image list is defined
+there must be one reference image for every output mask.
+.le
+.ls dims = "512,512"
+The default output mask dimensions. The value of dims is a comma delimited
+list of dimensions.
+.le
+.ls depth = 0
+The default output mask depth in bits currently 27.
+.le
+.ls regnumber = "constant"
+The region definition scheme. The options are:
+.ls constant
+Assign all the mask regions the value of \fIregval\fR.
+.le
+.ls number
+Assign each region a sequential value beginning with \fIregval\fR.
+.le
+.le
+.ls regval = 1
+The starting mask region value.
+.le
+.ls exprdb = "none"
+The file name of an optional expression database. An expression database
+may be used to define symbolic constants or a library of custom function
+macros.
+.le
+.ls append = no
+Add the region list to an existing mask ?
+.le
+.ls verbose = yes
+Print task status messages ?
+.le
+
+.ih
+DESCRIPTION
+
+Mskregions reads a list of region specifications from the input files
+\fIregions\fR and writes the results to the output masks \fImasks\fR image.
+The number of regions files must be on or equal to the number of output
+masks. The size of the output mask is determined by the reference image
+\fIrefimages\fR if any \fIrefmasks\fR if any or the values in the
+\fIdims\fR parameter in that order of precedence.
+
+The output mask is an integer image. Therefore all mask values must be
+integer. The mask values assigned to the regions in \fIregions\fR are
+determined by the \fIregnumber\fR and \fIregval\fR parameters. By
+default all new regions are assigned the value of 1. The depth of the output
+mask in bits is defined by the \fIdepth\fR parameter. The default value is
+27 bits.
+
+The input region specifications may be region descriptions or region
+expressions. Region descriptions are simple definitions of common geometric
+shapes. Evaluation of the regions expressions is carried out one line at a time.
+
+\fBRegions Definitions\fR
+
+The following region definitions are supported.
+
+.nf
+ point x1 y1
+ circle xc yc r
+ ellipse xc yc r ratio theta
+ box x1 y1 x2 y2)
+ rectangle xc yc r ratio theta
+ vector x1 y1 x2 y2 width
+ pie xc yc theta1 theta2
+ polygon x1 y1 ..., xn yn
+ cols ranges
+ lines ranges
+ cannulus xc yc r1 r2
+ eannulus xc yc r1 r2 ratio theta
+ rannulus xc yc r1 r2 ratio theta
+ pannulus width x1 y1 ... xn yn
+.fi
+
+\fBOperands Used in Region Expressions\fR
+
+Input operands are represented symbolically in the input expression. Use of
+symbolic operands allows the same expression to be used with different data
+sets, simplifies the expression syntax, and allows a single input image
+to be used several places in the same expression.
+
+There is a special builtin type of operand used to represent the
+mask pixel coordinates in a mask expression. These operands have the
+special reserved names "I", "J", "K", etc., up to the dimensions of the
+output image. The names must be upper case to avoid confusion to with the
+input operands "i" and "m".
+
+.nf
+ I x coordinate of pixel (column)
+ J y coordinate of pixel (line)
+ K z coordinate of pixel (band)
+.fi
+
+\fBOperators Used in Region Expressions\fR
+
+The expression syntax implemented by mskexpr provides the following
+set of operators:
+
+.nf
+ ( expr ) grouping
+ && logical and
+ || logical or
+ ! logical not
+.fi
+
+
+\fBFunctions Used in Region Expressions\fR
+
+Mskexpr supports a group of boolean region functions which can be used to set
+values inside or outside of certain geometric shapes. The routines may be
+called in two ways. The first way assumes that the output masks are two-
+dimensional. The second way assumes that they are multi-dimensional and
+specifies which dimensions the geometric operator applies to.
+
+.nf
+ point (x1, x2)
+ circle (xc, yc, r)
+ ellipse (xc, yc, r, ratio, theta)
+ box (x1, y1, x2, y2)
+ rectangle (xc, yc, r, ratio, theta)
+ vector (x1, y1, x2, y2, width)
+ pie (xc, yc, theta1, theta2)
+ polygon (x1, y1, ..., xn, yn)
+ cols (ranges)
+ lines (ranges)
+ cannulus (xc, yc, r1, r2)
+ eannulus (xc, yc, r1, r2, ratio, theta)
+ rannulus (xc, yc, r1, r2, ratio, theta)
+ pannulus (width, x1, y1, ..., xn, yn)
+
+ point (I, J, x1, x2)
+ circle (I, J, xc, yc, r)
+ ellipse (I, J, xc, yc, r, ratio, theta)
+ box (I, J, x1, y1, x2, y2)
+ rectangle (I, J, xc, yc, r, ratio, theta)
+ vector (I, J, x1, y1, x2, y2, width)
+ pie (I, J, xc, yc, theta1, theta2)
+ polygon (I, J, x1, y1, .., xn, yn)
+ cols (I, ranges)
+ lines (J, ranges)
+ cannulus (I, J, xc, yc, r1, r2)
+ eannulus (I, J, xc, yc, r1, r2, ratio, theta)
+ rannulus (I, J, xc, yc, r1, r2, ratio, theta)
+ pannulus (I, J, width, x1, y1, ..., xn, yn)
+
+ xc,yc - center coordinates in pixels
+ r1,r2 - semi-major axis lengths in pixels
+ ratio - ratio of semi-minor / semi-major axes
+ theta[n] - position angle in degrees
+ x1,y1 - starting coordinates in pixels
+ x2,y2 - ending coordinates in pixels
+ x[n],y[n] - vertices of a polygon
+ ranges - string defining a range, e.g. "100-200,300,400-500"
+.fi
+
+\fBThe Expression Database\fR
+
+The \fImskexpr\fR expression database provides a macro facility which can be
+used to create custom libraries of functions for specific applications. A
+simple example follows.
+
+.nf
+ # Sample MSKEXPR expression database file.
+
+ # Constants.
+ SQRTOF2= 1.4142135623730950488
+ PI= 3.1415926535897932385
+
+ # Simple bad data functions.
+ bdata1 (i < -100 || i > 25000)
+ bdata2 (i < -100 || i > 32000)
+
+ # New regions functions.
+ cmpie(xc,yc,r,t1,t2) circle (xc, yc, r) && (! pie (xc, yc, t1, t2))
+.fi
+
+The complete syntax of a macro entry is as follows:
+
+ <symbol>['(' arg-list ')'][':'|'='] replacement-text
+
+The replacement text may appear on the same line as the macro name or may
+start on the next line, and may extend over multiple input lines if necessary.
+If so, continuation lines must be indented. The first line with no whitespace
+at the beginning of the line terminates the macro. Macro functions may be
+nested. Macro functions are indistinguishable from intrinsic functions in
+expressions.
+
+
+.ih
+EXAMPLES
+
+1. Create a 0-valued 512 x 512 mask and set all the pixels inside a circular
+annulus to 1.
+
+.nf
+cl> type regions.dat
+cannulus 256. 256. 20. 40.
+cl> mskregions regions.dat mask.pl ""
+.fi
+
+2. Repeat the previous example but set all the pixels outside the circular
+annulus to 1. Note that in this case the user must use regions expression
+syntax not region definition syntax
+
+.nf
+cl> type region.dat
+! cannulus (256., 256., 20., 40.)
+cl> mskregions regions.dat mask.pl ""
+.fi
+
+3. Create a 0-valued 512 x 512 mask and set all the pixels inside the
+intersection of 2 circles to 1. The & operator produces the same result
+as &&.
+
+.nf
+cl> type regions.dat
+circle (220., 220., 50.) && circle (240., 220., 50.)
+cl> mskexpr regions.dat mask.pl ""
+.fi
+
+4. Create a 0 valued 512 x 512 mask and set all the pixels inside a circle
+excluding a wedge shaped region to 1. The expression cmpie is used defined
+and stored in the expression database "myexpr.db"
+
+.nf
+cl> type myexpr.db
+# Sample MSKEXPR expression database file.
+
+# Constants.
+SQRTOF2= 1.4142135623730950488
+PI= 3.1415926535897932385
+
+# Simple bad data functions.
+bdata1 (i < -100 || i > 25000)
+bdata2 (i < -100 || i > 32000)
+
+# New regions functions.
+cmpie(xc,yc,r,t1,t2) circle (xc, yc, r) && (! pie (xc, yc, t1, t2))
+
+cl> type regions.dat
+cmpie (256., 256., 50., 0., 30.) ? 1 : 0
+
+cl> mskregions regions.dat mask.pl "" exprdb=myexpr.db
+.fi
+
+.ih
+TIME REQUIREMENTS
+
+.ih
+BUGS
+
+.ih
+SEE ALSO
+imexpr, mskexpr
+.endhelp
diff --git a/pkg/proto/doc/ringavg.hlp b/pkg/proto/doc/ringavg.hlp
new file mode 100644
index 00000000..bdb4a0fd
--- /dev/null
+++ b/pkg/proto/doc/ringavg.hlp
@@ -0,0 +1,83 @@
+.help ringavg Nov02 proto
+.ih
+NAME
+ringavg -- compute pixel averages in concentric rings about given center
+.ih
+USAGE
+ringavg image xc yc
+.ih
+PARAMETERS
+.ls image
+Image to be used.
+.le
+.ls xc, yc
+Pixel coordinate for center of rings.
+.le
+.ls r1 = 0, r2 = 10, dr = 1
+Rings to be measured. \fIr1\fR is the inner radius of the first ring,
+\fIr2\fR is the outer radius of the last bin, and \fIdr\fR is the widths
+of the rings. The values are in units of pixels.
+.le
+.ls labels = yes
+Print column labels for the output?
+.le
+.ls vebar = no
+If \fIvebar\fR is yes then the standard deviation and standard error will
+be printed as negative values for use with \fBgraph\fR.
+.le
+.ih
+DESCRIPTION
+Pixels are binned into a series of concentric rings centered on a given
+position in the input image. The rings are defined by an inner radius
+for the first ring, an outer radius for the last ring, and the width
+of the rings. The statistics of the pixel values in each ring are then
+computed and list to the standard output. The output lines consist
+of the inner and outer ring radii, the number of pixels, the average value,
+the standard deviation of the value (corrected for population size), and
+the standard error. The parameter \fIlabel\fR selects whether to include
+column labels.
+
+If the ring average are to be plotted with the task \fBgraph\fR using
+the option to plot error bars based on the standard deviation or standard
+error then the \fIvebar\fR parameter may be set to write the values as
+negative values are required by that task.
+
+This task is a script and so users may copy it and modify it as desired.
+Because it is a script it will be very slow if r2 becomes large.
+.ih
+EXAMPLES
+1. Compute the ring averages with labels and output to the terminal.
+
+.nf
+ cl> ringavg pwimage 17 17
+ # R min R max Npix Average Std Dev Std Err
+ 0.00 1.00 5 7.336 9.16 4.096
+ 1.00 2.00 8 0.2416 0.2219 0.07844
+ 2.00 3.00 16 0.3994 0.5327 0.1332
+ 3.00 4.00 20 0.06211 0.05491 0.01228
+ 4.00 5.00 32 0.0987 0.08469 0.01497
+ 5.00 6.00 32 0.06983 0.06125 0.01083
+ 6.00 7.00 36 0.0641 0.0839 0.01398
+ 7.00 8.00 48 0.06731 0.05373 0.007755
+ 8.00 9.00 56 0.06146 0.07601 0.01016
+ 9.00 10.00 64 0.05626 0.05846 0.007308
+.fi
+
+2. Plot the ring averages with standard errors used for error bars.
+
+.nf
+ cl> ringavg pwimage 17 17 label- vebar+ | fields STDIN 2,4,6 |
+ >>> graph point+ marker=vebar
+.fi
+
+3. Plot ring averages for galaxy in dev$pix.
+
+.nf
+ cl> ringavg dev$pix 256 256 r2=100 dr=5 label- | fields STDIN 2,4 |
+ >>> graph logy+
+.fi
+
+.ih
+SEE ALSO
+pradprof, psfmeasure, radprof
+.endhelp
diff --git a/pkg/proto/doc/rskysub.hlp b/pkg/proto/doc/rskysub.hlp
new file mode 100644
index 00000000..ab6c8543
--- /dev/null
+++ b/pkg/proto/doc/rskysub.hlp
@@ -0,0 +1,234 @@
+.help rskysub Sep01 proto
+.ih
+NAME
+rskysub -- sky subtract images using running mean or median
+.ih
+USAGE
+rskysub input output
+.ih
+PARAMETERS
+.ls input
+The list of input images to be sky subtracted in time of observation order.
+.le
+.ls output
+The list of output sky subtracted images. The number of output images must
+equal the number of input images. If output is "default", "dir$default", or
+"dir$" then for every input image an output image called "dir$image.sub.?"
+is created, where "dir$" is the optional directory specification, "image" is
+the root input image name, and "?" is the next available version number.
+.le
+.ls imasks = ""
+The optional list of input image masks. The input image masks are assumed to
+consist of 0's in good pixel regions and > 0 integer values elsewhere. The
+number of input images masks must be 0, 1, or equal to the number of input
+images. If imasks is "default", "dir$default", or "dir$" then for every input
+image a default input image mask called "dir$image.obm.?" is searched for,
+where "dir$" is the optional directory specification, "image" is the root
+input image name, and "?" is the highest available version number.
+.le
+.ls omasks = ""
+The optional list of output masks. If output masks are defined they are
+used to created the sky image in place of the input masks. The output masks
+are a combination of the original input mask and pixels masked during the
+input image scale factor computation and consist of 0's in good data regions
+and 1's elsewhere. Output masks are only computed if \fIscale\fR = "median".
+The number of output masks must be 0 or equal to the number of input images.
+If imasks is "default", "dir$default", or "dir$" then for every input image
+an output mask image called "dir$image.skm.?" is created, where "dir$" is
+the optional directory specification, "image" is the root input image name,
+and "?" is the next available version number.
+.le
+.ls hmasks = ""
+The list of output holes masks. The holes masks defined bad pixels in the
+output images, i.e. those for which the underlying sky image was undefined.
+Holes masks are created only if \fIhmasks\fR is defined and there is at least
+1 undefined sky image pixel in the output image. Holes masks contain 0's in
+undefined sky regions and 1's elsewhere. If hmasks is "default", "dir$default",
+or "dir$" then for every input image an output mask image called
+"dir$image.hom.?" is created, where "dir$" is the optional directory
+specification, "image" is the root input image name, and "?" is the next
+available version number.
+.le
+
+.ls rescale = yes
+Force recomputation of the individual input image scale factors even though
+they have been previously computed and stored in the keyword \fIskyscale\fR?
+.le
+.ls scale = "median"
+The method used to compute the individual image scale factors. The options
+are:
+.ls none
+The individual scale factors are all set to 1.0.
+.le
+.ls !<keyword>
+The individual scale factors are all set to the value of the input image header
+keyword \fIkeyword\fR.
+.le
+.ls median
+The individual scale factors are set to 1 / median. The medians are estimated
+using the input masks \fIimasks\fR, input image section \fIstatsec\fR,
+the minimum and maximum good data values \fIlower\fR and \fIupper\R, the
+clipping factors \fImaxiter\fR, \fIlnsigrej\fR, and \fIunsigrej\fR and the
+histogram binning parameter \fIbinwidth\fR.
+.le
+.ls @<file>
+The individual image scale factors are read from the file \fIfile\fR.
+.le
+.le
+.ls skyscale = "SKYSCALE"
+The image header keyword containing the computed scaling factor.
+\fISkyscale\fR is written to both the input and output images.
+.le
+
+.ls statsec = ""
+The input image section used to compute the individual image scaling factors.
+Statsec is independent of the input image section if any.
+.le
+.ls lower = INDEF, upper = INDEF
+The minimum and maximum input image good data values.
+.le
+.ls maxiter = 20
+The maximum number of clipping iterations.
+.le
+.ls lnsigrej = 3.0, unsigrej = 3.0
+The lower and upper side sigma clipping factors.
+.le
+.ls binwidth = 0.1
+The histogram bin width in sigma used in estimating the median value.
+.le
+
+.ls resubtract = yes
+Force recomputation and subtraction of the sky image even though it exists
+already ?
+.le
+.ls combine = "average"
+The method used to create the sky images. The options are "average" and
+"median".
+.le
+.ls ncombine = 6
+The default number of images used to create the sky images.
+.le
+.ls nmin = 3
+The minimum number of images used to create the sky images.
+.le
+.ls nlorej = 0, nhirej = 0
+The number of high and low side pixels to reject if \fIcombine\fR is "average".
+.le
+.ls blank = 0.0
+The value assigned to undefined output image pixels, i.e. those for
+which the corresponding sky image pixel is undefined.
+.le
+.ls skysub = "SKYSUB"
+The sky subtraction processing keyword which is written to the output
+image when processing is complete.
+.le
+.ls holes = "HOLES"
+The homes mask name keyword which is written to the output image if an output
+holes mask is created.
+.le
+
+.ls cache = yes
+Cache the input images in memory if possible ?
+.le
+.ls verbose = yes
+Print messages about the progress of the task ?
+.le
+
+.ih
+DESCRIPTION
+
+RSKYSUB computes the average sky image for each image in the input image
+list \fIinlist\fR using a running mean or median technique and subtracts
+it from the input image to create the output sky subtracted images
+\fIoutlist\fR. The input image list is assumed to be ordered by time of
+observation. If the input image masks list \fIimasks\fR is defined then the
+input image pixels in the bad pixel regions are removed from the sky statistics
+and sky image computation. RSKYSUB optionally creates a list of output pixel
+masks \fIomasks\fR and a list of holes masks \fIhmasks\fR.
+
+The input masks \fIimasks\fR can be specified in a variety of ways as
+shown below.
+
+.nf
+ "" - empty mask, use all the pixels
+ EMPTY - empty mask, use all the pixels
+ !KEYWORD - use mask specified by header keyword KEYWORD
+ !^KEYWORD - use inverse of mask specified by header keyword KEYWORD
+ mask - use specified mask
+ ^mask - use inverse of specified mask
+.fi
+
+In all cases the mask values are assumed to be 0 in good data regions and
+non-zero in rejected data regions. The input masks may in pixel list, e.g.
+".pl" format, or any supported integer image format, e.g. ".imh", ".fits", etc.
+
+The optional output pixel masks \fIomasks\fR are a combination of the
+input image masks and the scaling factor computation masks. They consist
+entirely of 0's and 1's with 0's defining the good data regions.
+
+The optional output holes masks \fIhmasks\fR which specify those pixels
+in the output images which are undefined consist entirely of 1's and 0's
+with 0's defining the holes.
+
+Before beginning the sky subtraction step RSKYSUB computes a scaling factor for
+each individual input image in \fIinlist\fR and stores it in the input image
+header keyword \fIskyscale\fR. If \fIscale\fR is "median" then the median of
+the input image pixels is computed using the input image masks \fIimasks\fR,
+the good data limits \fIlower\fR and \fIupper\fR, the clipping factors
+\fImaxiter\fR, \fIlnsigrej\fR, and \fIunisgrej\fR, and the histogram
+resolution parameter \fIbinwidth\fR. The scaling factor is set to 1 / median.
+If \fIscale\fR is "none", "!<keyword>", or "@<file>" the individual
+scale factors are set to 1, read from the input image header keyword
+\fI<keyword>\fR, or from a file \fI@<file>\fR respectively. If \fIrescale\fR is
+yes and \fIscale\fR is "median" then the scaling computation is redone
+regardless of whether or not the \fIskyscale\fR keyword is present in the
+input image header.
+
+RSKYSUB computes the sky image for each input image by multiplying each
+input image by the value of its scaling factor and then computing the
+combination of \fIncombine\fR neighbor images using the algorithm
+specified by \fIcombine\fR. If \fIcombine\fR is average then the
+\fInlorej\fR and \fInhirej\fR lowest and highest pixels are rejected from
+the stack to be combined. For example if the number of input images is 25 and
+ncombine is 6 then images 2-4 are used to compute the sky image for image 1,
+images 10-12 and 14-16 are used to compute the sky for image 13, and images
+22-24 are used to compute the sky image for image 25. There must be a minimum
+of \fInmin\fR neighbor images or the sky image will not be computed. If the
+input masks are defined then pixels in bad regions are also rejected
+from the final sky image computation. Undefined output image pixels,
+i.e. those for which the corresponding sky image pixel is undefined, are
+assigned the value \fIblank\fR. The sky subtraction processing keyword
+\fIskysub\fR is written to the output image when sky subtraction is complete.
+
+If \fIcache\fR is "yes" then RSKYSUB will attempt to buffer the active images
+in memory and will run significantly faster. If \fIverbose\fR = yes then
+the task prints messages about its actions as it goes along.
+
+.ih
+EXAMPLES
+
+1. Sky subtract a list of 25 images without masking.
+
+.nf
+cl> rskysub @inlist @outlist maxiter=10 lnsigrej=5.0 unsigrej=5.0
+.fi
+
+
+2. Sky subtract the same list of 25 images with masking where the masks
+are assumed to be stored in the BPM keyword.
+
+.nf
+cl> rskysub @inlist @outlist imasks="!BPM" maxiter=10 lnsigrej=5.0 \
+unsigrej=5.0
+.fi
+
+.ih
+TIME REQUIREMENTS
+
+.ih
+BUGS
+
+.ih
+SEE ALSO
+imcombine, imexpr
+.endhelp
diff --git a/pkg/proto/doc/suntoiraf.hlp b/pkg/proto/doc/suntoiraf.hlp
new file mode 100644
index 00000000..4e14ffc2
--- /dev/null
+++ b/pkg/proto/doc/suntoiraf.hlp
@@ -0,0 +1,226 @@
+.help suntoiraf Apr92 proto
+.ih
+NAME
+suntoiraf -- convert Sun raster files into IRAF images
+.ih
+USAGE
+suntoiraf input
+.ih
+PARAMETERS
+.ls names
+List of raster files to be converted. The output image names will be
+the same as the individual input file names with a ".imh" appended
+(assuming that you are using the Old Image Format). Rasterfiles with
+an extension of `.ras', will have the extension omitted. The images will
+appear in the same directory as the raster files, typically the \fBUnix\fR
+login directory when the task is used within an imtool R_DISPOSE string.
+.le
+.ls apply_lut = yes
+Apply the lookup table translation to each pixel? If \fBapply_lut\fR =
+no, the pixel values will be taken directly from the raster file. If
+\fBapply_lut\fR = yes, an NTSC weighted translation from the rasterfile's
+color lookup table will be applied to each pixel to convert to grayscale.
+.le
+.ls delete = no
+Delete the rasterfile after making the image? This is useful for making
+automated (Unix or IRAF) scripts for producing photographic or other hardcopy.
+.le
+.ls verbose = yes
+Print informative information while the transformation is occurring?
+.le
+.ls listonly = no
+List the rasterfile header information instead?
+.le
+.ls yflip = yes
+Flip the output image top to bottom? Rasterfiles are stored in reverse
+vertical order from IRAF images.
+.le
+.ih
+DESCRIPTION
+\fBSuntoiraf\fR will convert Sun raster files into IRAF images. This is
+useful, for example, to make \fBsolitaire\fR photographic prints or
+other hardcopy from an \fBimtool\fR window (see IMTOOL HINTS, below).
+
+For general use, \fBsuntoiraf\fR will convert non-run-length-encoded
+Sun rasterfiles into IRAF images. The output image will have the same
+name as the input rasterfile, but with a `.imh' (or other IRAF image
+extension) appended. If the rasterfile has an extension of `.ras', this
+extension will be omitted from the image name.
+
+If \fBapply_lut\fR = no, the (typically 8 bit) pixel values will be
+copied directly to the output with no interpretation. If \fBapply_lut\fR
+= yes, the NTSC equalization weighting will be applied to the RGB lookup
+table to convert the color rasterfile to a grayscale image. The weights
+are 0.299, 0.587, and 0.114 for the red, green, and blue LUT entries,
+respectively.
+
+Various options are available to tailor the operation of the task to
+your (or your script's) precise liking. If \fBdelete\fR = yes, the
+input raster file will be removed from the disk after the image
+conversion. This is useful in script applications. If \fBverbose\fR =
+yes, a running commentary will be presented, otherwise the operation of
+the task is silent except for error messages. If \fBlistonly\fR = yes,
+the task will report information about each input rasterfile, rather
+than converting it. If \fByflip\fR = yes, the storage order of the
+lines of the output image will be inverted from the input rasterfile.
+Since the display convention is inverted for rasterfiles relative to
+IRAF images, this will result in an upright output image. On the other
+hand, if \fByflip\fR = no, the storage order will be preserved at the
+expense of the output orientation appearing inverted.
+.ih
+IMTOOL HINTS
+One possible first step in making a hardcopy is to create the raster files
+from the imtool window. The recommended way to do this is to select "Imcopy"
+from the imtool frame menu. If the menu is popped up by positioning the
+cursor on the right hand side of the window frame (and away from the edge
+of the screen), the menu won't overlay the window, possibly contaminating
+the hardcopy. The resulting raster file will save not only the pixels from
+the imtool buffer but also the lookup table information.
+
+Another way to generate an imtool screendump is to use the <F7> function
+key, but this requires care because of the possibility of catching cursor
+fallout in the solitaire. If you do use the <F7> function key, position the
+cursor to minimize its visual impact. The cursor will appear in the
+hardcopy (solitaire) unless it happens to blink out at the moment that
+the hardcopy is made.
+
+A possibly confusing choice is the "Save" option in the imtool setup menu.
+This is inappropriate because no lookup table information is preserved.
+
+Only the portion of the frame buffer that is displayed in the window
+will be snapped - what you see is what you get.
+
+If you have to adjust the contrast and brightness of the image very
+much by using the right mouse button, you may want to redisplay the
+image using a different Z1 and Z2. This will preserve the grayscale
+resolution in cases in which the "effective" Z1 and Z2 are much
+different than the "actual" Z1 and Z2.
+
+In the setup menu try:
+
+.nf
+ Show colorbar: No
+ Background color: black
+.fi
+
+The choice of the background color may have an effect on any graphics
+in the frame.
+
+If you use the \fBimttodmd\fR shell script available at NOAO/Tucson,
+the pixel files for the images will be created in the IRAF directory
+`tmp$', which is typically the UNIX directory `/tmp/'. If you have
+trouble with this directory filling up, the pixel files may be placed
+into another directory by setting the UNIX environment variable `tmp'
+to the desired pathname:
+
+.nf
+ % setenv tmp '/scr1/v13/pixels/'
+.fi
+
+*before* starting up IMTOOL (IN THE PARENT SHELL OF THE IMTOOL).
+Note that if this is set when IRAF is entered, all IRAF temporary
+files will end up in this directory.
+.ih
+EXAMPLES
+These are rather specific to NOAO/Tucson, but may suggest ways that the
+task may be useful to you.
+
+To configure imtool for one button solitaire operation:
+
+The Unix shell script, "/ursa/iraf/extern/nlocal/lib/imttodmd" (on
+Ursa and its kin) can be used to make imtool solitaire prints. The
+script may move to /usr/local/bin in the future and would thus be
+available like any other unix command. Imttodmd is meant to be
+called directly by the imtool. For example, place these lines in
+your `.login' file:
+
+.nf
+ setenv R_RASTERFILE 'snap.%d'
+ setenv R_DISPOSE '/ursa/iraf/extern/nlocal/lib/imttodmd %s'
+.fi
+
+More recent versions of imtool also allow setting these strings from
+the setup panel.
+
+The parent shell of the imtool must have these variables defined in
+its environment prior to starting imtool. If you aren't sure what
+this means, the simplest thing to do is to edit these lines into
+your \fB.login\fR, log off of the workstation \fBcompletely\fR, and
+log back into Unix, Sunview, and IRAF.
+
+Pressing <F7> will send snaps directly to the solitaire queue, leaving
+no intermediate files. Only the windowed portion of the frame buffer
+will be snapped. The necessary files will twinkle in and out of
+existence in the current working directory of the imtool, typically
+your Unix login directory. Your windows will be frozen until the
+solitaire is safely on its way, at which time the screen will beep.
+This should take on the order of half a minute for a 512 square
+imtool on a lightly loaded system. If faster response is needed,
+the script may be run in the background:
+
+.nf
+ setenv R_DISPOSE '/ursa/iraf/extern/nlocal/lib/imttodmd %s &'
+.fi
+
+Care should be taken in this case to avoid having too many
+(\fBtoo many is typically more than one\fR) background job running
+at once.
+
+
+To make one-button snap files and solitaires:
+
+The \fBimttodmd\fR script has various options for leaving the
+intermediate files around. To leave the snap images in your
+directory and also make solitaires (i.e., if you are highly
+suspicious by nature) set the variable:
+
+.nf
+ setenv R_DISPOSE '/ursa/iraf/extern/nlocal/lib/imttodmd -image %s'
+.fi
+
+
+To only make the images, with no solitaire output:
+
+.nf
+ setenv R_DISPOSE '/ursa/iraf/extern/nlocal/lib/imttodmd -nocrt %s'
+.fi
+
+This will allow you to run a single CRTPICT job after collecting all
+the snap files.
+
+
+To make solitaires from an imtool window, the old way:
+
+Enter this from the UNIX shell, \fBbefore starting suntools\fR:
+
+.nf
+ % setenv R_RASTERFILE "frame.%d"
+.fi
+
+Start suntools, login to iraf and load the noao, tv and local
+packages. Display an image and press the <F7> function key to
+create a raster file named "frame.N", where N is an index number
+generated by imtool. This raster file will be appear in your
+\fBUNIX\fR login directory.
+
+Dump the raster files to the solitaire queue:
+
+.nf
+ lo> suntoiraf frame.*
+ lo> crtpict frame.*.i.imh ztrans=min_max z1=5 z2=260
+ (The z1 & z2 values were empirically determined.)
+.fi
+
+*** Don't forget to clean up! ***
+
+.nf
+ lo> imdelete frame.*.i.imh
+ lo> delete frame.*
+.fi
+
+The solitaires should be ready the next day in the basket by the
+main computer lab.
+.ih
+SEE ALSO
+irafil, binfil, and the UNIX man page for imtool
+.endhelp
diff --git a/pkg/proto/doc/text2mask.hlp b/pkg/proto/doc/text2mask.hlp
new file mode 100644
index 00000000..575f611f
--- /dev/null
+++ b/pkg/proto/doc/text2mask.hlp
@@ -0,0 +1,90 @@
+.help text2mask Jun96 proto
+.ih
+NAME
+text2mask -- convert text description to pixel mask
+.ih
+USAGE
+.nf
+text2mask text mask ncols nlines
+.fi
+.ih
+PARAMETERS
+.ls text
+Text file of pixel regions. The format of this file consists of lines of
+individual pixels (whitespace separated column and line) or rectangular
+regions (whitespace separated starting and ending columns and starting and
+ending lines).
+.le
+.ls mask
+Pixel mask name to be created. A pixel list image, .pl extension,
+is created so no extension is necessary.
+.le
+.ls ncols, nlines
+Dimensions for pixel mask image.
+.le
+.ls linterp = 1
+Mask code for rectangular regions which are narrower in the line direction
+than the column direction.
+.le
+.ls cinterp = 2
+Mask code for rectangular regions which are narrower in the column direction
+than the line direction.
+.le
+.ls square = 3
+Mask code for square regions which are larger than a single pixel.
+.le
+.ls pixel = 4
+Mask code for single pixels.
+.le
+.ih
+DESCRIPTION
+A text file describing individual pixels or rectangular regions is
+converted to a pixel mask image in pixel list format. The name of
+the text file, the name of the pixel mask to be created, and the
+dimensions of the pixel mask image are specified.
+
+The text file consists of lines of two or four numbers. If two numbers
+are given, separated by whitespace, they define a single pixel and
+the values are the column and line pixel coordinates. If four numbers
+are given, separated by whitespace, they define a rectangular region.
+The four numbers are the pixel coordinates for the starting column,
+the ending column, the starting line, and the ending line. This format
+is the same as the old (pre-V2.11) "fixpix" format. This task may
+be used to convert these old "fixpix" data files to pixel masks (as used
+by the new \fBfixpix\fR task) or to create pixel masks.
+
+The different region shapes may be coded by the mask values. This is
+useful with the \fBfixpix\fR task which can select different replacement
+methods based on the mask codes. In particular, one may want to interpolate
+along the narrower dimension of a rectangular region. The region
+shapes that may be coded are individual pixels, square regions, and
+rectangular regions with narrow dimension along lines or columns.
+
+In addition to this task,
+pixel mask images may be made in a variety of ways. Any task which produces
+and modifies image values may be used. Some useful tasks are
+\fBimexpr, imreplace, imcopy,\fR and \fBmkpattern\fR. If a new image
+is specified with the explicit ".pl" extension then the pixel mask
+format is produced. Another way to make masks are with the
+task \fBccdmask\fR. The task \fBccdmask\fR is specialized to make a mask
+of bad pixels from flat fields or, even better, from the ratio of
+two flat fields of different exposure levels.
+.ih
+EXAMPLES
+1. Convert a text region description into a mask and then use it to
+replace pixels by interpolation along the narrower dimension.
+
+.nf
+ cl> list2mask fp.dat mask
+ cl> fixpix pix mask linterp=1,3,4 cinterp=2
+.fi
+.ih
+REVISIONS
+.ls TEXT2MASK V2.11
+This task is new and appears in conjunction with a new pixel mask
+based version of \fBfixpix\fR.
+.le
+.ih
+SEE ALSO
+imreplace, imexpr, imcopy, imedit, fixpix
+.endhelp
diff --git a/pkg/proto/doc/wcsedit.hlp b/pkg/proto/doc/wcsedit.hlp
new file mode 100644
index 00000000..e946b782
--- /dev/null
+++ b/pkg/proto/doc/wcsedit.hlp
@@ -0,0 +1,422 @@
+.help wcsedit Apr92 proto
+.ih
+NAME
+wcsedit -- edit the image world coordinate system
+.ih
+USAGE
+wcsedit image parameter value axes1
+.ih
+PARAMETERS
+.ls image
+The list of images for which the WCS is to be edited. Image sections are
+ignored.
+.le
+.ls parameter
+The WCS parameter to be edited. The WCS parameters recognized by
+WCSEDIT are: 1) the FITS WCS
+parameters crpix, crval, cd and, 2) the IRAF WCS parameters ltv, ltm, wtype,
+axtype, units, label, and format. Only one WCS parameter may be edited at a
+time.
+.le
+.ls value
+The new parameter value. The numerical parameters crpix, crval, cd, ltv, and
+ltm will not be updated if WCSEDIT is unable to decode the parameter value
+into a legal floating point number.
+.le
+.ls axes1
+The list of principal axes for which \fIparameter\fR is to be edited.
+Axes1 can
+be entered as a list of numbers separated by commas, e.g. "1,2" or as a
+range, e.g. "1-2".
+.le
+.ls axes2
+The list of dependent axes for which \fIparameter\fR is to be edited.
+Axes2 can
+be entered as a list of numbers separated by commas, e.g. "1,2" or as a
+range, e.g. "1-2". The axes2 parameter is only required if
+\fIparameter\fR is "cd" or "ltm".
+.le
+.ls wcs = "world"
+The WCS to be edited. The options are: the builtin systems "world" or
+"physical", or a named system, e.g. "image" or "multispec". The builtin system
+"logical" may not be edited.
+.ls world
+If \fIwcs\fR is "world" the default WCS is edited. The default WCS
+is either 1) the value of the environment variable "defwcs" if
+set in the user's IRAF environment (normally it is undefined) and present
+in the image header,
+2) the value of the "system"
+attribute in the image header keyword WAT0_001 if present in the
+image header or, 3) the "physical" coordinate system.
+.le
+.ls physical
+If \fIwcs\fR is "physical", WCS is the pixel coordinate system of
+the original image, which may be different from the pixel coordinate system
+of the current image, if the current image is the result of an
+imcopy or other geometric transformation operation. In the "physical"
+coordinate system the ltv, ltm and the axis attribute
+parameters wtype, axtype, units, label, and format may be edited, but the FITS
+parameters crval, crpix, and cd cannot.
+.le
+.ls name
+A user supplied wcs name.
+If the named WCS does not exist in the image, a new one of that
+name initialized to the identity transform, will be opened for editing, and
+the old WCS will be destroyed. This option should only be used for creating
+a totally new FITS WCS.
+.le
+.le
+.ls interactive = no
+Edit the WCS interactively?
+.le
+.ls commands = ""
+The interactive editing command prompt.
+.le
+.ls verbose = yes
+Print messages about actions taken in interactive or non-interactive mode?
+.le
+.ls update = yes
+Update the image header in non-interactive mode? A specific command exists
+to do this in interactive mode.
+.le
+
+.ih
+DESCRIPTION
+
+In non-interactive mode WCSEDIT replaces the current value of the WCS
+parameter \fIparameter\fR with the new value \fIvalue\fR in the headers of
+\fIimages\fR and prints a summary of the new WCS on the terminal. If
+\fIverbose\fR is "no" the summary is not printed. If \fIverbose\fR is
+"yes" and \fIupdate\fR is "no", the result of the editing operation
+is printed on the terminal but the header is not modified.
+
+The WCS parameter \fIparameter\fR may be one of: crval, crpix, cd, ltv, ltm,
+wtype, axtype, units, label, or format in either upper or lower case.
+The WCS array parameters crpix, crval, ltv, wtype, axtype, units, label,
+and format
+may be edited for more than one axis at a time by setting \fIaxes1\fR to a
+range of axes values. The WCS matrix parameters cd and ltm may be edited for
+more than one axis at a time by setting both \fIaxes1\fR and \fIaxes2\fR to
+a range of values. In this case, if no \fIaxes2\fR values are entered,
+\fIaxes2\fR = "", the
+diagonal elements of the cd and ltm matrices specified by \fIaxes1\fR are
+edited. A single non-diagonal element of the cd or ltm matrices can be
+edited by setting \fIaxis1\fR and \fIaxis2\fR to a single number.
+
+The user can create a new WCS from scratch by setting
+\fIwcs\fR to a name different from the name of the WCS in the image header.
+A new WCS with the same dimension as the image and initialized
+to the identity transformation is presented to the user for editing.
+IF THE USER UPDATES THE IMAGE HEADER AFTER EDITING THE NEW WCS, ALL
+PREVIOUS WCS INFORMATION IS LOST.
+
+In interactive mode, WCSEDIT displays the current WCS
+on the terminal if \fIverbose\fR = "yes", and prompts the user for
+an editing command. The supported editing commands are shown below.
+
+.nf
+ BASIC COMMANDS
+
+? Print the WCSEDIT commands
+show Print out the current WCS
+update Quit WCSEDIT and update the image WCS
+quit Quit WCSEDIT without updating the image WCS
+
+
+ PARAMETER DISPLAY AND EDITING COMMANDS
+
+crval [value axes1] Show/set the FITS crval parameter(s)
+crpix [value axes1] Show/set the FITS crpix parameter(s)
+cd [value axes1 [axes2]] Show/set the FITS cd parameter(s)
+ltv [value axes1] Show/set the IRAF ltv parameter(s)
+ltm [value axes1 [axes2]] Show/set the IRAF ltm parameter(s)
+wtype [value axes1] Show/set the FITS/IRAF axes transform(s)
+axtype [value axes1] Show/set the FITS/IRAF axis type(s)
+units [value axes1] Show/set the IRAF units(s)
+label [value axes1] Show/set the IRAF axes label(s)
+format [value axes1] Show/set the IRAF axes coordinate format(s)
+.fi
+
+.ih
+THE WCS PARAMETERS
+
+Below is a list of the WCS parameters as they appear encoded in the in the
+IRAF image header. Parameters marked with E can be edited directly with
+WCSEDIT. Parameters marked with U should be updated automatically by WCSEDIT
+if the proper conditions are met. The remaining parameters cannot be edited
+with WCSEDIT. A brief description of the listed parameters is given below.
+For a detailed description of the meaning of these parameters, the user
+should consult the two documents listed in the REFERENCES section.
+
+.nf
+WCSDIM WCS dimension (may differ from image)
+
+CTYPEn U coordinate type
+CRPIXn E reference pixel
+CRVALn E world coords of reference pixel
+CDi_j E CD matrix
+
+CDELTn U CDi_i if CD matrix not used (input only)
+CROTA2 U rotation angle if CD matrix not used
+
+LTVi E Lterm translation vector
+LTMi_j E Lterm rotation matrix
+
+WATi_jjj U WCS attributes for axis I (wtype,axtype,units,label,format)
+WAXMAPii WCS axis map
+.fi
+
+The WCSDIM and WAXMAP parameters cannot be edited by WCSEDIT, unless a
+new WCS is created in which case WCSDIM is set to
+the dimension of the input image and the axis map is deleted.
+The FITS parameters CRPIX, CRVAL, and CD
+define the transformation between the world coordinate system and the pixel
+coordinate system of the image and may be edited directly. The more general
+FITS CD matrix notation supersedes the FITS CDELT/CROTA notation if both are
+present on input, and is used by preference on output. The FITS parameter
+CTYPE cannot be edited directly by WCSEDIT but is correctly updated on
+output using the current values of the WCS parameters wtype and axtype
+parameters, if there was a pre-existing FITS header in the image. On input
+IRAF currently recognizes the following values of the FITS parameter CTYPE:
+RA---TAN and DEC--TAN (the tangent plane sky projection), RA---SIN and
+DEC--SIN (the sin sky projection), RA---ARC and DEC--ARC (the arc sky
+projection), LINEAR, and MULTISPEC, from which it derives the correct values
+for wtype and axtype.
+
+The LTV and LTM are IRAF parameters which define the transformation between
+the
+current image pixel coordinate system and the original pixel coordinate system,
+if the current image was derived from a previous
+image by a geometric transformation, e.g. IMCOPY or IMSHIFT.
+Both parameters may be edited directly by WCSEDIT, but with the exception
+of resetting the LTV vector to 0 and the LTM matrix to the identity
+matrix it is not usually desirable to do so. The task WCSRESET can also
+be used for this purpose.
+
+The WATi_jjj parameters are not directly accessible by WCSEDIT but the five
+axis attributes which are encoded under these keywords (wtype, axtype,
+units, label, and format) may be edited.
+The IRAF WCS code currently
+recognizes the following values for "wtype": "linear", "tan", "sin",
+"arc", and "multispec". If "wtype" is not defined or cannot
+be decoded by the WCS code "linear" is assumed.
+Axtype should be "ra" or "dec" if wtype is one of the sky projections
+"tan", "sin" or "arc", otherwise it should be undefined.
+WCSEDIT will combine the values of "wtype" amd "axtype" on output to
+produce the correct value of the FITS keyword CTYPE.
+The "label" and "units" parameter may be set to any string constant.
+Format must be set to a legal IRAF format as described in the section
+below.
+
+.ih
+FORMATS
+A format specification has the form "%w.dCn", where w is the field
+width, d is the number of decimal places or the number of digits of
+precision, C is the format code, and n is radix character for
+format code "r" only. The w and d fields are optional. The format
+codes C are as follows:
+
+.nf
+b boolean (YES or NO)
+c single character (c or '\c' or '\0nnn')
+d decimal integer
+e exponential format (D specifies the precision)
+f fixed format (D specifies the number of decimal places)
+g general format (D specifies the precision)
+h hms format (hh:mm:ss.ss, D = no. decimal places)
+m minutes, seconds (or hours, minutes) (mm:ss.ss)
+o octal integer
+rN convert integer in any radix N
+s string (D field specifies max chars to print)
+t advance To column given as field W
+u unsigned decimal integer
+w output the number of spaces given by field W
+x hexadecimal integer
+z complex format (r,r) (D = precision)
+
+
+Conventions for w (field width) specification:
+
+ W = n right justify in field of N characters, blank fill
+ -n left justify in field of N characters, blank fill
+ 0n zero fill at left (only if right justified)
+absent, 0 use as much space as needed (D field sets precision)
+
+
+Escape sequences (e.g. "\n" for newline):
+
+\b backspace (not implemented)
+\f formfeed
+\n newline (crlf)
+\r carriage return
+\t tab
+\" string delimiter character
+\' character constant delimiter character
+\\ backslash character
+\nnn octal value of character
+
+Examples
+
+%s format a string using as much space as required
+%-10s left justify a string in a field of 10 characters
+%-10.10s left justify and truncate a string in a field of 10 characters
+%10s right justify a string in a field of 10 characters
+%10.10s right justify and truncate a string in a field of 10 characters
+
+%7.3f print a real number right justified in floating point format
+%-7.3f same as above but left justified
+%15.7e print a real number right justified in exponential format
+%-15.7e same as above but left justified
+%12.5g print a real number right justified in general format
+%-12.5g same as above but left justified
+
+%h format as nn:nn:nn.n
+%15h right justify nn:nn:nn.n in field of 15 characters
+%-15h left justify nn:nn:nn.n in a field of 15 characters
+%12.2h right justify nn:nn:nn.nn
+%-12.2h left justify nn:nn:nn.nn
+
+%H / by 15 and format as nn:nn:nn.n
+%15H / by 15 and right justify nn:nn:nn.n in field of 15 characters
+%-15H / by 15 and left justify nn:nn:nn.n in field of 15 characters
+%12.2H / by 15 and right justify nn:nn:nn.nn
+%-12.2H / by 15 and left justify nn:nn:nn.nn
+
+\n insert a newline
+.fi
+
+.ih
+REFERENCES
+
+Detailed documentation for the IRAF world coordinate system interface MWCS
+can be found in the file "iraf$sys/mwcs/MWCS.hlp". This file can be
+formatted and printed with the command "help iraf$sys/mwcs/MWCS.hlp fi+ |
+lprint". Details of the FITS header world coordinate system interface can
+be found in the document "World Coordinate Systems Representations Within the
+FITS Format" by Hanisch and Wells, available from our anonymous ftp
+archive.
+
+.ih
+EXAMPLES
+
+1. Change the default output coordinate formats for an image with a defined
+FITS tangent plane projection in its header, for the RA axis (axis 1), and the
+DEC axis (axis 2) to %H and %h respectively. Then display the image and use
+rimcursor to produce a coordinate list of objects whose coordinates are
+printed as hh:mm:ss.s and dd:mm:ss.s respectively.
+
+.nf
+ cl> wcsedit image format %H 1
+ cl> wcsedit image format %h 2
+ cl> display image 1
+ cl> rimcursor wcs=world > coordlist
+ ... mark the coordinates
+.fi
+
+2. Change the default sky projection for an image with a defined tangent
+plane projection to one with a sin projection. Note that wtype for both
+axis1 and axis2 must be changed to "sin". Check the results first before
+doing the actual update.
+
+.nf
+ cl> wcsedit image wtype sin 1-2 update-
+ cl> wcsedit image wtype sin 1-2
+.fi
+
+
+3. Change the diagonal elements of the FITS cd matrix to 2.0. The off
+diagonal elements are 0.0. This is equivalent to resetting the image scale.
+
+.nf
+ cl> wcsedit image cd 2.0 1-2 ""
+.fi
+
+4. Set the value of the FITS cd matrix elements, cd[2,1] and cd[1,2] to 0.0.
+This removes any rotation/skew from the WCS definition.
+
+.nf
+ cl> wcsedit image cd 0.0 2 1
+ cl> wcsedit image cd 0.0 1 2
+.fi
+
+5. Change the FITS crval value for axis 2.
+
+.nf
+ cl> wcsedit image crval 47.85 2
+.fi
+
+6. Create a totally new WCS for an image, deleting the previous WCS
+and set the diagonal elements of the cd matrix to 0.68. 0.68 is the
+scale of the 36 inch telescope at KPNO.
+
+.nf
+ cl> wcsedit image cd 1.5 1-2 wcs="kpno9m"
+.fi
+
+7. Interactively edit the WCS of an image. with an existing FITS header.
+
+.nf
+ cl> wcsedit image interactive+
+
+ ... summary of current WCS is printed on terminal
+
+ wcsedit: ?
+
+ ... user types in ? to see list of wcsedit commands
+
+ wcsedit: cd 2.0 1-2
+
+ ... user changes the scale of the WCS
+
+ wcsedit: format %0.3f 1-2
+
+ ... user changes format so the coordinates will be printed
+ out with 3 decimals of precision by any tasks which
+ can read the WCS format parameter such as rimcursor
+ and listpixels
+
+ wcsedit: show
+
+ ... user checks the new wcs
+
+ wcsedit: update
+
+ ... user quits editor and updates the image header
+.fi
+
+8. Open and edit a new WCS for an image. Any pre-existing WCS will
+be destroyed, assuming that the default wcs is not "newwcs".
+
+.nf
+ cl> wcsedit image wcs=newwcs intera+
+
+ wcsedit: ....
+ wcsedit: ....
+
+ ... edit in the desired values
+
+ wcsedit: update
+
+ ... update the image header.
+.fi
+
+.ih
+TIME REQUIREMENTS
+.ih
+BUGS
+The IRAF WCS code supports the dimensional reduction of images,
+for example creating an image with smaller dimensions than its parent, but
+may not be fully compatible with FITS when this occurs.
+In this case user may need to fix up an illegal or
+incorrect WCS with HEDIT or HFIX bypassing the WCS code used by WCSEDIT.
+
+WCSEDIT does not permit the user to edit any parameters encoded in the
+WATi_jjj keywords other than the five listed: wtype, axtype, units, label,
+and format. For example WCSEDIT cannot be used to edit the "speci" parameters
+used by the IRAF spectral reductions code "multispec" format. The spectral
+reduction code itself should be used to do this, although hfix can
+be used to fix a serious problem should it arise.
+.ih
+SEE ALSO
+wcsreset,hedit,hfix
+.endhelp
diff --git a/pkg/proto/doc/wcsreset.hlp b/pkg/proto/doc/wcsreset.hlp
new file mode 100644
index 00000000..6725aa7a
--- /dev/null
+++ b/pkg/proto/doc/wcsreset.hlp
@@ -0,0 +1,272 @@
+.help wcsreset Apr92 proto
+.ih
+NAME
+wcsreset -- reset the image coordinate system
+.ih
+USAGE
+wcsreset image wcs
+.ih
+PARAMETERS
+.ls image
+The list of images for which the coordinate system is to be reset. Image
+sections are ignored.
+.le
+.ls wcs
+The name of the coordinate system to be reset. The following systems are
+pre-defined:
+.ls physical
+Reset the physical coordinate system to the logical coordinate system, but
+leave the default world coordinate system unchanged. This operation removes
+the history of past image operations such as imcopy, imshift, magnify, etc
+from the definition of the physical coordinate system, but not from the
+definition of the world coordinate system.
+.le
+.ls world
+Reset the default world coordinate system to the logical coordinate system.
+This operation removes all world coordinate system information from the
+image header.
+.le
+
+In addition to these two reserved world coordinate systems, the name of any
+other defined world coordinate system, for example "multispec" may be given.
+In this case WCSRESET resets the named coordinate system to the logical
+coordinate system only if it is present in the image header.
+.le
+.ls verbose = yes
+Print messages about actions taken by the task?
+.le
+.ih
+DESCRIPTION
+
+WCSRESET resets the coordinate system \fIwcs\fR in the images specified by
+\fIimage\fR to the logical coordinate system, and prints messages about the
+actions taken if \fIverbose\fR = "yes". Since WCSRESET modifies the
+image headers it should be used with caution.
+
+Logical coordinates are coordinates relative to the current image. The
+logical coordinate system is the one used by the image input/output routines
+to access the image on disk. In an image raster logical coordinate system,
+the coordinates of the pixel centers must lie within the following
+range: 1.0 <= x[i] <= nx[i], where x[i] is the coordinate in dimension i,
+nx[i] is the size of the image in dimension i, and the current maximum
+number of image dimensions is 7. In the case of an image section of an image
+raster, the nx[i] refer to the dimensions of the section, not the dimensions
+of the full image. The logical coordinate system cannot by definition be
+reset.
+
+The physical coordinate system is the coordinate system in which the
+coordinates of an object are invariant to successive linear transformations
+of the image. In this coordinate system, the pixel coordinates of an object
+in an image raster remain the same, regardless of any imcopy, imshift,
+rotate, etc operations on the image. The most common reason for desiring to
+reset the physical coordinate system to the logical coordinate system is to
+make the new image independent of its history by removing the effects of
+these linear transformation operations from its physical coordinate system.
+Resetting the physical coordinate system to the logical coordinate system,
+does not alter the default world coordinate system. If for example the input
+image is a spectrum, with a defined dispersion solution, resetting the
+physical coordinate system will not alter the dispersion solution.
+Similarly if the input image is a direct CCD image with a defined sky
+projection world coordinate system, resetting the physical coordinate system
+will not alter the sky projection.
+
+The world coordinate system is the default coordinate system for the
+image. The default world coordinate system is the one named by the
+environment variable "defwcs" if defined in the user environment (initially
+it is undefined) and present in the image header; else it is the first
+world coordinate system
+defined for the image (the .imh and .hhh image format support only one wcs
+but the .qp format can support more); else it is the physical coordinate
+system. Resetting the default coordinate system to the logical
+coordinate system will destroy all coordinate information for that system,
+for that image.
+
+If the user sets the parameter wcs to a specific system, for example
+to "multispec", only images with the coordinate system "multispec"
+will have their coordinate system reset.
+
+.ih
+REFERENCES
+
+Detailed documentation for the IRAF world coordinate system interface MWCS
+can be found in the file "iraf$sys/mwcs/MWCS.hlp". This file can be
+formatted and printed with the command "help iraf$sys/mwcs/MWCS.hlp fi+ |
+lprint". Details of the FITS header world coordinate system interface can
+be found in the document "World Coordinate Systems Representations Within the
+FITS Format" by Hanisch and Wells, available from our anonymous ftp
+archive.
+
+.ih
+EXAMPLES
+
+1. The user runs implot on a section of the spectrum outspec with the
+wcs parameter set to "physical".
+
+.nf
+ implot outsec[30:50] wcs=physical
+.fi
+
+To his/her surprise the range of the plot in x produced by implot is
+[129,149] not [30:50] as expected. The user lists the image header with the
+imheader task and sees the following.
+
+.nf
+ WCSDIM = 1
+ CTYPE1 = 'LINEAR '
+ CRVAL1 = 4953.94775390626
+ CRPIX1 = -98.
+ CDELT1 = 0.0714096948504449
+ CD1_1 = 0.0714096948504449
+ WAT0_001= 'system=linear
+ WAT1_001= 'wtype=linear label=Wavelength units=Angstroms
+ LTV1 = -99.
+ LTM1_1 = 1.
+.fi
+
+The standard FITS keywords CTYPE1, CRVAL1, CRPIX1, and CDELT1 are present.
+The CD1_1 keyword is part of the new FITS CD matrix notation and in this
+example duplicates the function of CDELT1. The remaining keywords WCSDIM,
+WAT0_001, WAT1_001, LTV1, and LTM1_1 are IRAF specific keywords. The
+user notes that the LTV1 keyword is -99. not 0. and suddenly remembers that
+outspec was created by extracting a piece of a larger spectrum using the
+imcopy task as shown below.
+
+.nf
+ cl> imcopy inspec[100:200] outspec
+.fi
+
+The section [30:50] in outspec actually corresponds to the section [129:149]
+in inspec and it is this coordinate system that implot is plotting when
+wcs = "physical". The user decides has he/she does not want to know
+about the pixel coordinate system of the original image and runs wcsreset
+to reset the physical coordinate system to the logical coordinate system.
+
+.nf
+ wcsreset outspec physical
+.fi
+
+The new header of outspec looks like the following.
+
+.nf
+ WCSDIM = 1
+ CTYPE1 = 'LINEAR '
+ CRVAL1 = 4953.94775390626
+ CRPIX1 = -98.
+ CDELT1 = 0.0714096948504449
+ CD1_1 = 0.0714096948504449
+ WAT0_001= 'system=linear
+ WAT1_001= 'wtype=linear label=Wavelength units=Angstroms
+ LTM1_1 = 1.
+.fi
+
+It is identical to the header listed above except that the
+LTV1 keyword is not defined and is therefore 0. The user runs
+implot with wcs = "physical" as before and sees a plot which extends
+from 30 to 50 as expected.
+
+2. Reset the physical coordinate system of the direct CCD image skypix
+which has a defined sky projection system. Skypix was created by
+copying the central [129:384,129:384] of a 512 square image into a 256
+square image.
+
+The image header is the following.
+
+.nf
+ CRPIX1 = 129.75
+ CRPIX2 = 130.93
+ CRVAL1 = 201.94541667302
+ CRVAL2 = 47.45444
+ CTYPE1 = 'RA---TAN'
+ CTYPE2 = 'DEC--TAN'
+ CDELT1 = -2.1277777E-4
+ CDELT2 = 2.1277777E-4
+ WCSDIM = 2
+ CD1_1 = -2.1277777000000E-4
+ CD2_2 = 2.12777770000000E-4
+ LTV1 = -128.
+ LTV2 = -128.
+ LTM1_1 = 1.
+ LTM2_2 = 1.
+ WAT0_001= 'system=image
+ WAT1_001= 'wtype=tan axtype=ra
+ WAT2_001= 'wtype=tan axtype=dec
+.fi
+
+The user runs implot on skypix wcs = "physical"
+
+.nf
+ implot skypix wcs=physical
+.fi
+
+and sees a plot in x which extends from 129 to 384 which are the coordinates
+of skypix in the original image.
+The user resets the physical coordinate system to the logical coordinate
+system.
+
+.nf
+ cl> wcsreset m51 physical
+.fi
+
+The new header looks like the following. Note that the LTV1 and LTV2 keywords
+have disappeared, they are 0. but everything else is the same.
+
+.nf
+ CRPIX1 = 129.75
+ CRPIX2 = 130.93
+ CRVAL1 = 201.94541667302
+ CRVAL2 = 47.45444
+ CTYPE1 = 'RA---TAN'
+ CTYPE2 = 'DEC--TAN'
+ CDELT1 = -2.1277777E-4
+ CDELT2 = 2.1277777E-4
+ WCSDIM = 2
+ CD1_1 = -2.1277777000000E-4
+ CD2_2 = 2.12777770000000E-4
+ LTM1_1 = 1.
+ LTM2_2 = 1.
+ WAT0_001= 'system=image
+ WAT1_001= 'wtype=tan axtype=ra
+ WAT2_001= 'wtype=tan axtype=dec
+.fi
+
+When the user runs implot with wcs = "physical" he/she sees a plot which
+extends from 1 to 256 as expected.
+
+3. Initialize the world coordinate system of the previous image.
+
+.nf
+ cl> wcsreset skypix world
+.fi
+
+The header now looks like the following.
+
+.nf
+ WCSDIM = 2
+ LTM1_1 = 1.
+ LTM2_2 = 1.
+ WAT0_001= 'system=physical
+ WAT1_001= 'wtype=linear
+ WAT2_001= 'wtype=linear
+.fi
+
+The world system defaults to the physical coordinates system and the
+physical coordinate system is identical to the logical coordinate system.
+All coordinate information has been destroyed.
+
+4. Initialize the world coordinate system "spec1". If the default world
+coordinate
+system "spec1" cannot be found in the image header a warning message
+will be issued and nothing will be changed.
+
+.nf
+ cl> wcsreset spectrum spec1
+.fi
+
+.ih
+TIME REQUIREMENTS
+.ih
+BUGS
+.ih
+SEE ALSO
+rimcursor,listpixels,wcsedit,hedit,hfix
+.endhelp