IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29130


Ignore:
Timestamp:
Sep 8, 2010, 4:50:07 PM (16 years ago)
Author:
watersc1
Message:

Convert bad query row data from "Not Set" to "Not_Set" so this can be treated like a standard fpa_id in the detectability_respond.pl script.

Fix the handling of bad components so they append correctly when re-reading the wisdom file.

Location:
trunk/pstamp/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/detect_query_read

    r28808 r29130  
    164164    }
    165165    elsif ($status == 219) {
    166         @{ $colData{$col->{name}} } = map { "Not Set" } (0 .. $numRows - 1);
     166        @{ $colData{$col->{name}} } = map { "Not_Set" } (0 .. $numRows - 1);
    167167        $status = 0;
    168168    }
     
    173173# Simple stuff first.
    174174    my %known_filters = ();
    175     if ($colData{STAGE}[$i] eq "Not Set") {
     175    if ($colData{STAGE}[$i] eq "Not_Set") {
    176176        $colData{STAGE}[$i] = 'diff';
    177177    }
    178     if ($colData{OBSCODE}[$i] eq "Not Set") {
     178    if ($colData{OBSCODE}[$i] eq "Not_Set") {
    179179        $colData{OBSCODE}[$i] = 566;
    180180    }
    181181# Define filter and MJD from FPA_ID
    182     if (($colData{FILTER}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "Not Set")) {
     182    if (($colData{FILTER}[$i] eq "Not_Set")&&($colData{FPA_ID}[$i] ne "Not_Set")) {
    183183        if (exists($known_filters{$colData{FPA_ID}[$i]})) {
    184184            $colData{FILTER}[$i] = $known_filters{$colData{FPA_ID}[$i]};
     
    210210        }
    211211    }
    212     if (($colData{'MJD-OBS'}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "Not Set")) {
     212    if (($colData{'MJD-OBS'}[$i] eq "Not_Set")&&($colData{FPA_ID}[$i] ne "Not_Set")) {
    213213        # HACK!
    214214        my $mjd = $colData{FPA_ID}[$i];
     
    217217        $colData{'MJD-OBS'}[$i] = $mjd;
    218218    }
    219     if (($colData{FPA_ID}[$i] eq "Not Set")&&(($colData{'FILTER'}[$i] ne "Not Set")&&
    220                                               ($colData{'MJD-OBS'}[$i] ne "Not Set"))) {
     219    if (($colData{FPA_ID}[$i] eq "Not_Set")&&(($colData{'FILTER'}[$i] ne "Not_Set")&&
     220                                              ($colData{'MJD-OBS'}[$i] ne "Not_Set"))) {
    221221        my $dateobs_begin = mjd_to_dateobs($colData{'MJD-OBS'}[$i]);
    222222        my $dateobs_end = mjd_to_dateobs($colData{'MJD-OBS'}[$i] + 1);
  • trunk/pstamp/scripts/detectability_respond.pl

    r29081 r29130  
    9191    print "Reading wisdom file $wisdom_file instead of parsing...\n";
    9292    open(WISDOM,"$wisdom_file") or my_die("failed to open wisdom file $wisdom_file");
    93     my $i = 0;
    9493    while(<WISDOM>) {
    9594        chomp;
    9695        my ($fpa_id,@key_values) = split /\s+/;
     96        my $index = $#{ $query{$fpa_id}{ROWNUM} } + 1;
    9797        while ($#key_values > -1) {
    9898            my $key = shift(@key_values);
     
    102102                $val = 0;
    103103            }
    104             $query{$fpa_id}{$key}[$i] = $val;
    105         }
    106         $i++;
     104            $query{$fpa_id}{$key}[$index] = $val;
     105        }
    107106    }
    108107    close(WISDOM);
     
    150149        my $filter;
    151150        my $mjd;
    152         # Determine the query style for this fpa_id
    153         if ($fpa_id =~ /o.*g.*o/) {
    154             $query_style = 'byexp';
    155         }
    156         elsif ($fpa_id =~ /\d+/) {
    157             $query_style = 'byid';
    158         }
    159         else {
    160             exit_with_failure(21,"Parse error in request file");
    161         }
    162151        # Confirm that we only have one stage/filter/mjd
    163         for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) {
    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         }
    168         if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) {
    169             $stage = (keys(%{ $temp_hash{STAGE} }))[0];
    170         }
    171         else {
    172             exit_with_failure(21,"Too many STAGEs specified");
    173         }
    174         if (scalar(keys(%{ $temp_hash{FILTER} })) == 1) {
    175             $filter = (keys(%{ $temp_hash{FILTER} }))[0];
    176         }
    177         else {
    178             exit_with_failure(21,"Too many FILTERs specified");
    179         }
    180         if (scalar(keys(%{ $temp_hash{'MJD-OBS'} })) == 1) {
    181             $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0];
    182         }
    183         else {
    184             exit_with_failure(21,"Too many MJD-OBS specified");
    185         }
    186         # Set common request components
    187         my $option_mask |= 1;
    188         $option_mask |= $PSTAMP_SELECT_IMAGE;
    189         $option_mask |= $PSTAMP_SELECT_MASK;
    190         $option_mask |= $PSTAMP_SELECT_VARIANCE;
    191         $option_mask |= $PSTAMP_SELECT_PSF;
    192         my $need_magic = 1;
    193         if ($stage eq 'stack') {
    194             $need_magic = 0;
    195         }
    196         my $mjd_min = $mjd;
    197         my $mjd_max = $mjd + 1;
    198        
    199         # Construct a row list.
     152        if ($fpa_id ne 'Not_Set') {   # We only need to check things that aren't the known odd case.
     153            for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) {
     154                $temp_hash{STAGE}{$query{$fpa_id}{STAGE}[$i]} = 1;
     155                $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1;
     156                $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1;
     157            }
     158            if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) {
     159                $stage = (keys(%{ $temp_hash{STAGE} }))[0];
     160            }
     161            else {
     162                exit_with_failure(21,"Too many STAGEs specified");
     163            }
     164            if (scalar(keys(%{ $temp_hash{FILTER} })) == 1) {
     165                $filter = (keys(%{ $temp_hash{FILTER} }))[0];
     166            }
     167            else {
     168                exit_with_failure(21,"Too many FILTERs specified");
     169            }
     170            if (scalar(keys(%{ $temp_hash{'MJD-OBS'} })) == 1) {
     171                $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0];
     172            }
     173            else {
     174                exit_with_failure(21,"Too many MJD-OBS specified");
     175            }
     176        }
     177
     178        # Set up a rowList with default values
    200179        my @rowList;
    201180        for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) {
     
    223202            $query{$fpa_id}{FAULT}[$i] = 'no_fault';
    224203            $query{$fpa_id}{BURNTOOL_STATE}[$i] = 'no_btstate';
    225 
    226         }
     204        }
     205
     206        # Determine the query style for this fpa_id
     207        if ($fpa_id =~ /o.*g.*o/) {
     208            $query_style = 'byexp';
     209        }
     210        elsif ($fpa_id =~ /\d+/) {
     211            $query_style = 'byid';
     212        }
     213        elsif ($fpa_id eq 'Not_Set') {
     214            next;
     215        }
     216        else {
     217            exit_with_failure(21,"Parse error in request file");
     218        }
     219        # Set common request components
     220        my $option_mask |= 1;
     221        $option_mask |= $PSTAMP_SELECT_IMAGE;
     222        $option_mask |= $PSTAMP_SELECT_MASK;
     223        $option_mask |= $PSTAMP_SELECT_VARIANCE;
     224        $option_mask |= $PSTAMP_SELECT_PSF;
     225        my $need_magic = 1;
     226        if ($stage eq 'stack') {
     227            $need_magic = 0;
     228        }
     229        my $mjd_min = $mjd;
     230        my $mjd_max = $mjd + 1;
     231       
    227232       
    228233        # Call the PStamp code to find the images that contain the target on the given MJD in the specified filter.
     
    321326open(WISDOM,">$wisdom_file") or my_die("failed to open wisdom file $wisdom_file");
    322327foreach my $fpa_id (keys %query) {
    323     for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) {
     328    for (my $i = 0; $i <= $#{ $query{$fpa_id}{ROWNUM} }; $i++) {
    324329        print WISDOM "$fpa_id\t";
    325330        foreach my $key (keys %{ $query{$fpa_id} }) {
     
    690695            $inHeader->{FPA_ID}->{value} = $fpa_id;
    691696        }
    692 
     697       
    693698        push @{$colData{'ROWNUM'}}, @{ $query{$fpa_id}{ROWNUM} };
    694699        push @{$colData{'ERROR_CODE'}}, @{ $query{$fpa_id}{PROC_ERROR} };
Note: See TracChangeset for help on using the changeset viewer.