Index: trunk/ippScripts/scripts/warp_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/warp_skycell.pl	(revision 14225)
+++ trunk/ippScripts/scripts/warp_skycell.pl	(revision 14228)
@@ -57,4 +57,12 @@
 $ipprc->define_camera($camera);
 
+my $STATS = 
+   [   
+       #          PPSTATS KEYWORD         STATISTIC          WARPTOOL FLAG
+       { name => "ROBUST_MEDIAN",  type => "mean",  flag => "-bg",             dtype => "float" },
+       { name => "ROBUST_STDEV",   type => "rms",   flag => "-bg_stdev",       dtype => "float" },
+   ];
+my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
+
 # Look for programs we need
 my $missing_tools;
@@ -119,5 +127,4 @@
 
 # Run pswarp
-my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
     my $command = "$pswarp -list $list1Name";
@@ -155,12 +162,8 @@
 }
 
-# Add the processed file to the database
-my $bg       = $stats->bg_mean();
-my $bg_stdev = $stats->bg_stdev();
-
 unless ($no_update) {
     my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id" .
-	" -uri $outputImage -path_base $outputRoot"; # -path_base $outputRoot"; # Command to run dettool
-    $command .= " -bg $bg -bg_stdev $bg_stdev";
+	" -uri $outputImage -path_base $outputRoot"; # Command to run dettool
+    $command .= $stats->cmdflags();
     $command .= " -dbname $dbname" if defined $dbname;
 
