Changeset 33324 for trunk/pstamp/scripts/dqueryparse.pl
- Timestamp:
- Feb 21, 2012, 4:11:24 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/dqueryparse.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/dqueryparse.pl
r33299 r33324 100 100 101 101 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 102 107 my %query = (); 103 my %image_list_hash = ();104 108 105 109 { 106 110 # 107 111 # Parse input request file using detect_query_read 112 # result is a simple text file 108 113 # 109 114 my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file"; … … 139 144 } 140 145 # 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. 142 147 # 143 148 my $query_id; … … 223 228 $option_mask |= $PSTAMP_SELECT_VARIANCE; 224 229 $option_mask |= $PSTAMP_SELECT_PSF; 225 my $need_magic = 1; 230 231 # magic is dead 232 my $need_magic = 0; 226 233 if ($stage eq 'stack') { 227 234 $need_magic = 0; … … 245 252 foreach my $this_image_ref (@{ $pstamp_images_ref }) { 246 253 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 258 255 foreach my $valid_index (@{ $this_image_ref->{row_index} }) { 259 256 $query{$fpa_id}{IMAGE}[$valid_index] = $this_image_ref->{image}; … … 336 333 foreach my $fpa_id (keys %query) { 337 334 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 # }352 335 if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) { 353 336 push @{ $rows_for_component{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i; … … 358 341 } 359 342 360 my $job_num = 0; 343 # 344 # Finally build the parameter lists and queue jobs for each component 345 # 346 347 my $job_num = 1; 361 348 foreach my $fpa_id (keys %rows_for_component) { 362 349 foreach my $component (keys % {$rows_for_component{$fpa_id} } ) { … … 368 355 my $stage = $query{$fpa_id}{STAGE}[$i]; 369 356 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]; 371 358 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) = @_; 372 360 $dep_id = queue_update_run($req_id, $outdir, $label, $data_state, $stage, $stage_id, $component, 0, $imagedb); 373 361 } 374 362 375 363 my $outputBase = "$outdir/$job_num" . "_"; 364 365 # params_file is an mdc description containing the parameters for the job 376 366 my $params_file = $outputBase . "params.mdc"; 377 367 378 368 open PARAMS, ">$params_file" or my_die("failed to create $params_file", $PS_EXIT_UNKNOWN_ERROR); 369 370 # first the job params 379 371 print PARAMS "dqueryJobParams METADATA\n"; 380 372 foreach my $key (keys %{ $query{$fpa_id} } ) { … … 383 375 } 384 376 print PARAMS "END\n\n"; 377 378 # then one structure with the coordinates for each row 385 379 print PARAMS "dqueryCoord MULTI\n"; 386 380 381 my @coordkeys = qw(ROWNUM RA1_DEG DEC1_DEG RA2_DEG DEC2_DEG MAG); 387 382 foreach my $row ( @{ $rows_for_component{$fpa_id}{$component} }) { 388 my @coordkeys = qw(ROWNUM RA1_DEG DEC1_DEG RA2_DEG DEC2_DEG MAG);389 383 print PARAMS "\ndqueryCoord METADATA\n"; 390 384 foreach my $key (@coordkeys) {
Note:
See TracChangeset
for help on using the changeset viewer.
