Index: /trunk/psphot/src/pmPeaksSigmaLimit.c
===================================================================
--- /trunk/psphot/src/pmPeaksSigmaLimit.c	(revision 5616)
+++ /trunk/psphot/src/pmPeaksSigmaLimit.c	(revision 5617)
@@ -31,9 +31,12 @@
     psFree (smooth);
 
-    // make this optional
-    // DumpPeaks (peaks, "peaks.dat");
-
+    // optional dump of all peak data
+    char *output = psMetadataLookupPtr (&status, config, "PEAKS_OUTPUT_FILE");
+    if (status && (output != NULL) && (output[0])) {
+	pmPeaksWriteText (peaks, output);
+	psFree (output);
+    }
+     
     psLogMsg ("psphot", 3, "%d peaks: %f sec\n", peaks->n, psTimerMark ("psphot"));
-
     return (peaks);
 }
Index: /trunk/psphot/src/psphot.c
===================================================================
--- /trunk/psphot/src/psphot.c	(revision 5616)
+++ /trunk/psphot/src/psphot.c	(revision 5617)
@@ -30,7 +30,19 @@
     // XXX - this has 1 leak
     psfClump = pmSourcePSFClump (sources, config);
+    // psLogMsg ("psphot", 4, "clump  X,  Y: %f, %f\n", psfClump.X, psfClump.Y);
+    // psLogMsg ("psphot", 4, "clump DX, DY: %f, %f\n", psfClump.dX, psfClump.dY);
 
     // group into STAR, COSMIC, GALAXY, SATURATED
     pmSourceRoughClass (sources, config, psfClump);
+
+    // optional dump of all rough source data
+    { 
+      bool status;
+      char *output = psMetadataLookupPtr (&status, config, "MOMENTS_OUTPUT_FILE");
+      if (status && (output != NULL) && (output[0])) {
+	pmMomentsWriteText (sources, output);
+	psFree (output);
+      }
+    }
 
     // source analysis is done in S/N order (brightest first)
Index: /trunk/psphot/src/psphotOutput.c
===================================================================
--- /trunk/psphot/src/psphotOutput.c	(revision 5616)
+++ /trunk/psphot/src/psphotOutput.c	(revision 5617)
@@ -348,9 +348,8 @@
 
 // write the peaks to an output file
-bool pmPeaksWriteText (psArray *sources, char *filename) {
+bool pmPeaksWriteText (psArray *peaks, char *filename) {
 
     int i;
     FILE *f;
-    pmPeak *peak;
 	
     f = fopen (filename, "w");
@@ -360,6 +359,6 @@
     }
 
-    for (i = 0; i < sources->n; i++) {
-	peak = (pmPeak *) sources->data[i];
+    for (i = 0; i < peaks->n; i++) {
+	pmPeak *peak = peaks->data[i];
 	if (peak == NULL) continue;
 	fprintf (f, "%5d %5d  %7.1f\n", 
Index: /trunk/psphot/src/psphotSourceStats.c
===================================================================
--- /trunk/psphot/src/psphotSourceStats.c	(revision 5616)
+++ /trunk/psphot/src/psphotSourceStats.c	(revision 5617)
@@ -46,5 +46,5 @@
 	psFree (source);
     }
-
+     
     psLogMsg ("psphot", 3, "%d moments: %f sec\n", sources->n, psTimerMark ("psphot"));
     return (sources);
