Changeset 28484 for branches/pap/pstamp/scripts/detectability_respond.pl
- Timestamp:
- Jun 24, 2010, 2:59:09 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pstamp/scripts/detectability_respond.pl (modified) (13 diffs)
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 }
Note:
See TracChangeset
for help on using the changeset viewer.
