Index: trunk/tools/dlapstacks
===================================================================
--- trunk/tools/dlapstacks	(revision 33573)
+++ trunk/tools/dlapstacks	(revision 33575)
@@ -30,4 +30,5 @@
 my ($singleframe, $fitToFrame, $deasin, $save_temps, $data_group);
 
+# XXX: get this from the ipprc
 my $temproot = '/local/ipp/tmp';
 my $outdir;
@@ -201,7 +202,11 @@
         $imagesize = 680;
     }
+    my $tempdir;
+    if (!$outdir) {
+        $tempdir = tempdir ("$temproot/dlapstacks.temp.XXXX", CLEANUP => !$save_temps);
+    }
     if ($deasin) {
         if ($outdir) {
-            print "Saving deasined files to $outdir\n";
+            print "Saving deasined files to $outdir\n" if $verbose;
             # user specified output directory save the files there
             if (!-d $outdir) {
@@ -210,6 +215,6 @@
         } else {
             # otherwise use a temporary directory
-            $outdir = tempdir ("$temproot/dlapstacks.temp.XXXX", CLEANUP => !$save_temps);
             print "deasined files will be saved to $outdir\n" if $save_temps;
+            $outdir = $tempdir;
         }
     }
@@ -222,11 +227,18 @@
         my $filename = $ipprc->file_resolve($pathname);
         next if !$filename;
-        # run ppstamp to undo the asin scaling. The output from ppstamp is linear F32 images
+
+        # prefix file name with filter
+        # this will either be the ppstamp output filename or we
+        # will put a symlink to it in tempdir
+        my $base = basename($pathname);
+        my $filt = substr $f->{filter}, 0, 1;
+        $base = "$filt.$base";
         if ($deasin) {
-            my $base = basename($pathname);
+            # run ppstamp to undo the asin scaling. The output from ppstamp is linear F32 images
+
+            # drop the .fits for the output path for ppstamp
             my $destbase = $base;
-
-            # drop the .fits for the output path for ppstamp
             $destbase =~ s/\.fits//g;
+
 
             my $command = "$ppstamp -wholefile -file $filename $outdir/$destbase";
@@ -241,4 +253,8 @@
             # new filename for ds9
             $filename = "$outdir/$base";
+        } else {
+            my $nebname = $filename;
+            $filename = "$tempdir/$base";
+            symlink $nebname, $filename or die "failed to symlink $nebname";
         }
 
