Changeset 28484 for branches/pap/pstamp
- Timestamp:
- Jun 24, 2010, 2:59:09 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 7 edited
-
. (modified) (1 prop)
-
pstamp/scripts/detectability_respond.pl (modified) (13 diffs)
-
pstamp/scripts/pstamp_finish.pl (modified) (10 diffs)
-
pstamp/scripts/pstamp_parser_run.pl (modified) (3 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (1 diff)
-
pstamp/src/ppstampMakeStamp.c (modified) (1 diff)
-
pstamp/src/pstamp.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/pstamp/scripts/detectability_respond.pl
r27859 r28484 226 226 my @psphot_Qfact= (); 227 227 my @psphot_flux = (); 228 my @psphot_error = (); 228 229 229 230 foreach my $k (keys %image_list_hash) { … … 231 232 my $cmf = "$image_list_hash{$k}{OUTROOT}.$image_list_hash{$k}{CLASS_ID}.cmf"; 232 233 233 my ($tmp_Npix,$tmp_Qfact,$tmp_flux ) = read_cmf_file($cmf,$image_list_hash{$k}{EXTENSION_BASE});234 my ($tmp_Npix,$tmp_Qfact,$tmp_flux,$tmp_flux_error) = read_cmf_file($cmf,$image_list_hash{$k}{EXTENSION_BASE}); 234 235 235 236 push @rownums, @{ $image_list_hash{$k}{ROWNUM} }; … … 238 239 push @psphot_Qfact, @{ $tmp_Qfact }; 239 240 push @psphot_flux, @{ $tmp_flux }; 241 push @psphot_error, @{ $tmp_flux_error }; 240 242 } 241 243 else { … … 245 247 push @psphot_Qfact, (map { 0.0 } @{ $image_list_hash{$k}{ROWNUM} }); 246 248 push @psphot_flux, (map { 0.0 } @{ $image_list_hash{$k}{ROWNUM} }); 249 push @psphot_error, (map { 0.0 } @{ $image_list_hash{$k}{ROWNUM} }); 247 250 } 248 251 } … … 252 255 $query{HEADER}{MJD_OBS}[0],$query{HEADER}{filter}[0], 253 256 $query{HEADER}{obscode}[0], 254 \@rownums, \@out_errors, \@psphot_Npix, \@psphot_Qfact, \@psphot_flux );257 \@rownums, \@out_errors, \@psphot_Npix, \@psphot_Qfact, \@psphot_flux, \@psphot_error); 255 258 # print "Wrote response file $output\n"; 256 259 # … … 406 409 my @tmp_Qfact = (); 407 410 my @tmp_flux = (); 411 my @tmp_flux_err = (); 408 412 409 413 my ($detect_F_col,$detect_N_col,$detect_flux_col,$detect_mag_col) = (-1, -1, -1, -1); … … 428 432 { name => 'PSF_NPIX', type => '1J', writetype => TLONG }, 429 433 { name => 'PSF_INST_MAG', type => '1E', writetype => TDOUBLE }, 434 { name => 'PSF_INST_MAG_SIG', type => '1E', writetype => TDOUBLE }, 430 435 ]; 431 436 } … … 435 440 { name => 'PSF_NPIX', type => '1J', writetype => TLONG }, 436 441 { name => 'PSF_INST_FLUX', type => '1E', writetype => TDOUBLE }, 442 { name => 'PSF_INST_FLUX_SIG', type => '1E', writetype => TDOUBLE }, 437 443 ]; 438 444 } … … 450 456 $inFits->get_num_rows($numRows, $status) and check_fitsio($status); 451 457 458 my $correct_error = 0; 452 459 foreach my $col (@$column_defs) { 453 460 my ($col_num,$col_type,$col_data); … … 469 476 @tmp_flux = map { $_ = 10**(-0.4 * $_) } @{ $col_data }; 470 477 } 478 elsif ($col->{name} eq 'PSF_INST_MAG_SIG') { 479 @tmp_flux_err = map { $_ = $_ / (2.5 * log10(exp(1))) } @{ $col_data }; 480 $correct_error = 1; 481 } 471 482 elsif ($col->{name} eq 'PSF_INST_FLUX') { 472 483 @tmp_flux = @{ $col_data }; 473 484 } 485 elsif ($col->{name} eq 'PSF_INST_FLUX_SIG') { 486 @tmp_flux_err = @{ $col_data }; 487 } 488 } 489 if ($correct_error) { 490 for (my $c = 0; $c <= $#tmp_flux_err; $c++) { 491 $tmp_flux_err[$c] = $tmp_flux_err[$c] * $tmp_flux[$c]; 492 } 474 493 } 475 494 $inFits->close_file( $status ) and check_fitsio($status); 476 return(\@tmp_Npix, \@tmp_Qfact, \@tmp_flux );495 return(\@tmp_Npix, \@tmp_Qfact, \@tmp_flux, \@tmp_flux_err); 477 496 } 478 497 … … 490 509 my $psphot_Qfact_ref = shift; 491 510 my $psphot_flux_ref = shift; 511 my $psphot_error_ref = shift; 492 512 my $status = 0; 493 513 … … 504 524 # flux of the target source 505 525 { name => 'TARGET_FLUX', type => 'D', writetype => TDOUBLE }, 526 # error in the flux of the target source 527 { name => 'TARGET_FLUX_SIG', type => 'D', writetype => TDOUBLE }, 506 528 ]; 507 529 … … 543 565 push @{$colData{'DETECT_F'}}, ${ $psphot_Qfact_ref }[$i]; 544 566 push @{$colData{'TARGET_FLUX'}}, ${ $psphot_flux_ref }[$i]; 567 push @{$colData{'TARGET_FLUX_SIG'}}, ${ $psphot_error_ref }[$i]; 545 568 unless (defined(${ $colData{'TARGET_FLUX'}}[-1])) { 546 569 $colData{'TARGET_FLUX'}[-1] = 0.0; 570 } 571 unless (defined(${ $colData{'TARGET_FLUX_SIG'}}[-1])) { 572 $colData{'TARGET_FLUX_SIG'}[-1] = 0.0; 547 573 } 548 574 } -
branches/pap/pstamp/scripts/pstamp_finish.pl
r28046 r28484 76 76 if ($product eq "NULL") { 77 77 # nothing more to do 78 stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);78 my_die("product is NULL!", $req_id, $PS_EXIT_PROG_ERROR); 79 79 } 80 80 … … 92 92 93 93 if (!mkdir $outdir) { 94 print STDERR "cannot create output directory $outdir"; 95 stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR); 94 my_die("cannot create output directory $outdir",$req_id, $PS_EXIT_UNKNOWN_ERROR); 96 95 } 97 96 98 97 99 98 } elsif (! -d $outdir ) { 100 # XXX TODO: fault the request so we pstamp_finish doesn't keep trying to process the 101 # request 102 print STDERR "output directory $outdir exists but is not a directory"; 103 stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR); 99 my_die("output directory $outdir exists but is not a directory", $req_id, $PS_EXIT_UNKNOWN_ERROR); 104 100 } 105 101 106 102 if (! -e $req_file ) { 107 print STDERR "request file $req_file is missing\n"; 108 stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR); 103 my_die("request file $req_file is missing", $req_id, $PS_EXIT_CONFIG_ERROR); 109 104 } 110 105 … … 115 110 # Since a request got queued, the request file must have been readable at some 116 111 # point 117 print STDERR "failed to read request_file $req_file" ; 118 stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR); 112 my_die("failed to read request file $req_file", $req_id, $PS_EXIT_CONFIG_ERROR); 119 113 } 120 114 … … 151 145 my $output = join "", @$stdout_buf; 152 146 if (!$output) { 153 if ($verbose) {154 print STDERR "Request $req_id produced no jobs.\n"155 }156 147 # This should not happen. A fake job should have been entered 157 stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);148 my_die("Request $req_id produced no jobs", $req_id, $PS_EXIT_PROG_ERROR); 158 149 } else { 159 if (0) {160 my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");161 162 my $jobs = parse_md_list($metadata);163 }164 150 my $jobs = parse_md_fast($mdcParser, $output); 165 151 … … 181 167 # this request had a duplicate request name yet the parser didn't give 182 168 # it an "ERROR style name. 183 stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);169 my_die("duplicate request not given a request name", $req_id, $PS_EXIT_PROG_ERROR); 184 170 } 185 171 my ($row, $req_info, $project) = get_request_info($rows, $rownum); … … 187 173 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 188 174 my $image_db = $proj_hash->{dbname}; 189 if (!$image_db) { 190 carp("failed to find imagedb for project: $project"); 191 if (!$fault) { 192 stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR); 193 } 175 if (!$image_db and !$fault) { 176 # if project isn't resolvable, the paser should have faulted this job 177 my_die("failed to find imagedb for project $project", $req_id, $PS_EXIT_CONFIG_ERROR); 194 178 } 195 179 … … 273 257 run(command => $command, verbose => $verbose); 274 258 unless ($success) { 275 print STDERR "Unable to perform $command error code: $error_code\n";276 259 $request_fault = $error_code >> 8; 260 my_die("Unable to perform $command error code: $error_code", $req_id, $request_fault); 277 261 } 278 262 } … … 282 266 my $command = "$dsreg --list $reglist_name --add $fileset --product $product --type PSRESULTS"; 283 267 $command .= " --link --datapath $outdir --ps0 $req_id"; 284 # XXX: let dsreg and config handle resolving dbname and dbserver285 # $command .= " --dbname $dbname" if $dbname;286 268 287 269 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 288 270 run(command => $command, verbose => $verbose); 289 271 unless ($success) { 290 #die("Unable to perform $command error code: $error_code");291 print STDERR "Unable to perform $command error code: $error_code\n";292 272 $request_fault = $error_code >> 8; 293 # fall through to stop the request273 my_die("Unable to perform $command error code: $error_code\n", $req_id, $request_fault); 294 274 } 295 275 } 296 276 # set the request's state to stop 297 277 { 298 my $command = "$pstamptool -updatereq -req_id $req_id -set_state stop -set_fault $request_fault";278 my $command = "$pstamptool -updatereq -req_id $req_id -set_state stop"; 299 279 $command .= " -dbname $dbname" if $dbname; 300 280 $command .= " -dbserver $dbserver" if $dbserver; … … 308 288 } 309 289 310 sub stop_request_and_exit { 290 sub my_die { 291 my $msg = shift; 311 292 my $req_id = shift; 312 293 my $fault = shift; 313 294 314 my $command = "$pstamptool -updatereq -req_id $req_id -set_state stop -set_fault $fault"; 295 carp($msg); 296 297 my $command = "$pstamptool -updatereq -req_id $req_id -set_fault $fault"; 315 298 $command .= " -dbname $dbname" if $dbname; 316 299 $command .= " -dbserver $dbserver" if $dbserver; … … 445 428 return undef; 446 429 } 447 if (0) {448 my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");449 450 my $exposures = parse_md_list($metadata);451 }452 430 my $exposures = parse_md_fast($mdcParser, $output); 453 431 my $numExp = @$exposures; -
branches/pap/pstamp/scripts/pstamp_parser_run.pl
r27897 r28484 198 198 $parse_cmd .= " --verbose" if $verbose; 199 199 200 my $newState = "run";200 my $newState; 201 201 my $fault; 202 202 { … … 224 224 } 225 225 226 unless ($success) { 226 if ($success) { 227 $newState = 'run'; 228 } else { 227 229 $fault = $error_code >> 8; 228 # $newState = "stop";229 230 } 230 231 } … … 234 235 # 235 236 { 236 my $command = "$pstamptool -updatereq -req_id $req_id -set_state $newState"; 237 my $command = "$pstamptool -updatereq -req_id $req_id"; 238 $command .= " -set_state $newState" if $newState; 237 239 $command .= " -set_outdir $outdir"; 238 240 $command .= " -set_reqType $reqType" if $reqType; -
branches/pap/pstamp/scripts/pstampparse.pl
r28145 r28484 361 361 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 362 362 if (!$proj_hash) { 363 print STDERR "project $project not found\n" ;364 363 foreach $row (@$rowList) { 365 364 insertFakeJobForRow($row, 1, $PSTAMP_UNKNOWN_PRODUCT); -
branches/pap/pstamp/src/ppstampMakeStamp.c
r27989 r28484 688 688 } 689 689 } 690 psU32 maskMask = ~convPoor; 690 psU32 suspect = psMetadataLookupU32(&status, masks, "SUSPECT"); 691 if (!status) { 692 psError(PM_ERR_CONFIG, false, "failed to lookup mask value for SUSPECT in recipes\n"); 693 return false; 694 } 695 psU32 maskMask = ~(convPoor | suspect); 691 696 692 697 double exciseValue; -
branches/pap/pstamp/src/pstamp.h
r28146 r28484 33 33 #define PSTAMP_SELECT_BACKMDL 32 34 34 #define PSTAMP_SELECT_INVERSE 1024 35 #define PSTAMP_SELECT_UNCONV 2048 36 #define PSTAMP_USE_IMFILE_ID 16384 35 37 36 #define PSTAMP_ WAIT_FOR_UPDATE 204838 #define PSTAMP_NO_WAIT_FOR_UPDATE 32768 37 39 38 40 #define PSTAMP_CENTER_IN_PIXELS 1
Note:
See TracChangeset
for help on using the changeset viewer.
