Index: trunk/archive/pslib/include/psAstrom.h
===================================================================
--- trunk/archive/pslib/include/psAstrom.h	(revision 198)
+++ trunk/archive/pslib/include/psAstrom.h	(revision 212)
@@ -25,4 +25,5 @@
     psDoubleArray *restrict coeff;	//!< Coefficients of astrometric solution
     psDoubleArray *restrict coeffErr;	//!< Error in coefficients
+    psBitMask *restrict coeffMask;	//!< Use this coefficient?
 } psAstromCoeffs;
 
@@ -44,5 +45,5 @@
 /***********************************************************************************************************/
 
-/** Telescope pointing information for an exposure */
+/** Exposure information from the telescope */
 typedef struct {
     // Telescope longitude, latitude and height are stored separately, since they don't change with pointing
@@ -51,26 +52,36 @@
     double zd;				//!< Zenith distance
     double az;				//!< Azimuth
+    double lst;				//!< Local Sidereal Time
+    float mjd;				//!< MJD of observation
     float rotAngle;			//!< Rotator position angle
-    float temp;				//!< Temperature
-    float pressure;			//!< Pressure
+    float temp;				//!< Air temperature, for estimating diffraction
+    float pressure;			//!< Air pressure, for calculating diffraction
+    float humidity;			//!< Relative humidity, for calculating diffraction
+    float exptime;			//!< Exposure time
     /* Derived quantities */
+    float posAngle;			//!< Position angle
     float parallactic;			//!< Parallactic angle
     float airmass;	                //!< Airmass, calculated from zenith distance
-} psTelPointing;
-
-/** Constructor */
-psTelPointing *
-psTelPointingAlloc(double ra, double dec,	//!< Telescope boresight
-		 double ha,		//!< Hour angle
-		 double zd,		//!< Zenith distance
-		 double az,		//!< Azimuth
-		 float rotAngle,	//!< Rotator position angle
-		 float temp,		//!< Temperature
-		 float pressure		//!< Pressure
-    );
-
-/** Destructor */
-void
-psTelPointingFree(psTelPointing *restrict myTelPointing //!< Object to destroy
+    float pf;				//!< Parallactic factor
+} psExposure;
+
+/** Constructor */
+psExposure *
+psExposureAlloc(double ra, double dec,	//!< Telescope boresight
+		double ha,		//!< Hour angle
+		double zd,		//!< Zenith distance
+		double az,		//!< Azimuth
+		double lst,		//!< Local Sidereal Time
+		float mjd,		//!< MJD
+		float rotAngle,		//!< Rotator position angle
+		float temp,		//!< Temperature
+		float pressure,		//!< Pressure
+		float humidity,		//!< Relative humidity
+		float exptime		//!< Exposure time
+    );
+
+/** Destructor */
+void
+psExposureFree(psExposure *restrict myExp //!< Object to destroy
     );
 
@@ -80,12 +91,13 @@
 /** Cell details: specifies how the cell is mounted on its parent OTA */
 typedef struct {
-    psOTAPos position;			//!< Position of cell in its OTA.  Specifies the position of the
+    double x, y;			//!< Position of cell in its OTA.  Specifies the position of the
 					//!< (imaginary) pixel (0,0)
-    float rotation;			//!< Rotation of cell in its OTA.  Specified from +x through +y
+    double xErr, yErr;			//!< Error in position of cell in the OTA.
+    double rotation;			//!< Rotation of cell in its OTA.  Specified from +x through +y
     int xSize, ySize;			//!< Number of pixels in x and y
-    float scale;			//!< Relative pixel scales, if CCD pitch varies. Specify a positive
-					//!< scale for a left-handed coordinate system, negative for right. If
-					//!< NULL, then every chip has identical scale, and system is
-					//!< left-handed.
+    double scale;			//!< Relative pixel scales, if CCD pitch varies over the OTA. Specify
+					//!< a positive scale for a left-handed coordinate system, negative
+					//!< for right. If NULL, then every chip has identical scale, and
+					//!< system is left-handed.
 } psCellDescription;
 
@@ -102,6 +114,23 @@
 
 /** Array of cell descriptions */
-PS_DECLARE_ARRAY_TYPE(psCellDescription);
-PS_CREATE_ARRAY_TYPE(psCellDescription);
+typedef struct {
+    enum psType type;			//!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
+    int size;				//!< Total number of elements available
+    int n;				//!< Number of elements in use
+    double *arr;			//!< The array data
+} psCellDescriptionArray;
+
+/** Constructor */
+psCellDescriptionArray *psCellDescriptionArrayAlloc(int s, //!< Total number of elements to make available
+						    int n //!< Number of elements that will be used
+						    );
+/** Reallocator */
+psCellDescriptionArray *psCellDescriptionArrayRealloc(psCellDescriptionArray *myArray, //!< Array to
+										       //!< reallocate
+						      int s //!< Total number of elements to make available
+						      );
+/** Destructor */
+void psCellDescriptionArrayFree(psCellDescriptionArray *restrict myArray //!< Array to free
+				);
 
 /***********************************************************************************************************/
@@ -109,9 +138,11 @@
 /** OTA details: specifies how the OTA is mounted on the focal plane */
 typedef struct {
-    psOTAPos position;			//!< Position of OTA on the focal plane.  Specifies the position of the
-					//!< bottom left-hand corner.
-    float rotation;			//!< Rotation of OTA on the focal plane.  Specified from +x through +y
+    double x, y;			//!< Position of OTA on the focal plane.  Specifies the position of
+					//!< the bottom left-hand corner.
+    double xErr, yErr;			//!< Error in the position of the OTA.
+    double rotation;			//!< Rotation of OTA on the focal plane.  Specified from +x through +y
     psCellDescriptionArray *restrict cells; //!< Cell descriptions
-    struct psOTAAstrom *astrom;		    //!< OTA astrometry
+    psOTAAstrom *astrom;		//!< OTA astrometry
+    psExposure *exp;			//!< Exposure data
 } psOTADescription;
 
@@ -159,5 +190,5 @@
 /** Constructor */
 psOTAAstrom *
-psOTAAstromAlloc(const psTelPointing *telescope //!< Telescope pointing, used to initialise the tp data.
+psOTAAstromAlloc(const psExposure *exp //!< Telescope pointing, used to initialise the tp data.
     );
 
@@ -188,6 +219,6 @@
 	    const psOTAPosArray *restrict detector, //!< Positions on OTA (chip#,x,y)
 	    const psSkyPosArray *restrict sky, //!< Positions on the sky (RA,Dec)
-	    const psTelPointing *telescope //!< Telescope pointing information, for airmass, parallactic angle
-					   //!< which may help set the astrometric solution
+	    const psExposure *exp	//!< Telescope pointing information, for airmass, parallactic angle
+					//!< which may help set the astrometric solution
 	    );
 
@@ -199,5 +230,5 @@
 float
 psGetAirmass(const psSkyPos *restrict position, //!< Position on the sky
-	     float siderealTime	//!< Sidereal time
+	     double siderealTime	//!< Sidereal time
 	     );
 
@@ -205,5 +236,5 @@
 float
 psGetParallactic(const psSkyPos *restrict position, //!< Position on the sky
-		 float siderealTime	//!< Sidereal time
+		 double siderealTime	//!< Sidereal time
 		 );
 
@@ -212,5 +243,5 @@
 psGetRefraction(float colour,		//!< Colour of object
 		psColourRef colourRef,	//!< Colour reference
-		psTelPointing telescope	//!< Telescope pointing information, for airmass, temp and pressure
+		psExposure *exp		//!< Telescope pointing information, for airmass, temp and pressure
     );
 
