Index: /tags/ipp-20100701/ippScripts/scripts/automate_stacks.pl
===================================================================
--- /tags/ipp-20100701/ippScripts/scripts/automate_stacks.pl	(revision 28650)
+++ /tags/ipp-20100701/ippScripts/scripts/automate_stacks.pl	(revision 28651)
@@ -41,5 +41,5 @@
 # Grab options
 my ( $date, $camera, $dbname, $logfile, $verbose, $manual);
-my ( $help, $isburning, $force_stack_count, $test_mode, $this_target_only, $this_filter_only, $check_mode);
+my ( $help, $isburning, $force_stack_count, $test_mode, $this_target_only, $this_filter_only, $this_mode_only, $check_mode);
 my ( $check_registration, $define_burntool, $queue_burntool, $check_chips, $queue_chips);
 my ( $check_stacks, $queue_stacks, $check_diffs, $queue_diffs, $clean_old);
@@ -60,4 +60,5 @@
     'this_target_only=s'   => \$this_target_only,
     'this_filter_only=s'   => \$this_filter_only,
+    'this_mode_only=s'     => \$this_mode_only,
     'check_registration'   => \$check_registration,
     'define_burntool'      => \$define_burntool,
@@ -87,4 +88,5 @@
            --this_target_only     Process only a single target.
            --this_filter_only     Process only a single filter.
+           --this_mode_only       Process only a single clean mode.
         Modes:
            --check_registration   Confirm the data downloaded correctly.
@@ -130,4 +132,5 @@
 my %detfilter_list = ();
 my %detmax_list = ();
+my @mode_list = ();
 my %clean_commands = ();
 my %clean_retention = ();
@@ -152,4 +155,5 @@
 	    if (${ $mentry }{name} eq 'MODE') {
 		$this_mode = ${ $mentry }{value};
+		push @mode_list, $this_mode;
 	    }
 	    elsif (${ $mentry }{name} eq 'COMMAND') {
@@ -264,4 +268,14 @@
     }
     die("$this_filter_only is invalid.") if ($#filter_list != 0);
+}
+
+if (defined($this_mode_only)) {
+    foreach my $t (@mode_list) {
+        if ($t eq $this_mode_only) {
+            @mode_list = ($this_mode_only);
+            last;
+        }
+    }
+    die("$this_mode_only is invalid.") if ($#mode_list != 0);
 }
 
@@ -842,5 +856,5 @@
     }
     if (($metadata_out{nsState} eq 'CHECKDETRENDS') && ($exposures > 0)) {
-	$metadata_out{nsState} eq 'QUEUE_DETRENDS';
+	$metadata_out{nsState} eq 'QUEUEDETRENDS';
     }
 }
@@ -1043,5 +1057,5 @@
     my $pretend = shift;
 
-    foreach my $mode (sort (keys (%clean_commands))) {
+    foreach my $mode (@mode_list) {
 	if ((exists($clean_alternate{$mode})) && ($clean_alternate{$mode} eq 'A')) {
 	    my ($cleaning_date,$command) = construct_cleantool_args($date,"",$mode);
Index: /tags/ipp-20100701/ippScripts/scripts/make_burntool_pcontrol.pl
===================================================================
--- /tags/ipp-20100701/ippScripts/scripts/make_burntool_pcontrol.pl	(revision 28650)
+++ /tags/ipp-20100701/ippScripts/scripts/make_burntool_pcontrol.pl	(revision 28651)
@@ -328,10 +328,10 @@
 	foreach my $target (@target_list) {
 #	    print STDERR "$target $obsmode_list{$target} $exp_type $obs_mode $object $comment\n";
-	    if (($obs_mode =~ /$obsmode_list{$target}/)&&
-		($object   =~ /$object_list{$target}/)&&
-		($comment  =~ /$comment_list{$target}/)) {
+	    if (($obs_mode =~ /$obsmode_list{$target}/i)&&
+		($object   =~ /$object_list{$target}/i)&&
+		($comment  =~ /$comment_list{$target}/i)) {
 		$return_value = 1;
 	    }
-#	    print ">$return_value $exp_type $obs_mode $object $comment $target $obsmode_list{$target} $object_list{$target} $comment_list{$target}\n";
+#	    print ">$return_value $exp_type $obs_mode $object $comment <> $target $obsmode_list{$target} $object_list{$target} $comment_list{$target}\n";
 	    if ($return_value) {
 		return($return_value);
Index: /tags/ipp-20100701/ippconfig/recipes/nightly_science.config
===================================================================
--- /tags/ipp-20100701/ippconfig/recipes/nightly_science.config	(revision 28650)
+++ /tags/ipp-20100701/ippconfig/recipes/nightly_science.config	(revision 28651)
@@ -15,10 +15,10 @@
   MODE STR DIFF
   COMMAND STR difftool
-# RETENTION_TIME U16 30
-  RETENTION_TIME S16 -1
+  RETENTION_TIME S16 30
+#  RETENTION_TIME S16 -1
 END
 CLEAN_MODES METADATA
   MODE STR DIST
-  COMMAND STR disttool -
+  COMMAND STR disttool 
   RETENTION_TIME S16 7
   ALTERNATE_CMD STR A
@@ -319,5 +319,5 @@
   DETTYPE  STR FLAT
   EXPTYPE  STR skyflat
-  REF_ID   S64 300
+  REF_ID   S64 278
   REF_ITER S32 0
   FILTER   STR g.00000
@@ -329,5 +329,5 @@
   DETTYPE  STR FLAT
   EXPTYPE  STR skyflat
-  REF_ID   S64 301
+  REF_ID   S64 279
   REF_ITER S32 0
   FILTER   STR r.00000
@@ -339,5 +339,5 @@
   DETTYPE  STR FLAT
   EXPTYPE  STR skyflat
-  REF_ID   S64 302
+  REF_ID   S64 280
   REF_ITER S32 0
   FILTER   STR i.00000
@@ -349,5 +349,5 @@
   DETTYPE  STR FLAT
   EXPTYPE  STR skyflat
-  REF_ID   S64 303
+  REF_ID   S64 281
   REF_ITER S32 0
   FILTER   STR z.00000
@@ -359,5 +359,5 @@
   DETTYPE  STR FLAT
   EXPTYPE  STR skyflat
-  REF_ID   S64 304
+  REF_ID   S64 282
   REF_ITER S32 0
   FILTER   STR y.00000
@@ -369,5 +369,5 @@
   DETTYPE  STR FLAT
   EXPTYPE  STR skyflat
-  REF_ID   S64 305
+  REF_ID   S64 283
   REF_ITER S32 0
   FILTER   STR w.00000
Index: /tags/ipp-20100701/pstamp/scripts/detectability_respond.pl
===================================================================
--- /tags/ipp-20100701/pstamp/scripts/detectability_respond.pl	(revision 28650)
+++ /tags/ipp-20100701/pstamp/scripts/detectability_respond.pl	(revision 28651)
@@ -209,5 +209,6 @@
     $psphot_cmd .= "-mask $image_list_hash{$k}{MASK} ";
     $psphot_cmd .= "-variance $image_list_hash{$k}{WEIGHT} ";
-    $psphot_cmd .= "-srctext $targetname $image_list_hash{$k}{OUTROOT}";
+    $psphot_cmd .= "-srctext $targetname $image_list_hash{$k}{OUTROOT} ";
+    $psphot_cmd .= "-D OUTPUT.FORMAT PS1_DV1 ";
 
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -477,5 +478,5 @@
 	}
 	elsif ($col->{name} eq 'PSF_INST_MAG_SIG') {
-	    @tmp_flux_err = map { $_ = $_ / (2.5 * log10(exp(1))) } @{ $col_data };
+	    @tmp_flux_err = map { $_ = $_ / (2.5 * (log(exp(1)) / log(10))) } @{ $col_data };
 	    $correct_error = 1;
 	}
