Changeset 38968
- Timestamp:
- Oct 27, 2015, 1:55:47 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/tools/bills/concatp2batch (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/bills/concatp2batch
r38860 r38968 21 21 22 22 GetOptions( 23 "ve bose|v" => \$verbose,23 "verbose|v" => \$verbose, 24 24 "save-temps" => \$save_temps, 25 25 "test" => \$test, … … 31 31 my $output = shift; 32 32 33 # TODO: make this an option 34 my $stiltsJar = '/home/panstarrs/bills/jars/stilts.jar'; 33 my $jardir = $ENV{JARDIR}; 34 if (!$jardir) { 35 $jardir = '/home/panstarrs/bills/jars'; 36 } 37 my $stiltsJar = "$jardir/stilts.jar"; 35 38 36 39 my $stilts="java -jar $stiltsJar"; … … 38 41 my $ofmt = 'fits'; 39 42 40 my $ extensionList = `ftlist $input h | grep Detection | awk '{print \$2}'`;43 my $listArg = getExtensionArg($input); 41 44 42 my ($listFile, $listName) = tempfile ("/tmp/foo.XXXX", UNLINK => !$save_temps); 45 my $cmd = "$stilts tcat in='$listArg' out=$output ofmt=$ofmt"; 46 print STDERR "running $cmd\n"; 43 47 44 # make a list of the detection extension names45 print "$listName\n" if $save_temps;46 foreach my $n (split "\n", $extensionList) {47 print "$n\n" if $verbose;48 # ftlist HDU number starts with 1, stilts expects zero based index49 $n -= 1;50 print $listFile "$input#$n\n";51 }52 close $listFile;53 54 # my $cmd = "$stilts tcat in=\@$listName out=$output ofmt=$ofmt ocmd='tablename $extname;'";55 my $cmd = "$stilts tcat in=\@$listName out=$output ofmt=$ofmt";56 48 my $rc = system $cmd; 57 49 if ($rc) { … … 62 54 exit 0; 63 55 56 sub getExtensionArg { 57 # find the zero offset extension number of each of the detection extensions and build 58 # an argument list for them 59 my $input = shift; 60 61 my $ftableOutput = `ftable -list $input`; 62 die "ftable didn't return any output for $input\n" unless $ftableOutput; 63 64 my @lines = split "\n", $ftableOutput; 65 66 my $listArg = ""; 67 my $n = -1; 68 foreach my $line (@lines) { 69 # skip first line which is a list header 70 if ($n == -1) { 71 $n = 0; 72 next; 73 } 74 if ($line =~ /^Detection/) { 75 $listArg .= "$input#$n "; 76 } 77 $n++; 78 } 79 80 return $listArg; 81 }
Note:
See TracChangeset
for help on using the changeset viewer.
