Index: /trunk/ippTools/scripts/dettest.sh
===================================================================
--- /trunk/ippTools/scripts/dettest.sh	(revision 14032)
+++ /trunk/ippTools/scripts/dettest.sh	(revision 14033)
@@ -7,14 +7,14 @@
 ./regtest.sh -detrend || exit 1
 
-det_id=`dettool -definebyquery -det_type bias -filelevel fpa -select_exp_type bias -airmass_min 1 -airmass_max 10 -exp_time_min 10 -exp_time_max 30.0 -workdir file::///some/path -simple | cut -f1 -d" "` || exit 1
+det_id=`dettool -definebyquery -det_type bias -inst gpc -filelevel fpa -select_exp_type bias -airmass_min 1 -airmass_max 10 -exp_time_min 10 -exp_time_max 30.0 -workdir file::///some/path -simple | cut -f1 -d" "` || exit 1
 
 dettool -raw || exit 1
 
 for ID in `seq 0 3` ; do
-    dettool -addprocessedimfile -det_id $det_id -exp_tag t10.1 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
+    dettool -addprocessedimfile -det_id $det_id -exp_id 1 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
 done;
 
 for ID in `seq 0 3` ; do
-    dettool -addprocessedimfile -det_id $det_id -exp_tag t11.2 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
+    dettool -addprocessedimfile -det_id $det_id -exp_id 2 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
 done;
 
@@ -43,20 +43,20 @@
 
 for ID in `seq 0 3` ; do
-    dettool -addresidimfile -det_id $det_id -exp_tag t10.1 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
+    dettool -addresidimfile -det_id $det_id -exp_id 1 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
 done;
 
 for ID in `seq 0 3` ; do
-    dettool -addresidimfile -det_id $det_id -exp_tag t11.2 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
+    dettool -addresidimfile -det_id $det_id -exp_id 2 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
 done;
 
 dettool -toresidexp || exit 1
-dettool -addresidexp -det_id $det_id -exp_tag t10.1 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base jpeg1 || exit 1
-dettool -addresidexp -det_id $det_id -exp_tag t11.2 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base jpeg1 -reject || exit 1
+dettool -addresidexp -det_id $det_id -exp_id 1 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base jpeg1 || exit 1
+dettool -addresidexp -det_id $det_id -exp_id 2 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -path_base jpeg1 -reject || exit 1
 
 dettool -residdetrun || exit 1
 dettool -residexp || exit 1
 dettool -updateresidexp -det_id $det_id -iteration 0 -recip yourrecipe || exit 1
-dettool -updateresidexp -det_id $det_id -iteration 0 -exp_tag t11.2 -reject || exit 1
-dettool -updateresidexp -det_id $det_id -iteration 0 -exp_tag t11.2 || exit 1
+dettool -updateresidexp -det_id $det_id -iteration 0 -exp_id 2 -reject || exit 1
+dettool -updateresidexp -det_id $det_id -iteration 0 -exp_id 2 || exit 1
 
 dettool -adddetrunsummary -det_id $det_id -iteration 0 -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -accept || exit 1
Index: /trunk/ippTools/share/Makefile.am
===================================================================
--- /trunk/ippTools/share/Makefile.am	(revision 14032)
+++ /trunk/ippTools/share/Makefile.am	(revision 14033)
@@ -13,4 +13,5 @@
 	detselect_select.sql \
 	dettool_find_completed_runs.sql \
+	dettool_raw.sql \
 	difftool_inputskyfile.sql \
 	difftool_skyfile.sql \
Index: /trunk/ippTools/share/dettool_raw.sql
===================================================================
--- /trunk/ippTools/share/dettool_raw.sql	(revision 14033)
+++ /trunk/ippTools/share/dettool_raw.sql	(revision 14033)
@@ -0,0 +1,12 @@
+SELECT
+    detInputExp.det_id,
+    detRun.det_type,
+    rawImfile.*
+FROM detRun
+JOIN detInputExp
+    USING(det_id) 
+JOIN rawImfile
+    ON detInputExp.exp_id = rawImfile.exp_id
+WHERE
+    detRun.state = 'run'
+    AND detRun.mode = 'master'
Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 14032)
+++ /trunk/ippTools/src/dettool.c	(revision 14033)
@@ -2050,21 +2050,9 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    psString query = psStringCopy(
-            "SELECT"
-            "   detInputExp.det_id,"
-            "   detRun.det_type,"
-            "   rawImfile.*,"
-            "   rawExp.camera"
-            " FROM rawImfile"
-            " JOIN detInputExp"
-            "   USING(exp_id) "
-            " JOIN rawExp"
-            "   USING(exp_id) "
-            " JOIN detRun"
-            "   ON detInputExp.det_id = detRun.det_id"
-            " WHERE"
-            "   detRun.state = 'run'"
-            "   AND detRun.mode = 'master'"
-        );
+    psString query = pxDataGet("dettool_raw.sql");
+    if (!query) {
+        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
+        return false;
+    }
 
     if (config->where) {
