Index: /branches/eam_branches/ipp-20110505/Ohana/src/addstar/src/GetFileMode.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/addstar/src/GetFileMode.c	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/addstar/src/GetFileMode.c	(revision 31628)
@@ -4,5 +4,6 @@
 int GetFileMode (Header *header) {
 
-  char ctype[81], ctmp[80];
+  char ctype[81], ctmp[81];
+
   int Naxis;
   int simple, extend, haveNaxis, haveCTYPE;
Index: /branches/eam_branches/ipp-20110505/dbconfig/changes.txt
===================================================================
--- /branches/eam_branches/ipp-20110505/dbconfig/changes.txt	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/dbconfig/changes.txt	(revision 31628)
@@ -2132,2 +2132,5 @@
 UPDATE dbversion set schema_version = '1.1.70', updated= CURRENT_TIMESTAMP();
 
+-- heather discovered that we need keys for addRun:
+
+alter table addRun add key(stage), add key (stage_id);
Index: /branches/eam_branches/ipp-20110505/ippMonitor/raw/site.php.in
===================================================================
--- /branches/eam_branches/ipp-20110505/ippMonitor/raw/site.php.in	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippMonitor/raw/site.php.in	(revision 31628)
@@ -37,5 +37,5 @@
 $REPL_DBNAME_PSTAMP = "ippRequestServer";
 
-$REPL_HOST_GPC1 = "ippc02.IfA.Hawaii.Edu";
+$REPL_HOST_GPC1 = "ippdb03.IfA.Hawaii.Edu";
 $REPL_USER_GPC1 = "ippMonitor";
 $REPL_PASSWORD_GPC1 = "ippMonitor";
Index: /branches/eam_branches/ipp-20110505/ippScripts/scripts/register_imfile.pl
===================================================================
--- /branches/eam_branches/ipp-20110505/ippScripts/scripts/register_imfile.pl	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippScripts/scripts/register_imfile.pl	(revision 31628)
@@ -40,5 +40,5 @@
 
 my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $bytes, $md5sum, $dbname, $verbose, $no_update, $no_op, $logfile);
-my ($sunrise, $sunset);
+my ($sunrise, $sunset, $summit_dateobs);
 GetOptions(
     'caches'           => \$cache,
@@ -51,4 +51,5 @@
     'sunrise=s'        => \$sunrise,
     'sunset=s'         => \$sunset,
+    'summit_dateobs=s' => \$summit_dateobs,
     'dbname|d=s'       => \$dbname,    # Database name
     'verbose'          => \$verbose,   # Print to stdout
@@ -181,4 +182,8 @@
 if (uc(&value_for_flag ($cmdflags, "NULL", "-exp_type"))  eq "NULL") { &my_die_for_add ("exp_type  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
 my $dateobs   = &value_for_flag($cmdflags, 0.0, "-dateobs");
+unless($summit_dateobs) {
+    $summit_dateobs = $dateobs;
+}
+
 my $exp_type  = &value_for_flag($cmdflags, "NULL", "-exp_type");
 
@@ -196,5 +201,5 @@
     $command .= " -data_state full";
 }
-elsif (is_daytime($dateobs,$sunrise,$sunset)) {
+elsif (is_daytime($summit_dateobs,$sunrise,$sunset)) {
     printf STDERR "This is a daytime exposure.\n";
     $command .= " -data_state full";
@@ -267,5 +272,5 @@
 
 if ((abs($burntoolStateCurrent) != $burntoolStateTarget)&&
-    (!is_daytime($dateobs,$sunrise,$sunset))&&
+    (!is_daytime($summit_dateobs,$sunrise,$sunset))&&
     (!is_ccim($tmp_exp_name,$exp_type))) {
     my $mdcParser  = PS::IPP::Metadata::Config->new;
Index: /branches/eam_branches/ipp-20110505/ippTasks/register.pro
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTasks/register.pro	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTasks/register.pro	(revision 31628)
@@ -294,4 +294,5 @@
     book getword regPendingImfile $pageName workdir      -var WORKDIR_TEMPLATE
     book getword regPendingImfile $pageName dbname       -var DBNAME
+    book getword regPendingImfile $pageName summit_dateobs -var SUMMIT_DATEOBS
 
     # EXP_TAG is used to generate the unique, but human-readable, filenames
@@ -320,5 +321,5 @@
     # XXX register_imfile.pl differs from the standard script : it does not have an 'outroot' argument, and it does not take '--redirect'
     $run = register_imfile.pl --exp_id $EXP_ID --tmp_class_id $TMP_CLASS_ID --tmp_exp_name $TMP_EXP_NAME --uri $URI --logfile $logfile --bytes $BYTES --md5sum $MD5SUM
-    $run = $run --sunset $sunset --sunrise $sunrise
+    $run = $run --sunset $sunset --sunrise $sunrise --summit_dateobs $SUMMIT_DATEOBS
     add_standard_args run
 
Index: /branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id.sql
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id.sql	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id.sql	(revision 31628)
@@ -3,6 +3,6 @@
 FROM 
      staticskyResult
-join staticSkyRun using (sky_id)
-join staticSkyInput using (stack_id)
+join staticskyRun using (sky_id)
+join staticskyInput using(sky_id)
 JOIN stackRun USING(stack_id)
 
@@ -13,5 +13,5 @@
           ) as foo
      ON sky_id = added_sky_id 
-     AND stage = 'sky'
+     AND stage = 'staticsky'
      -- hook for qualifying the join on the previous_dvodb
      AND %s
Index: /branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id_dvo.sql
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id_dvo.sql	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/share/addtool_find_sky_id_dvo.sql	(revision 31628)
@@ -1,4 +1,7 @@
 SELECT staticskyRun.* FROM staticskyResult
 JOIN staticskyRun USING(sky_id)
+join staticskyInput using(sky_id)
+JOIN stackRun USING(stack_id)
+
 WHERE staticskyRun.state = 'full' and staticskyResult.quality = 0
     AND sky_id NOT IN (SELECT sky_id
Index: /branches/eam_branches/ipp-20110505/ippTools/share/laptool_definerun.sql
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/share/laptool_definerun.sql	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/share/laptool_definerun.sql	(revision 31628)
@@ -8,9 +8,17 @@
   ) AS want
   LEFT JOIN 
-  (SELECT exp_id,MAX(chip_id) AS chip_id
-     FROM lapExp 
+  (SELECT exp_id,MAX(chip_id) AS chip_id, chipRun.state
+     FROM lapExp JOIN chipRun USING(exp_id,chip_id) 
      where private IS FALSE 
      AND chip_id IS NOT NULL
-     AND active = TRUE ) AS have USING(exp_id)
+     AND 
+     	 (
+	  -- (active = TRUE) OR 
+	  (chipRun.state = 'full') OR
+	  (chipRun.state = 'new')
+	  -- when we can do updates, put that here.
+	  )
+     GROUP BY exp_id
+) AS have USING(exp_id)
      
 
Index: /branches/eam_branches/ipp-20110505/ippTools/share/regtool_pendingimfile.sql
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/share/regtool_pendingimfile.sql	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/share/regtool_pendingimfile.sql	(revision 31628)
@@ -8,8 +8,10 @@
     newImfile.uri,
     newImfile.bytes,
-    newImfile.md5sum
+    newImfile.md5sum,
+    summitExp.dateobs AS summit_dateobs
 FROM newImfile
 JOIN newExp
     USING(exp_id)
+JOIN summitExp USING(summit_id)
 LEFT JOIN rawImfile
     ON newExp.exp_id = rawImfile.exp_id
Index: /branches/eam_branches/ipp-20110505/ippTools/src/addtool.c
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/src/addtool.c	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/src/addtool.c	(revision 31628)
@@ -117,5 +117,5 @@
 
     psMetadata *where = psMetadataAlloc();
-    pxcamGetSearchArgs (config, where);
+    //  pxcamGetSearchArgs (config, where);
     PXOPT_COPY_S64(config->args, where,  "-cam_id",    "camRun.cam_id", "==");
     PXOPT_COPY_S64(config->args, where,  "-stack_id",    "stackRun.stack_id", "==");
@@ -123,7 +123,8 @@
     PXOPT_LOOKUP_STR(stage,       config->args, "-stage", false, false);
     if (strcmp(stage, "cam")== 0) {
-
+      pxcamGetSearchArgs (config, where);
     pxAddLabelSearchArgs (config, where, "-label",     "camRun.label", "=="); // define using camRun label
     pxAddLabelSearchArgs (config, where, "-data_group","camRun.data_group", "=="); // define using camRun label
+
     PXOPT_COPY_STR(config->args, where,  "-reduction", "camRun.reduction", "==");
     }
@@ -133,4 +134,5 @@
     pxAddLabelSearchArgs (config, where, "-data_group","stackRun.data_group", "=="); // define using camRun label
     PXOPT_COPY_STR(config->args, where,  "-reduction", "stackRun.reduction", "==");
+    pxAddLabelSearchArgs (config, where, "-filter",     "stackRun.filter", "=="); // define using camRun label
     }
     if (strcmp(stage, "staticsky")== 0) {
@@ -139,4 +141,5 @@
     pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label
     PXOPT_COPY_STR(config->args, where,  "-reduction", "staticskyyRun.reduction", "==");
+    pxAddLabelSearchArgs (config, where, "-filter",     "stackRun.filter", "=="); // define using camRun label
     }
     
Index: /branches/eam_branches/ipp-20110505/ippTools/src/addtoolConfig.c
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/src/addtoolConfig.c	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/src/addtoolConfig.c	(revision 31628)
@@ -56,4 +56,5 @@
     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by camRun label", NULL);
     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by camRun data_group", NULL);
+    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-filter", PS_META_DUPLICATE_OK, "search by filter", NULL);
     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction",          0, "search by camRun reduction class", NULL);
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-destreaked",           0, "only queue destreaked runs", false);
Index: /branches/eam_branches/ipp-20110505/ippTools/src/magictool.c
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/src/magictool.c	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/src/magictool.c	(revision 31628)
@@ -404,5 +404,6 @@
     PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false);
     PXOPT_LOOKUP_BOOL(clearfault, config->args, "-clearfault", false);
-
+    PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
+    
     psString setString = NULL;
     if (fault || clearfault) {
@@ -411,4 +412,7 @@
     if (note) {
         psStringAppend(&setString, ", note = '%s'", note);
+    }
+    if (label) {
+        psStringAppend(&setString, ", label = '%s'", label);
     }
 
Index: /branches/eam_branches/ipp-20110505/ippTools/src/magictoolConfig.c
===================================================================
--- /branches/eam_branches/ipp-20110505/ippTools/src/magictoolConfig.c	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippTools/src/magictoolConfig.c	(revision 31628)
@@ -81,4 +81,5 @@
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state", 0, "set state (required)", NULL);
     psMetadataAddS16(updaterunArgs, PS_LIST_TAIL, "-set_fault", 0, "set fault code", 0);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_label", 0, "define label", 0);
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note",  0, "define note", NULL);
     psMetadataAddBool(updaterunArgs, PS_LIST_TAIL, "-clearfault",  0, "set fault to zero", NULL);
Index: /branches/eam_branches/ipp-20110505/ippconfig/isp/ppImage.config
===================================================================
--- /branches/eam_branches/ipp-20110505/ippconfig/isp/ppImage.config	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippconfig/isp/ppImage.config	(revision 31628)
@@ -3,7 +3,7 @@
 # Inherit everything from the top-level recipe file, except for what's below.
 
-FRINGE.FILTERS  MULTI
-FRINGE.FILTERS	STR z
-FRINGE.FILTERS	STR y
+#FRINGE.FILTERS  MULTI
+#FRINGE.FILTERS	STR z
+#FRINGE.FILTERS	STR y
 
 # apply the following constraints when selecting a detrend image
Index: /branches/eam_branches/ipp-20110505/ippconfig/isp/psastro.config
===================================================================
--- /branches/eam_branches/ipp-20110505/ippconfig/isp/psastro.config	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/ippconfig/isp/psastro.config	(revision 31628)
@@ -52,5 +52,5 @@
 
 # match radius in pixels for CHIP astrometry
-# PSASTRO.MATCH.RADIUS   F32    8
+PSASTRO.MATCH.RADIUS   F32    5
 
 # single-chip radius match in pixels
@@ -79,7 +79,4 @@
 PSASTRO.MATCH.LUMFUNC  BOOL     FALSE
 PSASTRO.IGNORE	       STR	SATURATED, DEFECT, SATSTAR, BLEND,FAIL
-
-
-
 
 PHOTCODE.DATA MULTI  #these are the zeropoints calculated by hand (10 stars)
Index: /branches/eam_branches/ipp-20110505/psModules/src/objects/models/pmModel_PS1_V1.c
===================================================================
--- /branches/eam_branches/ipp-20110505/psModules/src/objects/models/pmModel_PS1_V1.c	(revision 31627)
+++ /branches/eam_branches/ipp-20110505/psModules/src/objects/models/pmModel_PS1_V1.c	(revision 31628)
@@ -301,5 +301,4 @@
         return ( sigma * sqrt (2.0 * z) );
     }
-
     psF64 limit = flux / PAR[PM_PAR_I0];
 
