IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38000 for trunk/ippScripts


Ignore:
Timestamp:
Mar 24, 2015, 2:37:14 PM (11 years ago)
Author:
watersc1
Message:

Tested implementation of camProcessedExp exposure information that was missing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/sc_prepare_camera.pl

    r37833 r38000  
    1414use Data::Dumper;
    1515use File::Basename;
     16use File::Temp qw( tempfile );
    1617
    1718use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    3031my $remotetool = can_run('remotetool') or (warn "Can't find remotetool" and $missing_tools = 1);
    3132my $camtool    = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);
     33my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    3234
    3335if ($missing_tools) {
     
    8890my ($workdir,$exp_tag,$reduction);
    8991{
     92###    $command    = "$camtool -processedexp -cam_id $cam_id "; ### THIS LINE ONLY TO TEST! 
    9093    my $command = "$camtool -pendingexp -cam_id $cam_id ";
    9194    $command   .= " -dbname $dbname " if defined($dbname);
     
    142145    my $pre_cmd_cmfs = "ls -1 ${remote_chip_path}*.cmf > ${remote_outroot}.cmflist";
    143146    my $pre_cmd_masks= "ls -1 ${remote_chip_path}*.mk.fits > ${remote_outroot}.masklist";
     147
     148    # Despite the previous comment, we do care about the output of pendingimfile, as that
     149    # contains information for the exposure.
     150    my ($statFile, $statName) = tempfile( "/tmp/cm.$cam_id.stats.XXXX", UNLINK => 1 );
     151    foreach my $line (@$stdout_buf) {
     152        print $statFile $line;
     153    }
     154    close $statFile;
     155   
     156    # parse the stats in the metadata file
     157    $command = "$ppStatsFromMetadata $statName - CAMERA_EXP_IMFILE";
     158    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     159        run(command => $command, verbose => $verbose);
     160    unless ($success) {
     161        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     162        warn("Unable to perform ppStatsFromMetadata: $error_code\n");
     163        exit($error_code);
     164    }
     165
     166    my $results = '';
     167    foreach my $line (@$stdout_buf) {
     168        $results .= " $line";
     169    }
     170    chomp($results);
     171
     172
    144173
    145174    my $recipe_psastro = $ipprc->reduction($reduction, 'PSASTRO'); # Recipe to use
     
    163192    $camtool_post_cmd  .=  " -dbname $dbname " if defined $dbname;
    164193    $camtool_post_cmd  .=  " -path_base $ipp_outroot -hostname $remote_hostname -dtime_script 0 ";
     194    $camtool_post_cmd  .=  " $results "; # Add exposure information
    165195    my $post_cmd_echo = " echo -n \"$camtool_post_cmd\" > ${remote_outroot}.dbinfo ";
    166196    my $post_cmd_SfM  = " ppStatsFromMetadata ${remote_outroot}.stats - CAMERA_EXP_FPA >> ${remote_outroot}.dbinfo ";
Note: See TracChangeset for help on using the changeset viewer.