Changeset 18565 for trunk/ippScripts/scripts/ipp_serial_detrend.pl
- Timestamp:
- Jul 15, 2008, 11:35:22 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/ipp_serial_detrend.pl (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_serial_detrend.pl
r17172 r18565 12 12 use Data::Dumper; 13 13 14 my ($dbname, # Database name to use15 $workdir_global, # Global working directory16 $verbose, # Produce verbose output?14 my ($dbname, # Database name to use 15 $workdir_global, # Global working directory 16 $verbose, # Produce verbose output? 17 17 ); 18 18 GetOptions( 19 'dbname=s' => \$dbname,20 'workdir=s' => \$workdir_global,21 'verbose' => \$verbose,19 'dbname=s' => \$dbname, 20 'workdir=s' => \$workdir_global, 21 'verbose' => \$verbose, 22 22 ) or pod2usage( 2 ); 23 23 24 24 pod2usage( 25 -msg => "Required options: --dbname",26 -exitval => 3,27 ) unless defined $dbname;28 29 my $mdcParser = PS::IPP::Metadata::Config->new; # Metadata config parser25 -msg => "Required options: --dbname", 26 -exitval => 3, 27 ) unless defined $dbname; 28 29 my $mdcParser = PS::IPP::Metadata::Config->new; # Metadata config parser 30 30 my $ipprc = PS::IPP::Config->new(); # IPP configuration 31 31 … … 39 39 my $detrend_norm_apply = can_run('detrend_norm_apply.pl') or (warn "Can't find detrend_norm_apply.pl" and $missing_tools = 1); 40 40 my $detrend_norm_exp = can_run('detrend_norm_exp.pl') or (warn "Can't find detrend_norm_exp.pl" and $missing_tools = 1); 41 my $detrend_resid = can_run('detrend_resid.pl') or (warn "Can't find detrend_resid.pl" and $missing_tools = 1);42 my $detrend_re ject_imfile = can_run('detrend_reject_imfile.pl') or (warn "Can't find detrend_reject_imfile.pl" and $missing_tools = 1);41 my $detrend_resid_imfile = can_run('detrend_resid_imfile.pl') or (warn "Can't find detrend_resid_imfile.pl" and $missing_tools = 1); 42 my $detrend_resid_exp = can_run('detrend_resid_exp.pl') or (warn "Can't find detrend_resid_exp.pl" and $missing_tools = 1); 43 43 my $detrend_reject_exp = can_run('detrend_reject_exp.pl') or (warn "Can't find detrend_reject_exp.pl" and $missing_tools = 1); 44 44 die "Can't find required tools.\n" if $missing_tools; … … 48 48 my $command = "$dettool -toprocessedimfile -dbname $dbname"; 49 49 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 50 run( command => $command, verbose => 1 );50 run( command => $command, verbose => 1 ); 51 51 die "Unable to get detrend raw list: $error_code\n" if not $success; 52 52 … … 55 55 56 56 while ( scalar @whole > 0 ) { 57 my $value = shift @whole;58 push @single, $value;59 if ($value =~ /^\s*END\s*$/) {60 push @single, "\n";61 62 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ) or63 die "Unable to parse output from dettool.\n";64 65 foreach my $item (@$list) {66 my $det_id = $item->{det_id};67 my $det_type = $item->{det_type};68 my $exp_tag = $item->{exp_tag};69 my $exp_id = $item->{exp_id};70 my $class_id = $item->{class_id};71 my $uri = $item->{uri};72 my $camera = $item->{camera};73 my $workdir = $item->{workdir};74 my $reduction = $item->{reduction};75 76 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";77 die "No working directory specified.\n" unless defined $workdir;78 79 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detproc.$det_id" );80 $ipprc->outroot_prepare( $outroot );81 82 my $command = "$detrend_process_imfile --det_id $det_id --exp_tag $exp_tag --exp_id $exp_id --class_id $class_id --det_type $det_type --input_uri $uri --camera $camera --dbname $dbname --outroot $outroot";83 $command .= " --reduction $reduction" if defined $reduction;84 $command .= " --verbose" if defined $verbose;85 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =86 run( command => $command, verbose => 1 );87 die "Unable to do raw imfile processing on $exp_tag $class_id: $error_code\n" if not $success;88 }89 90 @single = ();91 92 } 57 my $value = shift @whole; 58 push @single, $value; 59 if ($value =~ /^\s*END\s*$/) { 60 push @single, "\n"; 61 62 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ) or 63 die "Unable to parse output from dettool.\n"; 64 65 foreach my $item (@$list) { 66 my $det_id = $item->{det_id}; 67 my $det_type = $item->{det_type}; 68 my $exp_tag = $item->{exp_tag}; 69 my $exp_id = $item->{exp_id}; 70 my $class_id = $item->{class_id}; 71 my $uri = $item->{uri}; 72 my $camera = $item->{camera}; 73 my $workdir = $item->{workdir}; 74 my $reduction = $item->{reduction}; 75 76 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 77 die "No working directory specified.\n" unless defined $workdir; 78 79 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detproc.$det_id" ); 80 $ipprc->outroot_prepare( $outroot ); 81 82 my $command = "$detrend_process_imfile --det_id $det_id --exp_tag $exp_tag --exp_id $exp_id --class_id $class_id --det_type $det_type --input_uri $uri --camera $camera --dbname $dbname --outroot $outroot"; 83 $command .= " --reduction $reduction" if defined $reduction; 84 $command .= " --verbose" if defined $verbose; 85 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 86 run( command => $command, verbose => 1 ); 87 die "Unable to do raw imfile processing on $exp_tag $class_id: $error_code\n" if not $success; 88 } 89 90 @single = (); 91 92 } 93 93 } 94 94 } … … 98 98 my $command = "$dettool -toprocessedexp -dbname $dbname"; 99 99 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 100 run( command => $command, verbose => 1 );100 run( command => $command, verbose => 1 ); 101 101 die "Unable to get detrend raw list: $error_code\n" if not $success; 102 102 my $list = parse_md_list( $mdcParser->parse( join( '', @$stdout_buf ) ) ) or 103 die "Unable to parse output from dettool.\n";104 105 foreach my $item (@$list) { 106 my $exp_tag = $item->{exp_tag};107 my $exp_id = $item->{exp_id};108 my $camera = $item->{camera};109 my $det_id = $item->{det_id};110 my $det_type = $item->{det_type};111 my $workdir = $item->{workdir};112 113 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";114 die "No working directory specified.\n" unless defined $workdir;115 116 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detproc.$det_id" );117 $ipprc->outroot_prepare( $outroot );118 119 my $command = "$detrend_process_exp --det_id $det_id --det_type $det_type --exp_tag $exp_tag --exp_id $exp_id --camera $camera --dbname $dbname --outroot $outroot";120 $command .= " --verbose" if defined $verbose;121 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =122 run( command => $command, verbose => 1 );123 die "Unable to do raw exposure processing on $det_id $exp_tag: $error_code\n" if not $success;103 die "Unable to parse output from dettool.\n"; 104 105 foreach my $item (@$list) { 106 my $exp_tag = $item->{exp_tag}; 107 my $exp_id = $item->{exp_id}; 108 my $camera = $item->{camera}; 109 my $det_id = $item->{det_id}; 110 my $det_type = $item->{det_type}; 111 my $workdir = $item->{workdir}; 112 113 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 114 die "No working directory specified.\n" unless defined $workdir; 115 116 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detproc.$det_id" ); 117 $ipprc->outroot_prepare( $outroot ); 118 119 my $command = "$detrend_process_exp --det_id $det_id --det_type $det_type --exp_tag $exp_tag --exp_id $exp_id --camera $camera --dbname $dbname --outroot $outroot"; 120 $command .= " --verbose" if defined $verbose; 121 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 122 run( command => $command, verbose => 1 ); 123 die "Unable to do raw exposure processing on $det_id $exp_tag: $error_code\n" if not $success; 124 124 } 125 125 } … … 129 129 my $command = "$dettool -tostacked -dbname $dbname"; 130 130 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 131 run( command => $command, verbose => 1 );131 run( command => $command, verbose => 1 ); 132 132 die "Unable to get stack list: $error_code\n" if not $success; 133 133 my $list = parse_md_list( $mdcParser->parse( join( '', @$stdout_buf ) ) ) or 134 die "Unable to parse output from dettool.\n";135 136 foreach my $item (@$list) { 137 my $det_id = $item->{det_id};138 my $iteration = $item->{iteration};139 my $class_id = $item->{class_id};140 my $det_type = $item->{det_type};141 my $camera = $item->{camera};142 my $workdir = $item->{workdir};143 my $reduction = $item->{reduction};144 145 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";146 die "No working directory specified.\n" unless defined $workdir;147 148 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.$det_id.$iteration" );149 $ipprc->outroot_prepare( $outroot );150 151 152 my $command = "$detrend_stack --det_id $det_id --iteration $iteration --class_id $class_id --det_type $det_type --camera $camera --dbname $dbname --outroot $outroot";153 $command .= " --reduction $reduction" if defined $reduction;154 $command .= " --verbose" if defined $verbose;155 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =156 run( command => $command, verbose => 1 );157 die "Unable to stack detrend $det_id $iteration $class_id: $error_code\n" if not $success;134 die "Unable to parse output from dettool.\n"; 135 136 foreach my $item (@$list) { 137 my $det_id = $item->{det_id}; 138 my $iteration = $item->{iteration}; 139 my $class_id = $item->{class_id}; 140 my $det_type = $item->{det_type}; 141 my $camera = $item->{camera}; 142 my $workdir = $item->{workdir}; 143 my $reduction = $item->{reduction}; 144 145 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 146 die "No working directory specified.\n" unless defined $workdir; 147 148 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.$det_id.$iteration" ); 149 $ipprc->outroot_prepare( $outroot ); 150 151 152 my $command = "$detrend_stack --det_id $det_id --iteration $iteration --class_id $class_id --det_type $det_type --camera $camera --dbname $dbname --outroot $outroot"; 153 $command .= " --reduction $reduction" if defined $reduction; 154 $command .= " --verbose" if defined $verbose; 155 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 156 run( command => $command, verbose => 1 ); 157 die "Unable to stack detrend $det_id $iteration $class_id: $error_code\n" if not $success; 158 158 } 159 159 } … … 163 163 my $command = "$dettool -tonormalizedstat -dbname $dbname"; 164 164 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 165 run( command => $command, verbose => 1 );165 run( command => $command, verbose => 1 ); 166 166 die "Unable to get normalise calculation list: $error_code\n" if not $success; 167 167 my $list = parse_md_list( $mdcParser->parse( join( '', @$stdout_buf ) ) ) or 168 die "Unable to parse output from dettool.\n";169 170 foreach my $item (@$list) { 171 my $det_id = $item->{det_id};172 my $iteration = $item->{iteration};173 my $det_type = $item->{det_type};174 my $camera = $item->{camera};175 my $workdir = $item->{workdir};176 177 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";178 die "No working directory specified.\n" unless defined $workdir;179 180 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.normstat.$det_id.$iteration" );181 $ipprc->outroot_prepare( $outroot );182 183 my $command = "$detrend_norm_calc --det_id $det_id --iteration $iteration --det_type $det_type --dbname $dbname --outroot $outroot";184 $command .= " --verbose" if defined $verbose;185 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =186 run( command => $command, verbose => 1 );187 die "Unable to calculate normalisation for $det_id $iteration: $error_code\n" if not $success;168 die "Unable to parse output from dettool.\n"; 169 170 foreach my $item (@$list) { 171 my $det_id = $item->{det_id}; 172 my $iteration = $item->{iteration}; 173 my $det_type = $item->{det_type}; 174 my $camera = $item->{camera}; 175 my $workdir = $item->{workdir}; 176 177 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 178 die "No working directory specified.\n" unless defined $workdir; 179 180 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.normstat.$det_id.$iteration" ); 181 $ipprc->outroot_prepare( $outroot ); 182 183 my $command = "$detrend_norm_calc --det_id $det_id --iteration $iteration --det_type $det_type --dbname $dbname --outroot $outroot"; 184 $command .= " --verbose" if defined $verbose; 185 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 186 run( command => $command, verbose => 1 ); 187 die "Unable to calculate normalisation for $det_id $iteration: $error_code\n" if not $success; 188 188 } 189 189 } … … 193 193 my $command = "$dettool -tonormalize -dbname $dbname"; 194 194 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 195 run( command => $command, verbose => 1 );195 run( command => $command, verbose => 1 ); 196 196 die "Unable to get normalisation list: $error_code\n" if not $success; 197 197 my $list = parse_md_list( $mdcParser->parse( join( '', @$stdout_buf ) ) ) or 198 die "Unable to parse output from dettool.\n";199 200 foreach my $item (@$list) { 201 my $det_id = $item->{det_id};202 my $iteration = $item->{iteration};203 my $det_type = $item->{det_type};204 my $class_id = $item->{class_id};205 my $value = $item->{norm};206 my $uri = $item->{uri};207 my $camera = $item->{camera};208 my $workdir = $item->{workdir};209 210 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";211 die "No working directory specified.\n" unless defined $workdir;212 213 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.norm.$det_id.$iteration" );214 $ipprc->outroot_prepare( $outroot );215 216 my $command = "$detrend_norm_apply --det_id $det_id --iteration $iteration --class_id $class_id --value $value --input_uri $uri --camera $camera --det_type $det_type --dbname $dbname --outroot $outroot";217 $command .= " --verbose" if defined $verbose;218 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =219 run( command => $command, verbose => 1 );220 die "Unable to apply normalisation for $det_id $iteration $class_id: $error_code\n" if not $success;198 die "Unable to parse output from dettool.\n"; 199 200 foreach my $item (@$list) { 201 my $det_id = $item->{det_id}; 202 my $iteration = $item->{iteration}; 203 my $det_type = $item->{det_type}; 204 my $class_id = $item->{class_id}; 205 my $value = $item->{norm}; 206 my $uri = $item->{uri}; 207 my $camera = $item->{camera}; 208 my $workdir = $item->{workdir}; 209 210 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 211 die "No working directory specified.\n" unless defined $workdir; 212 213 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.norm.$det_id.$iteration" ); 214 $ipprc->outroot_prepare( $outroot ); 215 216 my $command = "$detrend_norm_apply --det_id $det_id --iteration $iteration --class_id $class_id --value $value --input_uri $uri --camera $camera --det_type $det_type --dbname $dbname --outroot $outroot"; 217 $command .= " --verbose" if defined $verbose; 218 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 219 run( command => $command, verbose => 1 ); 220 die "Unable to apply normalisation for $det_id $iteration $class_id: $error_code\n" if not $success; 221 221 } 222 222 } … … 226 226 my $command = "$dettool -tonormalizedexp -dbname $dbname"; 227 227 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 228 run( command => $command, verbose => 1 );228 run( command => $command, verbose => 1 ); 229 229 die "Unable to get normalised exposures list: $error_code\n" if not $success; 230 230 my $list = parse_md_list( $mdcParser->parse( join( '', @$stdout_buf ) ) ) or 231 die "Unable to parse output from dettool.\n";232 233 foreach my $item (@$list) { 234 my $det_id = $item->{det_id};235 my $iteration = $item->{iteration};236 my $det_type = $item->{det_type};237 my $class_id = $item->{class_id};238 my $value = $item->{norm};239 my $uri = $item->{uri};240 my $camera = $item->{camera};241 my $workdir = $item->{workdir};242 243 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";244 die "No working directory specified.\n" unless defined $workdir;245 246 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.normexp.$det_id.$iteration" );247 $ipprc->outroot_prepare( $outroot );248 249 my $command = "$detrend_norm_exp --det_id $det_id --iteration $iteration --camera $camera --det_type $det_type --dbname $dbname --outroot $outroot";250 $command .= " --verbose" if defined $verbose;251 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =252 run( command => $command, verbose => 1 );253 die "Unable to examine normalised exposure for $det_id $iteration: $error_code\n" if not $success;231 die "Unable to parse output from dettool.\n"; 232 233 foreach my $item (@$list) { 234 my $det_id = $item->{det_id}; 235 my $iteration = $item->{iteration}; 236 my $det_type = $item->{det_type}; 237 my $class_id = $item->{class_id}; 238 my $value = $item->{norm}; 239 my $uri = $item->{uri}; 240 my $camera = $item->{camera}; 241 my $workdir = $item->{workdir}; 242 243 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 244 die "No working directory specified.\n" unless defined $workdir; 245 246 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.normexp.$det_id.$iteration" ); 247 $ipprc->outroot_prepare( $outroot ); 248 249 my $command = "$detrend_norm_exp --det_id $det_id --iteration $iteration --camera $camera --det_type $det_type --dbname $dbname --outroot $outroot"; 250 $command .= " --verbose" if defined $verbose; 251 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 252 run( command => $command, verbose => 1 ); 253 die "Unable to examine normalised exposure for $det_id $iteration: $error_code\n" if not $success; 254 254 } 255 255 } … … 259 259 my $command = "$dettool -toresidimfile -dbname $dbname"; 260 260 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 261 run( command => $command, verbose => 1 );261 run( command => $command, verbose => 1 ); 262 262 die "Unable to get residual processing list: $error_code\n" if not $success; 263 263 … … 266 266 267 267 while ( scalar @whole > 0 ) { 268 my $value = shift @whole;269 push @single, $value;270 if ($value =~ /^\s*END\s*$/) {271 push @single, "\n";272 273 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ) or274 die "Unable to parse output from dettool.\n";275 276 foreach my $item (@$list) {277 my $exp_tag = $item->{exp_tag};278 my $exp_id = $item->{exp_id};279 my $camera = $item->{camera};280 my $det_id = $item->{det_id};281 my $iteration = $item->{iteration};282 my $class_id = $item->{class_id};283 my $det_type = $item->{det_type};284 my $detrend = $item->{det_uri};285 my $uri = $item->{uri};286 my $mode = $item->{mode};287 my $workdir = $item->{workdir};288 my $reduction = $item->{reduction};289 290 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";291 die "No working directory specified.\n" unless defined $workdir;292 293 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detresid.$det_id.$iteration" );294 $ipprc->outroot_prepare( $outroot );295 296 my $command = "$detrend_resid--det_id $det_id --iteration $iteration --exp_tag $exp_tag --exp_id $exp_id --class_id $class_id --det_type $det_type --camera $camera --input_uri $uri --mode $mode --dbname $dbname --outroot $outroot";297 $command .= " --reduction $reduction" if defined $reduction;298 $command .= " --detrend $detrend" if defined $detrend;299 $command .= " --verbose" if defined $verbose;300 301 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =302 run( command => $command, verbose => 1 );303 die "Unable to do residual processing on $exp_tag $class_id: $error_code\n" if not $success;304 }305 306 @single = ();307 308 }268 my $value = shift @whole; 269 push @single, $value; 270 if ($value =~ /^\s*END\s*$/) { 271 push @single, "\n"; 272 273 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ) or 274 die "Unable to parse output from dettool.\n"; 275 276 foreach my $item (@$list) { 277 my $exp_tag = $item->{exp_tag}; 278 my $exp_id = $item->{exp_id}; 279 my $camera = $item->{camera}; 280 my $det_id = $item->{det_id}; 281 my $iteration = $item->{iteration}; 282 my $class_id = $item->{class_id}; 283 my $det_type = $item->{det_type}; 284 my $detrend = $item->{det_uri}; 285 my $uri = $item->{uri}; 286 my $mode = $item->{mode}; 287 my $workdir = $item->{workdir}; 288 my $reduction = $item->{reduction}; 289 290 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 291 die "No working directory specified.\n" unless defined $workdir; 292 293 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detresid.$det_id.$iteration" ); 294 $ipprc->outroot_prepare( $outroot ); 295 296 my $command = "$detrend_resid_imfile --det_id $det_id --iteration $iteration --exp_tag $exp_tag --exp_id $exp_id --class_id $class_id --det_type $det_type --camera $camera --input_uri $uri --mode $mode --dbname $dbname --outroot $outroot"; 297 $command .= " --reduction $reduction" if defined $reduction; 298 $command .= " --detrend $detrend" if defined $detrend; 299 $command .= " --verbose" if defined $verbose; 300 301 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 302 run( command => $command, verbose => 1 ); 303 die "Unable to do residual processing on $exp_tag $class_id: $error_code\n" if not $success; 304 } 305 306 @single = (); 307 308 } 309 309 } 310 310 } … … 314 314 my $command = "$dettool -toresidexp -dbname $dbname"; 315 315 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 316 run( command => $command, verbose => 1 );316 run( command => $command, verbose => 1 ); 317 317 die "Unable to get residual imfile list: $error_code\n" if not $success; 318 318 my $list = parse_md_list( $mdcParser->parse( join( '', @$stdout_buf ) ) ) or 319 die "Unable to parse output from dettool.\n";320 321 foreach my $item (@$list) { 322 my $exp_tag = $item->{exp_tag};323 my $exp_id = $item->{exp_id};324 my $camera = $item->{camera};325 my $det_id = $item->{det_id};326 my $iteration = $item->{iteration};327 my $det_type = $item->{det_type};328 my $workdir = $item->{workdir};329 330 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";331 die "No working directory specified.\n" unless defined $workdir;332 333 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detresid.$det_id.$iteration" );334 $ipprc->outroot_prepare( $outroot );335 336 my $command = "$detrend_reject_imfile--det_id $det_id --iteration $iteration --exp_tag $exp_tag --exp_id $exp_id --det_type $det_type --camera $camera --dbname $dbname --outroot $outroot";337 $command .= " --verbose" if defined $verbose;338 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =339 run( command => $command, verbose => 1 );340 die "Unable to do imfile rejection on $exp_tag $det_id $iteration: $error_code\n" if not $success;319 die "Unable to parse output from dettool.\n"; 320 321 foreach my $item (@$list) { 322 my $exp_tag = $item->{exp_tag}; 323 my $exp_id = $item->{exp_id}; 324 my $camera = $item->{camera}; 325 my $det_id = $item->{det_id}; 326 my $iteration = $item->{iteration}; 327 my $det_type = $item->{det_type}; 328 my $workdir = $item->{workdir}; 329 330 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 331 die "No working directory specified.\n" unless defined $workdir; 332 333 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", $exp_tag, "$exp_tag.detresid.$det_id.$iteration" ); 334 $ipprc->outroot_prepare( $outroot ); 335 336 my $command = "$detrend_resid_exp --det_id $det_id --iteration $iteration --exp_tag $exp_tag --exp_id $exp_id --det_type $det_type --camera $camera --dbname $dbname --outroot $outroot"; 337 $command .= " --verbose" if defined $verbose; 338 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 339 run( command => $command, verbose => 1 ); 340 die "Unable to do imfile rejection on $exp_tag $det_id $iteration: $error_code\n" if not $success; 341 341 } 342 342 } … … 346 346 my $command = "$dettool -todetrunsummary -dbname $dbname"; 347 347 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 348 run( command => $command, verbose => 1 );348 run( command => $command, verbose => 1 ); 349 349 die "Unable to get residual exposure list: $error_code\n" if not $success; 350 350 my $list = parse_md_list( $mdcParser->parse( join( '', @$stdout_buf ) ) ) or 351 die "Unable to parse output from dettool.\n";352 353 foreach my $item (@$list) { 354 my $camera = $item->{camera};355 my $det_id = $item->{det_id};356 my $iteration = $item->{iteration};357 my $det_type = $item->{det_type};358 my $workdir = $item->{workdir};359 360 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL";361 die "No working directory specified.\n" unless defined $workdir;362 363 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.$det_id.$iteration.detreject" );364 $ipprc->outroot_prepare( $outroot );365 366 my $command = "$detrend_reject_exp --det_id $det_id --iteration $iteration --det_type $det_type --camera $camera --dbname $dbname --outroot $outroot";367 $command .= " --verbose" if defined $verbose;368 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =369 run( command => $command, verbose => 1 );370 die "Unable to do exposure rejection on $det_id $iteration: $error_code\n" if not $success;351 die "Unable to parse output from dettool.\n"; 352 353 foreach my $item (@$list) { 354 my $camera = $item->{camera}; 355 my $det_id = $item->{det_id}; 356 my $iteration = $item->{iteration}; 357 my $det_type = $item->{det_type}; 358 my $workdir = $item->{workdir}; 359 360 $workdir = $workdir_global unless defined $workdir and $workdir ne "NULL"; 361 die "No working directory specified.\n" unless defined $workdir; 362 363 my $outroot = caturi( $workdir, "$camera.$det_type.$det_id", "$camera.$det_type.$det_id.$iteration.detreject" ); 364 $ipprc->outroot_prepare( $outroot ); 365 366 my $command = "$detrend_reject_exp --det_id $det_id --iteration $iteration --det_type $det_type --camera $camera --dbname $dbname --outroot $outroot"; 367 $command .= " --verbose" if defined $verbose; 368 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 369 run( command => $command, verbose => 1 ); 370 die "Unable to do exposure rejection on $det_id $iteration: $error_code\n" if not $success; 371 371 } 372 372 }
Note:
See TracChangeset
for help on using the changeset viewer.
