Index: trunk/psModules/src/camera/pmFPAfileDefine.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 11801)
+++ trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 11876)
@@ -784,4 +784,5 @@
     // added if specified for the particular detrend type by the DETREND.CONSTRAINTS
     // note that the filter-dependent choices are set for ppImage in ppImageParseCamera
+    // XXX make all of the detrend constraints explicit in DETREND.CONSTRAINTS?
 
     // Get the time from FPA.TIME
@@ -793,5 +794,5 @@
 
     // add additional constraints based on the type defined in the PPIMAGE recipe
-    // use PPIMAGE or DETREND or ???
+    // XXX use PPIMAGE or DETREND for the recipe name?
     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, "PPIMAGE");
     if (!status)
@@ -819,6 +820,9 @@
         char *concept = item->data.V;
 
+	// these items refer to the corresponding values for the input image 
+	// (ie, -filter input:filter or -exptime input:exptime)
         if (!strcasecmp (option, "filter")) {
             options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
+	    psMemIncrRefCounter (options->filter);
             if (!status)
                 psAbort("failed to find filter (concept %s)", concept);
@@ -827,4 +831,5 @@
         if (!strcasecmp (option, "exptime")) {
             options->exptime = psMetadataLookupF32 (&status, input->concepts, concept);
+	    options->exptimeSet = true;
             if (!status)
                 psAbort("exptime not found (concept %s)", concept);
@@ -832,28 +837,31 @@
         if (!strcasecmp (option, "airmass")) {
             options->airmass = psMetadataLookupF32 (&status, input->concepts, concept);
+	    options->airmassSet = true;
             if (!status)
                 psAbort("airmass not found (concept %s)", concept);
         }
-        # if (0)
-            if (!strcasecmp (option, "dettemp")) {
-                options->dettemp = psMetadataLookupF32 (&status, input->concepts, concept);
-                if (!status)
-                    psAbort("dettemp not found (concept %s)", concept);
-            }
-        if (!strcasecmp (option, "version")) {
-            // version is applied as a literal string
-            options->version = psMetadataLookupF32 (&status, input->concepts, concept);
-            if (!status)
-                psAbort("version not found (concept %s)", concept);
-        }
+	if (!strcasecmp (option, "dettemp")) {
+	    options->dettemp = psMetadataLookupF32 (&status, input->concepts, concept);
+	    options->dettempSet = true;
+	    if (!status)
+		psAbort("dettemp not found (concept %s)", concept);
+	}
         if (!strcasecmp (option, "twilight")) {
-            // XXX determine the twilight time based on concept defining the time-of-day
-            // XXX need to include twilight time somehow (uses lookup based on a time value)
             options->twilight = psMetadataLookupF32 (&status, input->concepts, concept);
+	    options->twilightSet = true;
             if (!status)
                 psAbort("twilight not found (concept %s)", concept);
         }
-        # endif
-
+
+	// the version is applied literally
+        if (!strcasecmp (option, "version")) {
+            options->version = psMemIncrRefCounter (concept);
+        }
+	// we can override the detrend database dettype if desired
+	// ie, use DOMEFLAT for type FLAT
+	// the dettype string is applied literally
+        if (!strcasecmp (option, "dettype")) {
+            options->dettype = psMemIncrRefCounter (concept);
+        }
     }
     psFree(iter);
