Changeset 42394 for trunk/ippScripts/scripts/chip_imfile.pl
- Timestamp:
- Feb 14, 2023, 12:59:01 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/chip_imfile.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/chip_imfile.pl
r40387 r42394 86 86 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR ); 87 87 88 my $burntoolStateGood; 89 my $burntoolStateGoodUpdate; 88 90 my $neb; 89 91 my $scheme = file_scheme($outroot); … … 292 294 293 295 ## Read camera config to get the current good burntool state : 294 ## XXX This is extremely slow. Any better way to do this? 295 ## my $camera_config_cmd = "$ppConfigDump -camera $camera -dump-camera -"; 296 ## ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 297 ## run(command => $camera_config_cmd, verbose => 0); 298 ## unless ($success) { 299 ## $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 300 ## &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 301 ## } 302 ## 303 ## my $camData = $mdcParser->parse(join "", @$stdout_buf) or 304 ## &my_die("Unable to parse ppConfigDump metadata", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 305 306 ## XXX short term hack until we have a C-based parser 307 my $burntoolStateGood = 14; 308 my $burntoolStateGoodUpdate = 13; 309 ## foreach my $camEntry (@$camData) { 310 ## if ($camEntry->{name} eq "BURNTOOL.STATE.GOOD") { 311 ## $burntoolStateGood = $camEntry->{value}; 312 ## } 313 ## if ($camEntry->{name} eq "BURNTOOL.STATE.GOOD.UPDATE") { 314 ## $burntoolStateGoodUpdate = $camEntry->{value}; 315 ## } 316 ## } 296 my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -get-key BURNTOOL.STATE.GOOD"; 297 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 298 IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose); 299 unless ($success) { 300 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 301 warn ("Unable to perform ppConfigDump"); 302 exit($error_code); 303 } 304 305 # This is ugly, but doing a full parse for one entry is a bit wasteful. 306 foreach my $line (split /\n/, (join "", @$stdout_buf)) { 307 if ($line =~ /BURNTOOL.STATE.GOOD/) { 308 $line =~ s/^\s+//; 309 $burntoolStateGood = (split /\s+/, $line)[2]; 310 last; 311 } 312 } 313 314 my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -get-key BURNTOOL.STATE.GOOD.UPDATE"; 315 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 316 IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose); 317 unless ($success) { 318 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 319 warn ("Unable to perform ppConfigDump"); 320 exit($error_code); 321 } 322 323 # This is ugly, but doing a full parse for one entry is a bit wasteful. 324 foreach my $line (split /\n/, (join "", @$stdout_buf)) { 325 if ($line =~ /BURNTOOL.STATE.GOOD.UPDATE/) { 326 $line =~ s/^\s+//; 327 $burntoolStateGoodUpdate = (split /\s+/, $line)[2]; 328 last; 329 } 330 } 317 331 318 332 if ($run_state eq 'new') { 319 333 print "burntool state vs burntoolStateGood : $burntoolState vs $burntoolStateGood\n"; 334 $useBestBurntool = 0 if (abs($burntoolState) >= $burntoolStateGoodUpdate); 320 335 } else { 321 336 # if doing update go ahead if burntoolState is at least at BURNTOOL.STATE.GOOD.UPDATE … … 369 384 if ($ppImageApplyBurntool && ($burntoolState == -1 * $burntoolStateGood)) { 370 385 my $burntoolTable_uri = $uri; 371 $burntoolTable_uri =~ s/fits$/burn.tbl/; 386 if($burntoolStateGood >= 15) { 387 $burntoolTable_uri =~ s/fits$/burn.v15.tbl/; 388 } else { 389 $burntoolTable_uri =~ s/fits$/burn.tbl/; 390 } 372 391 my $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 373 392 if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) { … … 416 435 if ($burntoolState == -1 * $burntoolStateGood) { # Burntool information stored in an external table. 417 436 $burntoolTable_uri = $uri; 418 $burntoolTable_uri =~ s/fits$/burn.tbl/; 437 if($burntoolStateGood >= 15) { 438 $burntoolTable_uri =~ s/fits$/burn.v15.tbl/; 439 } else { 440 $burntoolTable_uri =~ s/fits$/burn.tbl/; 441 } 419 442 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 420 443 if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) {
Note:
See TracChangeset
for help on using the changeset viewer.
