IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25776


Ignore:
Timestamp:
Oct 5, 2009, 2:17:58 PM (17 years ago)
Author:
bills
Message:

first implementation of REQ_TYPE bycoord
other bug fixes

Location:
trunk
Files:
2 edited

Legend:

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

    r25712 r25776  
    108108    } elsif ($req_type eq "bycoord") {
    109109
    110         # run
    111         # regtool -dbname $image_db -processedimfile -time_begin $mjd_min -time_end = $mjd_max -filter $filter
    112         #
    113         my $results = lookup_bycoord($ipprc, $image_db, $x, $y, $dateobs_begin, $dateobs_end, $filter, $verbose);
    114 
    115         # now take the results and lookup byexp
    116         # XXX: This needs work. What stops results from returning multiple images????
    117         # We should loop over the set of images returned building up the full results array
    118         $req_type = "byexp";
    119         $id = $results->{exp_name};
     110        if ($img_type eq "stack") {
     111            print STDERR "Error bycoord lookup not implemented for stage stack yet\n";
     112            return undef;
     113        }
    120114    } elsif ($req_type eq "byskycell") {
    121115        if (($img_type eq "raw") or ($img_type eq "chip")) {
     
    129123    }
    130124
    131     my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $tess_id, $component, $need_magic, $dateobs_begin, $dateobs_end, $filter, $label, $verbose);
     125    my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $label, $verbose);
    132126
    133127    return $results;
     
    143137    my $component= shift;
    144138    my $need_magic = shift;
     139    my $x        = shift;
     140    my $y        = shift;
    145141    my $dateobs_begin = shift;
    146142    my $dateobs_end   = shift;
     
    175171
    176172    my $magic_arg = $need_magic ? " -destreaked" : "";
     173    my $component_args;
    177174    if ($img_type eq "raw") {
    178175        $class_id = $component;
    179176        $command = "$regtool -processedimfile -dbname $image_db";
     177        # XXX: for now restrict lookups to type object
     178        # are stamps of detrend exposures interesting?
     179        $command .= " -exp_type object";
    180180        $id_opt = "-exp_id";
    181         $command .= " -class_id $class_id" if $component;
     181        $component_args = " -class_id $class_id" if $component;
    182182        $want_astrom = 1;
    183183        $set_class_id = 1;
     
    185185        $class_id = $component;
    186186        $command = "$chiptool -processedimfile -dbname $image_db";
    187         $command .= " -class_id $class_id" if $class_id;
     187        $component_args = " -class_id $class_id" if $class_id;
    188188        $id_opt = "-chip_id";
    189189        $image_name   = "PPIMAGE.CHIP";
     
    196196        $skycell_id = $component;
    197197        $command = "$warptool -warped -dbname $image_db";
    198         $command .= " -skycell_id $skycell_id" if $skycell_id;
     198        $component_args = " -skycell_id $skycell_id" if $skycell_id;
    199199        $id_opt = "-warp_id";
    200200        $image_name   = "PSWARP.OUTPUT";
     
    205205        $skycell_id = $component;
    206206        $command = "$difftool -diffskyfile -dbname $image_db";
    207         $command .= " -skycell_id $skycell_id" if $skycell_id;
     207        $component_args = " -skycell_id $skycell_id" if $skycell_id;
    208208        $id_opt = "-diff_id";
    209209        $image_name  = "PPSUB.OUTPUT";
     
    212212        $base_name   = "path_base";
    213213    } elsif ($img_type eq "stack") {
     214        $skycell_id = $component;
    214215        $command = "$stacktool -sumskyfile -dbname $image_db";
    215216        $id_opt = "-stack_id";
     217        $component_args = " -skycell_id $skycell_id" if $skycell_id;
    216218
    217219        $image_name  = "PPSTACK.OUTPUT";
     
    225227    if ($req_type eq "byid") {
    226228        $command .= " $id_opt $id";
     229        $command .= $component_args if $component_args;
    227230    } elsif ($req_type eq "byexp") {
    228231        $command .= " -exp_name $id";
     232        $command .= $component_args if $component_args;
    229233    } elsif ($req_type eq "byskycell") {
     234        die "tess_id and component are required for byskycell" if !$tess_id or ! $skycell_id;
    230235        $command .= " -tess_id $tess_id -skycell_id $skycell_id";
     236    } elsif ($req_type eq "bycoord") {
     237        $command .= " -radius 3.0 -ra $x -decl $y";
    231238    } else {
    232239        die "Unknown req_type supplied: $req_type";
  • trunk/pstamp/scripts/pstampparse.pl

    r25739 r25776  
    195195    my $mjd_max = $row->{MJD_MAX};
    196196    my $label   = $row->{LABEL};
     197    my $x       = $row->{CENTER_X};
     198    my $y       = $row->{CENTER_Y};
    197199
    198200    my $option_mask= $row->{OPTION_MASK};
     
    205207   
    206208    if (!$skycenter and !$search_component) {
    207         print STDERR "COMPONENT must be specified for pixel coordinate ROI\n" if $verbose;
     209        print STDERR "COMPONENT must be specified for pixel coordinate ROI center\n" if $verbose;
    208210        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
    209211        $num_jobs++;
     
    213215    $search_component = "" if $search_component eq "all";
    214216
    215     if (($job_type eq "stamp") and ! validROI($row)) {
     217    if ((($job_type eq "stamp") or ($req_type eq "bycoord")) and ! validROI($row)) {
    216218        print STDERR "invalid ROI for row $rownum\n" if $verbose;
    217219        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
     
    262264            next;
    263265        }
    264         print STDERR "lookup bycoord is not yet implemented" if $verbose;
    265         insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED);
    266         $num_jobs++;
    267         next;
    268     } else {
    269         # Call PS::IPP::PStamp::Job locate_images subroutine to get the images for this
    270         # request specification. An array reference is returned.
    271         my ($x, $y);
    272 
    273         $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $tess_id, $search_component,
     266        if ($stage eq "stack") {
     267            print STDERR "lookup bycoord is not yet implemented for stage stack" if $verbose;
     268            insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED);
     269            $num_jobs++;
     270            next;
     271        }
     272    }
     273    # Call PS::IPP::PStamp::Job locate_images subroutine to get the images for this
     274    # request specification. An array reference is returned.
     275    $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $tess_id, $search_component,
    274276                $inverse, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $label, $verbose);
    275277
    276         if (!$imageList or !@$imageList) {
    277             print STDERR "no matching images found for row $rownum\n" if $verbose;
    278             # note in this case queueJobs inserts the fake job for these rows
    279         }
    280         $row->{need_magic} = $need_magic;
    281         push @rowList, $row;
    282     }
     278    if (!$imageList or !@$imageList) {
     279        print STDERR "no matching images found for row $rownum\n" if $verbose;
     280        # note in this case queueJobs inserts the fake job for these rows
     281    }
     282    $row->{need_magic} = $need_magic;
     283    push @rowList, $row;
    283284}
    284285
Note: See TracChangeset for help on using the changeset viewer.