IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 6, 2011, 1:56:22 PM (15 years ago)
Author:
watersc1
Message:

merge from trunk before working on new stacking code

Location:
branches/czw_branch/20110406
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20110406

  • branches/czw_branch/20110406/ippScripts/scripts/dist_bundle.pl

    r30922 r31606  
    6262my $streaksrelease   = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1);
    6363my $bgtool   = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1);
     64my $staticskytool   = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1);
    6465my $file_cmd   = can_run('file') or (warn "can't find program file" and $missing_tools = 1);
    6566my $zcat   = can_run('zcat') or (warn "can't find program zcat" and $missing_tools = 1);
     
    106107    defined $stage_id and
    107108    defined $component and
    108     defined $exp_type and
    109109    defined $path_base and
    110110    defined $outroot;
    111111
     112if ($stage eq 'raw' and !$clean and !$no_magic) {
     113   
     114    # for raw stage need to have exposure type defined and if the type is OBJECT we need
     115    # a chip_path_base so we can find the chip mask file
     116    if (!defined $exp_type or ($exp_type eq 'OBJECT' and !defined $chip_path_base)) {
     117        pod2usage( -msg => "Required options: --chip_path_base --exp_type for raw stage", -exitval => 3);
     118    }
     119}
     120
    112121$ipprc->redirect_output($logfile) if $logfile;
    113122
    114 if ($stage eq 'raw' and !$clean and !$no_magic) {
    115     # need to be able to find chip mask file
    116     if ($exp_type eq 'OBJECT' and !defined $chip_path_base) {
    117         pod2usage( -msg => "Required options: --chip_path_base for raw stage", -exitval => 3);
    118     }
    119 }
    120 
    121123$ipprc->define_camera($camera);
    122124
    123125$ipprc->outroot_prepare($outroot);
    124126
     127my $num_sky_inputs;
     128if ($stage eq 'sky') {
     129    $num_sky_inputs = get_num_sky_inputs($stage_id);
     130}
    125131# Get the list of data products for this component
    126132# note: We my_die in get_file_list if something goes wrong.
    127133
    128 my $file_list = get_file_list($stage, $component, $path_base, $clean);
     134my $file_list = get_file_list($stage, $component, $path_base, $clean, $num_sky_inputs);
    129135
    130136if (($stage ne 'raw') and ($stage ne 'fake') and !$poor_quality) {
     
    184190        # it must exist)
    185191        next if $poor_quality;
     192
     193        # skip file stats file. Due to a bug the update process destroys them sometimes
     194        # XXX: perhaps only do this for stages where we know that this happens
     195        next if $file_rule =~ /STATS/;
    186196
    187197        &my_die("failed to resolve  $file_name", $component, $PS_EXIT_DATA_ERROR);
     
    480490    my $path_base = shift;
    481491    my $clean = shift;
     492    my $num_sky_inputs = shift;
    482493
    483494    my @file_list;
     
    531542        $config_file_rule = "PPSTACK.CONFIG";
    532543    } elsif ($stage eq "sky") {
    533         $config_file_rule = "PSPHOT.STACK.CONFIG";
     544        if ($num_sky_inputs > 1) {
     545            $config_file_rule = "PSPHOT.STACK.CONFIG";
     546        } else {
     547            $config_file_rule = "PSPHOT.SKY.CONFIG";
     548        }
    534549    } else {
    535550        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
     
    627642    return \@file_list;
    628643}
     644sub get_num_sky_inputs {
     645    my $sky_id = shift;
     646
     647    my $command = "$staticskytool -inputs -sky_id $sky_id -simple";
     648    $command .= " -dbname $dbname" if $dbname;
     649    $command .= " | wc";
     650    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     651        run(command => $command, verbose => $verbose);
     652    unless ($success) {
     653        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     654        &my_die("Unable to perform $command: $error_code", $component, $error_code);
     655    }
     656    my ($num_inputs, $words, $chars) = split " ", (join "", @$stdout_buf);
     657    if (!$num_inputs) {
     658        $num_inputs = "undefined" if !defined $num_inputs;
     659        &my_die("unexpected number of static sky inputs $num_inputs",  $PS_EXIT_PROG_ERROR, $component, $error_code);
     660    }
     661
     662    return $num_inputs;
     663}
    629664
    630665sub my_die
Note: See TracChangeset for help on using the changeset viewer.