Index: trunk/ippScripts/scripts/phase3.pl
===================================================================
--- trunk/ippScripts/scripts/phase3.pl	(revision 11829)
+++ trunk/ippScripts/scripts/phase3.pl	(revision 11837)
@@ -33,5 +33,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($exp_tag, $camera, $dbname, $workdir, $no_update);
+my ($exp_tag, $camera, $dbname, $workdir, $no_update, $no_op);
 GetOptions(
     'exp_tag|e=s'       => \$exp_tag,
@@ -39,5 +39,6 @@
     'dbname|d=s'        => \$dbname, # Database name
     'workdir|w=s'       => \$workdir,
-    'no-update'         => \$no_update
+    'no-update'         => \$no_update,
+    'no-op'             => \$no_op,
 ) or pod2usage( 2 );
 
@@ -111,11 +112,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');
     }
 }
@@ -169,54 +170,57 @@
 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $outputRoot); # MEF psastro output
 
-# run psastro +mosastro on the set of chips
-# XXX note that this is wrong if imfiles are cells
-if (@$files > 1) {
-    my $command = "$psastro -list $list3Name $outputRoot +mosastro -chipastro";
-    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 psastro: $error_code", $exp_tag, $error_code);
-    }
-    &my_die("Unable to find expected output file: $fpaObjects", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;
-} else {
-    $fpaObjects = $chipObjects;
-}
-
-# run addstar on either the single chip output or the single fpa output
-# XXX this construct requires the user to have a valid .ptolemyrc 
-# XXX which in turn points at ippconfig/dvo.site
-{
-    my $command = "addstar -D CAMERA $camera $fpaObjects";
-    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 addstar: $error_code", $exp_tag, $error_code);
-    }
-}
-
-# 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", $exp_tag, $error_code);
-    }
-    &my_die("Unable to find expected output file: $jpeg1", $exp_tag, $PS_EXIT_PROG_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", $exp_tag, $error_code);
-    }
-    &my_die("Unable to find expected output file: $jpeg2", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg2;
+unless ($no_op) {
+
+    # run psastro +mosastro on the set of chips
+    # XXX note that this is wrong if imfiles are cells
+    if (@$files > 1) {
+	my $command = "$psastro -list $list3Name $outputRoot +mosastro -chipastro";
+	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 psastro: $error_code", $exp_tag, $error_code);
+	}
+	&my_die("Unable to find expected output file: $fpaObjects", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;
+    } else {
+	$fpaObjects = $chipObjects;
+    }
+
+    # run addstar on either the single chip output or the single fpa output
+    # XXX this construct requires the user to have a valid .ptolemyrc 
+    # XXX which in turn points at ippconfig/dvo.site
+    {
+	my $command = "addstar -D CAMERA $camera $fpaObjects";
+	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 addstar: $error_code", $exp_tag, $error_code);
+	}
+    }
+    
+    # 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", $exp_tag, $error_code);
+	}
+	&my_die("Unable to find expected output file: $jpeg1", $exp_tag, $PS_EXIT_PROG_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", $exp_tag, $error_code);
+	}
+	&my_die("Unable to find expected output file: $jpeg2", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg2;
+    }
 }
 
@@ -226,4 +230,5 @@
 $jpeg1  = $ipprc->convert_filename_relative($jpeg1);
 $jpeg2  = $ipprc->convert_filename_relative($jpeg2);
+
 unless ($no_update) {
     my $command = "$p3tool -addprocessedexp -exp_tag $exp_tag -uri UNKNOWN " .
