IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 19, 2010, 6:52:05 PM (16 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/ippScripts/scripts/dist_bundle.pl

    r28794 r28981  
    5353                      'PPSTACK.OUTPUT.MASK' => 'mask',
    5454                      'PPSTACK.OUTPUT.VARIANCE' => 'variance' );
     55my %sky_cleaned   = ( 'PSPHOT.STACK.OUTPUT.IMAGE' => 'image',
     56                      'PSPHOT.STACK.OUTPUT.MASK' => 'mask',
     57                      'PSPHOT.STACK.OUTPUT.VARIANCE' => 'variance' );
    5558
    5659
     
    5861my $missing_tools;
    5962my $streaksrelease   = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1);
     63my $bgtool   = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1);
    6064if ($missing_tools) {
    6165    warn("Can't find required tools.");
     
    224228}
    225229
     230if (!$clean) {
     231    if ($stage eq 'chip_bg') {
     232        # add the variance file from the original chipRun
     233        my $command = "$bgtool -listchip -chip_bg_id $stage_id -class_id $component";
     234        $command .= " -dbname $dbname" if $dbname;
     235        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     236            run(command => $command, verbose => $verbose);
     237        unless ($success) {
     238            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     239            &my_die("Unable to perform $command: $error_code", $component, $error_code);
     240        }
     241        my $mdcParser = PS::IPP::Metadata::Config->new;
     242        my $list = $mdcParser->parse( join "", @$stdout_buf) or
     243            &my_die("Unable to parse bgtool metadata", $component, $PS_EXIT_SYS_ERROR);
     244        my $parsed = parse_md_list($list);
     245
     246        # result is an array with one element
     247        my $chip_data = $parsed->[0];
     248
     249        my $chip_path_base = $chip_data->{path_base};
     250        $variance = $ipprc->filename('PPIMAGE.CHIP.VARIANCE', $chip_path_base, $component) or
     251            &my_die("Unable to resolve variance file name from $chip_path_base", $component, $PS_EXIT_SYS_ERROR);
     252
     253    } elsif ($stage eq 'warp_bg') {
     254        # add the variance file from the original warpRun
     255        my $command = "$bgtool -listwarp -warp_bg_id $stage_id -skycell_id $component";
     256        $command .= " -dbname $dbname" if $dbname;
     257        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     258            run(command => $command, verbose => $verbose);
     259        unless ($success) {
     260            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     261            &my_die("Unable to perform $command: $error_code", $component, $error_code);
     262        }
     263        my $mdcParser = PS::IPP::Metadata::Config->new;
     264        my $list = $mdcParser->parse( join "", @$stdout_buf) or
     265            &my_die("Unable to parse bgtool metadata", $component, $PS_EXIT_SYS_ERROR);
     266        my $parsed = parse_md_list($list);
     267        my $warp_data = $parsed->[0];
     268        my $warp_path_base = $warp_data->{path_base};
     269        $variance = $ipprc->filename('PSWARP.OUTPUT.VARIANCE', $warp_path_base) or
     270            &my_die("Unable to resolve variance file name from $warp_path_base", $component, $PS_EXIT_SYS_ERROR);
     271    }
     272}
     273
    226274if ($nan_masked_pixels) {
    227275    # One last check as to whether magic has been applied to the inputs
     
    239287        if (($stage ne "chip_bg") and ($stage ne "warp_bg")) {
    240288            &my_die("no variance image found in file list", $component, $PS_EXIT_CONFIG_ERROR) if !$variance;
     289        } else {
     290            &my_die("variance is not defined", $component, $PS_EXIT_CONFIG_ERROR) if !$variance;
    241291        }
    242292    }
     
    373423    } elsif ($stage eq "stack") {
    374424        $type = $stack_cleaned{$rule};
     425    } elsif ($stage eq "sky") {
     426        $type = $sky_cleaned{$rule};
    375427    } else {
    376428        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
     
    453505    } elsif ($stage eq "stack") {
    454506        $config_file_rule = "PPSTACK.CONFIG";
     507    } elsif ($stage eq "sky") {
     508        $config_file_rule = "PSPHOT.STACK.CONFIG";
    455509    } else {
    456510        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
Note: See TracChangeset for help on using the changeset viewer.