Changeset 11837 for trunk/ippScripts/scripts/phase4_warp.pl
- Timestamp:
- Feb 15, 2007, 2:23:33 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase4_warp.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase4_warp.pl
r11830 r11837 32 32 use Pod::Usage qw( pod2usage ); 33 33 34 my ($p4_id, $skycell_id, $camera, $dbname, $workdir, $no_update );34 my ($p4_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op); 35 35 GetOptions( 36 36 'p4_id|i=s' => \$p4_id, # Phase 4 identifier … … 39 39 'dbname|d=s' => \$dbname, # Database name 40 40 'workdir|w=s' => \$workdir, # Working directory, for output files 41 'no-update' => \$no_update 41 'no-update' => \$no_update, # Don't update the database? 42 'no-op' => \$no_op, # Don't do any operations? 42 43 ) or pod2usage( 2 ); 43 44 … … 62 63 63 64 # Get list of component imfiles for exposure 65 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 64 66 my $imfiles; 65 67 { … … 97 99 open my $listFile, '>' . $listName; 98 100 foreach my $imfile (@$imfiles) { 99 my $uri = $ipprc->convert_filename_absolute( $ file->{uri} );101 my $uri = $ipprc->convert_filename_absolute( $imfile->{uri} ); 100 102 101 print $listFile $uri . "\n";103 print $listFile "$uri\n"; 102 104 } 103 105 close $listFile; 104 106 105 107 # Run pswarp 106 { 107 my $command = "$pswarp -file $uri $outputRoot -stat $outputStats"; # Command to run pswarp 108 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 109 unless ($no_op) { 110 my $command = "$pswarp -list $listName $outputRoot -stat $outputStats"; # Command to run pswarp 108 111 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 109 112 run(command => $command, verbose => 1); … … 116 119 &my_die("Couldn't find expected output file: $outputBin1", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1; 117 120 &my_die("Couldn't find expected output file: $outputBin2", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2; 118 }119 121 120 # Get the statistics on the warped image 121 my $stats; # Statistics from pswarp 122 { 122 # Get the statistics on the warped image 123 123 my $statsFile; # File handle 124 124 open $statsFile, "$outputStats" or die "Can't open statistics file $outputStats: $!\n"; 125 125 my @contents = <$statsFile>; # Contents of file 126 126 close $statsFile; 127 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files128 127 my $metadata = $mdcParser->parse(join "", @contents) 129 128 or &my_die("Unable to parse metadata config", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR); 130 $stats = PS::IPP::Metadata::Stats->new(); # Stats parser131 129 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR); 132 130 } … … 137 135 $outputBin2 = $ipprc->convert_filename_relative( $outputBin2 ); 138 136 137 my $bg = ($stats->bg_mean() or 'NAN'); 138 my $bg_stdev = ($stats->bg_stdev() or 'NAN'); 139 139 140 # Add the processed file to the database 140 141 unless ($no_update) { 141 142 my $command = "$p4tool -warped -p4_id $p4_id -skycell_id $skycell_id" . 142 143 " -uri $outputImage -b1_uri $outputRoot"; # Command to run dettool 143 $command .= " -bg " . $stats->bg_mean(); 144 $command .= " -bg_stdev " . $stats->bg_stdev(); 144 $command .= " -bg $bg -bg_stdev $bg_stdev"; 145 145 $command .= " -dbname $dbname" if defined $dbname; 146 146
Note:
See TracChangeset
for help on using the changeset viewer.
