IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 17, 2010, 12:04:36 PM (16 years ago)
Author:
bills
Message:

for warp_bg and chip_bg stages include the variance image from the original chip or warp run

File:
1 edited

Legend:

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

    r28753 r28942  
    5858my $missing_tools;
    5959my $streaksrelease   = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1);
     60my $bgtool   = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1);
    6061if ($missing_tools) {
    6162    warn("Can't find required tools.");
     
    224225}
    225226
     227if (!$clean) {
     228    if ($stage eq 'chip_bg') {
     229        # add the variance file from the original chipRun
     230        my $command = "$bgtool -listchip -chip_bg_id $stage_id -class_id $component";
     231        $command .= " -dbname $dbname" if $dbname;
     232        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     233            run(command => $command, verbose => $verbose);
     234        unless ($success) {
     235            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     236            &my_die("Unable to perform $command: $error_code", $component, $error_code);
     237        }
     238        my $mdcParser = PS::IPP::Metadata::Config->new;
     239        my $list = $mdcParser->parse( join "", @$stdout_buf) or
     240            &my_die("Unable to parse bgtool metadata", $component, $PS_EXIT_SYS_ERROR);
     241        my $parsed = parse_md_list($list);
     242
     243        # result is an array with one element
     244        my $chip_data = $parsed->[0];
     245
     246        my $chip_path_base = $chip_data->{path_base};
     247        $variance = $ipprc->filename('PPIMAGE.CHIP.VARIANCE', $chip_path_base, $component) or
     248            &my_die("Unable to resolve variance file name from $chip_path_base", $component, $PS_EXIT_SYS_ERROR);
     249
     250    } elsif ($stage eq 'warp_bg') {
     251        # add the variance file from the original warpRun
     252        my $command = "$bgtool -listwarp -warp_bg_id $stage_id -skycell_id $component";
     253        $command .= " -dbname $dbname" if $dbname;
     254        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     255            run(command => $command, verbose => $verbose);
     256        unless ($success) {
     257            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     258            &my_die("Unable to perform $command: $error_code", $component, $error_code);
     259        }
     260        my $mdcParser = PS::IPP::Metadata::Config->new;
     261        my $list = $mdcParser->parse( join "", @$stdout_buf) or
     262            &my_die("Unable to parse bgtool metadata", $component, $PS_EXIT_SYS_ERROR);
     263        my $parsed = parse_md_list($list);
     264        my $warp_data = $parsed->[0];
     265        my $warp_path_base = $warp_data->{path_base};
     266        $variance = $ipprc->filename('PSWARP.OUTPUT.VARIANCE', $warp_path_base) or
     267            &my_die("Unable to resolve variance file name from $warp_path_base", $component, $PS_EXIT_SYS_ERROR);
     268    }
     269}
     270
    226271if ($nan_masked_pixels) {
    227272    # One last check as to whether magic has been applied to the inputs
     
    239284        if (($stage ne "chip_bg") and ($stage ne "warp_bg")) {
    240285            &my_die("no variance image found in file list", $component, $PS_EXIT_CONFIG_ERROR) if !$variance;
     286        } else {
     287            &my_die("variance is not defined", $component, $PS_EXIT_CONFIG_ERROR) if !$variance;
    241288        }
    242289    }
Note: See TracChangeset for help on using the changeset viewer.