Index: trunk/ippScripts/scripts/warp_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/warp_skycell.pl	(revision 16020)
+++ trunk/ippScripts/scripts/warp_skycell.pl	(revision 16021)
@@ -134,8 +134,11 @@
 
 # Get list of filenames
-my ($imageFile, $imageName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.image.list.XXXX", UNLINK => !$save_temps);
-my ($maskFile, $maskName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.mask.list.XXXX", UNLINK => !$save_temps);
+my ($imageFile,  $imageName)  = tempfile( "$tess_id.$skycell_id.wrp$warp_id.image.list.XXXX",  UNLINK => !$save_temps);
+my ($maskFile,   $maskName)   = tempfile( "$tess_id.$skycell_id.wrp$warp_id.mask.list.XXXX",   UNLINK => !$save_temps);
 my ($weightFile, $weightName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.weight.list.XXXX", UNLINK => !$save_temps);
-my $inputAstrom;
+my ($astromFile, $astromName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.astrom.list.XXXX", UNLINK => !$save_temps);
+
+# XXXX this is inconsistent: what is the goal of inputAstrom?
+my $inputAstrom = 0;
 foreach my $imfile (@$imfiles) {
     my $image = $imfile->{uri};	# Image name
@@ -146,18 +149,22 @@
     &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
-    if ($astromSource and $astromSource ne 'NULL') {
+    my $astrom;		# Astrometry file
+    if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
 	$astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base});
 	&my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($astrom);
-    }
-
-    print $imageFile ( $image . "\n");
-    print $maskFile ( $mask  . "\n");
-    print $weightFile ( $weight  . "\n");
-
-    if (defined $inputAstrom and defined $astrom) {
-	&my_die("Astrometry files don't match: $inputAstrom vs $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $inputAstrom eq $astrom;
-    } else {
-	$inputAstrom = $astrom;
+	$inputAstrom = 1;
+    }
+    if ($astromSource eq 'PSASTRO.OUTPUT') {
+	my $chipRoot = $imfile->{chip_path_base};
+	my $classID = $imfile->{class_id};
+	$astrom = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
+	$inputAstrom = 1;
+    }
+
+    if ($inputAstrom) {
+	print $imageFile  "$image\n";
+	print $maskFile   "$mask\n";
+	print $weightFile "$weight\n";
+	print $astromFile "$astrom\n";
     }
 }
@@ -165,16 +172,18 @@
 close $maskFile;
 close $weightFile;
+close $astromFile;
 
 # Run pswarp
 my $accept = 1;			# Accept the skycell?
 unless ($no_op) {
-    my $command = "$pswarp -list $imageName";
+    my $command = "$pswarp";
+    $command .= " -list $imageName";
     $command .= " -masklist $maskName";
     $command .= " -weightlist $weightName";
-    $command .= " -astrom $inputAstrom" if defined $inputAstrom;
+    $command .= " -astromlist $astromName" if $inputAstrom;
     $command .= " $outputRoot $skyFile";
     $command .= " -stats $outputStats";
     $command .= " -recipe PPSTATS WARPSTATS";
-    $command .= " -psf";	# Turn on PSF determination
+    # $command .= " -psf";	# Turn on PSF determination
     $command .= " -tracedest $traceDest -log $logDest";
 
@@ -205,5 +214,5 @@
 	&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: $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);
