IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34739


Ignore:
Timestamp:
Nov 29, 2012, 2:35:21 PM (14 years ago)
Author:
bills
Message:

add n_detections and n_extended to skycalResult

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20121026/ippScripts/scripts/skycalibration.pl

    r34151 r34739  
    3333my $psastro = can_run('psastro') or (warn "Can't find psastro" and $missing_tools = 1);
    3434my $fhead = can_run('fhead') or (warn "Can't find fhead" and $missing_tools = 1);
     35my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1);
    3536my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    3637my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
     
    191192}
    192193
     194my $resolved = $ipprc->file_resolve($file);
     195if (!$resolved) {
     196    &my_die("Unable to find input file: $file", $skycal_id, $PS_EXIT_SYS_ERROR);
     197}
     198
     199# read the input header to find the number of detections and the number of detections
     200# with extended model
     201my $n_detections = 0;
     202my $n_extended = 0;
     203{
     204    my $command = "echo $resolved | $fields -n SkyChip.psf NAXIS2";
     205    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     206            run(command => $command, verbose => 0);
     207        # fields does not return 0 on success
     208    (undef, $n_detections)  = split " ", join "", @$stdout_buf;
     209    chomp $n_detections;
     210    &my_die("Unable to find number of detections from $file: ", $skycal_id, $PS_EXIT_SYS_ERROR)
     211        unless defined $n_detections;
     212
     213    $command = "echo $resolved | $fields -n SkyChip.hdr NDET_EXT";
     214    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     215            run(command => $command, verbose => 0);
     216    (undef, $n_extended)  = split " ", join "", @$stdout_buf;
     217    chomp $n_extended;
     218    &my_die("Unable to find number of extended objects from $file: ", $skycal_id, $PS_EXIT_SYS_ERROR)
     219        unless defined $n_extended;
     220}
     221
     222
    193223# Perform psastro analysis
    194224my $output_sources_filerule =  'PSASTRO.OUTPUT.CMF';
     
    246276{
    247277    my $command = "$staticskytool -skycal_id $skycal_id";
     278    $command .= " -n_detections $n_detections";
     279    $command .= " -n_extended $n_extended";
    248280    $command .= " -addskycalresult -path_base $outroot";
    249281    $command .= " $cmdflags";
Note: See TracChangeset for help on using the changeset viewer.