Index: /trunk/psphot/src/psphotOutput.c
===================================================================
--- /trunk/psphot/src/psphotOutput.c	(revision 29606)
+++ /trunk/psphot/src/psphotOutput.c	(revision 29607)
@@ -360,2 +360,45 @@
     return true;
 }
+bool psphotDumpTest (pmConfig *config, const pmFPAview *view, const char *filerule, char *filename) {
+
+    bool status;
+
+    psTimerStart ("psphot.models");
+
+    // find the currently selected readout
+    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest
+    psAssert (file, "missing file?");
+
+    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
+    psAssert (readout, "missing readout?");
+
+    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
+    psAssert (detections, "missing detections?");
+
+    psArray *sources = detections->newSources;
+    psAssert (sources, "missing sources?");
+
+    FILE *f = NULL;
+
+    f = fopen (filename, "w");
+    psAssert(f, "cannot open file");
+
+    for (int i = 0; i < sources->n; i++) {
+        pmSource *source = sources->data[i];
+
+        // skip non-astronomical objects (very likely defects)
+        if (source->type == PM_SOURCE_TYPE_DEFECT) continue;
+        if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
+        if (!source->peak) continue;
+        if (!source->moments) continue;
+
+        float Io = source->peak->flux;
+
+	fprintf (f, "%f %f : %f %f :: %f\n", 
+		 source->moments->Mx, source->moments->My, 
+		 source->peak->xf, source->peak->yf, Io);
+    }
+    fclose (f);
+    return true;
+}
+
