Index: /trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/chip_imfile.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/chip_imfile.pl	(revision 13748)
@@ -28,5 +28,5 @@
 use Pod::Usage qw( pod2usage );
 
-use constant RECIPE => 'PPIMAGE_OBDSFRA'; # Recipe to use
+my $RECIPE = 'PPIMAGE_OBDSFRA'; # Recipe to use
 
 # Parse the command-line arguments
@@ -95,6 +95,9 @@
     print "outputStats: $outputStats\n";
 
-    my $command = "$ppImage -file $input $outputRoot -recipe PPIMAGE " . RECIPE .
-	" -stat $outputStats"; # Command to run ppImage
+    my $command = "$ppImage -file $input $outputRoot";
+    $command .= " -recipe PPIMAGE $RECIPE";
+    $command .= " -recipe PPSTATS CHIPSTATS";
+    $command .= " -stats $outputStats"; # Command to run ppImage
+
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -103,4 +106,5 @@
 	&my_die("Unable to perform ppImage: $error_code", $chip_id, $class_id, $error_code);
     }
+
     &my_die("Couldn't find expected output file: $outputImage\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
     &my_die("Couldn't find expected output file: $outputMask\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
Index: /trunk/ippScripts/scripts/detrend_norm_apply.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 13748)
@@ -70,5 +70,6 @@
 
 
-use constant RECIPE => 'PPIMAGE_N'; # Recipe to use with ppImage
+my $RECIPE_PPIMAGE = 'PPIMAGE_N'; # Recipe to use with ppImage
+my $RECIPE_PPSTATS = 'CHIPSTATS'; # Recipe to use with ppStats
 
 # Look for programs we need
@@ -93,6 +94,10 @@
 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
-    my $command = "$ppImage -file $input $outputRoot -norm $value -stat $statsName -recipe PPIMAGE " . RECIPE(); # Command to run
+    my $command = "$ppImage -file $input $outputRoot";
+    $command .= " -norm $value -stats $statsName";
+    $command .= " -recipe PPIMAGE $RECIPE_PPIMAGE";
+    $command .= " -recipe PPSTATS $RECIPE_PPSTATS";
     $command .= ' -isfringe' if lc($det_type) eq 'fringe';
+
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
Index: /trunk/ippScripts/scripts/detrend_process_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 13748)
@@ -99,6 +99,9 @@
 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
-    my $command = "$ppImage -file $input_uri $outputRoot -recipe PPIMAGE $recipe" .
-	" -stat $outputStats"; # Command to run ppImage
+    my $command = "$ppImage -file $input_uri $outputRoot";
+    $command .= " -recipe PPIMAGE $recipe";
+    $command .= " -recipe PPSTATS CHIPSTATS";
+    $command .= " -stats $outputStats";
+
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
Index: /trunk/ippScripts/scripts/detrend_resid.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_resid.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/detrend_resid.pl	(revision 13748)
@@ -125,12 +125,13 @@
 my $bin2Name =  $ipprc->filename("PPIMAGE.BIN2", $outputRoot, $class_id);
 my $outputStats = $outputRoot . '.' . $class_id . '.stats';
-my $outputBinnedStats = $outputRoot . '.' . $class_id . '.bin.stats';
-
-# Run ppImage
+
+# Run ppImage & ppStats
 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 my $binnedStats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
-    my $command = "$ppImage -file $input_uri $outputRoot -recipe PPIMAGE $recipe" .
-	" -stat $outputStats "; # Command to run ppImage
+    my $command = "$ppImage -file $input_uri $outputRoot";
+    $command .= " -recipe PPIMAGE $recipe";
+    $command .= " -recipe PPSTATS RESIDUAL";
+    $command .= " -stats $outputStats";
 
     # Detrend to use in processing
@@ -152,19 +153,19 @@
     &my_die("Couldn't find expected output file: $bin2Name", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin2Name);
 
-    # Get the statistics on the residual image
+    # Load the raw output stats file
     my $statsFile;		# File handle
     open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR);
     my @contents = <$statsFile>; # Contents of file
     close $statsFile;
+
+    # Parse the statistics on the residual image
     my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
     my $metadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
-    # $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
     $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
 
     # run ppStats on the binned image
-    $command = "$ppStats $bin2Name $outputBinnedStats";
+    $command = "$ppStats -recipe PPSTATS RESIDUAL $bin2Name";
     ( $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);
@@ -172,11 +173,6 @@
     }
 
-    &my_die("Couldn't find expected output file: $outputBinnedStats", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputBinnedStats);
-
-    open $statsFile, $ipprc->file_resolve($outputBinnedStats) or &my_die("Can't open statistics file $outputBinnedStats: $!", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR);
-    @contents = <$statsFile>; # Contents of file
-    close $statsFile;
-    my $binnedMetadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
-    # $binnedStats = PS::IPP::Metadata::Stats->new(); # Stats parser
+    # parse the binned image statistics
+    my $binnedMetadata = $mdcParser->parse(join "", @$stdout_buf) or &my_die("Unable to parse metadata output", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
     $binnedStats->parse($binnedMetadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
 }
Index: /trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_stack.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/detrend_stack.pl	(revision 13748)
@@ -116,4 +116,5 @@
     $command .= ' -type ' . uc($det_type); # Type of stacking to perform
     $command .= " -stats $outputStats";	# Statistics output filename
+    $command .= " -recipe PPSTATS CHIPSTATS";
     
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Index: /trunk/ippScripts/scripts/diff_skycell.pl
===================================================================
--- /trunk/ippScripts/scripts/diff_skycell.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/diff_skycell.pl	(revision 13748)
@@ -143,5 +143,9 @@
 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
-    my $command = "$ppSub $input $template $outputRoot -inmask $inputMask -refmask $templateMask -stat $outputStats"; # Command to run ppSub
+    my $command = "$ppSub $input $template $outputRoot";
+    $command .= " -inmask $inputMask";
+    $command .= " -refmask $templateMask";
+    $command .= " -stats $outputStats";
+    $command .= " -recipe PPSTATS CHIPSTATS";
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Index: /trunk/ippScripts/scripts/ipp_serial_inject.pl
===================================================================
--- /trunk/ippScripts/scripts/ipp_serial_inject.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/ipp_serial_inject.pl	(revision 13748)
@@ -57,5 +57,5 @@
     my $relfile = $ipprc->convert_filename_relative( $absfile );
 
-    my $command_type = "$ppStats -concept FPA.OBSTYPE -concept FPA.TELESCOPE -concept FPA.INSTRUMENT $absfile";
+    my $command_type = "$ppStats -recipe PPSTATS RESIDUAL $absfile";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command_type, verbose => 1);
     die "Unable to perform ppStats: $error_code\n" if not $success;
@@ -69,5 +69,4 @@
 	if ($row->{name} eq "FPA.TELESCOPE")  { $telescope = $row->{value}; }
 	if ($row->{name} eq "FPA.INSTRUMENT") { $instrument = $row->{value}; } # this entry must return the camera in the ipp/config system which we load
-#	if ($row->{name} eq "FPA.OBSTYPE")    { $type = $row->{value}; }
     }
     
Index: /trunk/ippScripts/scripts/register_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/register_exp.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/register_exp.pl	(revision 13748)
@@ -86,6 +86,4 @@
 my $regtool = can_run('regtool')
     or (warn "can't find regtool" and $missing_tools = 1);
-my $ppStats = can_run('ppStats')
-    or (warn "can't find ppStats" and $missing_tools = 1);
 
 if ($missing_tools) { 
Index: /trunk/ippScripts/scripts/register_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/register_imfile.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/register_imfile.pl	(revision 13748)
@@ -58,5 +58,5 @@
     and defined $uri;
 
-my $RECIPE = "PPSTATS_REGISTER"; # Recipe to use for ppStats
+my $RECIPE = "REGISTER"; # Recipe to use for ppStats
 
 # These values should be constant for all components
Index: /trunk/ippScripts/scripts/stack_skycell.pl
===================================================================
--- /trunk/ippScripts/scripts/stack_skycell.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/stack_skycell.pl	(revision 13748)
@@ -143,5 +143,7 @@
 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
-    my $command = "$ppStack $listName $outputRoot -stat $outputStats"; # Command to run pois
+    my $command = "$ppStack $listName $outputRoot";
+    $command .= " -stats $outputStats";
+    $command .= " -recipe PPSTATS CHIPSTATS";
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Index: /trunk/ippScripts/scripts/warp_skycell.pl
===================================================================
--- /trunk/ippScripts/scripts/warp_skycell.pl	(revision 13747)
+++ /trunk/ippScripts/scripts/warp_skycell.pl	(revision 13748)
@@ -118,5 +118,11 @@
 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
-    my $command = "$pswarp -list $list1Name -masklist $list2Name -astromlist $list3Name $outputRoot $skyFile -stat $outputStats"; # Command to run pswarp
+    my $command = "$pswarp -list $list1Name";
+    $command .= " -masklist $list2Name";
+    $command .= " -astromlist $list3Name";
+    $command .= " $outputRoot $skyFile";
+    $command .= " -stats $outputStats";
+    $command .= " -recipe PPSTATS CHIPSTATS";
+
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
