IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 11, 2012, 2:04:31 PM (13 years ago)
Author:
watersc1
Message:

Merge from my branch including background restoration and stack stage projection cell binned images.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ippScripts/scripts/skycell_jpeg.pl

    r28403 r34800  
    268268
    269269    my %tangents = ();
     270
     271    my %products = ('image' => "PPSTACK.UNCONV",
     272                    'mask'  => "PPSTACK.UNCONV.MASK",
     273                    'variance' => "PPSTACK.UNCONV.VARIANCE",
     274                    'exp'   => "PPSTACK.UNCONV.EXP",
     275                    'num'   => "PPSTACK.UNCONV.EXPNUM",
     276                    'bkg'   => "PPSTACK.OUTPUT.BKGMODEL"
     277        );
    270278   
    271279    foreach my $imfile (@$imfiles) {
     
    281289
    282290        $projection_cell =~ s/^(.*)\..*$/$1/;
    283        
     291
    284292        unless (exists($tangents{$projection_cell})) {
    285293            # Make a temp file and fill, but be sure to save
    286             ($tempFile, $tempName) = tempfile("/tmp/skycell.$projection_cell.XXXX",
    287                                                  UNLINK => !$save_temps);
    288             $tangents{$projection_cell}{FILE} = $tempFile;
    289             $tangents{$projection_cell}{NAME} = $tempName;
    290             if ($masks) {
    291                 my ($maskFile, $maskName) = tempfile("/tmp/skycell.$projection_cell.masks.XXXX",
    292                                                      UNLINK => !$save_temps);
    293                 $tangents{$projection_cell}{MFILE} = $maskFile;
    294                 $tangents{$projection_cell}{MNAME} = $maskName;
    295             }           
    296         }
    297         print "$skycell_id $projection_cell\n";
    298         my $file = $ipprc->filename("PPSTACK.OUTPUT", $path_base, $skycell_id);
    299         print "$file $state $quality\n";
    300         my $f_fh = $tangents{$projection_cell}{FILE};
    301         print $f_fh "$file\n";
    302         if ($masks) {
    303             my $mask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base, $skycell_id);
    304             print "$mask\n";
    305             my $m_fh = $tangents{$projection_cell}{MFILE};
    306             print $m_fh "$mask\n";
     294            foreach my $key (keys %products) {
     295                ($tempFile, $tempName) = tempfile("/tmp/skycell.$projection_cell.$key.XXXX",
     296                                                  UNLINK => !$save_temps);
     297                $tangents{$projection_cell}{$key}{FILE} = $tempFile;
     298                $tangents{$projection_cell}{$key}{NAME} = $tempName;
     299            }
     300        }
     301        foreach my $key (keys %products) {
     302            print "$skycell_id $projection_cell\n";     
     303            my $file = $ipprc->filename($products{$key}, $path_base, $skycell_id);
     304            print "$file $state $quality\n";
     305            my $f_fh = $tangents{$projection_cell}{$key}{FILE};
     306            print $f_fh "$file\n";
    307307        }
    308308    }
    309309    foreach my $projection_cell (keys %tangents) {
    310         $command = "$ppSkycell -images $tangents{$projection_cell}{NAME}";
    311         if ($masks) {
    312             $command .= " -masks $tangents{$projection_cell}{MNAME} ";
    313         }
    314         $command .= " ${outroot}.${projection_cell} ";
    315         print "$command\n";
    316         ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
    317         unless ($success) {
    318             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    319             &my_die("unable to perform ppSkycell: $error_code", $stage_id, $error_code);
    320         }
     310        ## Loop over results here.
     311        # Images
     312        # Masks
     313        # Variances
     314        # Nexptime
     315        # Nexp
     316        # Backgrounds
     317       
     318        foreach my $key (keys %products) {
     319            $command = "$ppSkycell -images $tangents{$projection_cell}{$key}{NAME}";
     320            $command .= " ${outroot}.${projection_cell}.${key} ";
     321            if ($key eq 'bkg') {
     322                $command .= " -Di BIN1 1 -Di BIN2 1 ";
     323            }
     324            elsif ($key eq 'image') {
     325                $command .= " -masks $tangents{$projection_cell}{mask}{NAME} ";
     326            }
     327            elsif ($key eq 'mask') {
     328                next; # This should be made with the images.
     329            }
     330            print "$command\n";
     331            ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     332            unless ($success) {
     333                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     334                &my_die("unable to perform ppSkycell: $error_code", $stage_id, $error_code);
     335            }
     336        }
     337
    321338        # Update database:
    322339        $command = "$stacktool -addsummary -sass_id $stage_id -projection_cell $projection_cell -path_base $outroot";
Note: See TracChangeset for help on using the changeset viewer.