IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 18, 2009, 10:23:28 AM (17 years ago)
Author:
eugene
Message:

updated vysos branch from trunk

Location:
branches/eam_branches/20090820
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090820

  • branches/eam_branches/20090820/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r25766 r25870  
    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;
    134128}
    135129
    136 sub lookup {
     130sub lookup
     131{
    137132    my $ipprc    = shift;
    138133    my $image_db = shift;
     
    143138    my $component= shift;
    144139    my $need_magic = shift;
     140    my $x        = shift;
     141    my $y        = shift;
    145142    my $dateobs_begin = shift;
    146143    my $dateobs_end   = shift;
     
    175172
    176173    my $magic_arg = $need_magic ? " -destreaked" : "";
     174    my $component_args;
    177175    if ($img_type eq "raw") {
    178176        $class_id = $component;
    179177        $command = "$regtool -processedimfile -dbname $image_db";
     178        # XXX: for now restrict lookups to type object
     179        # are stamps of detrend exposures interesting?
     180        $command .= " -exp_type object";
    180181        $id_opt = "-exp_id";
    181         $command .= " -class_id $class_id" if $component;
     182        $component_args = " -class_id $class_id" if $component;
    182183        $want_astrom = 1;
    183184        $set_class_id = 1;
     
    185186        $class_id = $component;
    186187        $command = "$chiptool -processedimfile -dbname $image_db";
    187         $command .= " -class_id $class_id" if $class_id;
     188        $component_args = " -class_id $class_id" if $class_id;
    188189        $id_opt = "-chip_id";
    189190        $image_name   = "PPIMAGE.CHIP";
     
    196197        $skycell_id = $component;
    197198        $command = "$warptool -warped -dbname $image_db";
    198         $command .= " -skycell_id $skycell_id" if $skycell_id;
     199        $component_args = " -skycell_id $skycell_id" if $skycell_id;
    199200        $id_opt = "-warp_id";
    200201        $image_name   = "PSWARP.OUTPUT";
     
    205206        $skycell_id = $component;
    206207        $command = "$difftool -diffskyfile -dbname $image_db";
    207         $command .= " -skycell_id $skycell_id" if $skycell_id;
     208        $component_args = " -skycell_id $skycell_id" if $skycell_id;
    208209        $id_opt = "-diff_id";
    209210        $image_name  = "PPSUB.OUTPUT";
     
    212213        $base_name   = "path_base";
    213214    } elsif ($img_type eq "stack") {
     215        $skycell_id = $component;
    214216        $command = "$stacktool -sumskyfile -dbname $image_db";
    215217        $id_opt = "-stack_id";
     218        $component_args = " -skycell_id $skycell_id" if $skycell_id;
    216219
    217220        $image_name  = "PPSTACK.OUTPUT";
     
    225228    if ($req_type eq "byid") {
    226229        $command .= " $id_opt $id";
     230        $command .= $component_args if $component_args;
    227231    } elsif ($req_type eq "byexp") {
    228232        $command .= " -exp_name $id";
     233        $command .= $component_args if $component_args;
    229234    } elsif ($req_type eq "byskycell") {
     235        die "tess_id and component are required for byskycell" if !$tess_id or ! $skycell_id;
    230236        $command .= " -tess_id $tess_id -skycell_id $skycell_id";
     237    } elsif ($req_type eq "bycoord") {
     238        $command .= " -radius 3.0 -ra $x -decl $y";
    231239    } else {
    232240        die "Unknown req_type supplied: $req_type";
     
    289297
    290298        # if uri is nil this will get overridded below
    291         # (this is for raw stage)
     299        # (we do this here for raw stage)
    292300        $out->{image}  = $image->{uri};
    293301        if ($set_class_id) {
     
    295303            $out->{component} = $class_id;
    296304        }
     305        my $stage_id;
     306        if ($img_type eq "raw") {
     307            $stage_id = $image->{exp_id};
     308        } elsif ($img_type eq "chip") {
     309            $stage_id = $image->{chip};
     310        } elsif ($img_type eq "warp") {
     311            $stage_id = $image->{warp_id};
     312        } elsif ($img_type eq "diff") {
     313            $stage_id = $image->{diff_id};
     314        } elsif ($img_type eq "stack") {
     315            $stage_id = $image->{stack_id};
     316        }
     317        $image->{stage_id} = $stage_id;
     318        $image->{stage}    = $img_type;
     319        $image->{image_db} = $image_db;
    297320
    298321        # find the mask and weight images
    299322        if ($base) {
    300             $out->{image}  = $ipprc->filename($image_name,   $base, $class_id) if $image_name;
     323            $out->{image}  = $ipprc->filename($image_name,  $base, $class_id) if $image_name;
    301324            $out->{mask}   = $ipprc->filename($mask_name,   $base, $class_id) if $mask_name;
    302325            $out->{weight} = $ipprc->filename($weight_name, $base, $class_id) if $weight_name;
Note: See TracChangeset for help on using the changeset viewer.