Changeset 22430 for trunk/ippScripts/scripts/camera_exp.pl
- Timestamp:
- Feb 24, 2009, 12:00:25 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/camera_exp.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/camera_exp.pl
r20661 r22430 27 27 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 28 28 use Pod::Usage qw( pod2usage ); 29 30 # Look for programs we need 31 my $missing_tools; 32 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 33 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 34 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 35 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 36 my $psastro = can_run('psastro') or (warn "Can't find psastro" and $missing_tools = 1); 37 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1); 38 if ($missing_tools) { 39 warn("Can't find required tools."); 40 exit($PS_EXIT_CONFIG_ERROR); 41 } 29 42 30 43 my ( $exp_tag, $cam_id, $camera, $outroot, $recipe, $dbname, $reduction, $dvodb, $verbose, $no_update, … … 57 70 defined $camera; 58 71 72 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 73 $SIG{__DIE__} = sub { die @_ if $^S; 74 my_die( $_[0], $cam_id, $PS_EXIT_UNKNOWN_ERROR ); }; 75 59 76 $ipprc->define_camera($camera); 60 77 … … 84 101 my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 85 102 &my_die("Unrecognised ADDSTAR recipe", $cam_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe1; 86 87 # Look for programs we need88 my $missing_tools;89 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);90 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);91 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);92 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);93 94 # test for addstar and psastro:95 my $psastro = can_run('psastro') or (warn "Can't find psastro" and $missing_tools = 1);96 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1);97 98 if ($missing_tools) {99 warn("Can't find required tools.");100 exit($PS_EXIT_CONFIG_ERROR);101 }102 103 103 104 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files … … 272 273 273 274 if ($do_stats) { 274 my $fpaStatsReal = $ipprc->file_resolve($fpaStats);275 &my_die("Couldn't find expected output file: $fpaStats", $cam_id, $PS_EXIT_SYS_ERROR) unless -f $fpaStatsReal;276 277 # parse stats from metadata278 $command = "$ppStatsFromMetadata $fpaStatsReal - CAMERA_EXP_FPA";279 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =280 run(command => $command, verbose => $verbose);281 unless ($success) {282 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);283 &my_die("Unable to perform ppStatsFromMetadata: $error_code", $cam_id, $error_code);284 }285 foreach my $line (@$stdout_buf) {286 $cmdflags .= " $line";287 }288 chomp $cmdflags;275 my $fpaStatsReal = $ipprc->file_resolve($fpaStats); 276 &my_die("Couldn't find expected output file: $fpaStats", $cam_id, $PS_EXIT_SYS_ERROR) unless -f $fpaStatsReal; 277 278 # parse stats from metadata 279 $command = "$ppStatsFromMetadata $fpaStatsReal - CAMERA_EXP_FPA"; 280 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 281 run(command => $command, verbose => $verbose); 282 unless ($success) { 283 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 284 &my_die("Unable to perform ppStatsFromMetadata: $error_code", $cam_id, $error_code); 285 } 286 foreach my $line (@$stdout_buf) { 287 $cmdflags .= " $line"; 288 } 289 chomp $cmdflags; 289 290 } 290 291 … … 323 324 $command .= " $realFile"; 324 325 325 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script326 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script 326 327 327 328 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 331 332 &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code); 332 333 } 333 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); # MJD of starting script334 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); # MJD of starting script 334 335 } 335 336 }
Note:
See TracChangeset
for help on using the changeset viewer.
