IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25129


Ignore:
Timestamp:
Aug 19, 2009, 1:06:23 PM (17 years ago)
Author:
bills
Message:

Stop running warptool for each bydiff request. The exposure information that we
needed is now present in the difftool -diffskyfile output. This speeds up parsing
considerably.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r25107 r25129  
    3434    my $req_type = shift;   # required
    3535    my $img_type = shift;   # required
    36     my $id       = shift;   # required unless req_type eq bycoord
     36    my $id       = shift;   # required unless req_type eq bycoord or byskycell
    3737    my $component= shift;   # class_id or skycell_id
    3838    my $inverse  = shift;
     
    6363            return undef;
    6464        }
    65         if (($img_type eq "warp") or ($img_type eq "diff")) {
     65        if ($img_type eq "diff") {
    6666            # lookup_diff has done all of the work
    6767            return $results;
     
    7474            return undef if !$id;
    7575            # fall through and lookup byexp
     76        } elsif ($img_type eq "warp") {
     77            $req_type = "byid";
     78            $id = $image->{warp_id};
     79            return undef if !$id;
     80            # fall through and lookup by warp_id
    7681        } elsif ($img_type eq "stack") {
    7782            $req_type = "byid";
    7883            $id = $image->{stack_id};
    7984            return undef if !$id;
    80             # fall though and lookup by stack id
     85            # fall though and lookup by stack_id
    8186        } else {
    8287            # shouldn't I check this elsewhere?
     
    327332        }
    328333
    329         my $warp_id;
     334        my ($warp_id, $exp_id, $exp_name);
    330335        if ($inverse and !$image->{bothways}) {
    331             print STDERR "inverse image requested for diffRun that is not bothways ignoring\n";
     336            print STDERR "Inverse images requested for diffRun that is not bothways. Ignoring.\n";
    332337            $inverse = 0;
    333338        }
    334339        if ($inverse) {
    335340            $warp_id =  $image->{warp2};
     341            $exp_id = $image->{exp_id_2};
     342            $exp_name = $image->{exp_name_2};
    336343        } else {
    337344            $warp_id =  $image->{warp1};
     345            $exp_id = $image->{exp_id_1};
     346            $exp_name = $image->{exp_name_1};
    338347        }
    339348        # XXX difftool currently returns max long long for null
     
    341350        if ($warp_id and ($warp_id != 9223372036854775807)) {
    342351            $image->{warp_id} = $warp_id;
    343 
    344             ## now use the warp and go get the exposure information
    345             $command = "warptool -warped -warp_id $warp_id -skycell_id $skycell_id -dbname $image_db -limit 1";
    346             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    347                         run(command => $command, verbose => $verbose);
    348             unless ($success) {
    349                 # XXX: I'm not sure if we should die here
    350                 print STDERR @$stderr_buf;
    351                 return undef;
    352             }
    353 
    354             my $buf = join "", @$stdout_buf;
    355             if (!$buf) {
    356                 next;
    357             }
    358 
    359             my $mdcParser = PS::IPP::Metadata::Config->new;
    360             my $warps = parse_md_fast($mdcParser, $buf)
    361                 or die ("Unable to parse metadata config doc");
    362             my $warp = $warps->[0];
    363 
    364             if ($img_type eq "warp") {
    365                 $image = $warp;
    366             } else {
    367                 $image->{exp_id} = $warp->{exp_id};
    368                 $image->{exp_name} = $warp->{exp_name};
    369                 $image->{camera} = $warp->{camera};
    370             }
     352            $image->{exp_id} = $exp_id;
     353            $image->{exp_name} = $exp_name;
    371354        } else {
    372355            print STDERR "unexpected result warp_id not defined\n";
    373356            next;
    374357        }
    375 
    376         if (($img_type eq "diff") or ($img_type eq "warp")) {
     358        if ($img_type eq "diff") {
    377359            # the $image is going to be returned directly in this case so we need to duplicate
    378360            # some of processing that lookup does for other img_types
    379361            if ($image->{camera}) {
    380362                $ipprc->define_camera($image->{camera});
    381                 if ($img_type eq "diff") {
    382                     my $filerule_base = $inverse ? "PPSUB.INVERSE" : "PPSUB.OUTPUT";
    383                     $image->{image}  = $ipprc->filename($filerule_base, $image->{path_base});
    384                     $image->{mask}   = $ipprc->filename($filerule_base . ".MASK", $image->{path_base});
    385                     $image->{weight} = $ipprc->filename($filerule_base . ".VARIANCE", $image->{path_base});
    386                 } else {
    387                     $image->{image}  = $ipprc->filename("PSWARP.OUTPUT",   $image->{path_base});
    388                     $image->{mask}   = $ipprc->filename("PSWARP.OUTPUT.MASK",   $image->{path_base});
    389                     $image->{weight} = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $image->{path_base});
    390                 }
     363                my $filerule_base = $inverse ? "PPSUB.INVERSE" : "PPSUB.OUTPUT";
     364                $image->{image}  = $ipprc->filename($filerule_base, $image->{path_base});
     365                $image->{mask}   = $ipprc->filename($filerule_base . ".MASK", $image->{path_base});
     366                $image->{weight} = $ipprc->filename($filerule_base . ".VARIANCE", $image->{path_base});
    391367            } else {
    392368                # XXX this will only happen if the minuend is not a warp
Note: See TracChangeset for help on using the changeset viewer.