Index: trunk/psastro/src/psastroParseCamera.c
===================================================================
--- trunk/psastro/src/psastroParseCamera.c	(revision 6791)
+++ trunk/psastro/src/psastroParseCamera.c	(revision 6792)
@@ -1,52 +1,13 @@
 # include "psphot.h"
 
-ppFile *psastroParseCamera (ppConfig *config) {
+bool *psastroParseCamera (pmConfig *config) {
 
     ppFile *input = ppFileAlloc ();
 
-    input->filename = psMetadataLookupStr(NULL, config->arguments, "INPUT_FILE");
-    psMemCopy (input->filename); // keep for external use
-
-    // Open the input image
-    psLogMsg("psphot", PS_LOG_INFO, "Opening input image: %s\n", input->filename);
-    input->fits = psFitsOpen (input->filename, "r"); // File handle for FITS file
-    if (! input->fits) {
-        psErrorStackPrint(stderr, "Can't open input image: %s\n", input->filename);
-        exit(EXIT_FAILURE);
+    // the input image(s) are required arguments; they define the camera
+    input = pmFPAfileAddSource (config, "INPUT", "PSASTRO.INPUT", true);
+    if (input == NULL) {
+	psAbort (__func__, "missing INPUT entry");
     }
-    input->phu = psFitsReadHeader(NULL, input->fits); // FITS header
-
-    // Get camera configuration from header if not already defined
-    if (! config->camera) {
-        config->camera = pmConfigCameraFromHeader(config->site, input->phu);
-        if (! config->camera) {
-             // There's no point in continuing if we can't recognize what we've got
-            psErrorStackPrint(stderr, "Can't find camera configuration!\n");
-            exit(EXIT_FAILURE);
-        }
-   } else if (! pmConfigValidateCamera(config->camera, input->phu)) {
-       // There's no point in continuing if what we've got doesn't match what we've been told
-        psError(PS_ERR_IO, true, "%s does not seem to be from the specified camera.\n",
-                input->filename);
-        exit(EXIT_FAILURE);
-    }
-
-    // Determine the correct recipe to use (from camera or from user)
-    // if config->recipe is not NULL, it is a user-supplied recipe
-    if (!config->recipe) {
-	config->recipe = pmConfigRecipeFromCamera(config->camera, PSPHOT_RECIPE);
-	if (config->recipe == NULL) {
-	    psErrorStackPrint(stderr, "Can't find recipe configuration!\n");
-	    exit(EXIT_FAILURE);
-	}
-    }
-
-    // recipe override values (command-line options):
-    psMetadataItem *item = NULL;
-    psMetadataIterator *iter = psMetadataIteratorAlloc (config->options, PS_LIST_HEAD, NULL);
-    while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
-	psMetadataAddItem (config->recipe, item, PS_LIST_TAIL, PS_META_REPLACE);
-    }
-    psFree (iter);
 
     // set default recipe values here
@@ -54,31 +15,5 @@
     psMetadataAddStr (recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_NO_REPLACE, "default fitting mode", "NONE");
 
-    // Chip selection: if we are using a single chip, select it for each FPA
-    // Chip numbers to work on: -chip 1,2,3,5,8,10
-    # if (0)
-    char *chips = psMetadataLookupStr(NULL, config->arguments, "CHIP_SELECTIONS"); 
-    if (chips != NULL) {
-	char *p = chips;
-	while (strlen(p)) {
-	    char *q = strchr (p, ',');
-	    if (q == NULL) { 
-		q = p + strlen(p);
-	    } else {
-		*q = 0;
-		q = q + 1;
-	    }
-	    int chipNum = atoi(p);
-	    // XXX EAM : extend this to allow an array of selected chips (by name)
-	    if (! pmFPASelectChip(input->fpa, chipNum)) {
-		psErrorStackPrint(stderr, "Chip number %d doesn't exist in camera.\n", chipNum);
-		exit(EXIT_FAILURE);
-	    }
-	    psLogMsg("psphot", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);
-	    p = q;
-        }
-    }
-    # endif
-
-    psTrace(__func__, 1, "Done with psphotParseCamera...\n");
-    return input;
+    psTrace(__func__, 1, "Done with psastroParseCamera...\n");
+    return true;
 }
