IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 21, 2012, 4:11:24 PM (14 years ago)
Author:
bills
Message:

More changes for detectability queries. This version works.

File:
1 edited

Legend:

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

    r33299 r33324  
    100100
    101101
     102#
     103# query is a hash which uses $fpa_id as the key
     104# The values are hash references which have the various parameter name as the key
     105#   The values of the parameter hashes are arrays which contain the values for individual rows
     106#   in the detectabilty query request
    102107my %query = ();
    103 my %image_list_hash = ();
    104108
    105109{
    106110    #
    107111    # Parse input request file using detect_query_read
     112    # result is a simple text file
    108113    #
    109114    my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file";
     
    139144    }
    140145    #
    141     # Identify target images.  This should properly collate targets on a single imfile.
     146    # Identify target components.  This should properly collate targets on a single imfile.
    142147    #
    143148    my $query_id;
     
    223228        $option_mask |= $PSTAMP_SELECT_VARIANCE;
    224229        $option_mask |= $PSTAMP_SELECT_PSF;
    225         my $need_magic = 1;
     230
     231        # magic is dead
     232        my $need_magic = 0;
    226233        if ($stage eq 'stack') {
    227234            $need_magic = 0;
     
    245252        foreach my $this_image_ref (@{ $pstamp_images_ref }) {
    246253
    247             if (0) {
    248                 foreach my $key (sort (keys %{ $this_image_ref } )) {
    249                     my $value = ${ $this_image_ref }{$key};
    250                     if ($key eq 'row_index') {
    251                         $value = join ' ', @{ $this_image_ref->{$key} };
    252                     }
    253                     print "$this_image_ref $key $value\n";
    254                 }
    255             }
    256 
    257 
     254            # loop over the rows that this component matched
    258255            foreach my $valid_index (@{ $this_image_ref->{row_index} }) {
    259256                $query{$fpa_id}{IMAGE}[$valid_index] = $this_image_ref->{image};
     
    336333foreach my $fpa_id (keys %query) {
    337334    for (my $i = 0; $i <= $#{ $query{$fpa_id}{ROWNUM} }; $i++) {
    338 #        print WISDOM "$fpa_id\t";
    339 #        foreach my $key (keys %{ $query{$fpa_id} }) {
    340 #            print WISDOM "$key $query{$fpa_id}{$key}[$i]\t";
    341 #        }
    342 #        print WISDOM "\n";
    343 #        my $data_state = $query{$fpa_id}{DATA_STATE}[$i];
    344 #        if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) {
    345 #            if ($data_state ne 'full') {
    346                
    347 #                @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } =
    348 #                    ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i],
    349 #                     $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]);
    350 #            }
    351 #        }
    352335        if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) {
    353336            push @{ $rows_for_component{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i;
     
    358341}
    359342
    360 my $job_num = 0;
     343#
     344# Finally build the parameter lists and queue jobs for each component
     345#
     346
     347my $job_num = 1;
    361348foreach my $fpa_id (keys %rows_for_component) {
    362349    foreach my $component (keys % {$rows_for_component{$fpa_id} } ) {
     
    368355            my $stage = $query{$fpa_id}{STAGE}[$i];
    369356            my $stage_id = $query{$fpa_id}{STAGE_ID}[$i];
    370             my $component = $query{$fpa_id}{STAGE_ID}[$i];
     357            my $component = $query{$fpa_id}{COMPONENT_ID}[$i];
    371358            print "Need to UPDATE $stage $stage_id $component from $data_state\n";
     359    ####                           my ($req_id, $outdir, $label, $state, $stage, $stage_id, $component, $need_magic, $imagedb) = @_;
    372360            $dep_id = queue_update_run($req_id, $outdir, $label, $data_state, $stage, $stage_id, $component, 0, $imagedb);
    373361        }
    374362
    375363        my $outputBase = "$outdir/$job_num" . "_";
     364
     365        # params_file is an mdc description containing the parameters for the job
    376366        my $params_file = $outputBase . "params.mdc";
    377367
    378368        open PARAMS, ">$params_file" or my_die("failed to create $params_file", $PS_EXIT_UNKNOWN_ERROR);
     369
     370        # first the job params
    379371        print PARAMS "dqueryJobParams METADATA\n";
    380372        foreach my $key (keys %{ $query{$fpa_id} } ) {
     
    383375        }
    384376        print PARAMS "END\n\n";
     377
     378        # then one structure with the coordinates for each row
    385379        print PARAMS "dqueryCoord MULTI\n";
    386380
     381        my @coordkeys = qw(ROWNUM RA1_DEG DEC1_DEG RA2_DEG DEC2_DEG MAG);
    387382        foreach my $row ( @{ $rows_for_component{$fpa_id}{$component} }) {
    388             my @coordkeys = qw(ROWNUM RA1_DEG DEC1_DEG RA2_DEG DEC2_DEG MAG);
    389383            print PARAMS "\ndqueryCoord METADATA\n";
    390384            foreach my $key (@coordkeys) {
Note: See TracChangeset for help on using the changeset viewer.