IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2010, 3:55:49 PM (16 years ago)
Author:
eugene
Message:

update merges from trunk

Location:
branches/eam_branches/20100225
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20100225

  • branches/eam_branches/20100225/pstamp/scripts/pstampparse.pl

    r26289 r27517  
    151151        print STDERR @$stderr_buf;
    152152    }
    153     my $table =  $mdcParser->parse(join "", @$stdout_buf) or
    154         my_die("Unable to parse metdata config doc", $PS_EXIT_UNKNOWN_ERROR);
    155 
    156     $rows = parse_md_list($table);
     153    if (@$stdout_buf) {
     154        my $table =  $mdcParser->parse(join "", @$stdout_buf) or
     155            my_die("Unable to parse metdata config doc", $PS_EXIT_UNKNOWN_ERROR);
     156        $rows = parse_md_list($table);
     157    }
     158
    157159}
    158160
     
    191193
    192194    my $filter  = $row->{REQFILT};
     195    if ($filter) {
     196        if (length($filter) == 1) {
     197            # allow single character filter cuts to work
     198            $filter .= '%';
     199        }
     200    }
    193201    my $mjd_min = $row->{MJD_MIN};
    194202    my $mjd_max = $row->{MJD_MAX};
     
    197205        # backwards compatability hook
    198206        $data_group = $row->{LABEL};
     207        $data_group = "null" if !defined $data_group;
     208        $row->{DATA_GROUP} = $data_group;
    199209    }
    200210       
     
    202212    my $y       = $row->{CENTER_Y};
    203213
     214    # XXX things don't work if bit zero of option mask is not set;
     215    $row->{OPTION_MASK} |= 1;
    204216    my $option_mask= $row->{OPTION_MASK};
    205217    my $inverse = ($option_mask & $PSTAMP_SELECT_INVERSE) ? 1 : 0;
    206218    $row->{inverse} = $inverse;
     219    my $unconvolved = ($option_mask & $PSTAMP_SELECT_UNCONV) ? 1 : 0;
     220    $row->{unconvolved} = $unconvolved;
    207221
    208222    my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS);
     
    217231    }
    218232
     233    # user requested us to search all components. Set to ""
    219234    $search_component = "" if $search_component eq "all";
    220235
     
    226241    }
    227242
     243    if (($req_type eq "byexp") and ($stage eq "stack")) {
     244        print STDERR "byexp not implemented for stack stage. row: $rownum\n" if $verbose;
     245        insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED);
     246        $num_jobs++;
     247        next;
     248    }
     249
    228250   
    229251    # $mode list_uri is a debugging mode (it may used by the http interface)
     
    236258
    237259    # Temporary hack so that MOPS can get at non-magicked data
    238     if ($product and ($product eq "mops-pstamp-results")) {
    239         $need_magic = 0;
    240     }
     260#    if ($product and ($product eq "mops-pstamp-results")) {
     261#        $need_magic = 0;
     262#    }
    241263
    242264    # For "stamp" and "list_uri" jobs collect rows with the same images of interest in a list so that they
     
    267289            next;
    268290        }
    269         if ($stage eq "stack") {
    270             print STDERR "lookup bycoord is not yet implemented for stage stack" if $verbose;
    271             insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED);
     291    }
     292    if (($req_type eq "byid") or ($req_type eq "bydiff")) {
     293        if (!validID($id)) {
     294            print STDERR "ID must be a positive integer for req_type $req_type\n" if $verbose;
     295            insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
    272296            $num_jobs++;
    273297            next;
     
    277301    # request specification. An array reference is returned.
    278302    $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $tess_id, $search_component,
    279                 $inverse, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $data_group, $verbose);
     303                $option_mask, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $data_group, $verbose);
    280304
    281305    if (!$imageList or !@$imageList) {
     
    291315}
    292316
    293 if (($mode eq "queue_jobs") and ($num_jobs eq 0)) {
     317if (($mode eq "queue_job") and ($num_jobs eq 0)) {
    294318    print STDERR "no jobs created for $req_name\n" if $verbose;
    295     insertFakeJobForRow(undef, 0, $PSTAMP_UNKNOWN_ERROR);
     319    insertFakeJobForRow(undef, 0, $PSTAMP_INVALID_REQUEST);
    296320}
    297321
     
    317341    my $roi_string;
    318342
    319     # note values were insured to be numbers in validROI()
     343    # note values were checked by the function validROI()
    320344    my $x = $row->{CENTER_X};
    321345    my $y = $row->{CENTER_Y};
     
    323347    my $h = $row->{HEIGHT};
    324348    my $coord_mask = $row->{COORD_MASK};
    325     if ($x && ($x ne "null") && $y && ($y ne "null") && $w && ($w ne "null") && $h && ($h ne "null")) {
    326         if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) {
    327             $roi_string = "-pixcenter $x $y";
    328         } else {
    329             $roi_string = "-skycenter $x $y";
    330         }
    331         if ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) {
    332             $roi_string .= " -pixrange $w $h";
    333         } else {
    334             $roi_string .= " -arcrange $w $h";
    335         }
     349    if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) {
     350        $roi_string = "-pixcenter $x $y";
     351    } else {
     352        $roi_string = "-skycenter $x $y";
     353    }
     354    if ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) {
     355        $roi_string .= " -pixrange $w $h";
     356    } else {
     357        $roi_string .= " -arcrange $w $h";
    336358    }
    337359
     
    354376        if (($stage ne "stack") and ($need_magic and !$image->{magicked})) {
    355377            # XXX: should we add a faulted job so the client can know what happened if no images come back?
    356             # This test is made in locate_images now so this code never runs. This leads to no feedback
    357             # to users, but speeds up processing significatnly
     378            # The test for destreaked is made in locate_images now so this code never runs. This leads to no feedback
     379            # to users, but speeds up processing significantly
    358380            print STDERR "skipping non-magicked image $imagefile\n" if $verbose;
    359381
     
    391413        }
    392414
    393         my $base = basename($image->{path_base});
     415        my $base = basename($image->{image});
     416        if (! $base =~ /.fits$/ ) {
     417            my_die("unexpected image file name found $image->{image}", $PS_EXIT_PROG_ERROR);
     418        }
     419        $base =~ s/.fits$//;
     420           
    394421        # XXX: TODO use filerule for this. I don't have a camera defined here
    395422        if (($stage eq 'chip') and ($image->{camera} eq 'GPC1')) {
     
    724751        $job_type = $row->{JOB_TYPE};
    725752        $rownum = $row->{ROWNUM};
     753        $rownum = 0 if !defined $rownum;
     754        if ($job_type) {
     755            if (($job_type ne "stamp") and ($job_type ne "get_image")) {
     756                print STDERR "invalid job type: $job_type found in row $rownum\n";
     757                $job_type = "none";
     758            }
     759        } else {
     760            print STDERR "undefined job type found in row $rownum\n";
     761            $job_type = "none";
     762        }
    726763    } else {
    727764        $job_type = "none";
     
    799836    my $r2 = shift;
    800837
     838    return 0 if (($r1->{REQ_TYPE} eq "bycoord") or ($r2->{REQ_TYPE} eq "bycoord"));
    801839    return 0 if ($r1->{PROJECT}  ne $r2->{PROJECT});
    802840    return 0 if ($r1->{JOB_TYPE} ne $r2->{JOB_TYPE});
     
    810848    return 0 if ($r1->{MJD_MAX}  ne $r2->{MJD_MAX});
    811849    return 0 if ($r1->{inverse}  ne $r2->{inverse});
     850    return 0 if ($r1->{unconvolved}  ne $r2->{unconvolved});
    812851
    813852    if (defined($r1->{COMPONENT})) {
     
    828867    my $val = shift;
    829868
    830     return $val =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/;
     869    return 0 if !defined $val;
     870
     871    return ($val =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/);
     872}
     873sub validID
     874{
     875    my $val = shift;
     876
     877    return 0 if !$val;
     878
     879    return  ! ($val =~ /\D/);
    831880}
    832881
Note: See TracChangeset for help on using the changeset viewer.