IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 1, 2009, 10:07:51 AM (17 years ago)
Author:
bills
Message:

implement REQ_TYPE byskycell and various other features

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstampparse.pl

    r25540 r25712  
    1616use File::Basename qw(basename);
    1717use Carp;
    18 use POSIX qw( strftime );
     18use POSIX;
    1919
    2020my $verbose;
     
    7272}
    7373
     74# list_job is a deugging mode
    7475$no_update = 1 if $mode eq "list_job";
    7576
     
    185186    }
    186187    my $req_type = $row->{REQ_TYPE};
    187     $stage = $row->{IMG_TYPE};
    188     my $id       = $row->{ID};
     188    $stage       = $row->{IMG_TYPE};
     189    my $id      = $row->{ID};
    189190    my $component = $row->{COMPONENT};
    190 
    191     my $filter   = $row->{REQFILT};
     191    my $tess_id = $row->{TESS_ID};
     192
     193    my $filter  = $row->{REQFILT};
    192194    my $mjd_min = $row->{MJD_MIN};
    193195    my $mjd_max = $row->{MJD_MAX};
     196    my $label   = $row->{LABEL};
    194197
    195198    my $option_mask= $row->{OPTION_MASK};
     
    222225    my_die("job_type is list_uri but mode is $mode", $PS_EXIT_PROG_ERROR) if ($job_type eq "list_uri") and ($mode ne "list_uri");
    223226
    224 
    225227    my $image_db   = $proj_hash->{dbname};
    226228    my $camera     = $proj_hash->{camera};
     
    228230
    229231    # Temporary hack so that MOPS can get at non-magicked data
    230     if ($product eq "mops-pstamp-results") {
     232    if ($product and ($product eq "mops-pstamp-results")) {
    231233        $need_magic = 0;
    232234    }
     
    269271        my ($x, $y);
    270272
    271         $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $search_component,
    272                 $inverse, $skycenter, $x, $y, $mjd_min, $mjd_max, $filter, $verbose);
     273        $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $tess_id, $search_component,
     274                $inverse, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $label, $verbose);
    273275
    274276        if (!$imageList or !@$imageList) {
     
    305307    my $num_jobs = 0;
    306308    my $rownum = $row->{ROWNUM};
     309    my $option_mask = $row->{OPTION_MASK};
    307310    my $components = $row->{components};
    308311
     
    346349        if (($stage ne "stack") and ($need_magic and !$image->{magicked})) {
    347350            # XXX: should we add a faulted job so the client can know what happened if no images come back?
     351            # This test is made in locate_images now so this code never runs. This leads to no feedback
     352            # to users, but speeds up processing significatnly
    348353            print STDERR "skipping non-magicked image $imagefile\n" if $verbose;
    349354
     
    369374        $args .= " -file $imagefile";
    370375
    371         if (($row->{OPTION_MASK} & $PSTAMP_SELECT_MASK) &&  $image->{mask} ) {
     376        if (($option_mask & $PSTAMP_SELECT_MASK) &&  $image->{mask} ) {
    372377            $args .= " -mask $image->{mask}";
    373378        }
    374         if (($row->{OPTION_MASK} & $PSTAMP_SELECT_WEIGHT) and $image->{weight} ) {
     379        if (($option_mask & $PSTAMP_SELECT_WEIGHT) and $image->{weight} ) {
    375380            $args .= " -variance $image->{weight}";
    376381        }
     
    407412        $num_jobs++;
    408413        my $command = "$pstamptool -addjob  -req_id $req_id -job_type $row->{JOB_TYPE}"
    409                         . " -outputBase $output_base -rownum $rownum -state $newState";
     414                        . " -outputBase $output_base -rownum $rownum -state $newState -options $option_mask";
    410415        $command .= " -fault $fault" if $fault;
    411416        $command .= " -exp_id $exp_id" if $exp_id;
     
    542547                    run(command => $command, verbose => $verbose);
    543548                unless ($success) {
    544                     print STDERR @$stderr_buf;
    545                     my $rc = $error_code >> 8;
    546                     my_die( "dvoImagesAtCoords failed: $rc", $PS_EXIT_UNKNOWN_ERROR);
     549                    # don't fail if the program exited normally and exit status was PSTAMP_NO_OVERLAP
     550                    # That just means that the coordinate didn't match any image/skycell
     551                    if (!WIFEXITED($error_code) || (WEXITSTATUS($error_code) ne $PSTAMP_NO_OVERLAP)) {
     552                        print STDERR @$stderr_buf;
     553                        my $rc = WIFEXITED($error_code) ? WEXITSTATUS($error_code) : $PS_EXIT_SYS_ERROR;
     554                        my_die( "dvoImagesAtCoords failed: $rc", $rc);
     555                    }
    547556                }
    548557                # now we have a list of row numbers and components
Note: See TracChangeset for help on using the changeset viewer.