IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2009, 4:13:39 PM (17 years ago)
Author:
eugene
Message:

updates from head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091113/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r25793 r26236  
    8484
    8585        my $image = $results->[0];
    86         if (($img_type eq "raw") or ($img_type eq "chip")) {
    87             $req_type = "byexp";
    88             $id = $image->{exp_name};
     86        if ($img_type eq "raw") {
     87            $req_type = "byid";
     88            $id = $image->{exp_id};
    8989            return undef if !$id;
    90             # fall through and lookup byexp
     90            # fall through and lookup byid
     91        } elsif ($img_type eq "chip") {
     92            $req_type = "byid";
     93            $id = $image->{chip_id};
     94            return undef if !$id;
     95            # fall through and lookup byid
    9196        } elsif ($img_type eq "warp") {
    9297            $req_type = "byid";
     
    171176    }
    172177
     178    # note $magic_arg may be cleared below depending on $req_type
    173179    my $magic_arg = $need_magic ? " -destreaked" : "";
     180
    174181    my $component_args;
    175182    if ($img_type eq "raw") {
     
    229236        $command .= " $id_opt $id";
    230237        $command .= $component_args if $component_args;
     238        # don't include -destreaked if lookup is byid. Let pstampparse check so that the
     239        # error code returned to the client for a given component is 'not destreaked'
     240        # instead of 'not found'
     241        $magic_arg = "";
    231242    } elsif ($req_type eq "byexp") {
    232243        $command .= " -exp_name $id";
    233244        $command .= $component_args if $component_args;
     245        # don't include -destreaked if lookup is byexp. Let pstampparse check so that the error code gives
     246        # the reason as 'not destreaked'
     247        $magic_arg = "";
    234248    } elsif ($req_type eq "byskycell") {
    235249        die "tess_id and component are required for byskycell" if !$tess_id or ! $skycell_id;
     
    237251    } elsif ($req_type eq "bycoord") {
    238252        $command .= " -radius 3.0 -ra $x -decl $y";
     253        if ($img_type ne "raw") {
     254            $command .= " -tess_id $tess_id" if $tess_id;
     255            $command .= " -skycell_id $skycell_id" if $skycell_id;
     256        }
    239257    } else {
    240258        die "Unknown req_type supplied: $req_type";
     
    299317        # (we do this here for raw stage)
    300318        $out->{image}  = $image->{uri};
     319
    301320        if ($set_class_id) {
    302321            $class_id = $image->{class_id};
    303322            $out->{component} = $class_id;
     323        } else {
     324            $out->{component} = $image->{skycell_id};
    304325        }
    305326        my $stage_id;
     
    307328            $stage_id = $image->{exp_id};
    308329        } elsif ($img_type eq "chip") {
    309             $stage_id = $image->{chip};
     330            $stage_id = $image->{chip_id};
    310331        } elsif ($img_type eq "warp") {
    311332            $stage_id = $image->{warp_id};
     
    315336            $stage_id = $image->{stack_id};
    316337        }
    317         $image->{stage_id} = $stage_id;
    318         $image->{stage}    = $img_type;
    319         $image->{image_db} = $image_db;
     338        $out->{stage_id} = $stage_id;
     339        $out->{stage}    = $img_type;
     340        $out->{image_db} = $image_db;
    320341
    321342        # find the mask and weight images
     
    402423        }
    403424
    404         my ($warp_id, $exp_id, $exp_name);
     425        my ($warp_id, $exp_id, $exp_name, $chip_id, $cam_id);
    405426        if ($inverse and !$image->{bothways}) {
    406427            print STDERR "Inverse images requested for diffRun that is not bothways. Ignoring.\n";
     
    411432            $exp_id = $image->{exp_id_2};
    412433            $exp_name = $image->{exp_name_2};
     434            $chip_id = $image->{chip_id_2};
     435            $cam_id = $image->{cam_id_2};
    413436        } else {
    414437            $warp_id =  $image->{warp1};
    415438            $exp_id = $image->{exp_id_1};
    416439            $exp_name = $image->{exp_name_1};
     440            $chip_id = $image->{chip_id_1};
     441            $cam_id = $image->{cam_id_1};
    417442        }
    418443        # XXX difftool currently returns max long long for null
     
    422447            $image->{exp_id} = $exp_id;
    423448            $image->{exp_name} = $exp_name;
     449            $image->{chip_id} = $chip_id;
     450            $image->{cam_id} = $cam_id;
    424451        } else {
    425452            print STDERR "unexpected result warp_id not defined\n";
     
    561588    }
    562589
    563     # If there are multiple cam runs for this exposure, take the last one
    564     # assuming that it has the best astrometry
    565     my $camdata = pop @$camruns;
     590    # If there are multiple cam runs for this exposure, take the last completed one
     591    # on the assumption that it has the best astrometry.
     592    my $camdata;
     593    while ($camdata = pop @$camruns) {
     594        last if (($camdata->{quality} eq 0) and ($camdata->{fault} eq 0));
     595    }
    566596    if (!$camdata) {
    567597        # no cam runs for this exposure id therefore best astrometry is whatever is in the header
Note: See TracChangeset for help on using the changeset viewer.