IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 7, 2010, 9:16:10 AM (16 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/eam_branches/ipp-20100823
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823

  • branches/eam_branches/ipp-20100823/pstamp/scripts/detectability_respond.pl

    r28902 r29124  
    9898            my $key = shift(@key_values);
    9999            my $val = shift(@key_values);
     100            # if we have wisdom, then we should have updated already.  If not, we'll bomb out later in the code.
     101            if ($key eq 'FAULT') {
     102                $val = 0;
     103            }
    100104            $query{$fpa_id}{$key}[$i] = $val;
    101105        }
     
    148152        # Determine the query style for this fpa_id
    149153        if ($fpa_id =~ /o.*g.*o/) {
    150         $query_style = 'byexp';
    151     }
     154            $query_style = 'byexp';
     155        }
    152156        elsif ($fpa_id =~ /\d+/) {
    153         $query_style = 'byid';
    154     }
     157            $query_style = 'byid';
     158        }
    155159        else {
    156         exit_with_failure(21,"Parse error in request file");
    157     }
     160            exit_with_failure(21,"Parse error in request file");
     161        }
    158162        # Confirm that we only have one stage/filter/mjd
    159163        for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) {
    160         $temp_hash{STAGE}{$query{$fpa_id}{STAGE}[$i]} = 1;
    161         $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1;
    162         $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1;
    163     }
     164            $temp_hash{STAGE}{$query{$fpa_id}{STAGE}[$i]} = 1;
     165            $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1;
     166            $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1;
     167        }
    164168        if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) {
    165169            $stage = (keys(%{ $temp_hash{STAGE} }))[0];
    166170        }
    167171        else {
    168         exit_with_failure(21,"Too many STAGEs specified");
    169     }
     172            exit_with_failure(21,"Too many STAGEs specified");
     173        }
    170174        if (scalar(keys(%{ $temp_hash{FILTER} })) == 1) {
    171         $filter = (keys(%{ $temp_hash{FILTER} }))[0];
    172     }
     175            $filter = (keys(%{ $temp_hash{FILTER} }))[0];
     176        }
    173177        else {
    174         exit_with_failure(21,"Too many FILTERs specified");
    175     }
     178            exit_with_failure(21,"Too many FILTERs specified");
     179        }
    176180        if (scalar(keys(%{ $temp_hash{'MJD-OBS'} })) == 1) {
    177         $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0];
    178     }
     181            $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0];
     182        }
    179183        else {
    180         exit_with_failure(21,"Too many MJD-OBS specified");
    181     }
     184            exit_with_failure(21,"Too many MJD-OBS specified");
     185        }
    182186        # Set common request components
    183187        my $option_mask |= 1;
     
    200204            $rowList[$i]->{ID} = $query{$fpa_id}{ROWNUM}[$i];
    201205            $rowList[$i]->{COORD_MASK} = 0;
     206            # Set default values
     207            $query{$fpa_id}{BAD_COMPONENT}[$i] = 1;
     208            $query{$fpa_id}{IMAGE}[$i] = 'no_image';
     209            $query{$fpa_id}{MASK}[$i] = 'no_mask';
     210            $query{$fpa_id}{WEIGHT}[$i] = 'no_weight';
     211            $query{$fpa_id}{PSF}[$i] = 'no_psf';
     212
     213            $query{$fpa_id}{STAGE_ID}[$i] = 'no_id';
     214            $query{$fpa_id}{IMAGE_DB}[$i] = 'no_imdb';
     215            $query{$fpa_id}{NEED_MAGIC}[$i] = 'no_magic';
     216            $query{$fpa_id}{MAGICKED}[$i] = 'no_magic';
     217            $query{$fpa_id}{CATALOG}[$i] = 'no_catalog';
     218            $query{$fpa_id}{COMPONENT_ID}[$i] = 'no_component';
     219            $query{$fpa_id}{CLASS_ID}[$i] = 'no_class';
     220
     221            $query{$fpa_id}{STATE}[$i] = 'no_state';
     222            $query{$fpa_id}{DATA_STATE}[$i] = 'no_dstate';
     223            $query{$fpa_id}{FAULT}[$i] = 'no_fault';
     224            $query{$fpa_id}{BURNTOOL_STATE}[$i] = 'no_btstate';
     225
    202226        }
    203227       
     
    217241                    $value = join ' ', @{ $this_image_ref->{$key} };
    218242                }
     243
    219244#               print "$this_image_ref $key $value\n";
    220245                foreach my $valid_index (@{ $this_image_ref->{row_index} }) {
     
    226251                    $query{$fpa_id}{IMAGE_DB}[$valid_index] = $this_image_ref->{imagedb};
    227252                    $query{$fpa_id}{NEED_MAGIC}[$valid_index] = $need_magic;
     253                    $query{$fpa_id}{BAD_COMPONENT}[$valid_index] = 0;
    228254                   
    229255                    if (exists($this_image_ref->{astrom})) {
     
    231257                    }
    232258                    else {
    233                     $query{$fpa_id}{CATALOG}[$valid_index] = $this_image_ref->{cmf};
    234                 }
     259                        $query{$fpa_id}{CATALOG}[$valid_index] = $this_image_ref->{cmf};
     260                    }
    235261                    if (exists($this_image_ref->{class_id})) {
    236262                        $query{$fpa_id}{COMPONENT_ID}[$valid_index] = $this_image_ref->{class_id};
     
    301327        }
    302328        print WISDOM "\n";
    303         @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } =
    304             ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i],
    305              $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]);
    306         push @{ $processing_request{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i;
     329        if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) {
     330            @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } =
     331                ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i],
     332                 $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]);
     333            push @{ $processing_request{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i;
     334        }
    307335    }
    308336}
     
    356384        my $stage = $query{$fpa_id}{STAGE}[$index];
    357385        # if there's a fault, then we can't process this image.
    358         if ($fault != 0) {
     386        if (($fault != 0)||($query{$fpa_id}{BAD_COMPONENT}[$index] == 1)) {
     387            $query{$fpa_id}{PROC_ERROR}[$index] = 23;
     388           
     389            $query{$fpa_id}{NPIX}[$index] = 0;
     390            $query{$fpa_id}{QFACTOR}[$index] = 0.0;
     391            $query{$fpa_id}{FLUX}[$index] = 0.0;
     392            $query{$fpa_id}{FLUX_SIG}[$index] = 0.0;
     393
    359394            next;
    360395        }
     
    384419            my ($r_ra,$r_dec,$trash,$r_x,$r_y,$r_chip) = split /\s+/, $line;
    385420            print $targetfile "$r_x $r_y\n";
    386             if (($r_ra == $query{$fpa_id}{RA1_DEG}[$processing_request{$fpa_id}{$image}[$i]])&&
    387                 ($r_dec == $query{$fpa_id}{DEC1_DEG}[$processing_request{$fpa_id}{$image}[$i]])) {
     421            if ((abs($r_ra - $query{$fpa_id}{RA1_DEG}[$processing_request{$fpa_id}{$image}[$i]]) < 1e-8)&&
     422                (abs($r_dec - $query{$fpa_id}{DEC1_DEG}[$processing_request{$fpa_id}{$image}[$i]]) < 1e-8)) {
    388423                $query{$fpa_id}{X_PXL}[$processing_request{$fpa_id}{$image}[$i]] = $r_x;
    389424                $query{$fpa_id}{Y_PXL}[$processing_request{$fpa_id}{$image}[$i]] = $r_y;
     
    392427            else {
    393428                $error_code = $PS_EXIT_PROG_ERROR;
    394                 my_die("Unable to match input RA/DEC with output RA/DEC: ($query{$fpa_id}{RA1_DEG}[$i],$query{$fpa_id}{DEC1_DEG}[$i]) -> ($r_ra,$r_dec) i. $error_code",
     429                my_die("Unable to match input RA/DEC with output RA/DEC: ($query{$fpa_id}{RA1_DEG}[$i],$query{$fpa_id}{DEC1_DEG}[$i]) -> ($r_ra,$r_dec) $error_code",
    395430                   $query{$fpa_id}{QUERY_ID}[$index],$fpa_id,$query{$fpa_id}{'MJD-OBS'}[$index],
    396431                   $query{$fpa_id}{FILTER}[$index],$query{$fpa_id}{OBSCODE}[$index],$query{$fpa_id}{STAGE}[$index],
Note: See TracChangeset for help on using the changeset viewer.