IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24962


Ignore:
Timestamp:
Jul 31, 2009, 3:35:30 PM (17 years ago)
Author:
bills
Message:

fixed a few bugs

File:
1 edited

Legend:

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

    r24944 r24962  
    146146    $stage = $row->{IMG_TYPE};
    147147    my $id       = $row->{ID};
    148     my $class_id = $row->{CLASS_ID};
    149148    my $component = $row->{COMPONENT};
    150149
     
    159158
    160159    my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS);
    161     $class_id = "" if (defined($class_id) and ($class_id eq "null" or $class_id eq "all"));
    162160    $component = "" if (defined($component) and ($component eq "null" or $component eq "all"));
    163161   
     
    178176    if (@rowList) {
    179177        my $firstRow = $rowList[0];
    180         # the collecting might work with !$skycenter but I need to think about it
     178        # XXX: the collecting might work with !$skycenter but I need to think about it
    181179        if ($skycenter and same_images_of_interest($row, $firstRow)) {
    182180            push @rowList, $row;
     
    185183        } else {
    186184            # queue the jobs for this set of rows
    187             $num_jobs += queueJobs($mode, $stage, $need_magic, \@rowList, $imageList);
     185            $num_jobs += queueJobs($mode, \@rowList, $imageList);
    188186            @rowList = ();
    189187        }
     
    198196        # request specification. An array reference is returned
    199197        my ($x, $y);
    200         $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $class_id, $skycenter,
     198        $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $component, $skycenter,
    201199                $x, $y, $mjd_min, $mjd_max, $filter, $verbose);
    202200    }
     
    206204        next;
    207205    }
     206    $row->{need_magic} = $need_magic;
    208207    push @rowList, $row;
    209208}
    210209
    211210if (@rowList) {
    212     $num_jobs += queueJobs($mode, $stage, $need_magic, \@rowList, $imageList);
     211    $num_jobs += queueJobs($mode, \@rowList, $imageList);
    213212}
    214213
     
    229228{
    230229    my $row = shift;
     230    my $stage = shift;
    231231    my $imageList = shift;
    232232    my $have_skycells = shift;
     
    237237    foreach my $image (@$imageList) {
    238238        my $component;
    239         my $class_id;   # get rid of this use componet
    240239        if ($have_skycells) {
    241240            $component = $image->{skycell_id};
    242241        } else {
    243242            $component = $image->{class_id};
    244             $class_id = $component;
    245243        }
    246244
     
    252250        my $roi_string;
    253251
    254         # XXX we're depending on other code to insure valid values for roi components
    255         # this is checked in and ppstamp but I should check here so that we don't get that far,
    256         # but not today
     252        # note values were insured to be numbers in validROI()
    257253        my $x = $row->{CENTER_X};
    258254        my $y = $row->{CENTER_Y};
     
    282278           
    283279        my $args = $roi_string ? $roi_string : "";
    284         $args .= " -class_id $class_id" if $class_id;
     280        if ($stage eq "raw" or $stage eq "chip") {
     281            $args .= " -class_id $component" if $component;
     282        }
    285283
    286284        $job_num++;
    287 
    288         my $output_base = "$out_dir/${rownum}_${job_num}";
    289         my $argslist = "${output_base}.argslist";
    290285
    291286        # add astrometry file for raw and chip images if one is available
     
    300295        }
    301296        if (($row->{OPTION_MASK} & $PSTAMP_SELECT_WEIGHT) and $image->{weight} ) {
    302             $args .= " -weight $image->{weight}";
    303         }
     297            $args .= " -variance $image->{weight}";
     298        }
     299
     300        my $output_base = "$out_dir/${rownum}_${job_num}";
     301        my $argslist = "${output_base}.args";
    304302
    305303        # copy the argument list to a file
     
    314312
    315313        $num_jobs++;
    316         my $command = "$pstamptool -addjob -req_id $req_id -job_type $row->{JOB_TYPE}"
    317             . " -uri $argslist -outputBase $output_base -rownum $rownum"
    318             . " -state $newState";
    319 #        $command .= " -args '$args'" if $args;
     314        my $command = "$pstamptool -addjob  -req_id $req_id -job_type $row->{JOB_TYPE}"
     315                        . " -outputBase $output_base -rownum $rownum -state $newState";
    320316        $command .= " -exp_id $exp_id" if $exp_id;
    321317        $command .= " -dbname $dbname" if $dbname;
     
    326322            # this is sort of like the mode -noupdate that some other tools support
    327323            print "$command\n";
    328         } else {
     324        } elsif (!$no_update) {
    329325            # mode eq "queue_job"
    330326            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    337333                die "failed to queue job for request $req_id";
    338334            }
     335        } else {
     336            print "skipping command: $command\n";
    339337        }
    340338    }
     
    345343{
    346344    my $mode = shift;
    347     my $stage = shift;
    348     my $need_magic = shift;
    349345    my $rowList = shift;
    350346    my $imageList = shift;
    351347
    352348    my $firstRow = $rowList[0];
     349    my $stage    = $firstRow->{IMG_TYPE};
    353350    my $job_type = $firstRow->{JOB_TYPE};
     351    my $need_magic = $firstRow->{need_magic};
    354352
    355353    my $num_jobs = 0;
     
    394392                    my $astrom = $thisRun->[0]->{astrom};
    395393                    die "no astrometry file found" if !$astrom;
    396                     $command .= " -astrom $astrom";
     394                    my $astrom_resolved = $ipprc->file_resolve($astrom);
     395                    $command .= " -astrom $astrom_resolved";
    397396                }
    398397                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    418417           
    419418            foreach my $row (@$rowList) {
    420                 $num_jobs += queueJobsForRow($row, $thisRun, $have_skycells, $need_magic);
     419                $num_jobs += queueJobsForRow($row, $stage, $thisRun, $have_skycells, $need_magic);
    421420            }
    422421        }
     
    461460
    462461        my $image = shift @$imageList;
     462        $image->{stage} = $stage;
    463463        push @runList, $image;
    464464        $last_run_id = $run_id;
Note: See TracChangeset for help on using the changeset viewer.