Index: trunk/psastro/src/psastroUtils.c
===================================================================
--- trunk/psastro/src/psastroUtils.c	(revision 5560)
+++ trunk/psastro/src/psastroUtils.c	(revision 5565)
@@ -1,34 +1,4 @@
 # include "psastro.h"
 # define RENORM 0
-
-bool testWriteRaw (char *filename, psArray *sources);
-
-void psastroDumpStars (psArray *sources) {
-
-    for (int i = 0; i < sources->n; i++) {
-	pmAstromObj *star = sources->data[i];
-
-	fprintf (stderr, "%8.2f %8.2f   %8.2f %8.2f   %8.2f %8.2f   %8.2f %8.2f   %8.2f %8.2f   %10.6f %10.6f   %8.2f %8.2f\n", 
-		 star->pix.x, star->pix.y, 
-		 star->cell.x, star->cell.y, 
-		 star->chip.x, star->chip.y, 
-		 star->FP.x, star->FP.y, 
-		 star->TP.x, star->TP.y, 
-		 star->sky.r*DEG_RAD, star->sky.d*DEG_RAD, 
-		 star->Mag, star->dMag);
-    }
-}
-
-// sort by mag (descending)
-int pmAstromObjSortByMag (const void **a, const void **b)
-{
-    pmAstromObj *A = *(pmAstromObj **)a;
-    pmAstromObj *B = *(pmAstromObj **)b;
-
-    psF32 diff = A->Mag - B->Mag;
-    if (diff > FLT_EPSILON) return (-1);
-    if (diff < FLT_EPSILON) return (+1);
-    return (0);
-}
 
 bool psastroSelectBrightStars (pmFPA *fpa, psMetadata *config) {
@@ -62,50 +32,4 @@
 }
 
-pmFPA *pmFPACopyAstrom (pmFPA *inFPA) {
-
-    pmFPA *fpa = pmFPAAlloc (NULL, NULL);
-
-    // copy FPA astrometry data
-    fpa->toSky   = psProjectionCopy (inFPA->toSky);
-    fpa->toTPA   = psPlaneDistortCopy (inFPA->toTPA);
-    fpa->fromTPA = psPlaneDistortCopy (inFPA->fromTPA);
-
-    psArrayRealloc (fpa->chips, inFPA->chips->n);
-    for (int i = 0; i < inFPA->chips->n; i++) {
-	pmChip *inChip = inFPA->chips->data[i];
-	pmChip *chip = pmChipAlloc (fpa);
-
-	// copy Chip astrometry data
-	chip->toFPA = psPlaneTransformCopy (inChip->toFPA);
-	chip->fromFPA = psPlaneTransformCopy (inChip->fromFPA);
-
-	psArrayRealloc (chip->cells, inChip->cells->n);
-	for (int j = 0; j < inChip->cells->n; j++) {
-	    pmCell *inCell = inChip->cells->data[j];
-	    pmCell *cell = pmCellAlloc (chip);
-
-	    // cell.header is a view on inCell.header
-	    cell->header = psMemCopy (inCell->header);
-
-	    // copy Cell astrometry data 
-	    cell->toChip = psPlaneTransformCopy (inCell->toChip);
-
-	    psArrayRealloc (cell->readouts, inCell->readouts->n);
-	    for (int k = 0; k < inCell->readouts->n; k++) {
-		pmReadout *inReadout = inCell->readouts->data[k];
-		pmReadout *readout = pmReadoutAlloc (cell);
-
-		// copy Readout data
-		*readout = *inReadout;
-
-		cell->readouts->data[k] = readout;
-	    }
-	    chip->cells->data[j] = cell;
-	}
-	fpa->chips->data[i] = chip;
-    }
-    return (fpa);
-}
-
 // measure per-chip astrometry terms 
 bool psastroChipAstrom (pmFPA *fpa, psMetadata *config) {
@@ -153,6 +77,6 @@
 		psastroProjectRefstars (refstars, readout);
 
-		testWriteRaw ("ref.inp", refstars);
-		testWriteRaw ("raw.inp", rawstars);
+		// testWriteRaw ("ref.inp", refstars);
+		// testWriteRaw ("raw.inp", rawstars);
 
 		// fprintf (stderr, "rawstars:\n");
@@ -172,6 +96,6 @@
 		psastroProjectRefstars (refstars, readout);
 
-		testWriteRaw ("ref.dat", refstars);
-		testWriteRaw ("raw.dat", rawstars);
+		// testWriteRaw ("ref.dat", refstars);
+		// testWriteRaw ("raw.dat", rawstars);
     
 		// use small radius to match stars
@@ -284,63 +208,2 @@
     return true; 
 }
-
-// returns the rotation term, forcing positive parity
-double psPlaneTransformGetRotation (psPlaneTransform *map) {
-
-    if (map->x->nX < 1) return 0;
-    if (map->x->nY < 1) return 0;
-
-    if (map->y->nX < 1) return 0;
-    if (map->y->nY < 1) return 0;
-    
-    double pc1_1 = map->x->coeff[1][0];
-    double pc1_2 = map->x->coeff[0][1];
-    double pc2_1 = map->y->coeff[1][0];
-    double pc2_2 = map->y->coeff[0][1];
-
-    double px = SIGN (pc1_1);
-    double py = SIGN (pc2_2);
-
-    // both x and y terms imply an angle. take the average
-    double t1 = -atan2 (px*pc1_2, px*pc1_1);
-    double t2 = +atan2 (py*pc2_1, py*pc2_2);
-    
-    // careful near -pi,+pi boundary...
-    if (t1 - t2 > M_PI/2) t2 += 2*M_PI;
-    if (t2 - t1 > M_PI/2) t1 += 2*M_PI;
-
-    double theta = 0.5*(t1 + t2);
-    while (theta < M_PI) theta += 2*M_PI;
-    while (theta > M_PI) theta -= 2*M_PI;
-    
-    return (theta);
-}
-
-// elixir-style pseudo FITS table (header + ascii list)
-bool testWriteRaw (char *filename, psArray *sources) {
-
-    int i;
-
-    // re-open, add data to end of file
-    FILE *f = fopen (filename, "w");
-    if (f == NULL) {
-	psLogMsg ("WriteSourceOBJ", 3, "can't open output file for output %s\n", filename);
-	return false;
-    }
-
-    for (i = 0; i < sources->n; i++) {
-	
-	pmAstromObj *star = sources->data[i];
-
-	fprintf (f, "%8.2f %8.2f   %8.2f %8.2f   %8.2f %8.2f   %8.2f %8.2f   %8.2f %8.2f   %10.6f %10.6f   %8.2f %8.2f\n", 
-		 star->pix.x, star->pix.y, 
-		 star->cell.x, star->cell.y, 
-		 star->chip.x, star->chip.y, 
-		 star->FP.x, star->FP.y, 
-		 star->TP.x, star->TP.y, 
-		 star->sky.r*DEG_RAD, star->sky.d*DEG_RAD, 
-		 star->Mag, star->dMag);
-    }
-    fclose (f);
-    return true;
-}
