Index: /trunk/psastro/src/psastroChipAstrom.c
===================================================================
--- /trunk/psastro/src/psastroChipAstrom.c	(revision 35418)
+++ /trunk/psastro/src/psastroChipAstrom.c	(revision 35419)
@@ -75,4 +75,41 @@
                 if (refstars == NULL) { continue; }
 
+# if (0)
+		static int Nchip = 0;
+		if (1) {
+		  // XXX test
+		  char filename[64];
+		  snprintf (filename, 64, "refstars.%02d.dat", Nchip);
+		  FILE *outfile = fopen (filename, "w");
+		  assert (outfile);
+		  for (int nn = 0; nn < refstars->n; nn++) {
+		    pmAstromObj *ref = refstars->data[nn];
+		    fprintf (outfile, "%lf %lf  %lf %lf  %lf %lf  %lf %lf\n", 
+			     ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD,
+			     ref->TP->x, ref->TP->y, 
+			     ref->FP->x, ref->FP->y, 
+			     ref->chip->x, ref->chip->y);
+		  }
+		  fclose (outfile);
+		}
+		if (1) {
+		  // XXX test
+		  char filename[64];
+		  snprintf (filename, 64, "rawstars.%02d.dat", Nchip);
+		  FILE *outfile = fopen (filename, "w");
+		  assert (outfile);
+		  for (int nn = 0; nn < gridrawstars->n; nn++) {
+		    pmAstromObj *ref = gridrawstars->data[nn];
+		    fprintf (outfile, "%lf %lf  %lf %lf  %lf %lf  %lf %lf\n", 
+			     ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD,
+			     ref->TP->x, ref->TP->y, 
+			     ref->FP->x, ref->FP->y, 
+			     ref->chip->x, ref->chip->y);
+		  }
+		  fclose (outfile);
+		  Nchip ++;
+		}
+# endif
+
                 // the absolute minimum number of stars is 4 (for order = 1)
                 if ((rawstars->n < 4) || (refstars->n < 4)) {
Index: /trunk/psastro/src/psastroChooseRefstars.c
===================================================================
--- /trunk/psastro/src/psastroChooseRefstars.c	(revision 35418)
+++ /trunk/psastro/src/psastroChooseRefstars.c	(revision 35419)
@@ -107,5 +107,5 @@
 
                     if (ref->Mag < clampMagMin) {
-                        psWarning("Skipping refstar with abusrd magnintude %f ra: %f dec: %f\n",
+                        psWarning("Skipping refstar with abusrd magnitude %f ra: %f dec: %f\n",
                             ref->Mag, RAD_TO_DEG(ref->sky->r), RAD_TO_DEG(ref->sky->d));
                         goto skip;
@@ -131,12 +131,28 @@
 
 # if (0)
-		// XXX test
-		FILE *outfile = fopen ("refstars.dat", "w");
-		assert (outfile);
-		for (int nn = 0; nn < refstars->n; nn++) {
-			  pmAstromObj *ref = refstars->data[nn];
-			  fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD);
+		if (1) {
+		  // test output block, not used in normal ops
+		  char filename[64];
+		  snprintf (filename, 64, "refstars.%02d.dat", Nchip);
+		  FILE *outfile = fopen (filename, "w");
+		  assert (outfile);
+		  for (int nn = 0; nn < refstars->n; nn++) {
+		    pmAstromObj *ref = refstars->data[nn];
+		    fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD);
+		  }
+		  fclose (outfile);
 		}
-		fclose (outfile);
+		if (1) {
+		  // test output block, not used in normal ops
+		  char filename[64];
+		  snprintf (filename, 64, "refstars.%02d.dat", Nchip);
+		  FILE *outfile = fopen (filename, "w");
+		  assert (outfile);
+		  for (int nn = 0; nn < refstars->n; nn++) {
+		    pmAstromObj *ref = refstars->data[nn];
+		    fprintf (outfile, "%lf %lf  %lf %lf  %lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD, );
+		  }
+		  fclose (outfile);
+		}
 # endif
 
