Index: /trunk/ppImage/src/ppImagePhotom.c
===================================================================
--- /trunk/ppImage/src/ppImagePhotom.c	(revision 7686)
+++ /trunk/ppImage/src/ppImagePhotom.c	(revision 7687)
@@ -15,5 +15,4 @@
     // XXX place this in a psphot library function?
     psMetadataAddStr (recipe, PS_LIST_TAIL, "FITMODE",         PS_META_NO_REPLACE, "default fitting mode", "NONE");
-    psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE",        PS_META_NO_REPLACE, "default photcode",     "NONE");
     psMetadataAddStr (recipe, PS_LIST_TAIL, "BREAK_POINT",     PS_META_NO_REPLACE, "default break point",  "NONE");
     psMetadataAddF32 (recipe, PS_LIST_TAIL, "ZERO_PT",         PS_META_NO_REPLACE, "default zero point",    25.00);
@@ -33,4 +32,11 @@
 	pmFPAfile *outfile = pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT");
 	outfile->freeLevel = PM_FPA_LEVEL_FPA;
+    }
+
+    // determine PHOTCODE from fpa & view, overwrite in recipe
+    char *photcode = pmConceptsPhotcodeForView (config, input, view);
+    if (photcode) {
+	psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE", PS_META_REPLACE, "photcode from FPA concepts", photcode);
+	psFree (photcode);
     }
 
@@ -69,8 +75,9 @@
     // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE");
 
+    // XXX worry about this not having unique PHOTCODES...
     // view->cell = -1;
     // iterate over the cells in the current chip
     while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
-	psLogMsg ("ppImagePhot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
+	psLogMsg ("ppImagePhotom", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
 	if (! cell->process || ! cell->file_exists) { continue; }
 
@@ -81,38 +88,6 @@
 	    // run the actual photometry analysis
 	    psphotReadout (config, view);
-	    fprintf (stderr, "psphot done\n");
 	}
     }
     return true;
 }
-
-    // we only want to operate on PSPHOT pmFPAfiles here:
-    // XXX is this necessary?  why invoke I/O during this function?
-    // the psphot constructed files, if chosen, will be saved at the chip level
-    // in the next call outside of this function.
-    // XXX there could be an issue if those files are set for 'cell' or 'readout'
-    // pmFPAfileActivate (config->files, false, NULL);
-    // pmFPAfileActivate (config->files, true, "PSPHOT.INPUT");
-    // pmFPAfileActivate (config->files, true, "PSPHOT.RESID");
-    // pmFPAfileActivate (config->files, true, "PSPHOT.OUTPUT");
-    // pmFPAfileActivate (config->files, true, "PSPHOT.BACKSUB");
-    // pmFPAfileActivate (config->files, true, "PSPHOT.BACKGND");
-    // pmFPAfileActivate (config->files, true, "PSPHOT.BACKMDL");
-
-
-
-    // de-activate the PSPHOT image files, activate the PPIMAGE ones
-    # if 0
-    pmFPAfileActivate (config->files, false, NULL);
-    pmFPAfileActivate (config->files, true, "PPIMAGE.INPUT");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.BIAS");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.DARK");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.MASK");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.FLAT");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.OUTPUT");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.BIN1");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG1");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.BIN2");
-    pmFPAfileActivate (config->files, true, "PPIMAGE.JPEG2");
-    # endif
-
