Changeset 8763 for trunk/ippScripts/scripts/phase0imfile.pl
- Timestamp:
- Sep 6, 2006, 4:32:51 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase0imfile.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase0imfile.pl
r8715 r8763 4 4 use strict; 5 5 6 use vars qw( $VERSION ); 7 $VERSION = '0.01'; 8 6 9 use IPC::Cmd qw( can_run run ); 7 10 use PS::IPP::Metadata::Config; 8 11 use PS::IPP::Metadata::Stats; 12 use PS::IPP::Metadata::StatsFilter; 9 13 use Data::Dumper; 14 15 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 16 use Pod::Usage qw( pod2usage ); 17 18 my ($exp_id, $class, $class_id, $uri); 19 20 GetOptions( 21 'exp_id|e=s' => \$exp_id, 22 'class|c=s' => \$class, 23 'class_id|i=s' => \$class_id, 24 'uri|u=s' => \$uri, 25 ) or pod2usage( 2 ); 26 27 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 28 pod2usage( 29 -msg => "Required options: --exp_id --class --class_id --uri", 30 -exitval => 3, 31 ) unless defined $exp_id 32 and defined $class 33 and defined $class_id 34 and defined $uri; 35 36 # XXX the uri should be processed either here or by ppImage 37 my $file = $uri; 10 38 11 39 use constant RECIPE => "PPSTATS_PHASE0"; # Recipe to use for ppStats … … 40 68 use constant P0TOOL_BG_MEAN_STDEV => '-bg_mean_stdev'; # Switch to add the bg mean stdev 41 69 42 # Parse command-line arguments43 if (scalar @ARGV == 0 || scalar @ARGV > 3) {44 die "Perform phase 0 processing at the imfile level.\n\n" .45 "Usage: $0 EXP_ID CLASS_ID FILE.fits\n\n";46 }47 48 my $expid = shift @ARGV; # Exposure identifier49 my $classid = shift @ARGV; # Class identifier50 my $file = shift @ARGV; # Input filename51 52 53 70 # Look for programs we need 54 71 my $missing_tools; … … 63 80 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 64 81 run(command => $command, verbose => 1); 65 die "Unable to perform ppStats on exposure id $exp id: $error_code\n" if not $success;82 die "Unable to perform ppStats on exposure id $exp_id: $error_code\n" if not $success; 66 83 67 84 # Parse the output … … 69 86 my $metadata = $mdcParser->parse(join "", @$stdout_buf) 70 87 or die "unable to parse metadata config doc"; 88 my $statsfilter = PS::IPP::Metadata::StatsFilter->new; 89 $metadata = $statsfilter->filter($metadata) 90 or die "failed to filter stats document"; 71 91 my @constants = keys %{CONSTANTS()}; # List of constants to parse out 72 92 my @variables = keys %{VARIABLES()}; # List of variables to parse out … … 77 97 # Push the results into the database 78 98 { 79 my $command = $p0tool . " " . P0TOOL_MODE() . " " . P0TOOL_EXPID() . " " . $exp id . " " .80 P0TOOL_CLASSID() . " " . $class id; # Command to run p0tool99 my $command = $p0tool . " " . P0TOOL_MODE() . " " . P0TOOL_EXPID() . " " . $exp_id . " " . 100 P0TOOL_CLASSID() . " " . $class_id; # Command to run p0tool 81 101 82 102 foreach my $constant (keys %{CONSTANTS()}) {
Note:
See TracChangeset
for help on using the changeset viewer.
