Index: /trunk/pswarp/src/pswarpCleanup.c
===================================================================
--- /trunk/pswarp/src/pswarpCleanup.c	(revision 12525)
+++ /trunk/pswarp/src/pswarpCleanup.c	(revision 12526)
@@ -11,6 +11,6 @@
     pmConceptsDone ();
     pmConfigDone ();
-    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "pswarp");
-    // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "pswarp");
+    // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "pswarp");
+    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "pswarp");
 
     return;
Index: /trunk/pswarp/src/pswarpDataLoad.c
===================================================================
--- /trunk/pswarp/src/pswarpDataLoad.c	(revision 12525)
+++ /trunk/pswarp/src/pswarpDataLoad.c	(revision 12526)
@@ -24,5 +24,4 @@
     pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSWARP.ASTROM");
     if (!astrom) {
-	fprintf (stderr, "*** using header astrometry\n");
 	astrom = input;
     }
Index: /trunk/pswarp/src/pswarpDefine.c
===================================================================
--- /trunk/pswarp/src/pswarpDefine.c	(revision 12525)
+++ /trunk/pswarp/src/pswarpDefine.c	(revision 12526)
@@ -18,5 +18,8 @@
     }
 
-    // open the full skycell file; no need to defer different depths
+    // open the full skycell file; no need to defer different depths. only load the header data
+    // XXX force fileLevel and view to be chip. is this right?
+    // skycell->type = PM_FPA_FILE_HEADER;
+    // skycell->fileLevel = PM_FPA_LEVEL_CHIP;
     pmFPAview *view = pmFPAviewAlloc (0);
     pmFPAfileOpen (skycell, view, config);
@@ -49,6 +52,37 @@
 	return false;
     }
+    // output->fileLevel = PM_FPA_LEVEL_CHIP;
 
     pmFPAfileCreate(output, view, config);
+
+# if 0
+    // XXX This function should only load the skycell headers and create the output based
+    // on that file.  I'm going to ask paul to look into this
+    pmFPACopyStructure (output->fpa, skycell->fpa, 1, 1);
+
+    // XXX can I just create the needed readout?
+    // create the needed readouts
+    for (int i = 0; i < output->fpa->chips->n; i++) {
+	pmChip *chip = output->fpa->chips->data[i];
+	for (int j = 0; j < chip->cells->n; j++) {
+	    pmCell *cell = chip->cells->data[j];
+	    pmReadout *readout;
+	    if (cell->readouts->n == 0) {
+		readout = pmReadoutAlloc (cell);
+	    }
+	    bool mdok1 = false;
+	    bool mdok2 = false;
+	    pmHDU *hdu = pmHDUGetLowest (output->fpa, chip, cell);
+	    int Nx = psMetadataLookupS32(&mdok1, hdu->header, "NAXIS1"); // Trim section
+	    int Ny = psMetadataLookupS32(&mdok2, hdu->header, "NAXIS2"); // Trim section
+	    if (!mdok1 || !mdok2) {
+		psError(PS_ERR_IO, true, "NAXIS1 or NAXIS2 not set --- unable to create output image.\n");
+		return false;
+	    }
+	    readout->image = psImageAlloc (Nx, Ny, PS_TYPE_F32);
+	    psFree (readout);
+	}
+    }
+# endif
 
     psFree (view);
Index: /trunk/pswarp/src/pswarpMatchRange.c
===================================================================
--- /trunk/pswarp/src/pswarpMatchRange.c	(revision 12525)
+++ /trunk/pswarp/src/pswarpMatchRange.c	(revision 12526)
@@ -8,10 +8,8 @@
     psPlaneTransformApply (srcFP, fpaSrc->fromTPA, srcTP); \
     psPlaneTransformApply (srcPix, chipSrc->fromFPA, srcFP); \
-    fprintf (stderr, "%6.1f,%6.1f -> ", srcPix->x, srcPix->y); \
     *minX = PS_MIN (*minX, srcPix->x); \
     *minY = PS_MIN (*minY, srcPix->y); \
     *maxX = PS_MAX (*maxX, srcPix->x); \
-    *maxY = PS_MAX (*maxY, srcPix->y); \
-    fprintf (stderr, "%4d,%4d - %4d,%4d\n", *minX, *minY, *maxX, *maxY);
+    *maxY = PS_MAX (*maxY, srcPix->y);
 
 // we are warping from src to dest.  find the max overlapping pixels in the INPUT (src)
@@ -37,5 +35,4 @@
     *maxX = src->image->col0;
     *maxY = src->image->row0;
-    fprintf (stderr, "%4d,%4d - %4d,%4d\n", *minX, *minY, *maxX, *maxY);
 
     // XXX save these as static for speed?
@@ -88,4 +85,5 @@
 
     // demo forward and backward transformation
+# if (0)
     srcPix->x = *minX;
     srcPix->y = *minY;
@@ -96,5 +94,4 @@
     psPlaneTransformApply (destFP, fpaDest->fromTPA, destTP); 
     psPlaneTransformApply (destPix, chipDest->fromFPA, destFP); 
-
     fprintf (stderr, "%f,%f -> %f,%f ", srcPix->x, srcPix->y, destPix->x, destPix->y);
 
@@ -105,6 +102,6 @@
     psPlaneTransformApply (srcFP, fpaSrc->fromTPA, srcTP); 
     psPlaneTransformApply (srcPix, chipSrc->fromFPA, srcFP); 
-
     fprintf (stderr, "-> %f,%f ", srcPix->x, srcPix->y);
+# endif
 
     psFree (srcPix);
Index: /trunk/pswarp/src/pswarpParseCamera.c
===================================================================
--- /trunk/pswarp/src/pswarpParseCamera.c	(revision 12525)
+++ /trunk/pswarp/src/pswarpParseCamera.c	(revision 12526)
@@ -19,16 +19,16 @@
     pmFPAfileDefineFromArgs (&status, config, "PSWARP.ASTROM", "ASTROM");
     if (status) {
-	fprintf (stderr, "using supplied astrometry\n");
+	psLogMsg ("pswarp", 3, "using supplied astrometry\n");
     } else {
-	fprintf (stderr, "using header astrometry\n");
+	psLogMsg ("pswarp", 3, "using header astrometry\n");
     }
 
     // the mask is not required - but must conform to input camera
     if (!pmFPAfileBindFromArgs (NULL, input, config, "PSWARP.MASK", "MASK")) {
-	fprintf (stderr, "no mask supplied\n");
+	psLogMsg ("pswarp", 3, "no mask supplied\n");
     } 
 
     if (!pmFPAfileBindFromArgs (NULL, input, config, "PSWARP.WEIGHT", "WEIGHT")) {
-	fprintf (stderr, "no weight supplied\n");
+	psLogMsg ("pswarp", 3, "no weight supplied\n");
     } 
 
@@ -42,4 +42,6 @@
 
     // these calls bind the I/O handle to the specified fpa
+    // NOTE: output file could be binned relative to sky cell...
+    // if (!pmFPAfileDefineFromFPA (skyConfig, skycell->fpa, 1, 1, "PSWARP.OUTPUT")) {
     if (!pmFPAfileDefineOutput (skyConfig, skycell->fpa, "PSWARP.OUTPUT")) {
 	psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT");
Index: /trunk/pswarp/src/pswarpTransformReadout_Opt.c
===================================================================
--- /trunk/pswarp/src/pswarpTransformReadout_Opt.c	(revision 12525)
+++ /trunk/pswarp/src/pswarpTransformReadout_Opt.c	(revision 12526)
@@ -37,5 +37,5 @@
     // XXX need to modify the grid based on this result and force the maxError < XXX
     double maxError = pswarpMapGridMaxError (grid);
-    fprintf (stderr, "maximum error using this grid sampling: %f\n", maxError);
+    psLogMsg ("pswarp", 3, "maximum error using this grid sampling: %f\n", maxError);
 
     pswarpMapGridSetGrid (grid, minX, minY, &gridX, &gridY); 
