IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34680


Ignore:
Timestamp:
Nov 20, 2012, 6:00:56 PM (14 years ago)
Author:
watersc1
Message:

Finished? I need to do testing tomorrow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/ippScripts/scripts/regenerate_background.pl

    r34679 r34680  
    184184## stack stage
    185185elsif ($stage eq 'stack') {
    186    
    187 
     186    &my_die("--stage_id required for stage stack", $stage, $stage_id, $PS_EXIT_CONFIG_ERROR) if !$stage_id;
     187    my $stack_id = $stage_id; # Same as above.  Alias this so I don't make mistakes.
     188   
     189    # Configuration stuff
     190    my $stacktool = can_run('stacktool') or
     191        &my_die("Can't find stacktool",$stage,$stage_id,$PS_EXIT_UNKNOWN_ERROR);
     192    my $ppStackMedian = can_run('ppStackMedian') or
     193        &my_die("Can't find ppStackMedian",$stage,$stage_id,$PS_EXIT_UNKNOWN_ERROR);
     194   
     195
     196    # Get inputs
     197    my $imfiles;  # Array of component files
     198    my $command = "$stacktool -inputskyfile -stack_id $stack_id";
     199    $command .= " -dbname $dbname " if defined $dbname;
     200    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     201        run(command => $command, verbose => $verbose);
     202    unless($success) {
     203        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     204        &my_die("Unable to perform stacktool -inputskyfile",$stage,$stage_id,$error_code);
     205    }
     206    if (@$stdout_buf == 0) {
     207        # Nothing to do;
     208    }
     209    my $in_md = $mdcParser->parse_list(join "", @$stdout_buf) or
     210        &my_die("Unable to parse metadata config doc", $stage, $stage_id, $PS_EXIT_PROG_ERROR);
     211    $imfiles  = parse_md_list($in_md) or
     212        &my_die("Unable to parse metadata", $stage, $stage_id, $PS_EXIT_PROG_ERROR);
     213   
     214    my $num = 0;
     215   
     216    my ($inputMDC_file, $inputMDC_name) = tempfile("/tmp/bkgreg.stack.mdc.${stage_id}.XXXX",
     217                                                   UNLINK => !$save_temps);
     218    foreach my $imfile (@$imfiles) {
     219        if ($imfile->{ignored}) {next; }
     220        print $inputMDC_file "INPUT${num}\tMETADATA\n";
     221       
     222        print $inputMDC_file "\tIMAGE\tSTR\t" . $ipprc->filename( "PSWARP.OUTPUT.BKGMODEL",
     223                                                                  $imfile->{path_base} ) . "\n";
     224        print $inputMDC_file "\tSOURCES\tSTR\t" . $ipprc->filename( "PSWARP.OUTPUT.SOURCES",
     225                                                                    $imfile->{path_base} ) . "\n";
     226        print $inputMDC_file "END\n\n";
     227        $num++;
     228    }
     229    close($inputMDC_file);
     230   
    188231    my $ppStack_command = "$ppStackMedian -input $inputMDC_name $path_base ";
    189232    $ppStack_command   .= " -recipe PPSTACK STACK -recipe PPSUB STACK -recipe PSPHOT STACK ";
Note: See TracChangeset for help on using the changeset viewer.