IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42394


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

burntool handling/parsing updates

Location:
trunk/ippScripts/scripts
Files:
7 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)))) {
  • trunk/ippScripts/scripts/dist_bundle.pl

    r40823 r42394  
    7575my $file_cmd   = can_run('file') or (warn "can't find program file" and $missing_tools = 1);
    7676my $zcat   = can_run('zcat') or (warn "can't find program zcat" and $missing_tools = 1);
     77my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    7778if ($missing_tools) {
    7879    warn("Can't find required tools.");
     
    131132}
    132133
     134# Determine the value of a "good" burntool run.
     135my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
     136my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     137    run ( command => $config_cmd, verbose => $verbose);
     138unless ($success) {
     139    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     140    &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
     141}
     142
     143my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
     144    &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
     145
     146my $burntoolStateGood = 999;
     147foreach my $cfg (@$recipeData) {
     148    if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
     149        $burntoolStateGood = $cfg->{value};
     150    }
     151}
     152if ($burntoolStateGood == 999) {
     153    &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR);
     154}
     155
     156
    133157$ipprc->redirect_output($logfile) if $logfile;
    134158
     
    144168# note: We my_die in get_file_list if something goes wrong.
    145169
    146 my $file_list = get_file_list($stage, $component, $path_base, $clean, $num_sky_inputs);
     170my $file_list = get_file_list($stage, $component, $path_base, $clean, $num_sky_inputs,$burntoolStateGood);
    147171
    148172if (($stage ne 'raw') and ($stage ne 'fake') and ($stage ne 'stack_summary') and !$poor_quality) {
     
    555579    my $clean = shift;
    556580    my $num_sky_inputs = shift;
     581    my $bt_state_good = shift;
    557582
    558583    my @file_list;
     
    576601                my %burntool_table;
    577602                $burntool_table{file_rule} = "BURNTOOL.TABLE";
    578                 $burntool_table{name} = "$path_base.burn.tbl";
     603               
     604                if($bt_state_good == 15) {
     605                    $burntool_table{name} = "$path_base.burn.v15.tbl"; 
     606                } else {
     607                    $burntool_table{name} = "$path_base.burn.tbl";             
     608                }               
    579609                push @file_list, \%burntool_table;
    580610            }
  • trunk/ippScripts/scripts/ipp_apply_burntool.pl

    r31906 r42394  
    146146
    147147    my $outTable  = $file->{uri};
    148     $outTable  =~ s/fits$/burn.tbl/;
     148   
     149    if($burntoolStateGood == 15) {
     150        $outTable =~ s/fits$/burn.v15.tbl/;         
     151    } else {
     152        $outTable =~ s/fits$/burn.tbl/;             
     153    }
    149154    my $outTableReal = $ipprc->file_resolve($outTable, 1);
    150155
  • trunk/ippScripts/scripts/ipp_apply_burntool_fix.pl

    r37313 r42394  
    1515my $missing_tools;
    1616my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1);
     17my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    1718my $burntool = can_run('ipp_apply_burntool_single.pl') or (warn "Can't find ipp_burntool_apply_single.pl" and $missing_tools = 1);
    1819if ($missing_tools) {
     
    6566die "failed to find uri in regtool output" unless $uri;
    6667
     68# Determine the value of a "good" burntool run.
     69my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
     70my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     71    run ( command => $config_cmd, verbose => $verbose);
     72unless ($success) {
     73    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     74    carp("Unable to perform ppConfigDUmp $command: $error_code");
     75    exit $error_code;
     76}
     77
     78my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or die("Unable to parse Config metadata");
     79
     80my $burntoolStateGood = 999;
     81foreach my $cfg (@$recipeData) {
     82    if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
     83        $burntoolStateGood = $cfg->{value};
     84    }
     85}
     86if ($burntoolStateGood == 999) {
     87    die("Failed to determine BURNTOOL.STATE.GOOD");
     88}
     89
     90
    6791# Construct burntool table name
    6892my $table;
    69 ($table = $uri) =~ s/\.fits/\.burn\.tbl/;
     93if($burntoolStateGood == 15) {
     94    ($table = $uri) =~ s/\.fits/\.burn\.v15\.tbl/;     
     95} else {
     96    ($table = $uri) =~ s/\.fits/\.burn\.tbl/;           
     97}
     98
    7099print "$table\n";
    71100
  • trunk/ippScripts/scripts/ipp_apply_burntool_single.pl

    r37077 r42394  
    178178   
    179179    my $outTable  = $this_uri;
    180     $outTable  =~ s/fits$/burn.tbl/;
     180    if($burntoolStateGood == 15) {
     181        $outTable =~ s/fits$/burn.v15.tbl/;         
     182    } else {
     183        $outTable =~ s/fits$/burn.tbl/;             
     184    }
     185
    181186    my $outTableReal = $ipprc->file_resolve($outTable, 1);
    182187    if (!$outTableReal) {
     
    188193    if ($previous_uri) {
    189194        $previousTable = $previous_uri;
    190         $previousTable =~ s/fits$/burn.tbl/;
     195        if($burntoolStateGood == 15) {
     196            $previousTable =~ s/fits$/burn.v15.tbl/;       
     197        } else {
     198            $previousTable =~ s/fits$/burn.tbl/;           
     199        }
    191200        $previousTableReal = $ipprc->file_resolve($previousTable, 0);
    192201        if (!$previousTableReal) {
     
    219228# burntool
    220229    if (($previousTableReal)&&($previousTableReal ne '')) {
     230        print "Running: $burntool $tempPixels in=$previousTableReal out=$outTableReal tableonly=t persist=t\n";
    221231        $status = vsystem ("$burntool $tempPixels in=$previousTableReal out=$outTableReal tableonly=t persist=t", $REALRUN);
    222232    }
    223233    else {
     234        print "Running: $burntool $tempPixels out=$outTableReal tableonly=t persist=t\n";
    224235        $status = vsystem ("$burntool $tempPixels out=$outTableReal tableonly=t persist=t", $REALRUN);
    225236    }
  • trunk/ippScripts/scripts/permcheck.pl

    r39971 r42394  
    375375            if ($product eq 'BURN.TABLE.DOESNT.HAVE.A.PRODUCT') {
    376376                my $bt_state = $entry->{burntool_state};
    377                 if ($bt_state != -14) { next; }
     377                if ($bt_state > -14) { next; }
    378378                my $bt_file = $entry->{uri};
    379                 $bt_file    =~ s/fits$/burn.tbl/;
     379
     380                if($bt_state <= -15) {
     381                  $bt_file =~ s/fits$/burn.v15.tbl/;       
     382                } else {
     383                  $bt_file =~ s/fits$/burn.tbl/;           
     384                }
    380385                push @keys, $bt_file;
    381386
  • trunk/ippScripts/scripts/sc_prepare_chip.pl

    r38168 r42394  
    260260        }
    261261
     262
     263        # Determine the value of a "good" burntool run.
     264        my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
     265        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     266            run ( command => $config_cmd, verbose => $verbose);
     267        unless ($success) {
     268            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     269            &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $class_id, $PS_EXIT_SYS_ERROR);
     270        }
     271
     272        my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
     273            &my_die("Unable to parse metadata config doc", $exp_id, $class_id, $PS_EXIT_SYS_ERROR);
     274
     275        my $burntoolStateGood = 999;
     276        foreach my $cfg (@$recipeData) {
     277            if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
     278                $burntoolStateGood = $cfg->{value};
     279            }
     280        }
     281        if ($burntoolStateGood == 999) {
     282            &my_die("Failed to determine BURNTOOL.STATE.GOOD", $exp_id, $class_id, $PS_EXIT_SYS_ERROR);
     283        }
     284
     285
    262286        # The image exists, so continue.  This resets the variables, but also outputs the file locations.
    263287        ($ipp_uri, $remote_uri) = uri_to_outputs_raw($uri);
    264288        my $btt = $uri;
    265         $btt =~ s/fits$/burn.tbl/;
    266 
     289        if($burntoolStateGood == 15) {
     290            $btt =~ s/fits$/burn.v15.tbl/;   
     291        } else {
     292            $btt =~ s/fits$/burn.tbl/;     
     293        }
     294       
    267295        # Check burntool table for existance, and if it doesn't, regenerate it.
    268296        my ($ipp_btt, $remote_btt) = uri_convert($btt);
Note: See TracChangeset for help on using the changeset viewer.