Changeset 12213 for trunk/ippScripts/scripts/chip_imfile.pl
- Timestamp:
- Mar 2, 2007, 5:37:28 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/chip_imfile.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/chip_imfile.pl
r12079 r12213 32 32 33 33 # Parse the command-line arguments 34 my ($exp_tag, # Exposure tag 35 $class_id, # Class Id 34 my ($exp_id, # Exposure identifier 35 $chip_id, # Chiptool identifier 36 $class_id, # Class identifier 36 37 $input, # Input FITS file 37 38 $camera, # Camera … … 42 43 ); 43 44 GetOptions( 44 'exp_tag|e=s' => \$exp_tag, 45 'class_id|i=s' => \$class_id, 46 'uri|u=s' => \$input, 47 'camera|c=s' => \$camera, 48 'dbname|d=s' => \$dbname, # Database name 49 'workdir|w=s' => \$workdir, 50 'no-update' => \$no_update, 51 'no-op' => \$no_op, 52 ) or pod2usage( 2 ); 45 'exp_id=s' => \$exp_id, 46 'chip_id=s' => \$chip_id, 47 'class_id=s' => \$class_id, 48 'uri|u=s' => \$input, 49 'camera|c=s' => \$camera, 50 'dbname|d=s' => \$dbname, # Database name 51 'workdir|w=s' => \$workdir, 52 'no-update' => \$no_update, 53 'no-op' => \$no_op, 54 ) or pod2usage( 2 ); 53 55 54 56 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 55 57 pod2usage( 56 -msg => "Required options: --exp_ tag--class_id --uri --camera",58 -msg => "Required options: --exp_id --chip_id --class_id --uri --camera", 57 59 -exitval => 3, 58 ) unless defined $exp_tag 60 ) unless defined $exp_id 61 and defined $chip_id 59 62 and defined $class_id 60 63 and defined $input … … 82 85 } 83 86 84 $workdir = File::Spec->catfile( $workdir, $exp_ tag);87 $workdir = File::Spec->catfile( $workdir, $exp_id ); 85 88 system "mkdir -p $workdir" unless -d $workdir; 86 89 87 90 ### Output file name --- must match camera configuration! 88 my $outputFile = "$exp_ tag.chip";91 my $outputFile = "$exp_id.chp$chip_id"; 89 92 my $outputRoot = File::Spec->catfile( $workdir, $outputFile ); 90 93 my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id); … … 106 109 unless ($success) { 107 110 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 108 &my_die("Unable to perform ppImage: $error_code", $ exp_tag, $class_id, $error_code);111 &my_die("Unable to perform ppImage: $error_code", $chip_id, $class_id, $error_code); 109 112 } 110 &my_die("Couldn't find expected output file: $outputImage\n", $ exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;111 &my_die("Couldn't find expected output file: $outputBin1\n", $ exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;112 &my_die("Couldn't find expected output file: $outputBin2\n", $ exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;113 &my_die("Couldn't find expected output file: $outputStats\n", $ exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;113 &my_die("Couldn't find expected output file: $outputImage\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage; 114 &my_die("Couldn't find expected output file: $outputBin1\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1; 115 &my_die("Couldn't find expected output file: $outputBin2\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2; 116 &my_die("Couldn't find expected output file: $outputStats\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats; 114 117 115 118 # Get the statistics on the processed image 116 119 my $statsFile; # File handle 117 open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $ exp_tag, $class_id, $PS_EXIT_SYS_ERROR);120 open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 118 121 my @contents = <$statsFile>; # Contents of file 119 122 close $statsFile; 120 123 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 121 124 my $metadata = $mdcParser->parse(join "", @contents) or 122 &my_die("Unable to parse metadata config doc", $ exp_tag, $class_id, $PS_EXIT_PROG_ERROR);125 &my_die("Unable to parse metadata config doc", $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 123 126 $stats->parse($metadata) or 124 &my_die("Unable to find all values in statistics output.\n", $ exp_tag, $class_id, $PS_EXIT_PROG_ERROR);127 &my_die("Unable to find all values in statistics output.\n", $chip_id, $class_id, $PS_EXIT_PROG_ERROR); 125 128 } 126 129 … … 136 139 # Command to run chiptool 137 140 my $command = "$chiptool -addprocessedimfile"; 138 $command .= " - exp_tag $exp_tag";141 $command .= " -chip_id $chip_id"; 139 142 $command .= " -class_id $class_id"; 140 143 $command .= " -recip " . RECIPE; … … 159 162 { 160 163 my $msg = shift; # Warning message on die 161 my $ exp_tag = shift; # Exposure tag164 my $chip_id = shift; # Chiptool identifier 162 165 my $class_id = shift; # Class identifier 163 166 my $exit_code = shift; # Exit code to add 164 167 165 168 warn($msg); 166 if ($ exp_tagand $class_id and not $no_update) {169 if ($chip_id and $class_id and not $no_update) { 167 170 my $command = "$chiptool -addprocessedimfile"; 168 $command .= " - exp_tag $exp_tag";171 $command .= " -chip_id $chip_id"; 169 172 $command .= " -class_id $class_id"; 170 173 $command .= " -code $exit_code";
Note:
See TracChangeset
for help on using the changeset viewer.
