Index: trunk/ippScripts/scripts/detrend_process_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 11829)
+++ trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 11837)
@@ -33,5 +33,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_tag, $camera, $dbname, $workdir, $no_update);
+my ($det_id, $exp_tag, $camera, $dbname, $workdir, $no_update, $no_op);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -40,5 +40,6 @@
     'dbname|d=s'        => \$dbname, # Database name
     'workdir|w=s'       => \$workdir,	# Working directory, for output files
-    'no-update'         => \$no_update
+    'no-update'         => \$no_update,
+    'no-op'             => \$no_op,
 ) or pod2usage( 2 );
 
@@ -102,11 +103,11 @@
 	my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
 	$stats->add_data(@backgrounds);
-	$bg = $stats->mean();
-	$bg_mean_stdev = $stats->standard_deviation() || 0.0;
+	$bg = ($stats->mean() or 'NAN');
+	$bg_mean_stdev = ($stats->standard_deviation() or 'NAN');
     }
     {
 	my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
 	$stats->add_data(@variances);
-	$bg_stdev = sqrt( $stats->mean() );
+	$bg_stdev = (sqrt( $stats->mean() ) or 'NAN');
     }
 }
@@ -143,28 +144,29 @@
 my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
 
-# Make the jpeg for binning 1
-{
-    my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run
-    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
-    unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppImage: $error_code", $det_id, $exp_tag, $error_code);
-    }
-    &my_die("Unable to find expected output file: $jpeg1", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg1;
-}
-
-# Make the jpeg for binning 2
-{
-    my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run
-    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
-    unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppImage: $error_code", $det_id, $exp_tag, $error_code);
-    }
-    &my_die("Unable to find expected output file: $jpeg2", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg2;
-}
-
+unless ($no_op) {
+    # Make the jpeg for binning 1
+    {
+	my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    run(command => $command, verbose => 1);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_tag, $error_code);
+	}
+	&my_die("Unable to find expected output file: $jpeg1", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg1;
+    }
+    
+    # Make the jpeg for binning 2
+    {
+	my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    run(command => $command, verbose => 1);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_tag, $error_code);
+	}
+	&my_die("Unable to find expected output file: $jpeg2", $det_id, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg2;
+    }
+}
 
 # Add the result into the database
