Changeset 11049 for trunk/ippScripts/scripts/phase0_exp.pl
- Timestamp:
- Jan 11, 2007, 3:44:12 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase0_exp.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase0_exp.pl
r11036 r11049 52 52 # These values should be constant for all components 53 53 use constant CONSTANTS => [ 54 "object", # Object54 "object", # Object 55 55 "exp_type", # Exposure type 56 56 "filter", # Filter used … … 98 98 cache_run(command => $command, verbose => 1); 99 99 unless ($success) { 100 warn ("Unable to perform p0tool on exposure id $exptag: $error_code");101 &my_die ($exptag, $error_code);100 warn ("Unable to perform p0tool on exposure id $exptag: $error_code"); 101 &my_die ($exptag, $error_code); 102 102 } 103 103 104 104 my $metadata = $mdcParser->parse(join "", @$stdout_buf); 105 105 unless ($metadata) { 106 warn ("Unable to parse metadata config doc");107 &my_die ($exptag, $PS_EXIT_PROG_ERROR);106 warn ("Unable to parse metadata config doc"); 107 &my_die ($exptag, $PS_EXIT_PROG_ERROR); 108 108 } 109 109 $imfiles = parse_md_list($metadata); # Data for imfiles … … 125 125 $values{$constant} = $value; 126 126 } 127 if ($values{$constant} ne $value) {127 if ($values{$constant} ne $value) { 128 128 warn ("Value of $constant for $imfile->{PHASE0_CLASSID} doesn't match previous value"); 129 &my_die ($exptag, $PS_EXIT_PROG_ERROR);129 &my_die ($exptag, $PS_EXIT_PROG_ERROR); 130 130 } 131 131 } … … 154 154 unless ($no_update) { 155 155 my @command; 156 push @command, $p0tool, '- updateexp', '-exp_tag', $exptag; # Command to execute to update exposure parameters156 push @command, $p0tool, '-addprocessedexp', '-exp_tag', $exptag; # Command to execute to update exposure parameters 157 157 158 158 # Add the values of interest 159 159 foreach my $constant (@{CONSTANTS()}) { 160 push @command, ( '-' . $constant ), $values{$constant};160 push @command, ( '-' . $constant ), $values{$constant}; 161 161 } 162 162 foreach my $variable (@{VARIABLES()}) { … … 164 164 my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator 165 165 $stats->add_data(@$array); 166 push @command, ( '-' . $variable ), $stats->mean();166 push @command, ( '-' . $variable ), $stats->mean(); 167 167 } 168 168 … … 171 171 my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator 172 172 $stats->add_data(@backgrounds); 173 push @command, ( '-' . PHASE0_BG() ), $stats->mean();174 push @command, ( '-' . PHASE0_BG_MEAN_STDEV() ), ( $stats->standard_deviation() || 0 )173 push @command, ( '-' . PHASE0_BG() ), $stats->mean(); 174 push @command, ( '-' . PHASE0_BG_MEAN_STDEV() ), ( $stats->standard_deviation() || 0 ) 175 175 } 176 176 { 177 177 my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator 178 178 $stats->add_data(@variances); 179 push @command, ( '-' . PHASE0_BG_STDEV() ), sqrt( $stats->mean() );179 push @command, ( '-' . PHASE0_BG_STDEV() ), sqrt( $stats->mean() ); 180 180 } 181 181 … … 183 183 foreach my $detrendType (@{DETRENDS()}) { 184 184 if (lc($values{TYPE()}) =~ /$detrendType/) { 185 push @command, DETREND_FLAG;185 push @command, DETREND_FLAG; 186 186 last; 187 187 } … … 190 190 # Quote arguments with whitespace 191 191 for (my $i = 0; $i < scalar @command; $i++) { 192 if ($command[$i] =~ /\s/) {193 $command[$i] = "\'$command[$i]\'";194 }192 if ($command[$i] =~ /\s/) { 193 $command[$i] = "\'$command[$i]\'"; 194 } 195 195 } 196 196 … … 198 198 cache_run(command => \@command, verbose => 1); 199 199 unless ($success) { 200 warn ("Unable to run phase0 update for $exptag: $error_code");201 &my_die ($exptag, $error_code);200 warn ("Unable to run phase0 update for $exptag: $error_code"); 201 &my_die ($exptag, $error_code); 202 202 } 203 203 } … … 213 213 214 214 unless (defined $imfile->{$name}) { 215 warn ("Couldn't find value of $name for class_id=$source");216 &my_die ($exptag, $PS_EXIT_PROG_ERROR);215 warn ("Couldn't find value of $name for class_id=$source"); 216 &my_die ($exptag, $PS_EXIT_PROG_ERROR); 217 217 } 218 218 return $imfile->{$name}; … … 238 238 my $exit_code = $_[1]; 239 239 if ($exp_tag) { 240 system ("$p0tool -faultexp -exp_tag $exp_tag -code $exit_code");240 system ("$p0tool -faultexp -exp_tag $exp_tag -code $exit_code"); 241 241 } 242 242 exit $exit_code;
Note:
See TracChangeset
for help on using the changeset viewer.
