- Timestamp:
- Sep 7, 2010, 9:16:10 AM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100823
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pstamp/scripts/detectability_respond.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823
-
branches/eam_branches/ipp-20100823/pstamp/scripts/detectability_respond.pl
r28902 r29124 98 98 my $key = shift(@key_values); 99 99 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 } 100 104 $query{$fpa_id}{$key}[$i] = $val; 101 105 } … … 148 152 # Determine the query style for this fpa_id 149 153 if ($fpa_id =~ /o.*g.*o/) { 150 $query_style = 'byexp';151 }154 $query_style = 'byexp'; 155 } 152 156 elsif ($fpa_id =~ /\d+/) { 153 $query_style = 'byid';154 }157 $query_style = 'byid'; 158 } 155 159 else { 156 exit_with_failure(21,"Parse error in request file");157 }160 exit_with_failure(21,"Parse error in request file"); 161 } 158 162 # Confirm that we only have one stage/filter/mjd 159 163 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 } 164 168 if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) { 165 169 $stage = (keys(%{ $temp_hash{STAGE} }))[0]; 166 170 } 167 171 else { 168 exit_with_failure(21,"Too many STAGEs specified");169 }172 exit_with_failure(21,"Too many STAGEs specified"); 173 } 170 174 if (scalar(keys(%{ $temp_hash{FILTER} })) == 1) { 171 $filter = (keys(%{ $temp_hash{FILTER} }))[0];172 }175 $filter = (keys(%{ $temp_hash{FILTER} }))[0]; 176 } 173 177 else { 174 exit_with_failure(21,"Too many FILTERs specified");175 }178 exit_with_failure(21,"Too many FILTERs specified"); 179 } 176 180 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 } 179 183 else { 180 exit_with_failure(21,"Too many MJD-OBS specified");181 }184 exit_with_failure(21,"Too many MJD-OBS specified"); 185 } 182 186 # Set common request components 183 187 my $option_mask |= 1; … … 200 204 $rowList[$i]->{ID} = $query{$fpa_id}{ROWNUM}[$i]; 201 205 $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 202 226 } 203 227 … … 217 241 $value = join ' ', @{ $this_image_ref->{$key} }; 218 242 } 243 219 244 # print "$this_image_ref $key $value\n"; 220 245 foreach my $valid_index (@{ $this_image_ref->{row_index} }) { … … 226 251 $query{$fpa_id}{IMAGE_DB}[$valid_index] = $this_image_ref->{imagedb}; 227 252 $query{$fpa_id}{NEED_MAGIC}[$valid_index] = $need_magic; 253 $query{$fpa_id}{BAD_COMPONENT}[$valid_index] = 0; 228 254 229 255 if (exists($this_image_ref->{astrom})) { … … 231 257 } 232 258 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 } 235 261 if (exists($this_image_ref->{class_id})) { 236 262 $query{$fpa_id}{COMPONENT_ID}[$valid_index] = $this_image_ref->{class_id}; … … 301 327 } 302 328 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 } 307 335 } 308 336 } … … 356 384 my $stage = $query{$fpa_id}{STAGE}[$index]; 357 385 # 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 359 394 next; 360 395 } … … 384 419 my ($r_ra,$r_dec,$trash,$r_x,$r_y,$r_chip) = split /\s+/, $line; 385 420 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)) { 388 423 $query{$fpa_id}{X_PXL}[$processing_request{$fpa_id}{$image}[$i]] = $r_x; 389 424 $query{$fpa_id}{Y_PXL}[$processing_request{$fpa_id}{$image}[$i]] = $r_y; … … 392 427 else { 393 428 $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", 395 430 $query{$fpa_id}{QUERY_ID}[$index],$fpa_id,$query{$fpa_id}{'MJD-OBS'}[$index], 396 431 $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.
