Index: trunk/doc/pslib/psAstroGroup.tex
===================================================================
--- trunk/doc/pslib/psAstroGroup.tex	(revision 381)
+++ trunk/doc/pslib/psAstroGroup.tex	(revision 747)
@@ -1,45 +1,51 @@
 \begin{CompactItemize}
 \item 
-{\bf ps\-Chip} $\ast$ {\bf ps\-Chip\-In\-FPA} ({\bf ps\-Chip} $\ast$out, const {\bf ps\-FPA} $\ast$fpa, const {\bf ps\-Coord} $\ast$coord)
+{\bf ps\-Cell} $\ast$ {\bf ps\-Cell\-In\-FPA} ({\bf ps\-Cell} $\ast$out, const {\bf ps\-Plane} $\ast$coord, const {\bf ps\-FPA} $\ast$fpa)
+\begin{CompactList}\small\item\em Return the cell in FPA which contains the given FPA coordinates.\item\end{CompactList}\item 
+{\bf ps\-Chip} $\ast$ {\bf ps\-Chip\-In\-FPA} ({\bf ps\-Chip} $\ast$out, const {\bf ps\-Plane} $\ast$coord, const {\bf ps\-FPA} $\ast$fpa)
 \begin{CompactList}\small\item\em returns Chip in FPA which contains the given FPA coordinate\item\end{CompactList}\item 
-{\bf ps\-Cell} $\ast$ {\bf ps\-Cell\-In\-Chip} ({\bf ps\-Cell} $\ast$out, const {\bf ps\-Chip} $\ast$chip, const {\bf ps\-Coord} $\ast$coord)
+{\bf ps\-Cell} $\ast$ {\bf ps\-Cell\-In\-Chip} ({\bf ps\-Cell} $\ast$out, const {\bf ps\-Plane} $\ast$coord, const {\bf ps\-Chip} $\ast$chip)
 \begin{CompactList}\small\item\em returns Cell in Chip which contains the given chip coordinate\item\end{CompactList}\item 
-{\bf ps\-Cell} $\ast$ {\bf ps\-Cell\-In\-FPA} ({\bf ps\-Cell} $\ast$out, const {\bf ps\-FPA} $\ast$fpa, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em Return the cell in FPA which contains the given FPA coordinates.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Sky\-To\-Cell} ({\bf ps\-Coord} $\ast$out, {\bf ps\-Cell} $\ast$cell, const {\bf ps\-FPA} $\ast$fpa)
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-Cellto\-Chip} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Cell} $\ast$cell)
+\begin{CompactList}\small\item\em converts the specified Cell coord to the coord on the parent Chip\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-Chipto\-FPA} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Chip} $\ast$chip)
+\begin{CompactList}\small\item\em converts the specified Chip coord to the coord on the parent FPA\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-FPATo\-TP} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-FPA} $\ast$fpa)
+\begin{CompactList}\small\item\em Convert focal plane coords to tangent plane coordinates.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Coord\-TPto\-Sky} ({\bf ps\-Sphere} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Grommit} $\ast$grommit)
+\begin{CompactList}\small\item\em Convert tangent plane coords to (RA,Dec).\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-Cell\-To\-FPA} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Cell} $\ast$cell)
+\begin{CompactList}\small\item\em Convert Cell coords to FPA coordinates.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Coord\-Cell\-To\-Sky} ({\bf ps\-Sphere} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Cell} $\ast$cell)
+\begin{CompactList}\small\item\em Convert cell and cell coordinate to (RA,Dec).\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Coord\-Cell\-To\-Sky\-QD} ({\bf ps\-Sphere} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Cell} $\ast$cell)
+\begin{CompactList}\small\item\em Convert cell and cell coordinate to (RA,Dec).\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-Sky\-To\-TP} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Sphere} $\ast$in, const {\bf ps\-Grommit} $\ast$grommit)
+\begin{CompactList}\small\item\em Convert (RA,Dec) to tangent plane coords.\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-TPto\-FPA} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-FPA} $\ast$fpa)
+\begin{CompactList}\small\item\em Convert tangent plane coords to focal plane coordinates.\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-FPAto\-Chip} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Chip} $\ast$chip)
+\begin{CompactList}\small\item\em converts the specified FPA coord to the coord on the given Chip\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-Chipto\-Cell} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane} $\ast$in, const {\bf ps\-Cell} $\ast$cell)
+\begin{CompactList}\small\item\em converts the specified Chip coord to the coord on the given Cell\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-Sky\-To\-Cell} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Sphere} $\ast$in, const {\bf ps\-Cell} $\ast$cell)
 \begin{CompactList}\small\item\em Convert (RA,Dec) to cell and cell coordinates.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Cell\-To\-Sky} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Cell} $\ast$cell, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em Convert cell and cell coordinate to (RA,Dec).\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Cell\-To\-Sky\-Quick} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Cell} $\ast$cell, const {\bf ps\-Coord} $\ast$coord)
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Coord\-Sky\-To\-Cell\-QD} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Sphere} $\ast$in, const {\bf ps\-Cell} $\ast$cell)
 \begin{CompactList}\small\item\em Quick and dirty cell to (RA,Dec) --- employs cell\-To\-Sky transformation.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Sky\-To\-TP} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Exposure} $\ast$exp, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em Convert (RA,Dec) to tangent plane coords.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-TPto\-FPA} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-FPA} $\ast$fpa, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em Convert tangent plane coords to focal plane coordinates.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-FPAto\-Chip} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Chip} $\ast$chip, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em converts the specified FPA coord to the coord on the given Chip\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Chipto\-Cell} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Cell} $\ast$cell, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em converts the specified Chip coord to the coord on the given Cell\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Cellto\-Chip} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Cell} $\ast$cell, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em converts the specified Cell coord to the coord on the parent Chip\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Chipto\-FPA} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Chip} $\ast$chip, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em converts the specified Chip coord to the coord on the parent FPA\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-FPATo\-TP} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-FPA} $\ast$fpa, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em Convert focal plane coords to tangent plane coordinates.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-TPto\-Sky} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Exposure} $\ast$exp, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em Convert tangent plane coords to (RA,Dec).\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Cell\-To\-FPA} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Cell} $\ast$cell, const {\bf ps\-Coord} $\ast$coord)
-\begin{CompactList}\small\item\em Convert Cell coords to FPA coordinates.\item\end{CompactList}\item 
-float {\bf ps\-Get\-Airmass} (const {\bf ps\-Coord} $\ast$coord, double sidereal\-Time, float height)
+float {\bf ps\-Get\-Airmass} (const {\bf ps\-Sphere} $\ast$coord, double sidereal\-Time, float height)
 \begin{CompactList}\small\item\em Get the airmass for a given position and sidereal time.\item\end{CompactList}\item 
-float {\bf ps\-Get\-Parallactic} (const {\bf ps\-Coord} $\ast$coord, double sidereal\-Time)
+float {\bf ps\-Get\-Parallactic} (const {\bf ps\-Sphere} $\ast$coord, double sidereal\-Time)
 \begin{CompactList}\small\item\em Get the parallactic angle for a given position and sidereal time.\item\end{CompactList}\item 
 float {\bf ps\-Get\-Refraction} (float colour, {\bf ps\-Phot\-System} color\-Plus, {\bf ps\-Phot\-System} color\-Minus, const {\bf ps\-Exposure} $\ast$exp)
 \begin{CompactList}\small\item\em Estimate atmospheric refraction, along the parallactic.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Get\-Parallax\-Factor} (const {\bf ps\-Exposure} $\ast$exp)
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Get\-Parallax\-Factor} (const {\bf ps\-Exposure} $\ast$exp)
 \begin{CompactList}\small\item\em Calculate the parallax factor.\item\end{CompactList}\item 
 {\bf ps\-Exposure} $\ast$ {\bf ps\-Exposure\-Alloc} (double ra, double dec, double ha, double zd, double az, double lst, float mjd, float rot\-Angle, float temp, float pressure, float humidity, float exptime)
 \begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
 void {\bf ps\-Exposure\-Free} ({\bf ps\-Exposure} $\ast$restrict my\-Exp)
+\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
+{\bf ps\-Grommit} $\ast$ {\bf ps\-Grommit\-Alloc} (const {\bf ps\-Exposure} $\ast$exp)
+\begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
+void {\bf ps\-Grommit\-Free} ({\bf ps\-Grommit} $\ast$grommit)
 \begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
 double {\bf ps\-Get\-MJD} (void)
@@ -47,31 +53,35 @@
 double {\bf ps\-Get\-Sidereal} (float mjd, float longitude)
 \begin{CompactList}\small\item\em Get current sidereal time at longitude.\item\end{CompactList}\item 
-char $\ast$ {\bf ps\-Time\-To\-ISOTime} (ps\-Time time)
-\begin{CompactList}\small\item\em Convert ps\-Time to ISOTime (Human-readable date/time string YYYY/MM/DD,HH:MM:SS.SSS).\item\end{CompactList}\item 
-double {\bf ps\-Time\-To\-UTC} (ps\-Time time)
-\begin{CompactList}\small\item\em Convert ps\-Time to UTC.\item\end{CompactList}\item 
-double {\bf ps\-Time\-To\-MJD} (ps\-Time time)
-\begin{CompactList}\small\item\em Convert ps\-Time to MJD.\item\end{CompactList}\item 
-double {\bf ps\-Time\-To\-JD} (ps\-Time time)
-\begin{CompactList}\small\item\em Convert ps\-Time to JD.\item\end{CompactList}\item 
-timeval $\ast$ {\bf ps\-Time\-To\-Timeval} (ps\-Time time)
-\begin{CompactList}\small\item\em Convert ps\-Time to timeval (struct timeval).\item\end{CompactList}\item 
-tm $\ast$ {\bf ps\-Time\-To\-Tm} (ps\-Time time)
-\begin{CompactList}\small\item\em Convert ps\-Time to broken-down time (struct tm).\item\end{CompactList}\item 
-ps\-Time $\ast$ {\bf ps\-ISOTime\-To\-Time} (char $\ast$input)
-\begin{CompactList}\small\item\em Convert ISOTime (Human-readable date/time string YYYY/MM/DD,HH:MM:SS.SSS) to ps\-Time.\item\end{CompactList}\item 
-ps\-Time $\ast$ {\bf ps\-UTCTo\-Time} (double input)
-\begin{CompactList}\small\item\em Convert UTC to ps\-Time.\item\end{CompactList}\item 
-ps\-Time $\ast$ {\bf ps\-MJDTo\-Time} (double input)
-\begin{CompactList}\small\item\em Convert MJD to ps\-Time.\item\end{CompactList}\item 
-ps\-Time $\ast$ {\bf ps\-JDTo\-Time} (double input)
-\begin{CompactList}\small\item\em Convert JD to ps\-Time.\item\end{CompactList}\item 
-ps\-Time $\ast$ {\bf ps\-Timeval\-To\-Time} (struct timeval $\ast$input)
-\begin{CompactList}\small\item\em Convert timeval to ps\-Time (struct timeval).\item\end{CompactList}\item 
-ps\-Time $\ast$ {\bf ps\-TMto\-Time} (struct tm $\ast$input)
-\begin{CompactList}\small\item\em Convert broken-to ps\-Time down time (struct tm).\item\end{CompactList}\item 
-{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Alloc} (int nx, int ny, {\bf ps\-Type} type)
+char $\ast$ {\bf ps\-Time\-To\-ISOTime} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Convert {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})} to ISOTime (Human-readable date/time string YYYY/MM/DD,HH:MM:SS.SSS).\item\end{CompactList}\item 
+double {\bf ps\-Time\-To\-UTC} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Convert {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})} to UTC.\item\end{CompactList}\item 
+double {\bf ps\-Time\-To\-MJD} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Convert {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})} to MJD.\item\end{CompactList}\item 
+double {\bf ps\-Time\-To\-JD} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Convert {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})} to JD.\item\end{CompactList}\item 
+timeval $\ast$ {\bf ps\-Time\-To\-Timeval} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Convert {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})} to timeval (struct timeval).\item\end{CompactList}\item 
+tm $\ast$ {\bf ps\-Time\-To\-Tm} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Convert {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})} to broken-down time (struct tm).\item\end{CompactList}\item 
+float {\bf ps\-Time\-To\-Lunation} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Convert {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})} to lunation number.\item\end{CompactList}\item 
+{\bf ps\-Time} $\ast$ {\bf ps\-ISOTime\-To\-Time} (char $\ast$input)
+\begin{CompactList}\small\item\em Convert ISOTime (Human-readable date/time string YYYY/MM/DD,HH:MM:SS.SSS) to {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})}.\item\end{CompactList}\item 
+{\bf ps\-Time} $\ast$ {\bf ps\-UTCTo\-Time} (double input)
+\begin{CompactList}\small\item\em Convert UTC to {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})}.\item\end{CompactList}\item 
+{\bf ps\-Time} $\ast$ {\bf ps\-MJDTo\-Time} (double input)
+\begin{CompactList}\small\item\em Convert MJD to {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})}.\item\end{CompactList}\item 
+{\bf ps\-Time} $\ast$ {\bf ps\-JDTo\-Time} (double input)
+\begin{CompactList}\small\item\em Convert JD to {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})}.\item\end{CompactList}\item 
+{\bf ps\-Time} $\ast$ {\bf ps\-Timeval\-To\-Time} (struct timeval $\ast$input)
+\begin{CompactList}\small\item\em Convert timeval (struct timeval) to {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})}.\item\end{CompactList}\item 
+{\bf ps\-Time} $\ast$ {\bf ps\-TMTo\-Time} (struct tm $\ast$input)
+\begin{CompactList}\small\item\em Convert broken-down time (struct tm) to {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})}.\item\end{CompactList}\item 
+{\bf ps\-Time} $\ast$ {\bf ps\-Lunation\-To\-Time} (float lunation)
+\begin{CompactList}\small\item\em Convert lunation number to {\bf ps\-Time} {\rm (p.\,\pageref{structpsTime})}.\item\end{CompactList}\item 
+{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Alloc} (int width, int height, {\bf ps\-Elem\-Type} type)
 \begin{CompactList}\small\item\em Create an image of the specified size and type.\item\end{CompactList}\item 
-{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Subset} ({\bf ps\-Image} $\ast$out, const {\bf ps\-Image} $\ast$image, int nx, int ny, int x0, int y0)
+{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Subset} (const {\bf ps\-Image} $\ast$image, int width, int height, int x0, int y0)
 \begin{CompactList}\small\item\em Create a subimage of the specified area.\item\end{CompactList}\item 
 void {\bf ps\-Image\-Free} ({\bf ps\-Image} $\ast$restrict image)
@@ -79,13 +89,11 @@
 {\bf ps\-Image} $\ast$ {\bf ps\-Image\-Free\-Pixels} ({\bf ps\-Image} $\ast$restrict image)
 \begin{CompactList}\small\item\em Destroy the pixels of the specified image.\item\end{CompactList}\item 
-int {\bf ps\-Image\-Free\-Children} (const {\bf ps\-Image} $\ast$image)
-\begin{CompactList}\small\item\em Destroy the children of the specified image. Returns number of children freed.\item\end{CompactList}\item 
-{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Copy} ({\bf ps\-Image} $\ast$output, const {\bf ps\-Image} $\ast$input)
+{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Copy} ({\bf ps\-Image} $\ast$output, const {\bf ps\-Image} $\ast$input, {\bf ps\-Elem\-Type} type)
 \begin{CompactList}\small\item\em Create a copy of the specified image.\item\end{CompactList}\item 
-{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Image\-Slice} ({\bf ps\-Float\-Array} $\ast$out, const {\bf ps\-Image} $\ast$input, int x, int y, int nx, int ny, int direction, const {\bf ps\-Stats} $\ast$stats)
+{\bf ps\-Vector} $\ast$ {\bf ps\-Image\-Slice} ({\bf ps\-Vector} $\ast$out, const {\bf ps\-Image} $\ast$input, int x, int y, int nx, int ny, int direction, const {\bf ps\-Stats} $\ast$stats)
 \begin{CompactList}\small\item\em Extract pixels from rectlinear region to a vector.\item\end{CompactList}\item 
-{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Image\-Cut} ({\bf ps\-Float\-Array} $\ast$out, const {\bf ps\-Image} $\ast$input, float xs, float ys, float xe, float ye, float dw, const {\bf ps\-Stats} $\ast$stats)
+{\bf ps\-Vector} $\ast$ {\bf ps\-Image\-Cut} ({\bf ps\-Vector} $\ast$out, const {\bf ps\-Image} $\ast$input, float xs, float ys, float xe, float ye, float dw, const {\bf ps\-Stats} $\ast$stats)
 \begin{CompactList}\small\item\em Extract pixels along a line to a vector.\item\end{CompactList}\item 
-{\bf ps\-Float\-Array} $\ast$ {\bf ps\-Image\-Radial\-Cut} ({\bf ps\-Float\-Array} $\ast$out, const {\bf ps\-Image} $\ast$input, float x, float y, float radius, float dr, const {\bf ps\-Stats} $\ast$stats)
+{\bf ps\-Vector} $\ast$ {\bf ps\-Image\-Radial\-Cut} ({\bf ps\-Vector} $\ast$out, const {\bf ps\-Image} $\ast$input, float x, float y, const {\bf ps\-Vector} $\ast$radii, const {\bf ps\-Stats} $\ast$stats)
 \begin{CompactList}\small\item\em Extract radial annulii data to a vector.\item\end{CompactList}\item 
 {\bf ps\-Image} $\ast$ {\bf ps\-Image\-Rebin} ({\bf ps\-Image} $\ast$out, const {\bf ps\-Image} $\ast$input, float scale, const {\bf ps\-Stats} $\ast$stats)
@@ -97,11 +105,11 @@
 {\bf ps\-Image} $\ast$ {\bf ps\-Image\-Roll} ({\bf ps\-Image} $\ast$out, const {\bf ps\-Image} $\ast$input, int dx, int dy)
 \begin{CompactList}\small\item\em Roll image by an integer number of pixels in either direction.\item\end{CompactList}\item 
-{\bf ps\-Stats} $\ast$ {\bf ps\-Image\-Get\-Stats} (const {\bf ps\-Image} $\ast$input, {\bf ps\-Stats} $\ast$stats)
+{\bf ps\-Stats} $\ast$ {\bf ps\-Image\-Get\-Stats} ({\bf ps\-Stats} $\ast$stats, const {\bf ps\-Image} $\ast$input)
 \begin{CompactList}\small\item\em Determine statistics for image (or subimage).\item\end{CompactList}\item 
 {\bf ps\-Histogram} $\ast$ {\bf ps\-Image\-Histogram} ({\bf ps\-Histogram} $\ast$hist, const {\bf ps\-Image} $\ast$input)
 \begin{CompactList}\small\item\em Construct a histogram from an image (or subimage).\item\end{CompactList}\item 
-{\bf ps\-Polynomial2D} $\ast$ {\bf ps\-Image\-Fit\-Polynomial} (const {\bf ps\-Image} $\ast$input, {\bf ps\-Polynomial2D} $\ast$coeffs)
+{\bf ps\-Polynomial2D} $\ast$ {\bf ps\-Image\-Fit\-Polynomial} ({\bf ps\-Polynomial2D} $\ast$coeffs, const {\bf ps\-Image} $\ast$input)
 \begin{CompactList}\small\item\em Fit a 2-D polynomial surface to an image.\item\end{CompactList}\item 
-int {\bf ps\-Image\-Eval\-Polynomial} (const {\bf ps\-Image} $\ast$input, const {\bf ps\-Polynomial2D} $\ast$coeffs)
+{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Eval\-Polynomial} (const {\bf ps\-Image} $\ast$input, const {\bf ps\-Polynomial2D} $\ast$coeffs)
 \begin{CompactList}\small\item\em Evaluate a 2-D polynomial surface to image pixels.\item\end{CompactList}\item 
 {\bf ps\-Image} $\ast$ {\bf ps\-Image\-Read\-Section} ({\bf ps\-Image} $\ast$output, int x, int y, int nx, int ny, int z, const char $\ast$extname, int extnum, const char $\ast$filename)
@@ -109,12 +117,8 @@
 {\bf ps\-Image} $\ast$ {\bf ps\-Image\-FRead\-Section} ({\bf ps\-Image} $\ast$output, int x, int y, int nx, int ny, int z, const char $\ast$extname, int extnum, FILE $\ast$f)
 \begin{CompactList}\small\item\em Read an image or subimage from file descriptor.\item\end{CompactList}\item 
-{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Write\-Section} ({\bf ps\-Image} $\ast$input, int x, int y, int z, const char $\ast$extname, int extnum, const char $\ast$filename)
+{\bf ps\-Image} $\ast$ {\bf ps\-Image\-Write\-Section} (const {\bf ps\-Image} $\ast$input, int x, int y, int z, const char $\ast$extname, int extnum, const char $\ast$filename)
 \begin{CompactList}\small\item\em Write an image section to named file (which may exist).\item\end{CompactList}\item 
-{\bf ps\-Image} $\ast$ {\bf ps\-Image\-FWrite\-Section} ({\bf ps\-Image} $\ast$input, int x, int y, int z, const char $\ast$extname, int extnum, FILE $\ast$f)
+{\bf ps\-Image} $\ast$ {\bf ps\-Image\-FWrite\-Section} (const {\bf ps\-Image} $\ast$input, int x, int y, int z, const char $\ast$extname, int extnum, FILE $\ast$f)
 \begin{CompactList}\small\item\em Write an image section to named file (which may exist).\item\end{CompactList}\item 
-ps\-Metadata $\ast$ {\bf ps\-Image\-Read\-Header} (ps\-Metadata $\ast$output, const char $\ast$extname, int extnum, const char $\ast$filename)
-\begin{CompactList}\small\item\em Read only header from image file.\item\end{CompactList}\item 
-ps\-Metadata $\ast$ {\bf ps\-Image\-FRead\-Header} (ps\-Metadata $\ast$output, const char $\ast$extname, int extnum, FILE $\ast$f)
-\begin{CompactList}\small\item\em Read only header from image file descriptor.\item\end{CompactList}\item 
 int {\bf ps\-Image\-Clip} ({\bf ps\-Image} $\ast$input, float min, float vmin, float max, float vmax)
 \begin{CompactList}\small\item\em Clip image values outside of range to given values. Return number of clipped pixels.\item\end{CompactList}\item 
@@ -123,47 +127,74 @@
 int {\bf ps\-Image\-Overlay\-Section} ({\bf ps\-Image} $\ast$image, const {\bf ps\-Image} $\ast$overlay, int x0, int y0, const char $\ast$op)
 \begin{CompactList}\small\item\em Overlay subregion of image with another image. Return number of pixels replaced.\item\end{CompactList}\item 
-{\bf ps\-Meta\-Data\-Item} $\ast$ {\bf ps\-Meta\-Data\-Item\-Alloc} (int type\-Flags, const void $\ast$val, const char $\ast$comment, const char $\ast$name,...)
-\begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
-void {\bf ps\-Meta\-Data\-Item\-Free} ({\bf ps\-Meta\-Data\-Item} $\ast$ms)
-\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
-{\bf ps\-Meta\-Data\-Set} $\ast$ {\bf ps\-Meta\-Data\-Set\-Alloc} (void)
-\begin{CompactList}\small\item\em make a new set of metadata\item\end{CompactList}\item 
-void {\bf ps\-Meta\-Data\-Set\-Free} ({\bf ps\-Meta\-Data\-Set} $\ast$ms)
-\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
-{\bf ps\-Meta\-Data\-Item} $\ast$ {\bf ps\-Meta\-Data\-Append} ({\bf ps\-Meta\-Data\-Set} $\ast$restrict ms, {\bf ps\-Meta\-Data\-Item} $\ast$restrict item)
-\begin{CompactList}\small\item\em Add entry to the end of the metadata set.\item\end{CompactList}\item 
-{\bf ps\-Meta\-Data\-Item} $\ast$ {\bf ps\-Meta\-Data\-Remove} ({\bf ps\-Meta\-Data\-Set} $\ast$restrict ms, const char $\ast$restrict key)
-\begin{CompactList}\small\item\em delete entry from the metadata set\item\end{CompactList}\item 
-void {\bf ps\-Meta\-Data\-Set\-Iterator} ({\bf ps\-Meta\-Data\-Set} $\ast$ms)
+{\bf ps\-Metadata\-Item} $\ast$ {\bf ps\-Metadata\-Item\-Alloc} (const char $\ast$name, int format, const char $\ast$comment,...)
+\begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
+{\bf ps\-Metadata\-Item} $\ast$ {\bf ps\-Metadata\-Item\-Alloc} (const char $\ast$name, int format, const char $\ast$comment, va\_\-list ap)
+\item 
+void {\bf ps\-Metadata\-Item\-Free} ({\bf ps\-Metadata\-Item} $\ast$ms)
+\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
+{\bf ps\-Metadata} $\ast$ {\bf ps\-Metadata\-Alloc} (void)
+\begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
+void {\bf ps\-Metadata\-Free} ({\bf ps\-Metadata} $\ast$md)
+\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
+{\bf ps\-Metadata\-Item} $\ast$ {\bf ps\-Metadata\-Append\-Item} ({\bf ps\-Metadata} $\ast$restrict md, {\bf ps\-Metadata\-Item} $\ast$restrict item)
+\begin{CompactList}\small\item\em Add item to the end of the metadata.\item\end{CompactList}\item 
+{\bf ps\-Metadata\-Item} $\ast$ {\bf ps\-Metadata\-Append} ({\bf ps\-Metadata} $\ast$restrict md, const char $\ast$name, int format, const char $\ast$comment,...)
+\begin{CompactList}\small\item\em Add item to the end of the metadata. Combines ps\-Metadata\-Item\-Alloc and ps\-Metadata\-Append\-Item.\item\end{CompactList}\item 
+{\bf ps\-Metadata\-Item} $\ast$ {\bf ps\-Metadata\-Remove} ({\bf ps\-Metadata} $\ast$restrict md, const char $\ast$restrict key)
+\begin{CompactList}\small\item\em delete item from the metadata\item\end{CompactList}\item 
+void {\bf ps\-Metadata\-Set\-Iterator} ({\bf ps\-Metadata} $\ast$md)
 \begin{CompactList}\small\item\em reset the iterator to the start of the list\item\end{CompactList}\item 
-{\bf ps\-Meta\-Data\-Item} $\ast$ {\bf ps\-Meta\-Data\-Get\-Next} ({\bf ps\-Meta\-Data\-Set} $\ast$restrict ms, const char $\ast$restrict match)
-\begin{CompactList}\small\item\em get the next entry in the sequence\item\end{CompactList}\item 
-{\bf ps\-Meta\-Data\-Item} $\ast$ {\bf ps\-Meta\-Data\-Lookup} (const {\bf ps\-Meta\-Data\-Set} $\ast$restrict ms, const char $\ast$restrict key)
+{\bf ps\-Metadata\-Item} $\ast$ {\bf ps\-Metadata\-Get\-Next} ({\bf ps\-Metadata} $\ast$restrict md, const char $\ast$restrict match, int which)
+\begin{CompactList}\small\item\em get the next item in the sequence\item\end{CompactList}\item 
+{\bf ps\-Metadata\-Item} $\ast$ {\bf ps\-Metadata\-Lookup} (const {\bf ps\-Metadata} $\ast$restrict md, const char $\ast$restrict key)
 \begin{CompactList}\small\item\em find the metadata with the specified key\item\end{CompactList}\item 
-void {\bf ps\-Meta\-Data\-Item\-Print} (FILE $\ast$fd, const {\bf ps\-Meta\-Data\-Item} $\ast$restrict ms, const char $\ast$prefix)
+void {\bf ps\-Metadata\-Item\-Print} (FILE $\ast$fd, const {\bf ps\-Metadata\-Item} $\ast$restrict md, const char $\ast$prefix)
 \begin{CompactList}\small\item\em print metadata item to the specified stream\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coord\-Xform\-Apply} ({\bf ps\-Coord} $\ast$out, const {\bf ps\-Coord\-Xform} $\ast$frame, const {\bf ps\-Coord} $\ast$coords)
+{\bf ps\-Metadata} $\ast$ {\bf ps\-Metadata\-Read\-Header} ({\bf ps\-Metadata} $\ast$out, const char $\ast$ext, int extnum, const char $\ast$file)
+\begin{CompactList}\small\item\em Read only header from image file.\item\end{CompactList}\item 
+{\bf ps\-Metadata} $\ast$ {\bf ps\-Metadata\-FRead\-Header} ({\bf ps\-Metadata} $\ast$out, const char $\ast$ext, int extnum, FILE $\ast$f)
+\begin{CompactList}\small\item\em Read only header from image file descriptor.\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Plane\-Transform\-Apply} ({\bf ps\-Plane} $\ast$out, const {\bf ps\-Plane\-Transform} $\ast$frame, const {\bf ps\-Plane} $\ast$coords)
 \begin{CompactList}\small\item\em apply the coordinate transformation to the given coordinate\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Distortion\-Apply} ({\bf ps\-Coord} $\ast$out, const psdistortion $\ast$pattern, const {\bf ps\-Coord} $\ast$coords, float mag, float color)
+{\bf ps\-Plane} $\ast$ {\bf ps\-Plane\-Distort\-Apply} ({\bf ps\-Plane} $\ast$out, const ps\-Plane\-Distortion $\ast$pattern, const {\bf ps\-Plane} $\ast$coords, float mag, float color)
 \begin{CompactList}\small\item\em apply the optical distortion to the given coordinate, magnitude, color\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Get\-Offset} (const {\bf ps\-Coord} $\ast$restrict position1, const {\bf ps\-Coord} $\ast$restrict position2, const char $\ast$type)
+{\bf ps\-Sphere\-Transform} $\ast$ {\bf ps\-Sphere\-Transform\-Alloc} (double pole1, double pole2, double rotation)
+\begin{CompactList}\small\item\em Constructor.\item\end{CompactList}\item 
+void {\bf ps\-Sphere\-Transform\-Free} ({\bf ps\-Sphere\-Transform} $\ast$trans)
+\begin{CompactList}\small\item\em Destructor.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Sphere\-Transform\-Apply} (const {\bf ps\-Sphere} $\ast$coord, const {\bf ps\-Sphere\-Transform} $\ast$sys)
+\begin{CompactList}\small\item\em Apply general spherical transformation.\item\end{CompactList}\item 
+{\bf ps\-Sphere\-Transform} $\ast$ {\bf ps\-Sphere\-Transform\-Ito\-E} (void)
+\begin{CompactList}\small\item\em Return transformation structure to convert ICRS to Ecliptic.\item\end{CompactList}\item 
+{\bf ps\-Sphere\-Transform} $\ast$ {\bf ps\-Sphere\-Transform\-Eto\-I} (void)
+\begin{CompactList}\small\item\em Return transformation structure to convert Ecliptic to ICRS.\item\end{CompactList}\item 
+{\bf ps\-Sphere\-Transform} $\ast$ {\bf ps\-Sphere\-Transform\-Ito\-G} (void)
+\begin{CompactList}\small\item\em Return transformation structure to convert ICRS to Galactic.\item\end{CompactList}\item 
+{\bf ps\-Sphere\-Transform} $\ast$ {\bf ps\-Sphere\-Transform\-Gto\-I} (void)
+\begin{CompactList}\small\item\em Return transformation structure to convert Galactic to ICRS.\item\end{CompactList}\item 
+{\bf ps\-Plane} $\ast$ {\bf ps\-Coord\-Project} (const {\bf ps\-Sphere} $\ast$coord, const {\bf ps\-Projection} $\ast$projection)
+\begin{CompactList}\small\item\em Project spherical system onto a plane.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Coord\-Deproject} (const {\bf ps\-Plane} $\ast$coord, const {\bf ps\-Projection} $\ast$projection)
+\begin{CompactList}\small\item\em Deproject plane onto spherical system.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Sphere\-Get\-Offset} (const {\bf ps\-Sphere} $\ast$restrict position1, const {\bf ps\-Sphere} $\ast$restrict position2, const char $\ast$type)
 \begin{CompactList}\small\item\em Get offset (RA,Dec) on the sky between two positions position1 and position2 may not be identical.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Apply\-Offset} (const {\bf ps\-Coord} $\ast$restrict position, const {\bf ps\-Coord} $\ast$restrict offset, const char $\ast$type)
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Sphere\-Apply\-Offset} (const {\bf ps\-Sphere} $\ast$restrict position, const {\bf ps\-Sphere} $\ast$restrict offset, const char $\ast$type)
 \begin{CompactList}\small\item\em Apply an offset to a position.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Get\-Sun\-Pos} (float mjd)
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Sun\-Get\-Pos} ({\bf ps\-Time} time)
 \begin{CompactList}\small\item\em Get Sun Position.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Get\-Moon\-Pos} (float mjd, double latitude, double longitude)
-\begin{CompactList}\small\item\em Get Moon position.\item\end{CompactList}\item 
-float {\bf ps\-Get\-Moon\-Phase} (float mjd)
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Sun\-Get\-Rise} ({\bf ps\-Time} $\ast$twi15, {\bf ps\-Time} $\ast$twi18, {\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Get Sun Rise time.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Sun\-Get\-Set} ({\bf ps\-Time} $\ast$twi15, {\bf ps\-Time} $\ast$twi18, {\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Get Sun Set time.\item\end{CompactList}\item 
+float {\bf ps\-Night\-Length} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Get Length of closest night.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Moon\-Get\-Pos} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Get Moon Position.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Moon\-Get\-Rise} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Get Moon Rise time.\item\end{CompactList}\item 
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Moon\-Get\-Set} ({\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Get Moon Set time.\item\end{CompactList}\item 
+float {\bf ps\-Moon\-Get\-Phase} ({\bf ps\-Time} time)
 \begin{CompactList}\small\item\em Get Moon phase.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Get\-Solar\-System\-Pos} (const char $\ast$solar\-System\-Object, float mjd)
-\begin{CompactList}\small\item\em Get Planet positions.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coordinates\-Ito\-E} (const {\bf ps\-Coord} $\ast$restrict coordinates)
-\begin{CompactList}\small\item\em Convert ICRS to Ecliptic.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coordinates\-Eto\-I} (const {\bf ps\-Coord} $\ast$restrict coordinates)
-\begin{CompactList}\small\item\em Convert Ecliptic to ICRS.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coordinates\-Ito\-G} (const {\bf ps\-Coord} $\ast$restrict coordinates)
-\begin{CompactList}\small\item\em Convert ICRS to Galactic.\item\end{CompactList}\item 
-{\bf ps\-Coord} $\ast$ {\bf ps\-Coordinates\-Gto\-I} (const {\bf ps\-Coord} $\ast$restrict coordinates)
-\begin{CompactList}\small\item\em Convert Galactic to ICRS.\item\end{CompactList}\end{CompactItemize}
-
+{\bf ps\-Sphere} $\ast$ {\bf ps\-Planet\-Get\-Pos} (const char $\ast$solar\-System\-Object, {\bf ps\-Time} time)
+\begin{CompactList}\small\item\em Get Planet positions.\item\end{CompactList}\end{CompactItemize}
