IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21240


Ignore:
Timestamp:
Jan 30, 2009, 2:21:39 PM (17 years ago)
Author:
bills
Message:

adapt to changes in diffRun schema. change from class_id to component
so that the variable can be used to select by skycell_id as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PStamp/lib/PStamp/Job.pm

    r21193 r21240  
    2525use PS::IPP::Config qw( :standard );
    2626
    27 ### my @images = locate_images($image_db, $req_type, $img_type, $id, $lookup_class_id,
     27### my @images = locate_images($image_db, $req_type, $img_type, $id, $component,
    2828###            $mjd_min, $mjd_max, $filter);
    2929
     
    3434    my $img_type = shift;   # required
    3535    my $id       = shift;   # required unless req_type eq bycoord
    36     my $class_id = shift;
     36    my $component= shift;   # class_id or skycell_id
    3737    my $x        = shift;
    3838    my $y        = shift;
     
    6666            $req_type = "byid";
    6767            $id = $results->{warp_id};
     68            $component = $results->{skycell_id};
    6869            return undef if !$id;
    6970            # fall through and lookup by warp_id
     
    9394    }
    9495
    95     my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $class_id, $verbose);
     96    my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $component, $verbose);
    9697
    9798    return $results;
     
    104105    my $img_type = shift;
    105106    my $id       = shift;
    106     my $class_id = shift;
    107     my $verbose = shift;
     107    my $component= shift;
     108    my $verbose  = shift;
    108109
    109110    my $missing_tools;
     
    124125    my $want_astrom;
    125126    my $set_class_id;
     127    my $class_id;
     128    my $skycell_id;
    126129
    127130    # special class_id value "null" means ignore
    128     if ($class_id eq "null") {
    129         $class_id = undef;
     131    if ($component eq "null") {
     132        $component = undef;
    130133    }
    131134
    132135    if ($img_type eq "raw") {
     136        $class_id = $component;
    133137        $command = "$regtool -processedimfile -dbname $image_db";
    134138        $id_opt = "-exp_id";
    135         $command .= " -class_id $class_id" if $class_id;
     139        $command .= " -class_id $class_id" if $component;
    136140        $want_astrom = 1;
    137141        $set_class_id = 1;
    138142    } elsif ($img_type eq "chip") {
     143        $class_id = $component;
    139144        $command = "$chiptool -processedimfile -dbname $image_db";
    140145        $command .= " -class_id $class_id" if $class_id;
     
    146151        $set_class_id = 1;
    147152    } elsif ($img_type eq "warp") {
     153        $skycell_id = $component;
    148154        $command = "$warptool -warped -dbname $image_db";
     155        $command .= " -skycell_id $skycell_id" if $skycell_id;
    149156        $id_opt = "-warp_id";
    150157        $mask_name    = "PSWARP.OUTPUT.MASK";
     
    152159        $base_name    = "path_base"; # name of the field for the warptool output
    153160    } elsif ($img_type eq "diff") {
     161        $skycell_id = $component;
    154162        $command = "$difftool -diffskyfile -dbname $image_db";
     163        $command .= " -skycell_id $skycell_id" if $skycell_id;
    155164        $id_opt = "-diff_id";
    156165        $mask_name   = "PPSUB.OUTPUT.MASK";
     
    281290    my $image = $images->[0];
    282291
     292    my $skycell_id = $image->{skycell_id};
     293
     294    if ($image->{fault}) {
     295        print STDERR "selected difference image $id $image->{diff_id} $skycell_id has fault: $image->{fault}\n";
     296        return undef;
     297    }
     298
    283299    # The standard way to do a diff is warp - stack
    284300    # so we interpret the requested image in that way
    285301
    286     # XXX the query currently returns max long long for null
     302    my $stack_id = $image->{stack2};
     303    # XXX difftool currently returns max long long for null
    287304    # this line is ready if we switch the code to return zero for null
    288     my $stack_id = $image->{stack_id_temp_1};
    289305    if ($stack_id and ($stack_id != 9223372036854775807)) {
    290306        $image->{stack_id} = $stack_id;
    291307    }
    292308
    293     # XXX the query currently returns max long long for null
     309    my $warp_id =  $image->{warp1};
     310    # XXX difftool currently returns max long long for null
    294311    # this line is ready if we switch the code to return zero for null
    295     my $warp_id =  $image->{warp_id_temp_0};
    296312    if ($warp_id and ($warp_id != 9223372036854775807)) {
    297313        $image->{warp_id} = $warp_id;
    298314
    299315        ## now use the warp and go get the exposure information
    300         $command = "warptool -warped -warp_id $warp_id -dbname $image_db -limit 1";
     316        $command = "warptool -warped -warp_id $warp_id -skycell_id $skycell_id -dbname $image_db -limit 1";
    301317        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    302318                    run(command => $command, verbose => $verbose);
Note: See TracChangeset for help on using the changeset viewer.