IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 14, 2023, 12:59:01 PM (3 years ago)
Author:
tdeboer
Message:

burntool handling/parsing updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/chip_imfile.pl

    r40387 r42394  
    8686my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR );
    8787
     88my $burntoolStateGood;
     89my $burntoolStateGoodUpdate;
    8890my $neb;
    8991my $scheme = file_scheme($outroot);
     
    292294
    293295        ## 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        }
    317331
    318332        if ($run_state eq 'new') {
    319333            print "burntool state vs burntoolStateGood : $burntoolState vs $burntoolStateGood\n";
     334            $useBestBurntool = 0 if (abs($burntoolState) >= $burntoolStateGoodUpdate);
    320335        } else {
    321336            # if doing update go ahead if burntoolState is at least at BURNTOOL.STATE.GOOD.UPDATE
     
    369384        if ($ppImageApplyBurntool && ($burntoolState == -1 * $burntoolStateGood)) {
    370385            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            }
    372391            my $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
    373392            if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) {
     
    416435            if ($burntoolState == -1 * $burntoolStateGood) {   # Burntool information stored in an external table.
    417436                $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                }
    419442                $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
    420443                if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) {
Note: See TracChangeset for help on using the changeset viewer.