Index: trunk/psphot/src/psphotSetup.c
===================================================================
--- trunk/psphot/src/psphotSetup.c	(revision 5754)
+++ trunk/psphot/src/psphotSetup.c	(revision 5802)
@@ -55,5 +55,5 @@
 	for (int iy = 0; iy < image->numRows; iy++) {
 	    for (int ix = 0; ix < image->numCols; ix++) {
-		weight->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN);
+		weight->data.F32[iy][ix] = PS_MAX (image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN), 0.0);
 	    }
 	}
@@ -104,4 +104,7 @@
     psLogMsg ("psphot", 4, "load data: %f sec\n", psTimerMark ("psphot"));
 
+    psphotSaveImage (NULL, weight, "weight.fits");
+    psphotSaveImage (NULL, mask, "mask.fits");
+
     // save the image data & return it
     eamReadout *imdata = eamReadoutAlloc(image, weight, mask, header);
