Changeset 29130
- Timestamp:
- Sep 8, 2010, 4:50:07 PM (16 years ago)
- Location:
- trunk/pstamp/scripts
- Files:
-
- 2 edited
-
detect_query_read (modified) (4 diffs)
-
detectability_respond.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/detect_query_read
r28808 r29130 164 164 } 165 165 elsif ($status == 219) { 166 @{ $colData{$col->{name}} } = map { "Not Set" } (0 .. $numRows - 1);166 @{ $colData{$col->{name}} } = map { "Not_Set" } (0 .. $numRows - 1); 167 167 $status = 0; 168 168 } … … 173 173 # Simple stuff first. 174 174 my %known_filters = (); 175 if ($colData{STAGE}[$i] eq "Not Set") {175 if ($colData{STAGE}[$i] eq "Not_Set") { 176 176 $colData{STAGE}[$i] = 'diff'; 177 177 } 178 if ($colData{OBSCODE}[$i] eq "Not Set") {178 if ($colData{OBSCODE}[$i] eq "Not_Set") { 179 179 $colData{OBSCODE}[$i] = 566; 180 180 } 181 181 # Define filter and MJD from FPA_ID 182 if (($colData{FILTER}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "NotSet")) {182 if (($colData{FILTER}[$i] eq "Not_Set")&&($colData{FPA_ID}[$i] ne "Not_Set")) { 183 183 if (exists($known_filters{$colData{FPA_ID}[$i]})) { 184 184 $colData{FILTER}[$i] = $known_filters{$colData{FPA_ID}[$i]}; … … 210 210 } 211 211 } 212 if (($colData{'MJD-OBS'}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "NotSet")) {212 if (($colData{'MJD-OBS'}[$i] eq "Not_Set")&&($colData{FPA_ID}[$i] ne "Not_Set")) { 213 213 # HACK! 214 214 my $mjd = $colData{FPA_ID}[$i]; … … 217 217 $colData{'MJD-OBS'}[$i] = $mjd; 218 218 } 219 if (($colData{FPA_ID}[$i] eq "Not Set")&&(($colData{'FILTER'}[$i] ne "NotSet")&&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"))) { 221 221 my $dateobs_begin = mjd_to_dateobs($colData{'MJD-OBS'}[$i]); 222 222 my $dateobs_end = mjd_to_dateobs($colData{'MJD-OBS'}[$i] + 1); -
trunk/pstamp/scripts/detectability_respond.pl
r29081 r29130 91 91 print "Reading wisdom file $wisdom_file instead of parsing...\n"; 92 92 open(WISDOM,"$wisdom_file") or my_die("failed to open wisdom file $wisdom_file"); 93 my $i = 0;94 93 while(<WISDOM>) { 95 94 chomp; 96 95 my ($fpa_id,@key_values) = split /\s+/; 96 my $index = $#{ $query{$fpa_id}{ROWNUM} } + 1; 97 97 while ($#key_values > -1) { 98 98 my $key = shift(@key_values); … … 102 102 $val = 0; 103 103 } 104 $query{$fpa_id}{$key}[$i] = $val; 105 } 106 $i++; 104 $query{$fpa_id}{$key}[$index] = $val; 105 } 107 106 } 108 107 close(WISDOM); … … 150 149 my $filter; 151 150 my $mjd; 152 # Determine the query style for this fpa_id153 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 }162 151 # 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 200 179 my @rowList; 201 180 for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) { … … 223 202 $query{$fpa_id}{FAULT}[$i] = 'no_fault'; 224 203 $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 227 232 228 233 # Call the PStamp code to find the images that contain the target on the given MJD in the specified filter. … … 321 326 open(WISDOM,">$wisdom_file") or my_die("failed to open wisdom file $wisdom_file"); 322 327 foreach 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++) { 324 329 print WISDOM "$fpa_id\t"; 325 330 foreach my $key (keys %{ $query{$fpa_id} }) { … … 690 695 $inHeader->{FPA_ID}->{value} = $fpa_id; 691 696 } 692 697 693 698 push @{$colData{'ROWNUM'}}, @{ $query{$fpa_id}{ROWNUM} }; 694 699 push @{$colData{'ERROR_CODE'}}, @{ $query{$fpa_id}{PROC_ERROR} };
Note:
See TracChangeset
for help on using the changeset viewer.
