aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/irred
diff options
context:
space:
mode:
Diffstat (limited to 'noao/imred/irred')
-rw-r--r--noao/imred/irred/Revisions61
-rw-r--r--noao/imred/irred/center.par21
-rw-r--r--noao/imred/irred/centerpars.par14
-rw-r--r--noao/imred/irred/datapars.par25
-rw-r--r--noao/imred/irred/doc/center.hlp637
-rw-r--r--noao/imred/irred/doc/irlincor.hlp81
-rw-r--r--noao/imred/irred/doc/mosproc.hlp170
-rw-r--r--noao/imred/irred/imcombine11
-rw-r--r--noao/imred/irred/iralign.par20
-rw-r--r--noao/imred/irred/irlincor.par7
-rw-r--r--noao/imred/irred/irmatch1d.par21
-rw-r--r--noao/imred/irred/irmatch2d.par21
-rw-r--r--noao/imred/irred/irmosaic.par22
-rw-r--r--noao/imred/irred/irred.cl36
-rw-r--r--noao/imred/irred/irred.hd8
-rw-r--r--noao/imred/irred/irred.men11
-rw-r--r--noao/imred/irred/irred.par3
-rw-r--r--noao/imred/irred/mkpkg24
-rw-r--r--noao/imred/irred/mosproc.cl172
-rw-r--r--noao/imred/irred/t_irlincor.x254
-rw-r--r--noao/imred/irred/txdump.par8
-rw-r--r--noao/imred/irred/x_irred.x1
22 files changed, 1628 insertions, 0 deletions
diff --git a/noao/imred/irred/Revisions b/noao/imred/irred/Revisions
new file mode 100644
index 00000000..22a23670
--- /dev/null
+++ b/noao/imred/irred/Revisions
@@ -0,0 +1,61 @@
+.help revisions Jun88 noao.imred.irred
+.nf
+irred$irred.cl
+ The IRLINCOR task was mistakenly declared using 'x_irred.x' instead
+ of 'x_irred.e'. Works fine under the CL but broke Pyraf (1/18/07, MJF)
+
+irred$center.par
+irred$doc/center.hlp
+ Updated the center task parameter file to support the new cache, wcsin,
+ and wcsout parameters.
+
+ Added a copy of the center task help page so it is accessible even
+ if apphot is not loaded. Center1d gets picked up instead in that case.
+
+ Davis, April 8, 2001
+
+irred$mosproc.cl
+ Changed the outtype parameter setting in the imcombine task call from
+ "" to "real". Added default values for the rejmask, nkeep, and snoise
+ parameters.
+
+ Davis, January 18, 1999
+
+irred$irred.cl
+irred$irred.hd
+irred$irred.men
+irred$mkpkg
+irred$irlincor.par
+irred$x_irred.x
+irred$t_irlincor.x
+irred$doc/irlincor.hlp
+ Added the ctio.irlincor package task to the irred package.
+
+irred$irred.cl
+irred$mosproc.cl
+ 1. The irred cl script was modified to reference nproto instead of proto.
+ 2. The irred script was modified to load the core proto package in order to
+ pick up the bscale task.
+ 3. The references to the apselect task were replace by references to the
+ txdump task.
+ 4. The bscale.par file was removed since one cannot have private copies
+ of .par files across package boundaries.
+ 5. Replaced the obsolete version of datapars.par with the new version.
+ 6. Replaced the obsolate versions of irmosaic.par, iralign.par,
+ irmatch1d.par, and irmatch2d.par with new ones.
+
+ Davis, January 25, 1992
+
+irred$mosproc.cl
+ 1. Replaced the call to imcombine with a call to the new imcombine.
+
+ Davis, January 25, 1992
+
+
+irred$
+ The IRRED package was added to the imred package menu. The current
+ tasks are bscale, center, irmosaic, iralign, irmatch1d, and irmatch2d,
+ mosproc, and txdump.
+ Davis, April 1, 1989
+
+.endhelp
diff --git a/noao/imred/irred/center.par b/noao/imred/irred/center.par
new file mode 100644
index 00000000..4cc613cd
--- /dev/null
+++ b/noao/imred/irred/center.par
@@ -0,0 +1,21 @@
+# CENTER
+
+image,f,a,,,,"Input image(s)"
+coords,f,h,"",,,"Input coordinate list(s) (default: image.coo.?)"
+output,f,h,"default",,,"Output center file(s) (default: image.ctr.?)"
+plotfile,s,h,"",,,"Output plot metacode file"
+datapars,pset,h,"",,,"Data dependent parameters"
+centerpars,pset,h,"",,,"Centering parameters"
+interactive,b,h,yes,,,"Interactive mode ?"
+radplots,b,h,no,,,"Plot the radial profiles in interactive mode ?"
+icommands,*imcur,h,"",,,"Image cursor: [x y wcs] key [cmd]"
+gcommands,*gcur,h,"",,,"Graphics cursor: [x y wcs] key [cmd]"
+wcsin,s,h,logical,,,"The input coordinate system (logical,tv,physical,world)"
+wcsout,s,h,logical,,,"The output coordinate system (logical,tv,physical)"
+cache,b,h,no,,,"Cache the input image pixels in memory ?"
+verify,b,h,yes,,,"Verify critical parameters in non-interactive mode ?"
+update,b,h,no,,,"Update critical parameters in non-interactive mode ?"
+verbose,b,h,yes,,,"Print messages in non-interactive mode ?"
+graphics,s,h,"stdgraph",,,"Graphics device"
+display,s,h,"stdimage",,,"Display device"
+mode,s,h,'ql'
diff --git a/noao/imred/irred/centerpars.par b/noao/imred/irred/centerpars.par
new file mode 100644
index 00000000..1692b29e
--- /dev/null
+++ b/noao/imred/irred/centerpars.par
@@ -0,0 +1,14 @@
+# CENTERPARS
+
+calgorithm,s,h,"centroid","|centroid|gauss|none|ofilter|",,Centering algorithm
+cbox,r,h,5.0,,,Centering box width in scale units
+cthreshold,r,h,0.0,,,Centering threshold in sigma above background
+minsnratio,r,h,1.0,0.0,,Minimum signal-to-noise ratio for centering algorithm
+cmaxiter,i,h,10,,,Maximum number of iterations for centering algorithm
+maxshift,r,h,1.0,,,Maximum center shift in scale units
+clean,b,h,no,,,Symmetry clean before centering ?
+rclean,r,h,1.0,,,Cleaning radius in scale units
+rclip,r,h,2.0,,,Clipping radius in scale units
+kclean,r,h,3.0,,,Rejection limit in sigma
+mkcenter,b,h,no,,,Mark the computed center on display ?
+mode,s,h,'ql'
diff --git a/noao/imred/irred/datapars.par b/noao/imred/irred/datapars.par
new file mode 100644
index 00000000..15778b9f
--- /dev/null
+++ b/noao/imred/irred/datapars.par
@@ -0,0 +1,25 @@
+# DATAPARS
+
+scale,r,h,1.0,0.0,,Image scale in units per pixel
+fwhmpsf,r,h,2.5,0.0,,FWHM of the PSF in scale units
+emission,b,h,y,,,Features are positive ?
+sigma,r,h,INDEF,,,Standard deviation of background in counts
+datamin,r,h,INDEF,,,Minimum good data value
+datamax,r,h,INDEF,,,Maximum good data value
+
+noise,s,h,"poisson","|constant|poisson|",,Noise model
+ccdread,s,h,"",,,CCD readout noise image header keyword
+gain,s,h,"",,,CCD gain image header keyword
+readnoise,r,h,0.0,,,CCD readout noise in electrons
+epadu,r,h,1.0,,,Gain in electrons per count
+
+exposure,s,h,"",,,Exposure time image header keyword
+airmass,s,h,"",,,Airmass image header keyword
+filter,s,h,"",,,Filter image header keyword
+obstime,s,h,"",,,Time of observation image header keyword
+itime,r,h,1.0,,,Exposure time
+xairmass,r,h,INDEF,,,Airmass
+ifilter,s,h,"INDEF",,,Filter
+otime,s,h,"INDEF",,,Time of observation
+
+mode,s,h,'ql'
diff --git a/noao/imred/irred/doc/center.hlp b/noao/imred/irred/doc/center.hlp
new file mode 100644
index 00000000..1171deb4
--- /dev/null
+++ b/noao/imred/irred/doc/center.hlp
@@ -0,0 +1,637 @@
+.help center May00 irred
+.ih
+NAME
+center -- compute accurate centers for a list of objects
+.ih
+USAGE
+center image
+.ih
+PARAMETERS
+.ls image
+The list of images containing the objects to be centered.
+.le
+.ls coords = ""
+The list of text files containing initial coordinates for the objects to
+be centered. Objects are listed in coords one object per line with the
+initial coordinate values in columns one and two. The number of coordinate
+files must be zero, one, or equal to the number of images.
+If coords is "default", "dir$default", or a directory specification then an
+coords file name of the form dir$root.extension.version is constructed and
+searched for, where dir is the directory, root is the root image name,
+extension is "coo" and version is the next available version number for the
+file.
+.le
+.ls output = "default"
+The name of the results file or results directory. If output is
+"default", "dir$default", or a directory specification then an output file name
+of the form dir$root.extension.version is constructed, where dir is the
+directory, root is the root image name, extension is "ctr" and version is
+the next available version number for the file. The number of output files
+must be zero, one, or equal to the number of image files. In both interactive
+and batch mode full output is written to output. In interactive mode
+an output summary is also written to the standard output.
+.le
+.ls plotfile = ""
+The name of the file containing radial profile plots of the stars written
+to the output file. If plotfile is defined then a radial profile plot
+is written to plotfile every time a record is written to \fIoutput\fR.
+The user should be aware that this can be a time consuming operation.
+.le
+.ls datapars = ""
+The name of the file containing the data dependent parameters.
+The critical parameters \fIfwhmpsf\fR and \fIsigma\fR are located in
+datapars. If datapars is undefined then the default parameter set in
+uparm directory is used.
+.le
+.ls centerpars = ""
+The name of the file containing the centering algorithm parameters.
+The critical parameters \fIcalgorithm\fR and \fIcbox\fR are located in
+centerpars. If centerpars is undefined then the default parameter
+set in uparm is used.
+.le
+.ls interactive = yes
+Interactive or non-interactive mode?
+.le
+.ls radplots = no
+If \fIradplots\fR is "yes" and CENTER is run in interactive mode, a radial
+profile of each star is plotted on the screen after the center is fit.
+.le
+.ls icommands = ""
+The image display cursor or image cursor command file.
+.le
+.ls gcommands = ""
+The graphics cursor or graphics cursor command file.
+.le
+.ls wcsin = "logical", wcsout = "logical"
+The coordinate system of the input coordinates read from \fIcoords\fR and
+of the output coordinates written to \fIoutput\fR respectively. The image
+header coordinate system is used to transform from the input coordinate
+system to the "logical" pixel coordinate system used internally,
+and from the internal "logical" pixel coordinate system to the output
+coordinate system. The input coordinate system options are "logical", tv",
+"physical", and "world". The output coordinate system options are "logical",
+"tv", and "physical". The image cursor coordinate system is assumed to
+be the "tv" system.
+.ls logical
+Logical coordinates are pixel coordinates relative to the current image.
+The logical coordinate system is the coordinate system used by the image
+input/output routines to access the image data on disk. In the logical
+coordinate system the coordinates of the first pixel of a 2D image, e.g.
+dev$ypix and a 2D image section, e.g. dev$ypix[200:300,200:300] are
+always (1,1).
+.le
+.ls tv
+Tv coordinates are the pixel coordinates used by the display servers. Tv
+coordinates include the effects of any input image section, but do not
+include the effects of previous linear transformations. If the input
+image name does not include an image section, then tv coordinates are
+identical to logical coordinates. If the input image name does include a
+section, and the input image has not been linearly transformed or copied from
+a parent image, tv coordinates are identical to physical coordinates.
+In the tv coordinate system the coordinates of the first pixel of a
+2D image, e.g. dev$ypix and a 2D image section, e.g. dev$ypix[200:300,200:300]
+are (1,1) and (200,200) respectively.
+.le
+.ls physical
+Physical coordinates are pixel coordinates invariant with respect to linear
+transformations of the physical image data. For example, if the current image
+was created by extracting a section of another image, the physical
+coordinates of an object in the current image will be equal to the physical
+coordinates of the same object in the parent image, although the logical
+coordinates will be different. In the physical coordinate system the
+coordinates of the first pixel of a 2D image, e.g. dev$ypix and a 2D
+image section, e.g. dev$ypix[200:300,200:300] are (1,1) and (200,200)
+respectively.
+.le
+.ls world
+World coordinates are image coordinates in any units which are invariant
+with respect to linear transformations of the physical image data. For
+example, the ra and dec of an object will always be the same no matter
+how the image is linearly transformed. The units of input world coordinates
+must be the same as those expected by the image header wcs, e. g.
+degrees and degrees for celestial coordinate systems.
+.le
+The wcsin and wcsout parameters default to the values of the package
+parameters of the same name. The default values of the package parameters
+wcsin and wcsout are "logical" and "logical" respectively.
+.le
+.ls cache = no
+Cache the image pixels in memory. Cache may be set to "yes", or "no".
+By default cacheing is
+disabled.
+.le
+.ls verify = yes
+Verify the critical parameters in non-interactive mode ? Verify may be set to
+or "no.
+.le
+.ls update = no
+Update the critical parameters in non-interactive mode if \fIverify\fR is
+set to yes? Update may be set to "yes" or "no.
+.le
+.ls verbose = yes
+Print messages on the terminal in non-interactive mode ? Verbose may be set
+to "yes" or "no.
+.le
+.ls graphics = ")_.graphics"
+The default graphics device.
+Graphics may be set to the apphot package parameter value (the default), "yes",
+or "no.
+.le
+.ls display = ")_.display"
+The default display device. Display may be set to the apphot package
+parameter value (the default), "yes", or "no. By default graphics overlay
+is disabled. Setting display to one of "imdr", "imdg", "imdb", or "imdy"
+enables graphics overlay with the IMD graphics kernel. Setting display to
+"stdgraph" enables CENTER to work interactively from a contour plot.
+.le
+
+.ih
+DESCRIPTION
+CENTER computes accurate centers for a set of objects in the IRAF image
+\fIimage\fR, whose initial coordinates are read from the image display cursor,
+from the text file \fIcoords\fR, or from a cursor command file.
+The computed x and y coordinates, the errors, and the fitting parameters
+are written to the text file \fIoutput\fR.
+
+The coordinates read from \fIcoords\fR are assumed to be in coordinate
+system defined by \fIwcsin\fR. The options are "logical", "tv", "physical",
+and "world" and the transformation from the input coordinate system to
+the internal "logical" system is defined by the image coordinate system.
+The simplest default is the "logical" pixel system. Users working on with
+image sections but importing pixel coordinate lists generated from the parent
+image must use the "tv" or "physical" input coordinate systems.
+Users importing coordinate lists in world coordinates, e.g. ra and dec,
+must use the "world" coordinate system and may need to convert their
+equatorial coordinate units from hours and degrees to degrees and degrees first.
+
+The coordinates written to \fIoutput\fR are in the coordinate
+system defined by \fIwcsout\fR. The options are "logical", "tv",
+and "physical". The simplest default is the "logical" system. Users
+wishing to correlate the output coordinates of objects measured in
+image sections or mosaic pieces with coordinates in the parent
+image must use the "tv" or "physical" coordinate systems.
+
+If \fIcache\fR is yes and the host machine physical memory and working set size
+are large enough, the input image pixels are cached in memory. If cacheing
+is enabled and CENTER is run interactively the first measurement will appear
+to take a long time as the entire image must be read in before the measurement
+is actually made. All subsequent measurements will be very fast because CENTER
+is accessing memory not disk. The point of cacheing is to speed up random
+image access by making the internal image i/o buffers the same size as the
+image itself. However if the input object lists are sorted in row order and
+sparse cacheing may actually worsen not improve the execution time. Also at
+present there is no point in enabling cacheing for images that are less than
+or equal to 524288 bytes, i.e. the size of the test image dev$ypix, as the
+default image i/o buffer is exactly that size. However if the size of dev$ypix
+is doubled by converting it to a real image with the chpixtype task then the
+effect of cacheing in interactive is can be quite noticeable if measurements
+of objects in the top and bottom halves of the image are alternated.
+
+CENTER can be run either interactively or in batch mode by setting the
+parameter \fIinteractive\fR. In interactive mode starting x and y positions
+can either be read directly from the image cursor or read from the text
+file \fIcoords\fR. In interactive mode the user can examine, adjust, and
+save the algorithm parameters, change ojects interactively, query for
+the next or nth object in the list, or fit the entire coordinate list with
+the chosen parameter set. In batch mode the positions can be read from the
+text file \fIcoords\fR or the image cursor can be redirected to a text file
+containing a list of cursor commands as specified by the parameter
+\fIicommands\fR.
+
+.ih
+CURSOR COMMANDS
+
+The following cursor commands are currently available.
+
+.nf
+ Interactive Keystroke Commands
+
+? Print help
+: Colon commands
+v Verify the critical parameters
+w Save the current parameters
+d Plot radial profile of current star
+i Interactively set parameters using current star
+f Fit center of current star
+spbar Fit center of current star, output results
+m Move to next star in coordinate list
+n Center next star in coordinate list, output results
+l Center remaining stars in coordinate list, output results
+e Print error messages
+r Rewind the coordinate list
+q Exit task
+
+
+ Colon Commands
+
+:show [data/center] List the parameters
+:m [n] Move to next [nth] star in coordinate list
+:n [n] Center next [nth] star in coordinate list,
+ output results
+
+
+ Colon Parameter Editing Commands
+
+# Image and file name parameters
+
+:image [string] Image name
+:coords [string] Coordinate file name
+:output [string] Output file name
+
+# Data dependent parameters
+
+:scale [value] Image scale (units per pixel)
+:fwhmpsf [value] Full-width half-maximum of PSF (scale units)
+:emission [y/n] Emission feature (y), absorption (n)
+:sigma [value] Standard deviation of sky (counts)
+:datamin [value] Minimum good data value (counts)
+:datamax [value] Maximum good data value (counts)
+
+# Noise parameters
+
+:noise [string] Noise model (constant|poisson)
+:gain [string] Gain image header keyword
+:ccdread [string] Readout noise image header keyword
+:epadu [value] Gain (electrons per adu)
+:readnoise [value] Readout noise (electrons)
+
+# Observations parameters
+
+:exposure [string] Exposure time image header keyword
+:airmass [string] Airmass image header keyword
+:filter [string] Filter image header keyword
+:obstime [string] Time of observation image header keyword
+:itime [value] Exposure time (time units)
+:xairmass [value] Airmass value (number)
+:ifilter [string] Filter id string
+:otime [string] Time of observation (time units)
+
+# Centering parameters
+
+:calgorithm [string] Centering algorithm
+:cbox [value] Width of centering box (scale units)
+:cthreshold [value] Centering intensity threshold (sigma)
+:cmaxiter [value] Maximum number of iterations
+:maxshift [value] Maximum center shift (scale units)
+:minsnratio [value] Minimum signal to noise for centering
+:clean [y/n] Clean subraster before centering
+:rclean [value] Cleaning radius (scale units)
+:rclip [value] Clipping radius (scale units)
+:kclean [value] Clean K-sigma rejection limit (sigma)
+
+# Plotting and marking parameters
+
+:mkcenter [y/n] Mark computed centers on the display
+:radplot [y/n] Plot radial profile of object
+
+
+The following keystroke commands are available from the interactive setup
+menu.
+
+ Interactive Center Setup Menu
+
+ v Mark and verify the critical center parameters (f,s,c)
+
+ f Mark and verify the full-width half-maximum of the psf
+ s Mark and verify the standard deviation of the background
+ l Mark and verify the minimum good data value
+ u Mark and verify the maximum good data value
+
+ c Mark and verify the centering box half-width
+ n Mark and verify the cleaning radius
+ p Mark and verify the clipping radius
+.fi
+
+.ih
+ALGORITHMS
+
+Descriptions of the data dependent parameters and the centering
+algorithm parameters can be found in the online manual pages for
+\fIdatapars\fR and \fIcenterpars\fR.
+
+.ih
+OUTPUT
+
+In interactive mode the following quantities are written to the terminal
+as each object is measured. Error is a simple string which indicates
+whether an error condition has been flagged. The centers and their errors are
+in pixel units.
+
+.nf
+ image xinit yinit xcenter ycenter xerr yerr error
+.fi
+
+In both interactive and batch mode the full output is written to the
+text file \fIoutput\fR. At the beginning of each file is a header
+listing the current values of the parameters when the first stellar
+record was written. These parameters can be subsequently altered.
+For each star measured the following record is written
+
+.nf
+ image xinit yinit id coords lid
+ xcenter ycenter xshift yshift xerr yerr cier error
+.fi
+
+Image and coords are the name of the image and coordinate file respectively.
+Id and lid are the sequence numbers of stars in the output and coordinate
+files respectively. Cier and error are the centering error code and accompanying
+error message respectively. Xinit, yinit, xcenter, ycenter, xshift, yshift,
+and xerr, yerr are self explanatory and output in pixel units. The sense of
+the xshift and yshift definitions is the following.
+
+.nf
+ xshift = xcenter - xinit
+ yshift = ycenter - yinit
+.fi
+
+In interactive mode a radial profile of each measured object is plotted
+in the graphics window if \fIradplots\fR is "yes".
+
+In interactive and batchmode a radial profile plot is written to
+\fIplotfile\fR if it is defined each time the result of an object
+measurement is written to \fIoutput\fR .
+
+.ih
+ERRORS
+
+If the object centering was error free then the field cier will be zero.
+Non-zero values in the cier column flag the following error conditions.
+
+.nf
+ 0 # No error
+ 101 # The centering box is off the image
+ 102 # The centering box is partially off the image
+ 103 # The S/N ratio is low in the centering box
+ 104 # There are two few points for a good fit
+ 105 # The x or y center fit is singular
+ 106 # The x or y center fit did not converge
+ 107 # The x or y center shift is greater than maxshift
+ 108 # There is bad data in the centering box
+.fi
+
+.ih
+EXAMPLES
+
+1. Compute the centers for a few stars in dev$ypix using the image display
+and the image cursor. Setup the task parameters using the interactive
+setup menu defined by the i keystroke command and a radial profile plot.
+
+.nf
+ ap> display dev$ypix 1 fi+
+
+ ... display the image
+
+ ap> center dev$ypix
+
+ ... type ? to see help screen
+
+ ... move image cursor to a star
+ ... type i to enter the interactive setup menu
+ ... enter the maximum radius in pixels for the radial profile or
+ accept the default with a CR
+ ... type v to get the default menu
+ ... set the fwhmpsf, sigma, and centering box half-width using the
+ graphics cursor and the stellar radial profile plot
+ ... typing <CR> after a prompt leaves the parameter at its default
+ value
+ ... type q to exit setup menu
+
+ ... type the v key to verify the critical parameters
+
+ ... type the w key to save the parameters in the parameter files
+
+ ... move the image cursor to the stars of interest and tap
+ the space bar
+
+ ... type q to quit followed by q to confirm the quit
+
+ ... the output will appear in ypix.ctr.1
+
+.fi
+
+2. Compute the centers for a few stars in dev$ypix using the contour plot
+and the graphics cursor. This option is only useful for those (now very few)
+users who have access to a graphics terminal but not to an image display
+server. Setup the task parameters using the interactive setup menu defined by
+the i key command as in example 1.
+
+.nf
+ ap> show stdimcur
+
+ ... record the default value of stdimcur
+
+ ap> set stdimcur = stdgraph
+
+ ... define the image cursor to be the graphics cursor
+
+ ap> contour dev$ypix
+
+ ... make a contour plot of dev$ypix
+
+ ap> contour dev$ypix >G ypix.plot1
+
+ ... store the contour plot of ypix in the file ypix.plot
+
+ ap> center dev$ypix display=stdgraph
+
+ ... type ? to see the help screen
+
+ ... move graphics cursor to a star
+ ... type i to enter the interactive setup menu
+ ... enter the maximum radius in pixels for the radial profile or
+ accept the default with a CR
+ ... type v key to get the default setup menu
+ ... enter maximum radius in pixels of the radial profile
+ ... set the fwhmpsf, sigma, and centering box half-width
+ using the graphics cursor and the stellar radial profile plot
+ ... typing <CR> after the prompt leaves the parameter at its
+ default value
+ ... type q to quit the setup menu
+
+ ... type the v key to verify critical parameters
+
+ ... type the w key to save the parameters in the parameter files
+
+ ... retype :.read ypix.plot1 to reload the contour plot
+
+ ... move the graphics cursor to the stars of interest and tap
+ the space bar
+
+ ... a one line summary of the answers will appear on the standard
+ output for each star measured
+
+ ... type q to quit followed by q to confirm the quit
+
+ ... full output will appear in the text file ypix.ctr.2
+
+ ap> set stdimcur = <default>
+
+ ... reset stdimcur to its previous value
+.fi
+
+
+3. Setup and run CENTER interactively on a list of objects temporarily
+overriding the fwhmpsf, sigma, and cbox parameters determined in examples
+1 or 2.
+
+.nf
+ ap> daofind dev$ypix fwhmpsf=2.6 sigma=25.0 verify-
+
+ ... make a coordinate list
+
+ ... the output will appear in the text file ypix.coo.1
+
+ ap> center dev$ypix cbox=7.0 coords=ypix.coo.1
+
+ ... type ? for optional help
+
+
+ ... move the graphics cursor to the stars and tap space bar
+
+ or
+
+ ... select stars from the input coordinate list with m / :m #
+ and measure with spbar
+
+ ... measure stars selected from the input coordinate list
+ with n / n #
+
+ ... a one line summary of results will appear on the standard output
+ for each star measured
+
+ ... the output will appear in ypix.ctr.3 ...
+.fi
+
+
+4. Display and measure some stars in an image section and write the output
+coordinates in the coordinate system of the parent image.
+
+.nf
+ ap> display dev$ypix[150:450,150:450] 1
+
+ ... display the image section
+
+ ap> center dev$ypix[150:450,150:450] wcsout=tv
+
+ ... move cursor to stars and type spbar
+
+ ... type q to quit and q again to confirm quit
+
+ ... output will appear in ypix.ctr.4
+
+ ap> pdump ypix.ctr.4 xc,yc yes | tvmark 1 STDIN col=204
+.fi
+
+
+5. Run CENTER in batch mode using the coordinate file and the previously
+saved parameters. Verify the critical parameters.
+
+.nf
+ ap> center dev$ypix coords=ypix.coo.1 verify+ inter-
+
+ ... output will appear in ypix.ctr.5 ...
+.fi
+
+
+6. Repeat example 5 but assume that the input coordinate are ra and dec
+in degrees and degrees, turn off verification, and submit the task to to
+the background.
+
+.nf
+ ap> display dev$ypix
+
+ ap> rimcursor wcs=world > radec.coo
+
+ ... move to selected stars and type any key
+
+ ... type ^Z to quit
+
+ ap> center dev$ypix coords=radec.coo wcsin=world verify- inter- &
+
+ ... output will appear in ypix.ctr.6
+
+ ap> pdump ypix.ctr.6 xc,yc yes | tvmark 1 STDIN col=204
+
+ ... mark the stars on the display
+
+
+7. Run CENTER interactively without using the image display.
+
+.nf
+ ap> show stdimcur
+
+ ... record the default value of stdimcur
+
+ ap> set stdimcur = text
+
+ ... set the image cursor to the standard input
+
+ ap> center dev$ypix coords=ypix.coo.1
+
+ ... type ? for optional help
+
+ ... type :m 3 to set the initial coordinates to those of the
+ third star in the list
+
+ ... type i to enter the interactive setup menu
+ ... enter the maximum radius in pixels for the radial profile or
+ accept the default with a CR
+ ... type v to enter the default menu
+ ... set the fwhmpsf, sigma, and centering box half-width
+ using the graphics cursor and the stellar radial profile plot
+ ... typing <CR> after the prompt leaves the parameter at its default
+ value
+
+ ... type r to rewind the coordinate list
+
+ ... type l to measure all the stars in the coordinate list
+
+ ... a one line summary of the answers will appear on the standard
+ output for each star measured
+
+ ... type q to quit followed by q to confirm the quit
+
+ ... full output will appear in the text file ypix.ctr.7
+
+ ap> set stdimcur = <default>
+
+ ... reset the value of stdimcur
+.fi
+
+8. Use a image cursor command file to drive the CENTER task. The cursor command
+file shown below sets the fwhmpsf, calgorithm, and cbox parameters, computes
+the centers for 3 stars, updates the parameter files, and quits the task.
+
+.nf
+ ap> type cmdfile
+ : calgorithm gauss
+ : fwhmpsf 2.5
+ : cbox 9.0
+ 442 410 101 \040
+ 349 188 101 \040
+ 225 131 101 \040
+ w
+ q
+
+ ap> center dev$ypix icommands=cmdfile verify-
+
+ ... full output will appear in ypix.ctr.8
+.fi
+
+.ih
+BUGS
+
+It is the responsibility of the user to make sure that the image displayed
+in the image display is the same as the image specified by the image parameter.
+
+Commands which draw to the image display are disabled by default.
+To enable graphics overlay on the image display, set the display
+parameter to "imdr", "imdg", "imdb", or "imdy" to get red, green,
+blue or yellow overlays and set the centerpars mkcenter switch to
+"yes". It may be necessary to run gflush and to redisplay the image
+to get the overlays position correctly.
+
+.ih
+SEE ALSO
+datapars, centerpars
+.endhelp
diff --git a/noao/imred/irred/doc/irlincor.hlp b/noao/imred/irred/doc/irlincor.hlp
new file mode 100644
index 00000000..630370a1
--- /dev/null
+++ b/noao/imred/irred/doc/irlincor.hlp
@@ -0,0 +1,81 @@
+.help irlincor Nov94 irred
+.ih
+NAME
+irlincor -- Correct IR imager frames for non-linearity.
+.ih
+USAGE
+irlincor input output
+.ih
+PARAMETERS
+.ls input
+The list of images to be corrected for non-linearity
+.le
+.ls output
+The list of corrected output images
+.le
+
+.ls coeff1 = 1.0
+The first coefficient of the correction function
+.le
+
+.ls coeff2 = 0.0
+The second coefficient of the correction function
+.le
+
+.ls coeff3 = 0.0
+The third coefficient of the correction function
+.le
+
+.ih
+DESCRIPTION
+The IR imager frames specified by \fIinput\fR, which may be a general image
+template including wild cards or an @list, are corrected for non-linearity
+on a pixel by pixel basis and written to \fIoutput\fR. The number of output
+images must match the number input. The pixel type of the output image(s) will
+match that of the input image(s), however, internally all calculations are
+performed as type real. The correction is performed assuming
+that the non-linearity can be represented by the following simple relationship:
+.nf
+
+ADU' = ADU * [ coeff1 + coeff2 * (ADU / 32767) + coeff3 * (ADU / 32767)**2 ]
+
+.fi
+The coefficients which occur in this expression are specified by the
+parameters \fIcoeff1\fR, \fIcoeff2\fR and \fIcoeff3\fR. Their values are
+derived from periodic instrumental calibrations and are believed to be
+fairly constant. The default values specify a \fBnull\fR correction.
+You should consult \fBJay Elias\fR for the latest values.
+Note that the coefficients are expressed in terms of ADU normalised to the
+maximum possible value 32767, in order that their values can be input
+more easily.
+.ih
+EXAMPLES
+1. Correct input to output using the default values for the coefficients (not a very rewarding operation!)
+
+.nf
+ cl> irlincor input output
+
+.fi
+
+2. Correct a list of images in place using specified values for the coefficients
+
+.nf
+ cl> irlincor @list @list coeff1=1.0 coeff2=0.1 coeff3=0.01
+
+.fi
+.ih
+TIME REQUIREMENTS
+.ih
+AUTHORS
+The IRLINCOR task was originally written by Steve Heathcote as part of the
+CTIO package.
+.ih
+BUGS
+The form of the correction equation is currently experimental;
+a higher order polynomial or a different functional form could be accommodated
+very easily if required.
+It may be advisable to carry out the calculations in double precision.
+.ih
+SEE ALSO
+onedspec.coincor, proto.imfunction
+.endhelp
diff --git a/noao/imred/irred/doc/mosproc.hlp b/noao/imred/irred/doc/mosproc.hlp
new file mode 100644
index 00000000..d0f5c931
--- /dev/null
+++ b/noao/imred/irred/doc/mosproc.hlp
@@ -0,0 +1,170 @@
+.help mosproc May89 irred
+.ih
+NAME
+mosproc -- Prepare images for quick look mosaicing
+.ih
+USAGE
+mosproc input output nxsub nysub
+.ih
+PARAMETERS
+.ls input
+The list of input images to be mosaiced. The images are assumed
+to be ordered either by row, column, or in a raster pattern. If
+the image list is not in order then the iraf \fBfiles\fR task plus
+the \fBeditor\fR must be used to construct an image list. The images
+in the input list are assumed to all be the same size.
+.le
+.ls output
+The name of the output mosaiced image.
+.le
+.ls nxsub
+The number of subrasters along a row of the output image.
+.le
+.ls nysub
+The number of subrasters along a column of the output image.
+.le
+.ls skysubtract = yes
+Subtract a sky image from all the input images. The sky image
+to be subtracted is either \fIsky\fR or a sky image computed
+by median filtering selected input images after weighting the images
+by the exposure time..
+.le
+.ls sky = ""
+The name of the sky image.
+.le
+.ls exclude = ""
+The input images to be excluded from the computation of the sky image.
+For example if \fIexclude\fR="1,3-5" then input images 1, 3, 4, 5 are
+not used for computing the sky frame.
+.le
+.ls expname = "exptime"
+The image header exposure time keyword. If the sky frame is computed
+internally by median filtering the input images, the individual images
+are weighted by the exposure time defined by the exposure time
+keyword \fIexpname\fR. Weights of 1 are assigned when no exposure time
+is given.
+.le
+.ls flatten = yes
+Divide all the images by a flat field image. Flat fielding is done
+after sky subtraction. If the name of a flat field image \fIflat\fR
+is supplied that image is divided directly into all the input images.
+Otherwise the skyframe computed above is normalized by the mode of the
+pixels and divided into all the input images.
+.le
+.ls flat = ""
+The name of the flat field image.
+.le
+.ls transpose = no
+Transpose the input images before inserting them into the mosaic.
+.le
+.ls trim_section = "[*,*]"
+The section of the input images to be mosaiced into the output
+image. Section can be used to flip and/or trim the individual
+subrasters before adding them to the mosaic. For example if we
+want to flip each subraster around the y axis before adding it
+to the mosaic, then \fItrim_section\fR = "[*,-*]".
+.le
+.ls corner = "lr"
+The starting position in the output image. The four options are "ll" for
+lower left corner, "lr" for lower right corner, "ul" for upper left
+corner and "ur" for upper right corner.
+.le
+.ls direction = "row"
+Add input images to the output image in row or column order. The options
+are "row" for row order and "column" for column order. The direction
+specified must agree with the order of the input list.
+.le
+.ls raster = no
+Add the columns or rows to the output image in a raster pattern or return
+to the start of a column or a row.
+.le
+.ls median_section = ""
+Compute the median of each input image inserted into the mosaic using the
+specified section.
+.le
+.ls subtract = no
+Subtract the computed median from each input image before inserting it
+into the mosaic.
+.le
+.ls oval = -1.0
+The value of border pixels.
+.le
+.ls delete = yes
+Delete sky subtracted, flat fielded and transposed images upon exit from
+the script.
+.le
+.ls logfile = STDOUT
+The name of the log file.
+.le
+
+.ih
+DESCRIPTION
+
+MOSPROC takes the list of input images \fIinput\fR of identical dimensions and
+inserts them into a single output image \fIoutput\fR. Before mosaicing the user
+can optionally sky subtract, flat field or transpose the input images.
+If \fIskysubtract\fR = yes, a single sky
+image is subtracted from all the input images. The sky image
+may be the externally derived image \fIsky\fR or calculated internally
+by computing the exposure time weighted median of the input images, minus
+those input images specifically excluded by the \fIexclude\fR parameter.
+If \fIflatten\fR = yes, the input images are flat fielded using either
+the externally defined flat field image \fIflat\fR or the internally
+derived sky image normalized by its mode.
+If \fItranspose\fR is enabled all the input images are optionally transposed
+before mosaicing.
+
+MOSPROC takes the list of processed images and inserts them into the
+output image in positions determined by their order in the input list,
+\fInxsub\fR, \fInysub\fR and the parameters \fIcorner\fR, \fIdirection\fR
+and \fIraster\fR.
+The orientation and size of each individual subraster in the output image
+may be altered by setting the parameter \fItrim_section\fR. The size
+of the output image is determined by nxsub and nysub and the size of
+the individual input images. A one column wide border is drawn between
+each of the output image subrasters with a pixel value of \fIoval\fR.
+The user may optionally compute and subtract the median from each input
+image before inserting it into the mosaic.
+
+MOSPROC produces an output mosaiced image \fIoutput\fR and an accompanying
+database file \fIdboutput\fR. These two files plus an interactively
+generated coordinate list comprise the necessary input for the IRALIGN,
+IRMATCH1D and IRMATCH2D tasks.
+The temporary images generated (sky substracted, flat fielded, and
+transposed)
+can be deleted automatically if \fBdelete=yes\fR, before the task completes.
+Otherwise they will be left in the same directory of the input images.
+The temporary sky and flat field images if created are not deleted.
+
+The computation of the sky frame is done with IMAGES.IMCOMBINE and the
+subsequent sky subraction with IMAGES.IMARITH. The computation of
+the flat field is done with PROTO.BSCALE and the flat field division
+with FLATTEN. The task IMAGES.TRANSPOSE transpose the input.
+The mosaicing itself is done with PROTO.IRMOSAIC.
+
+.ih
+EXAMPLES
+
+1. Mosaic a list of 64 infrared images onto an 8 by 8 grid after sky
+ subtraction and flat fielding. Use an externally derived sky and
+ flat field image
+
+ ir> mosproc @imlist mosaic 8 8 skysub+ sky=skyimage flatten+ \
+ >>> flat=flatfield
+
+2. Mosaic a list of 64 infrared images onto an 8 by 8 grid after sky
+ subtraction and flat fielding. Derive the sky and flat field frames
+ from the data excluding image number 5
+
+ ir> mosproc @imlist mosaic 8 8 skysub+ exclude="5" flatten+
+
+.ih
+TIME REQUIREMENTS
+
+.ih
+BUGS
+
+.ih
+SEE ALSO
+images.imcombine, images.imarith, proto.bscale, images.imtrans, proto.irmosaic
+.endhelp
diff --git a/noao/imred/irred/imcombine b/noao/imred/irred/imcombine
new file mode 100644
index 00000000..c95d8302
--- /dev/null
+++ b/noao/imred/irred/imcombine
@@ -0,0 +1,11 @@
+imcombine ("@"//tmptmp, skyframe, sigma="", logfile=logfile,
+ outtype="", option="median", expname=expname, exposure+,
+ sca-, off-, wei+, modesec="", low=3., high=3., blank=-1)
+
+imcombine ("@"//tmptmp, skyframe, plfile="", sigma="", logfile=logfile,
+ combine="median", reject="none", project=no, outtype="", offsets="none",
+ masktype="none", maskvalue=0.0, blank=-1.0, scale="exposure",
+ zero="none", weight="exposure", statsec="", expname=expname,
+ lthreshold=INDEF, hthreshold=INDEF, nlow=1, nhigh=1, mclip=yes,
+ lsigma=3.0, hsigma=3.0, rdnoise="0.0", gain="1.0", sigscale=0.1,
+ pclip=-0.5, grow=0)
diff --git a/noao/imred/irred/iralign.par b/noao/imred/irred/iralign.par
new file mode 100644
index 00000000..0865c07d
--- /dev/null
+++ b/noao/imred/irred/iralign.par
@@ -0,0 +1,20 @@
+# IRALIGN
+
+input,f,a,,,,Input image
+output,f,a,,,,Output image
+database,f,a,,,,Database file
+coords,f,a,,,,Coordinate file
+xshift,r,a,0.0,,,Xshift for align by shifts
+yshift,r,a,0.0,,,Yshift for align by shifts
+alignment,s,h,"coords",,,'Alignment technique (coords|shifts|file)'
+nxrsub,i,h,INDEF,,,Row index of reference subraster
+nyrsub,i,h,INDEF,,,Column index of reference subraster
+xref,i,h,0,,,X offset of reference subraster in pixels
+yref,i,h,0,,,Y offset of reference subraster in pixels
+trimlimits,s,h,"[1:1,1:1]",,,Trim limits for each subraster
+nimcols,i,h,INDEF,,,Number of column in the output image
+nimlines,i,h,INDEF,,,Number of lines in the output image
+oval,r,h,INDEF,,,The value of undefined regions the image
+interpolant,s,h,'linear',,,'Interpolant (nearest|linear|poly3|poly5,spline3)'
+verbose,b,h,yes,,,Print messages
+mode,s,h,'ql'
diff --git a/noao/imred/irred/irlincor.par b/noao/imred/irred/irlincor.par
new file mode 100644
index 00000000..701a0483
--- /dev/null
+++ b/noao/imred/irred/irlincor.par
@@ -0,0 +1,7 @@
+# irlincor parameter file
+input,s,a,"",,,Input images
+output,s,a,"",,,Output images
+section,s,h,"",,,Image section to correct
+coeff1,r,h,1.0,,,First coefficient of correction equation
+coeff2,r,h,0.0,,,Second coefficient of correction equation
+coeff3,r,h,0.0,,,Third coefficient of correction equation
diff --git a/noao/imred/irred/irmatch1d.par b/noao/imred/irred/irmatch1d.par
new file mode 100644
index 00000000..a9c40ff6
--- /dev/null
+++ b/noao/imred/irred/irmatch1d.par
@@ -0,0 +1,21 @@
+# IRMATCH1D
+
+input,f,a,,,,Input image
+output,f,a,,,,Output image
+database,f,a,,,,Database file
+coords,f,a,,,,Coordinate file
+xshift,r,a,0.0,,,Xshift for align by shifts
+yshift,r,a,0.0,,,Yshift for align by shifts
+alignment,s,h,"coords",,,'Alignment technique (coords|shifts|file)'
+match,s,h,"*",,,Intensity match the following subrastrers
+nxrsub,i,h,INDEF,,,Row index of reference subraster
+nyrsub,i,h,INDEF,,,Column index of reference subraster
+xref,i,h,0,,,Column offset of reference subraster
+yref,i,h,0,,,Line offset of reference subraster
+trimlimits,s,h,"[1:1,1:1]",,,Trim limits for the input subraster
+nimcols,i,h,INDEF,,,Number of column in the output image
+nimlines,i,h,INDEF,,,Number of lines in the output image
+oval,r,h,INDEF,,,The value of undefined regions the image
+interpolant,s,h,'linear',,,'Interpolant (nearest|linear|poly3|poly5,spline3)'
+verbose,b,h,yes,,,Print messages
+mode,s,h,'ql'
diff --git a/noao/imred/irred/irmatch2d.par b/noao/imred/irred/irmatch2d.par
new file mode 100644
index 00000000..7a159eba
--- /dev/null
+++ b/noao/imred/irred/irmatch2d.par
@@ -0,0 +1,21 @@
+# IRMATCH2D
+
+input,f,a,,,,Input image
+output,f,a,,,,Output image
+database,f,a,,,,Database file
+coords,f,a,,,,Coordinate file
+xshift,r,a,0.0,,,Xshift for align by shifts
+yshift,r,a,0.0,,,Yshift for align by shifts
+alignment,s,h,"coords",,,'Alignment technique (coords|shifts|file)'
+match,s,h,"*",,,Intensity match the following subrastrers
+nxrsub,i,h,INDEF,,,Row index of reference subraster
+nyrsub,i,h,INDEF,,,Column index of reference subraster
+xref,i,h,0,,,Column offset of the reference subraster
+yref,i,h,0,,,Line offset of the reference subraster
+trimlimits,s,h,"[1:1,1:1]",,,Trim limits for the input subraster
+nimcols,i,h,INDEF,,,Number of column in the output image
+nimlines,i,h,INDEF,,,Number of lines in the output image
+oval,r,h,INDEF,,,The value of undefined regions the image
+interpolant,s,h,'linear',,,'Interpolant (nearest|linear|poly3|poly5,spline3)'
+verbose,b,h,yes,,,Print messages
+mode,s,h,'ql'
diff --git a/noao/imred/irred/irmosaic.par b/noao/imred/irred/irmosaic.par
new file mode 100644
index 00000000..7fc573ff
--- /dev/null
+++ b/noao/imred/irred/irmosaic.par
@@ -0,0 +1,22 @@
+# IRMOSAIC
+
+input,f,a,,,,List of input images
+output,f,a,,,,Output image
+database,f,a,,,,Output database file
+nxsub,i,a,,,,Number of input images along the x direction
+nysub,i,a,,,,Number of input images along the y direction
+trim_section,s,h,"[*,*]",,,Input image section written to the output image
+null_input,s,h,"",,,List of missing input images
+corner,s,h,"ll",,,Position of first subraster
+direction,s,h,"row",,,Row or column order placement
+raster,b,h,no,,,Raster scan mode
+median_section,s,h,"",,,Input image section used to compute the median
+subtract,b,h,no,,,Subtract median from each input image
+nimcols,i,h,INDEF,,,The number of columns in the output image
+nimrows,i,h,INDEF,,,The number of rows in the output image
+nxoverlap,i,h,-1,,,Number of columns of overlap between input images
+nyoverlap,i,h,-1,,,Number of rows of overlap between input images
+opixtype,s,h,"r",,,Output image pixel type
+oval,r,h,0.0,,,Value of undefined output image pixels
+verbose,b,h,yes,,,Print out messages
+mode,s,h,'ql'
diff --git a/noao/imred/irred/irred.cl b/noao/imred/irred/irred.cl
new file mode 100644
index 00000000..a3b33765
--- /dev/null
+++ b/noao/imred/irred/irred.cl
@@ -0,0 +1,36 @@
+#{ IRRED -- KPNO IR Camera Reduction Package
+
+# Load necessary core packages
+
+images # tasks sections,imcopy,imarith,imcombine,imdelete
+lists # tokens task
+utilities # task translit
+proto # task bscale
+
+# Define necessary paths
+
+set generic = "noao$imred/generic/"
+set nproto = "noao$nproto/"
+
+package irred
+
+task irlincor = "irred$x_irred.e"
+
+task iralign,
+ irmatch1d,
+ irmatch2d,
+ irmosaic = "nproto$x_nproto.e"
+
+# Define the apphot centering and related tasks
+
+task center = "irred$x_apphot.e"
+task centerpars = "irred$centerpars.par"
+task datapars = "irred$datapars.par"
+task txdump = "irred$x_ptools.e"
+
+# Scripts
+
+task flatten = "generic$flatten.cl"
+task mosproc = "irred$mosproc.cl"
+
+clbye()
diff --git a/noao/imred/irred/irred.hd b/noao/imred/irred/irred.hd
new file mode 100644
index 00000000..8a2e6437
--- /dev/null
+++ b/noao/imred/irred/irred.hd
@@ -0,0 +1,8 @@
+# Help directory for the IRRED package.
+
+$doc = "./doc/"
+
+center hlp=doc$center.hlp
+irlincor hlp=doc$irlincor.hlp, src=t_irlincor.x
+mosproc hlp=doc$mosproc.hlp, src=mosproc.cl
+revisions sys=Revisions
diff --git a/noao/imred/irred/irred.men b/noao/imred/irred/irred.men
new file mode 100644
index 00000000..e3500032
--- /dev/null
+++ b/noao/imred/irred/irred.men
@@ -0,0 +1,11 @@
+ txdump - Select fields from the center task output text file
+ center - Compute accurate centers for a list of objects
+ centerpars - Edit the centering parameters
+ datapars - Edit the data dependent parameters
+ flatten - Flatten images using a flat field
+ iralign - Align the image produced by irmosaic
+ irlincor - Correct IR imager frames for non-linearity
+ irmatch1d - Align and intensity match the image produced by irmosaic (1D)
+ irmatch2d - Align and intensity match the image produced by irmosaic (2D)
+ irmosaic - Mosaic an ordered list of images onto a grid
+ mosproc - Prepare images for quick look mosaicing
diff --git a/noao/imred/irred/irred.par b/noao/imred/irred/irred.par
new file mode 100644
index 00000000..18e57b78
--- /dev/null
+++ b/noao/imred/irred/irred.par
@@ -0,0 +1,3 @@
+# PARAMETERS FOR KPNO IR CAMERA REDUCTION PACKAGE
+
+version,s,h,"Mar 1989"
diff --git a/noao/imred/irred/mkpkg b/noao/imred/irred/mkpkg
new file mode 100644
index 00000000..b62021e8
--- /dev/null
+++ b/noao/imred/irred/mkpkg
@@ -0,0 +1,24 @@
+# Make the IRRED package.
+
+$call relink
+$exit
+
+update:
+ $call relink
+ $call install
+ ;
+
+relink:
+ $set LIBS="-lxtools"
+ $update libpkg.a
+ $omake x_irred.x
+ $link x_irred.o libpkg.a $(LIBS) -o xx_irred.e
+ ;
+
+install:
+ $move xx_irred.e noaobin$x_irred.e
+ ;
+
+libpkg.a:
+ t_irlincor.x <error.h> <imhdr.h>
+ ;
diff --git a/noao/imred/irred/mosproc.cl b/noao/imred/irred/mosproc.cl
new file mode 100644
index 00000000..3fa89405
--- /dev/null
+++ b/noao/imred/irred/mosproc.cl
@@ -0,0 +1,172 @@
+# MOSPROC - Sky subtract, flat field and transpose images before mosaicing.
+
+procedure mosproc (input, output, nxsub, nysub)
+
+string input {prompt="Input images"}
+string output {prompt="Output image"}
+int nxsub {8, prompt="Number of subrasters in x"}
+int nysub {8, prompt="Number of subrasters in y"}
+
+bool skysubtract {yes, prompt="Sky subtract images before mosaicing"}
+string sky {"", prompt="Sky image to subtract"}
+string exclude {"", prompt="Input images excluded from sky frame"}
+string expname {"EXPTIME", prompt="Image exposure time keywords"}
+
+bool flatten {yes, prompt="Flatten images before mosaicing"}
+string flat {"", prompt="Flat field image"}
+bool transpose {no, prompt="Transpose images before mosaicing?"}
+
+string trim_section {"[*,*]", prompt="Input image section to be extracted"}
+string corner {"lr", prompt="Starting corner for the mosaic"}
+string direction {"row", prompt="Starting direction for the mosaic"}
+bool raster {no, prompt="Raster scan?"}
+string median_section {"", prompt="Input subraster section for median ?"}
+bool subtract {no, prompt="Substract median from each subraster?"}
+real oval {-1.0, prompt="Mosaic border pixel values"}
+
+bool delete {yes, prompt="Delete temporary images?"}
+file logfile {"STDOUT", prompt="Log file name"}
+
+struct *list1, *list2
+
+begin
+ file tmpimg, tmptmp, tmpred, tmpexc
+ int nx, ny, i, nin, lo, hi
+ string skyframe, normframe, in, out, img, delim, junk
+
+ tmpimg = mktemp ("MOS")
+ tmptmp = mktemp ("MOS")
+ tmpred = mktemp ("MOS")
+ tmpexc = mktemp ("tmp$MOS")
+
+ # Get positional parameters
+ in = input
+ out = output
+ nx = nxsub
+ ny = nysub
+
+ # Expand input file name list removing the ".imh" extensions.
+ sections (in, option="fullname", > tmptmp)
+ list1 = tmptmp
+ for (nin = 0; fscan (list1, img) != EOF; nin += 1) {
+ i = strlen (img)
+ if (substr (img, i-3, i) == ".imh")
+ img = substr (img, 1, i-4)
+ print (img, >> tmpimg)
+ print (img // ".red", >> tmpred)
+ }
+ list1 = ""; delete (tmptmp, ver-, >& "dev$null")
+
+ # Expand the range of images to skip.
+ if (skysubtract && sky != "") {
+
+ skyframe = sky
+ imarith ("@"//tmpimg, "-", skyframe, "@"//tmpred, title="",
+ divzero=0., hparams="", pixtype="", calctype="", verbose+,
+ noact-, >> logfile)
+
+ } else if (skysubtract) {
+
+ print (exclude, ",") | translit ("", "^-,0-9", del+) |
+ translit ("", "-", "!", del-) | tokens (new-) |
+ translit ("", "\n,", " \n", del-, > tmpexc)
+
+ type (tmpexc, >> logfile)
+
+ list1 = tmpexc
+ while (fscan (list1, lo, delim, hi, junk) != EOF) {
+ if (nscan() == 0)
+ next
+ else if (nscan() == 1 && lo >= 1)
+ print (lo, >> tmptmp)
+ else if (nscan() == 3) {
+ lo = min (max (lo, 1), nin); hi = min (max (hi, 1), nin)
+ for (i = lo; i <= hi; i += 1)
+ print (i, >> tmptmp)
+ }
+ }
+ list1 = ""; delete (tmpexc, ver-, >& "dev$null")
+
+ if (access (tmptmp)) {
+ sort (tmptmp, col=0, ign+, num+, rev-) | unique (> tmpexc)
+ delete (tmptmp, ver-, >& "dev$null")
+
+ list1 = tmpimg; list2 = tmpexc; junk = fscan (list2, nin)
+ for (i = 1; fscan (list1, img) != EOF; i += 1) {
+ if (i == nin) {
+ junk = fscan (list2, nin)
+ next
+ }
+ print (img, >> tmptmp)
+ }
+ list1 = ""; list2 = ""; delete (tmpexc, ver-, >& "dev$null")
+ } else
+ tmptmp = tmpimg
+
+ skyframe = out // ".sky"
+
+ imcombine ("@"//tmptmp, skyframe, rejmask="", plfile="", sigma="",
+ logfile=logfile, combine="median", reject="none", project=no,
+ outtype="real", offsets="none", masktype="none", maskvalue=0.0,
+ blank=-1.0, scale="exposure", zero="none", weight="exposure",
+ statsec="", expname=expname, lthreshold=INDEF,
+ hthreshold=INDEF, nlow=1, nhigh=1, nkeep=1, mclip=yes,
+ lsigma=3.0, hsigma=3.0, rdnoise="0.0", gain="1.0", snoise="0.0",
+ sigscale=0.1, pclip=-0.5, grow=0)
+ print ("\n", >> logfile)
+ imarith ("@"//tmpimg, "-", skyframe, "@"//tmpred, title="",
+ divzero=0., hparams="", pixtype="", calctype="", verbose+,
+ noact-, >> logfile)
+
+ } else {
+
+ skyframe = ""
+ imcopy ("@"//tmpimg, "@"//tmpred, verbose-)
+ }
+
+ if (flatten) {
+ if (flat != "") {
+ print ("\n", >> logfile)
+ flatten ("@"//tmpred, flat, minflat=INDEF, pixtype="",
+ keeplog=yes, logfile=logfile)
+ } else if (skyframe != "") {
+ print ("\n", >> logfile)
+ normframe = out // ".norm"
+ imcopy (skyframe, normframe, verbose-)
+ bscale (normframe, normframe, bzero="0.0", bscale="mode",
+ section="", step=10, lower=INDEF, upper=INDEF,
+ verbose+, >>logfile)
+ print ("\n", >> logfile)
+ flatten ("@"//tmpred, normframe, minflat=INDEF, pixtype="",
+ keeplog=yes, logfile=logfile)
+ }
+ }
+
+ if (transpose) {
+ print ("\nTRANSPOSE: Transpose images", >> logfile)
+ time (, >> logfile)
+ imtrans ("@"//tmpred, "@"//tmpred)
+ time (, >> logfile)
+ print ("TRANSPOSE: done", >> logfile)
+ }
+
+ print ("\nIRMOSAIC: Mosaic images", >> logfile)
+ time (, >> logfile)
+ irmosaic ("@"//tmpred, out, "db"//out, nx, ny,
+ trim_section=trim_section, null_input="", corner=corner,
+ direction=direction, raster=raster, nxover=-1, nyover=-1,
+ nimcols=INDEF, nimrows=INDEF, oval=oval,
+ median_section=median_section, sub=subtract, opixtype="r",
+ verbose+, >> logfile)
+ time (, >> logfile)
+ print ("IRMOSAIC: done", >> logfile)
+
+ if (delete) {
+ if (access (tmpred))
+ imdelete ("@"//tmpred, ver-, >& "dev$null")
+ }
+
+ delete (tmpimg, ver-, >& "dev$null")
+ delete (tmptmp, ver-, >& "dev$null")
+ delete (tmpred, ver-, >& "dev$null")
+end
diff --git a/noao/imred/irred/t_irlincor.x b/noao/imred/irred/t_irlincor.x
new file mode 100644
index 00000000..053c383d
--- /dev/null
+++ b/noao/imred/irred/t_irlincor.x
@@ -0,0 +1,254 @@
+include <imhdr.h>
+include <error.h>
+
+# Maximum number of correction function coefficients.
+define MAXCOEF 3
+
+# Maximum number of ADU....
+define MAXADU 32767.0
+
+
+# T_ARLINCOR -- Corrects IR imager frames for non linearity. This task
+# only corrects a section of the total image and copies the rest of
+# the image intact to the output image.
+
+procedure t_irlincor ()
+
+pointer inlist, outlist # input and output image lists
+char section[SZ_LINE] # image section
+pointer coeff # coeficients of correction function
+
+bool sflag
+pointer imin, imout
+pointer input, output, orig, temp
+pointer sp
+
+int strlen()
+int imtgetim(), imtlen()
+real clgetr()
+pointer immap(), imtopenp()
+
+begin
+ # Get parameters
+ inlist = imtopenp ("input")
+ outlist = imtopenp ("output")
+ call clgstr ("section", section, SZ_LINE)
+
+ # Check that the input and output image lists have the
+ # same number of images. Abort if that's not the case.
+ if (imtlen (inlist) != imtlen (outlist)) {
+ call imtclose (inlist)
+ call imtclose (outlist)
+ call error (1, "Input and output image lists don't match")
+ }
+
+ # Set section flag
+ sflag = (strlen (section) > 0)
+
+ # Allocate string space
+ call smark (sp)
+ call salloc (input, SZ_FNAME, TY_CHAR)
+ call salloc (output, SZ_FNAME, TY_CHAR)
+ call salloc (orig, SZ_FNAME, TY_CHAR)
+ call salloc (temp, SZ_FNAME, TY_CHAR)
+
+ # Allocate memory for the correction coefficients and
+ # read them from the parameter file.
+ call malloc (coeff, MAXCOEF, TY_REAL)
+ Memr[coeff] = clgetr ("coeff1")
+ Memr[coeff+1] = clgetr ("coeff2")
+ Memr[coeff+2] = clgetr ("coeff3")
+
+ # Loop over all images in the input and output lists
+ while ((imtgetim (inlist, Memc[input], SZ_FNAME) != EOF) &&
+ (imtgetim (outlist, Memc[output], SZ_FNAME) != EOF)) {
+
+ # Generate temporary output image name to allow for
+ # input and output images having the same name
+ call xt_mkimtemp (Memc[input], Memc[output], Memc[orig], SZ_FNAME)
+
+ # Take different actions depending on whether the image section
+ # is specified or not, in order to optimize speed. When the image
+ # section is specified the input image is copied to the output
+ # image and then the output image opened to work on the section.
+ # Otherwise the output image is created only once.
+ if (sflag) {
+
+ # Copy input image into output image using fast copy
+ iferr (call irl_imcopy (Memc[input], Memc[output])) {
+ call erract (EA_WARN)
+ next
+ }
+
+ # Append section to image names. The output name should
+ # be preserved without the section for later use.
+ call strcat (section, Memc[input], SZ_FNAME)
+ call sprintf (Memc[temp], SZ_FNAME, "%s%s")
+ call pargstr (Memc[output])
+ call pargstr (section)
+
+ # Open input and output images. The output image already
+ # exists, since it was created by the copy operation, so
+ # it is opened as read/write.
+ iferr (imin = immap (Memc[input], READ_ONLY, 0)) {
+ call erract (EA_WARN)
+ next
+ }
+ iferr (imout = immap (Memc[temp], READ_WRITE, 0)) {
+ call imunmap (imin)
+ call erract (EA_WARN)
+ next
+ }
+
+ } else {
+
+ # Open input and output images. The output image does not
+ # exist already so it is opened as a new copy of the input
+ # image.
+ iferr (imin = immap (Memc[input], READ_ONLY, 0)) {
+ call erract (EA_WARN)
+ next
+ }
+ iferr (imout = immap (Memc[output], NEW_COPY, imin)) {
+ call imunmap (imin)
+ call erract (EA_WARN)
+ next
+ }
+
+ }
+
+ # Perform the linear correction.
+ call irl_correct (imin, imout, Memr[coeff], MAXCOEF)
+
+ # Close images
+ call imunmap (imin)
+ call imunmap (imout)
+
+ # Replace output image with the temporary image. This is a
+ # noop if the input and output images have different names
+ call xt_delimtemp (Memc[output], Memc[orig])
+ }
+
+ # Free memory and close image lists
+ call mfree (coeff, TY_REAL)
+ call imtclose (inlist)
+ call imtclose (outlist)
+end
+
+
+# IRL_CORRECT -- Corrects an IR imager frame for non-linearity using a
+# simple power series polynomial correction function:
+#
+# ADU' = ADU * [ a + b * (ADU / MAXADU) + c * (ADU / MAXADU) **2 ]
+#
+
+procedure irl_correct (imin, imout, coeff, ncoef)
+
+pointer imin # input image pointer
+pointer imout # output image pointer
+real coeff[ncoef] # coefficients of polynomial function
+int ncoef # number of polynomial coeficients
+
+int col, ncols
+long v1[IM_MAXDIM], v2[IM_MAXDIM]
+pointer inbuf, outbuf
+
+int imgeti()
+int imgnlr(), impnlr()
+real apolr()
+
+begin
+ # Initiliaze counters for line i/o
+ call amovkl (long(1), v1, IM_MAXDIM)
+ call amovkl (long(1), v2, IM_MAXDIM)
+
+ # Number of pixels per line
+ ncols = imgeti (imin, "i_naxis1")
+
+ # Loop over image lines
+ while ((imgnlr (imin, inbuf, v1) != EOF) &&
+ (impnlr (imout, outbuf, v2) != EOF)) {
+ call adivkr (Memr[inbuf], MAXADU, Memr[outbuf], ncols)
+ do col = 1, ncols {
+ Memr[outbuf+col-1] = apolr (Memr[outbuf+col-1], coeff, ncoef)
+ }
+ call amulr (Memr[inbuf], Memr[outbuf], Memr[outbuf], ncols)
+ }
+end
+
+
+# IRL_IMCOPY -- Copy input image into the output image. Avoid data type
+# conversion in order to opetimize speed.
+
+procedure irl_imcopy (input, output)
+
+char input[ARB] # input image name
+char output[ARB] # output image name
+
+int npix
+long vin[IM_MAXDIM], vout[IM_MAXDIM]
+pointer imin, imout
+pointer inline, outline
+
+int imgeti()
+int imgnls(), impnls()
+int imgnli(), impnli()
+int imgnll(), impnll()
+int imgnlr(), impnlr()
+int imgnld(), impnld()
+int imgnlx(), impnlx()
+pointer immap()
+
+begin
+ # Open input and output images
+ iferr (imin = immap (input, READ_ONLY, 0))
+ call erract (EA_ERROR)
+ iferr (imout = immap (output, NEW_COPY, imin)) {
+ call imunmap (imin)
+ call erract (EA_ERROR)
+ }
+
+ # Initiliaze counters
+ call amovkl (long(1), vin, IM_MAXDIM)
+ call amovkl (long(1), vout, IM_MAXDIM)
+
+ # Copy image lines
+ switch (imgeti (imin, "i_pixtype")) {
+ case TY_SHORT, TY_USHORT:
+ while (imgnls (imin, inline, vin) != EOF) {
+ npix = impnls (imout, outline, vout)
+ call amovs (Mems[inline], Mems[outline], npix)
+ }
+ case TY_INT:
+ while (imgnli (imin, inline, vin) != EOF) {
+ npix = impnli (imout, outline, vout)
+ call amovi (Memi[inline], Memi[outline], npix)
+ }
+ case TY_LONG:
+ while (imgnll (imin, inline, vin) != EOF) {
+ npix = impnll (imout, outline, vout)
+ call amovl (Meml[inline], Meml[outline], npix)
+ }
+ case TY_REAL:
+ while (imgnlr (imin, inline, vin) != EOF) {
+ npix = impnlr (imout, outline, vout)
+ call amovr (Memr[inline], Memr[outline], npix)
+ }
+ case TY_DOUBLE:
+ while (imgnld (imin, inline, vin) != EOF) {
+ npix = impnld (imout, outline, vout)
+ call amovd (Memd[inline], Memd[outline], npix)
+ }
+ case TY_COMPLEX:
+ while (imgnlx (imin, inline, vin) != EOF) {
+ npix = impnlx (imout, outline, vout)
+ call amovx (Memx[inline], Memx[outline], npix)
+ }
+ default:
+ call error (0, "Unsupported pixel type")
+ }
+
+ # Close images
+ call imunmap (imin)
+ call imunmap (imout)
+end
diff --git a/noao/imred/irred/txdump.par b/noao/imred/irred/txdump.par
new file mode 100644
index 00000000..ce400817
--- /dev/null
+++ b/noao/imred/irred/txdump.par
@@ -0,0 +1,8 @@
+# TXDUMP Parameters
+
+textfiles,s,a,,,,Input apphot/daophot text database(s)
+fields,s,a,,,,Fields to be extracted
+expr,s,a,yes,,,Boolean expression for record selection
+headers,b,h,no,,,Print the field headers ?
+parameters,b,h,yes,,,Print the parameters if headers is yes ?
+mode,s,h,"ql",,,Mode of task
diff --git a/noao/imred/irred/x_irred.x b/noao/imred/irred/x_irred.x
new file mode 100644
index 00000000..25e406aa
--- /dev/null
+++ b/noao/imred/irred/x_irred.x
@@ -0,0 +1 @@
+task irlincor = t_irlincor