Index: /trunk/doc/ipptools/detselect.txt
===================================================================
--- /trunk/doc/ipptools/detselect.txt	(revision 9120)
+++ /trunk/doc/ipptools/detselect.txt	(revision 9120)
@@ -0,0 +1,88 @@
+
+detselect queries the detrend database to select the best currently
+available detrend image matching the supplied criteria.  Detselect has
+two major modes, search and select:
+
+** detselect -search 
+
+detselect -search will examine the detrend database and return the
+entry detID+iteration which matches the request criteria.  The criteria include:
+
+camera
+detrend type
+
+These criteria are required for all 'detselect -search' invocations.
+Detselect should exit with an error state if these search criteria are
+not included.
+
+Other criteria include:
+
+date/time
+filter
+exptime
+detector temperature
+airmass
+label
+
+detselect should use the following rules to select the best detrend
+data for each query:
+
+* camera must match exactly
+* detrend type must match exactly
+
+for the remaining, if the value is supplied:
+
+* date/time must be > date_start and < date_stop
+* filter must match exactly (string match)
+* exptime must be > exptime_min and < exptime_max
+* airmass must be > airmass_min and < airmass_max
+* detector temperature must be > det_temp_min and < det_temp_max
+* label must match exactly
+
+if the above rules result is more than a single valid detrun, the one
+with the greatest value for date_create should be chosen.
+
+if the above rules do not match any detrun, then detselect must return
+the value NONE for the det_id.
+
+the output for a successful operation (including the empty set) should
+include:
+
+det_id, iteration, class, 
+
+
+** detselect -select -detID (det_id) -iter (iter) -classID (class_id)
+
+returns the specific master detrend imfile filename which matches the
+specified det_id, iteration, and class_id.  the output from this
+operation should consist of a single filename, which should have the
+value NONE if no match is found.  
+
+** detrend DB tables
+
+The detrend DB tables may be missing some fields needed to perform the
+operations above.  these may perhaps be placed in detRun when the
+detRun is defined.  here is the list of fields:
+
+date_start  : start of the validity range for the detrend data
+date_stop   : end of the validity range for the detrend data
+
+date_create : date when the detrend data was defined (perhaps this
+should be the date that the iteration was set, and should be stored in
+detRunSummary).
+
+filter       : filter name used to create this data
+det_temp_min : minimum valid detector temperature for this data set
+det_temp_max : maximum valid detector temperature for this data set
+airmass_min  : minimum valid airmass for this data set
+airmass_max  : minimum valid airmass for this data set
+exptime_min  : minimum valid exptime for this data set
+exptime_max  : minimum valid exptime for this data set
+label        : a string label used to distinguish related detrend frames 
+
+these values should be specified when creating the detrun, and are
+optional (the dettools should not enforce the requirements for
+specific detrend types).
+
+
+
