Index: /trunk/psModules/src/camera/pmFPAfileDefine.c
===================================================================
--- /trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 11105)
+++ /trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 11106)
@@ -28,4 +28,5 @@
 #include "pmFPA_JPEG.h"
 #include "pmDetrendDB.h"
+#include "pmConceptsPhotcode.h"
 
 // define an input-type pmFPAfile, bind to the optional fpa if supplied
@@ -644,7 +645,9 @@
     }
 
-    // detselect -camera (camera) -time (time) -type (type) [others]
-    // camera and time are functions of (pmFPA *input)
-    // XXX add other options here f(pmFPA *input, type)
+    // we are constructing a detselect command of the form:
+    //   detselect -search -inst (camera) -type (type) -time (time) [others]
+    // camera, type, and time are derived from pmFPA *input, other options are
+    // added if specified for the particular detrend type by the DETREND.CONSTRAINTS
+    // note that the filter-dependent choices are set for ppImage in ppImageParseCamera
 
     // Get the time from FPA.TIME
@@ -678,11 +681,39 @@
         }
         char *option  = item->name;     // item->name must correspond to a valid detselect option
-        char *concept = item->data.V; // item->data.V is a concept to look up
+
+        psArray *conceptData = psStringSplitArray ((char *) item->data.V, ":", true);
+        if (conceptData == NULL)
+            psAbort ("psModules", "programming error");
+        if (conceptData->n == 0)
+            psAbort ("psModules", "missing data for %s", item->name);
+        if (conceptData->n  > 2)
+            psAbort ("psModules", "invalid format for %s", item->name);
+
+        char *concept = NULL;
+        char *function = NULL;
+        if (conceptData->n == 1) {
+            concept = conceptData->data[0];
+        }
+        if (conceptData->n == 2) {
+            function = conceptData->data[0];
+            concept = conceptData->data[1];
+        }
+
         if (!strcasecmp (option, "filter")) {
-            options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
-            if (!status)
-                psAbort ("psModules", "filter not found");
+            options->filter = NULL;
+            if (function) {
+                if (!strcasecmp (function, "FILTER.ID")) {
+                    options->filter = pmConceptsFilterIDfromConcept (concept, input->concepts, config->camera);
+                }
+            } else {
+                options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
+            }
+            if (options->filter == NULL)
+                psAbort ("psModules", "failed to find filter");
+
         }
         if (!strcasecmp (option, "exptime")) {
+            if (function)
+                psAbort ("psModules", "no detrend constraint function for exptime");
             options->exptime = psMetadataLookupF32 (&status, input->concepts, concept);
             if (!status)
@@ -690,4 +721,6 @@
         }
         if (!strcasecmp (option, "airmass")) {
+            if (function)
+                psAbort ("psModules", "no detrend constraint function for airmass");
             options->airmass = psMetadataLookupF32 (NULL, input->concepts, concept);
             if (!status)
@@ -700,4 +733,16 @@
                     psAbort ("psModules", "dettemp not found");
             }
+        if (!strcasecmp (option, "version")) {
+            // version is applied as a literal string
+            if (function)
+                psAbort ("psModules", "no detrend constraint function for airmass");
+            options->version = psStringCopy(concept);
+        }
+        if (!strcasecmp (option, "twilight")) {
+            // XXX determine the twilight time based on concept defining the time-of-day
+            options->twilight = psMetadataLookupF32 (NULL, input->concepts, concept);
+            if (!status)
+                psAbort ("psModules", "dettemp not found");
+        }
         // XXX need to include twilight time somehow (uses lookup based on a time value)
         # endif
