Index: trunk/psModules/src/astrom/pmAstrometryUtils.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryUtils.c	(revision 35768)
+++ trunk/psModules/src/astrom/pmAstrometryUtils.c	(revision 41892)
@@ -23,4 +23,15 @@
 #include "pmAstrometryUtils.h"
 
+static int transform_extra_orders = 3;
+
+int pmAstrometryGetExtraOrders (void) {
+  return transform_extra_orders;
+}
+
+int pmAstrometrySetExtraOrders (int orders) {
+  transform_extra_orders = orders;
+  return transform_extra_orders;
+}
+
 // this is used by the test output block
 static int Nout = 0;
@@ -120,11 +131,15 @@
 
 // convert a transformation L(x,y) to L'(x-xo,y-yo)
+// is this used for an upward (e.g., chip->fpa) or a downward (fpa->chip) transform?
 psPlaneTransform *psPlaneTransformSetCenter (psPlaneTransform *output, psPlaneTransform *input, double Xo, double Yo)
 {
 
-    // validate fit order
+    // validate fit type:
+    // polynomial in input transforms must match type -- and for now be ORD
+    psAssert (input->x->type == PS_POLYNOMIAL_ORD, "fix for CHEB");
+    psAssert (input->y->type == PS_POLYNOMIAL_ORD, "fix for CHEB");
 
     if (output == NULL) {
-        output = psPlaneTransformAlloc(input->x->nX, input->x->nY);
+        output = psPlaneTransformAlloc(input->x->nX, input->x->nY, PS_POLYNOMIAL_ORD);
     }
 
@@ -169,5 +184,5 @@
 
 // rotate a transformation L(x,y) by theta
-psPlaneTransform *psPlaneTransformRotate (psPlaneTransform *output, psPlaneTransform *input, double theta)
+psPlaneTransform *psPlaneTransformRotate  (psPlaneTransform *output, psPlaneTransform *input, double theta)
 {
     /* given the polynomial transformations:
@@ -181,5 +196,6 @@
 
     if (output == NULL) {
-        output = psPlaneTransformAlloc(input->x->nX, input->x->nY);
+	// generate a new transform using the same order and type as the input
+        output = psPlaneTransformAlloc(input->x->nX, input->x->nY, input->x->type);
     }
 
@@ -216,5 +232,5 @@
 
     // all coeffs and masks initially set to 0
-    transform = psPlaneTransformAlloc (order, order);
+    transform = psPlaneTransformAlloc (order, order, PS_POLYNOMIAL_ORD);
 
     for (int i = 0; i <= order; i++) {
