Index: trunk/ippScripts/scripts/diff_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/diff_skycell.pl	(revision 17762)
+++ trunk/ippScripts/scripts/diff_skycell.pl	(revision 17787)
@@ -31,5 +31,5 @@
     'outroot=s'         => \$outroot, # Output root name
     'verbose'           => \$verbose,   # Print to stdout
-    'no-update'         => \$no_update,	# Don't update the database?
+    'no-update'         => \$no_update, # Don't update the database?
     'no-op'             => \$no_op, # Don't do any operations?
 ) or pod2usage( 2 );
@@ -39,13 +39,16 @@
     -msg => "Required options: --diff_id",
     -exitval => 3,
-	  ) unless defined $diff_id
+          ) unless defined $diff_id
     and defined $outroot;
 
-my $STATS = 
-   [   
+my $STATS =
+   [
        #          PPSTATS KEYWORD         STATISTIC          DIFFTOOL FLAG
        { name => "ROBUST_MEDIAN",   type => "mean", flag => "-bg",         dtype => "float" },
        { name => "ROBUST_STDEV",    type => "rms",  flag => "-bg_stdev",   dtype => "float" },
-#      { name => "DT_DIFF",         type => "sum",  flag => "-dtime_diff", dtype => "float" },
+       { name => "DT_DIFF",         type => "sum",  flag => "-dtime_diff", dtype => "float" },
+       { name => "SUBTRACTION.NUM", type => "mean", flag => "-stamps_num", dtype => "int" },
+       { name => "SUBTRACTION.RMS", type => "mean", flag => "-stamps_rms", dtype => "float" },
+       { name => "NUM_SOURCES",     type => "sum",  flag => "-sources",    dtype => "int" },
        { name => "GOOD_PIXEL_FRAC", type => "mean", flag => "-good_frac",  dtype => "float" },
    ];
@@ -56,11 +59,11 @@
 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
 my $ppSub = can_run('ppSub') or (warn "Can't find ppSub" and $missing_tools = 1);
-if ($missing_tools) { 
+if ($missing_tools) {
     warn("Can't find required tools.");
-    exit($PS_EXIT_CONFIG_ERROR); 
+    exit($PS_EXIT_CONFIG_ERROR);
 }
 
 # Get list of components for subtraction
-my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 my $files;
 {
@@ -68,14 +71,14 @@
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform difftool -inputskyfile: $error_code", $diff_id, $error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform difftool -inputskyfile: $error_code", $diff_id, $error_code);
     }
 
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
-    $files = parse_md_list($metadata) or 
-	&my_die("Unable to parse metadata list", $diff_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
+    $files = parse_md_list($metadata) or
+        &my_die("Unable to parse metadata list", $diff_id, $PS_EXIT_PROG_ERROR);
 }
 
@@ -86,49 +89,49 @@
 my ($input, $inputMask, $inputWeight, $inputPath, $inputPSF); # Input files and path
 my ($template, $templateMask, $templateWeight, $templatePath, $templateSources); # Template files and path
-my $tess_id;			# Tesselation identifier
-my $skycell_id;			# Skycell identifier
-my $camera;			# Camera
+my $tess_id;                    # Tesselation identifier
+my $skycell_id;                 # Skycell identifier
+my $camera;                     # Camera
 foreach my $file (@$files) {
     if (defined $file->{template} and $file->{template}) {
-	$template = $file->{uri};
-	$templatePath = $file->{path_base};
-	if ($file->{warp_id} == 0) {
-	    $templateMask = "PPSTACK.OUTPUT.MASK";
-	    $templateWeight = "PPSTACK.OUTPUT.WEIGHT";
-	    $templateSources = "PSPHOT.OUTPUT";
-	} else {
-	    $templateMask = "PSWARP.OUTPUT.MASK";
-	    $templateWeight = "PSWARP.OUTPUT.WEIGHT";
-	    $templateSources = "PSWARP.OUTPUT.SOURCES";
-	}
-    } else {
-	$input = $file->{uri};
-	$inputPath = $file->{path_base};
-	if ($file->{warp_id} == 0) {
-	    $inputMask = "PPSTACK.OUTPUT.MASK";
-	    $inputWeight = "PPSTACK.OUTPUT.WEIGHT";
-	    $inputPSF = "PSPHOT.PSF.SAVE";
-	} else {
-	    $inputMask = "PSWARP.OUTPUT.MASK";
-	    $inputWeight = "PSWARP.OUTPUT.WEIGHT";
-	    $inputPSF = "PSPHOT.PSF.SAVE";
-	}
+        $template = $file->{uri};
+        $templatePath = $file->{path_base};
+        if ($file->{warp_id} == 0) {
+            $templateMask = "PPSTACK.OUTPUT.MASK";
+            $templateWeight = "PPSTACK.OUTPUT.WEIGHT";
+            $templateSources = "PSPHOT.OUTPUT";
+        } else {
+            $templateMask = "PSWARP.OUTPUT.MASK";
+            $templateWeight = "PSWARP.OUTPUT.WEIGHT";
+            $templateSources = "PSWARP.OUTPUT.SOURCES";
+        }
+    } else {
+        $input = $file->{uri};
+        $inputPath = $file->{path_base};
+        if ($file->{warp_id} == 0) {
+            $inputMask = "PPSTACK.OUTPUT.MASK";
+            $inputWeight = "PPSTACK.OUTPUT.WEIGHT";
+            $inputPSF = "PSPHOT.PSF.SAVE";
+        } else {
+            $inputMask = "PSWARP.OUTPUT.MASK";
+            $inputWeight = "PSWARP.OUTPUT.WEIGHT";
+            $inputPSF = "PSPHOT.PSF.SAVE";
+        }
     }
     if (defined $tess_id) {
-	&my_die("Tesselation identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
-	    $file->{tess_id} eq $tess_id;
-    } else {
-	$tess_id = $file->{tess_id};
+        &my_die("Tesselation identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
+            $file->{tess_id} eq $tess_id;
+    } else {
+        $tess_id = $file->{tess_id};
     }
     if (defined $skycell_id) {
-	&my_die("Skycell identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
-	    $file->{skycell_id} eq $skycell_id;
-    } else {
-	$skycell_id = $file->{skycell_id};
+        &my_die("Skycell identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
+            $file->{skycell_id} eq $skycell_id;
+    } else {
+        $skycell_id = $file->{skycell_id};
     }
     if (defined $camera) {
-	&my_die("Cameras don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
-    } else {
-	$camera = $file->{camera};
+        &my_die("Cameras don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
+    } else {
+        $camera = $file->{camera};
     }
 
@@ -181,8 +184,8 @@
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppSub: $error_code", $diff_id, $error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform ppSub: $error_code", $diff_id, $error_code);
     }
     &my_die("Couldn't find expected output file: $outputName", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
@@ -195,10 +198,10 @@
 
     # Get the statistics on the residual image
-    my $statsFile;		# File handle
+    my $statsFile;              # File handle
     open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $diff_id, $PS_EXIT_SYS_ERROR);
     my @contents = <$statsFile>; # Contents of file
     close $statsFile;
     my $metadata = $mdcParser->parse(join "", @contents) or
-	&my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
     $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $diff_id, $PS_EXIT_PROG_ERROR);
 }
@@ -208,28 +211,28 @@
     # Add the subtraction result
     {
-	my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
-	$command .= $stats->cmdflags();
-	$command .= " -dbname $dbname" if defined $dbname;
-	
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $error_code);
-	}
+        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
+        $command .= $stats->cmdflags();
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $error_code);
+        }
     }
 
     # Register the run as completed
     {
-	my $command = "$difftool -updaterun -diff_id $diff_id -state stop"; # Command to run difftool
-	$command .= " -dbname $dbname" if defined $dbname;
-
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    warn("Unable to perform difftool -updaterun: $error_code\n");
-	    exit($error_code);
-	}
+        my $command = "$difftool -updaterun -diff_id $diff_id -state stop"; # Command to run difftool
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            warn("Unable to perform difftool -updaterun: $error_code\n");
+            exit($error_code);
+        }
     }
 }
@@ -238,12 +241,12 @@
 sub my_die
 {
-    my $msg = shift;		# Warning message on die
-    my $diff_id = shift;	# Diff identifier
-    my $exit_code = shift;	# Exit code to add
+    my $msg = shift;            # Warning message on die
+    my $diff_id = shift;        # Diff identifier
+    my $exit_code = shift;      # Exit code to add
 
     warn($msg);
     if (defined $diff_id and not $no_update) {
-	my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
-	$command .= " -dbname $dbname" if defined $dbname;
+        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
+        $command .= " -dbname $dbname" if defined $dbname;
         run(command => $command, verbose => $verbose);
     }
Index: trunk/ippScripts/scripts/warp_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/warp_skycell.pl	(revision 17762)
+++ trunk/ippScripts/scripts/warp_skycell.pl	(revision 17787)
@@ -34,5 +34,5 @@
     'outroot=s'         => \$outroot, # Output root name
     'verbose'           => \$verbose,   # Print to stdout
-    'no-update'         => \$no_update,	# Don't update the database?
+    'no-update'         => \$no_update, # Don't update the database?
     'no-op'             => \$no_op, # Don't do any operations?
     'save-temps'        => \$save_temps, # Save temporary files?
@@ -51,11 +51,15 @@
 $ipprc->define_camera($camera);
 
-my $STATS = 
-   [   
+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" },
-#      { name => "DT_WARP",         type => "sum",  flag => "-dtime_warp", dtype => "float" },
+       { name => "DT_WARP",         type => "sum",  flag => "-dtime_warp", dtype => "float" },
        { name => "GOOD_PIXEL_FRAC", type => "mean", flag => "-good_frac",  dtype => "float" },
+       { name => "RANGE.XMIN",      type => "mean", flag => "-xmin",       dtype => "int"   },
+       { name => "RANGE.XMAX",      type => "mean", flag => "-xmax",       dtype => "int"   },
+       { name => "RANGE.YMIN",      type => "mean", flag => "-ymin",       dtype => "int"   },
+       { name => "RANGE.YMAX",      type => "mean", flag => "-ymax",       dtype => "int"   },
    ];
 my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
@@ -66,11 +70,11 @@
 my $pswarp = can_run('pswarp') or (warn "Can't find pswarp" and $missing_tools = 1);
 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
-if ($missing_tools) { 
+if ($missing_tools) {
     warn("Can't find required tools.");
-    exit($PS_EXIT_CONFIG_ERROR); 
+    exit($PS_EXIT_CONFIG_ERROR);
 }
 
 # Get list of component imfiles for exposure
-my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 my $imfiles;
 {
@@ -78,28 +82,28 @@
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
-    unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
     }
 
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
-    $imfiles = parse_md_list($metadata) or 
-	&my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
+    $imfiles = parse_md_list($metadata) or
+        &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
 }
 
 # Where do we get the astrometry source from?
-my $astromSource;		# The astrometry source
+my $astromSource;               # The astrometry source
 {
     my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
-    unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $error_code);
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $error_code);
     }
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $warp_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $warp_id, $PS_EXIT_PROG_ERROR);
     $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE');
 }
@@ -128,5 +132,5 @@
 my $wrote_astrom = 0;
 foreach my $imfile (@$imfiles) {
-    my $image = $imfile->{uri};	# Image name
+    my $image = $imfile->{uri}; # Image name
     my $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name
     my $weight = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name
@@ -135,25 +139,25 @@
     &my_die("Couldn't find input file: $mask", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($mask);
 
-    my $astrom;		# Astrometry file
+    my $astrom;         # Astrometry file
     if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
-	$astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base});
+        $astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base});
     } elsif ($astromSource eq 'PSASTRO.OUTPUT') {
-	my $chipRoot = $imfile->{chip_path_base};
-	my $classID = $imfile->{class_id};
-	$astrom = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
+        my $chipRoot = $imfile->{chip_path_base};
+        my $classID = $imfile->{class_id};
+        $astrom = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
     }
 
     &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless defined $astrom and $ipprc->file_exists($astrom);
-    
+
     print $imageFile  "$image\n";
     print $maskFile   "$mask\n";
     print $weightFile "$weight\n";
-    
+
     if (!$wrote_astrom) {
-	print $astromFile "$astrom\n";
-	# XXX simplify this?  only ever have one file for astrometry (must be MEF)
-	if ($astromSource eq 'PSASTRO.OUTPUT.MEF') { 
-	    $wrote_astrom = 1;
-	}
+        print $astromFile "$astrom\n";
+        # XXX simplify this?  only ever have one file for astrometry (must be MEF)
+        if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
+            $wrote_astrom = 1;
+        }
     }
 }
@@ -165,5 +169,5 @@
 
 # Run pswarp
-my $accept = 1;			# Accept the skycell?
+my $accept = 1;                 # Accept the skycell?
 unless ($no_op) {
     my $command = "$pswarp";
@@ -175,12 +179,12 @@
     $command .= " -stats $outputStats";
     $command .= " -recipe PPSTATS WARPSTATS";
-    $command .= " -psf";	# Turn on PSF determination
+    $command .= " -psf";        # Turn on PSF determination
     $command .= " -tracedest $traceDest -log $logDest";
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
-    unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
     }
 
@@ -188,5 +192,5 @@
     &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats);
     # Get the statistics on the warped image
-    my $statsFile;		# File handle
+    my $statsFile;              # File handle
     open $statsFile, $ipprc->file_resolve($outputStats) or die "Can't open statistics file $outputStats: $!\n";
     my @contents = <$statsFile>; # Contents of file
@@ -195,14 +199,14 @@
 
     my $metadata = $mdcParser->parse($contents)
-	or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
+        or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
     $accept = metadataLookupBool($metadata, "ACCEPT");
     if ($accept) {
-	$stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
-	
-	&my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
-	&my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
-	&my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
-	&my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
-	&my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF);
+        $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
+
+        &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
+        &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
+        &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
+        &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
+        &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF);
 #    &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
 #    &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
@@ -218,9 +222,9 @@
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
-    unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	warn("Unable to perform warptool -addwarped: $error_code\n");
-	exit($error_code);
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        warn("Unable to perform warptool -addwarped: $error_code\n");
+        exit($error_code);
     }
 }
@@ -228,14 +232,14 @@
 sub my_die
 {
-    my $msg = shift;		# Warning message on die
-    my $warp_id = shift;	# Warp identifier
-    my $skycell_id = shift;	# Skycell identifier
-    my $tess_id = shift;	# Tesselation identifier
-    my $exit_code = shift;	# Exit code to add
+    my $msg = shift;            # Warning message on die
+    my $warp_id = shift;        # Warp identifier
+    my $skycell_id = shift;     # Skycell identifier
+    my $tess_id = shift;        # Tesselation identifier
+    my $exit_code = shift;      # Exit code to add
 
     warn($msg);
     if (defined $warp_id and defined $skycell_id and defined $tess_id and not $no_update) {
-	my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code";
-	$command .= " -dbname $dbname" if defined $dbname;
+        my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code";
+        $command .= " -dbname $dbname" if defined $dbname;
         run(command => $command, verbose => $verbose);
     }
