Changeset 13275 for trunk/ippScripts/scripts/diff_skycell.pl
- Timestamp:
- May 4, 2007, 4:52:03 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/diff_skycell.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/diff_skycell.pl
r13118 r13275 19 19 use Data::Dumper; 20 20 21 use PS::IPP::Config qw( 22 $PS_EXIT_SUCCESS 23 $PS_EXIT_UNKNOWN_ERROR24 $PS_EXIT_SYS_ERROR25 $PS_EXIT_CONFIG_ERROR26 $PS_EXIT_PROG_ERROR27 $PS_EXIT_DATA_ERROR28 $PS_EXIT_TIMEOUT_ERROR 29 );21 use PS::IPP::Config qw($PS_EXIT_SUCCESS 22 $PS_EXIT_UNKNOWN_ERROR 23 $PS_EXIT_SYS_ERROR 24 $PS_EXIT_CONFIG_ERROR 25 $PS_EXIT_PROG_ERROR 26 $PS_EXIT_DATA_ERROR 27 $PS_EXIT_TIMEOUT_ERROR 28 caturi 29 ); 30 30 my $ipprc = PS::IPP::Config->new(); # IPP configuration 31 use File::Spec;32 31 33 32 use constant POIS_OPTIONS => '-v -B 1000'; … … 89 88 my $camera; # Camera 90 89 foreach my $file (@$files) { 91 my $uri = $ipprc->convert_filename_absolute( $file->{uri} ); # URI for file92 90 if (defined $file->{template} and $file->{template}) { 93 $template = $ uri;94 } else { 95 $input = $ uri;91 $template = $file->{uri}; 92 } else { 93 $input = $file->{uri}; 96 94 } 97 95 if (defined $tess_id) { … … 119 117 $ipprc->define_camera($camera); 120 118 121 ### Working directory122 if (defined $workdir) {123 $workdir = $ipprc->convert_filename_absolute( $workdir );124 $workdir = File::Spec->catdir( $workdir, "tess_" . $tess_id, "sky_" . $skycell_id );125 } else {126 my ($vol, $dir, $file) = File::Spec->splitpath( $input );127 $workdir = $dir;128 }129 system "mkdir -p $workdir" unless -d $workdir;130 119 131 120 # Get the output filenames 132 my $outputFile = "$tess_id.$skycell_id.dif$diff_id"; # Root name 133 my $outputRoot = File::Spec->catfile( $workdir, $outputFile ); 134 121 $workdir = caturi( $workdir, "tess_" . $tess_id, "sky_" . $skycell_id ) if defined $workdir; 122 my $outputRoot = $ipprc->file_prepare( "$tess_id.$skycell_id.dif$diff_id", $workdir, $input ); 135 123 my $outputName = $outputRoot . ".fits"; 136 124 my $bin1Name = $ipprc->filename("PPIMAGE.BIN1", $outputRoot); … … 138 126 my $outputStats = $outputRoot . '.stats'; 139 127 128 129 ### XXX We have to play around some here, because pois can't use Nebulous 130 my $outputNameResolved = $ipprc->file_create( $outputName ); 131 my $templateResolved = $ipprc->file_resolve( $template ); 132 my $inputResolved = $ipprc->file_resolve( $input ); 133 140 134 # Perform subtraction 141 135 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 142 136 unless ($no_op) { 143 my $command = "$pois " . POIS_OPTIONS() . " $template $input $outputName"; # Command to run pois137 my $command = "$pois " . POIS_OPTIONS() . " $templateResolved $inputResolved $outputNameResolved"; # Command to run pois 144 138 145 139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 149 143 &my_die("Unable to perform ppImage: $error_code", $diff_id, $error_code); 150 144 } 151 &my_die("Couldn't find expected output file: $outputName", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ outputName;152 # &my_die("Couldn't find expected output file: $bin1Name", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ bin1Name;153 # &my_die("Couldn't find expected output file: $bin2Name", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ bin2Name;154 # &my_die("Couldn't find expected output file: $outputStats", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ outputStats;145 &my_die("Couldn't find expected output file: $outputName", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputName); 146 # &my_die("Couldn't find expected output file: $bin1Name", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin1Name); 147 # &my_die("Couldn't find expected output file: $bin2Name", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin2Name); 148 # &my_die("Couldn't find expected output file: $outputStats", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStats); 155 149 156 150 # Get the statistics on the residual image 157 151 if (0) { ### Disabled because pois doesn't output stats yet 158 152 my $statsFile; # File handle 159 open $statsFile, $ outputStatsor &my_die("Can't open statistics file $outputStats: $!", $diff_id, $PS_EXIT_SYS_ERROR);153 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $diff_id, $PS_EXIT_SYS_ERROR); 160 154 my @contents = <$statsFile>; # Contents of file 161 155 close $statsFile; … … 167 161 168 162 # Add the processed file to the database 169 $outputName = $ipprc->convert_filename_relative( $outputName );170 $outputRoot = $ipprc->convert_filename_relative( $outputRoot );171 172 163 my $bg = ($stats->bg_mean() or 'NAN'); 173 164 my $bg_stdev = ($stats->bg_stdev() or 'NAN'); … … 187 178 &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $error_code); 188 179 } 189 190 # unlink $outputStats;191 180 } 192 181
Note:
See TracChangeset
for help on using the changeset viewer.
