Index: trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/chip_imfile.pl	(revision 12079)
+++ trunk/ippScripts/scripts/chip_imfile.pl	(revision 12213)
@@ -32,6 +32,7 @@
 
 # Parse the command-line arguments
-my ($exp_tag,			# Exposure tag
-    $class_id,			# Class Id
+my ($exp_id,			# Exposure identifier
+    $chip_id,			# Chiptool identifier
+    $class_id,			# Class identifier
     $input,			# Input FITS file
     $camera,			# Camera
@@ -42,19 +43,21 @@
     );
 GetOptions(
-    'exp_tag|e=s'   => \$exp_tag,
-    'class_id|i=s'  => \$class_id,
-    'uri|u=s'       => \$input,
-    'camera|c=s'    => \$camera,
-    'dbname|d=s'    => \$dbname, # Database name
-    'workdir|w=s'   => \$workdir,
-    'no-update'     => \$no_update,
-    'no-op'         => \$no_op,
-) or pod2usage( 2 );
+	   'exp_id=s'      => \$exp_id,
+	   'chip_id=s'     => \$chip_id,
+	   'class_id=s'    => \$class_id,
+	   'uri|u=s'       => \$input,
+	   'camera|c=s'    => \$camera,
+	   'dbname|d=s'    => \$dbname, # Database name
+	   'workdir|w=s'   => \$workdir,
+	   'no-update'     => \$no_update,
+	   'no-op'         => \$no_op,
+	   ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-    -msg => "Required options: --exp_tag --class_id --uri --camera",
+    -msg => "Required options: --exp_id --chip_id --class_id --uri --camera",
     -exitval => 3,
-) unless defined $exp_tag 
+) unless defined $exp_id
+    and defined $chip_id 
     and defined $class_id 
     and defined $input
@@ -82,9 +85,9 @@
 }
 
-$workdir = File::Spec->catfile( $workdir, $exp_tag );
+$workdir = File::Spec->catfile( $workdir, $exp_id );
 system "mkdir -p $workdir" unless -d $workdir;
 
 ### Output file name --- must match camera configuration!
-my $outputFile =  "$exp_tag.chip";
+my $outputFile =  "$exp_id.chp$chip_id";
 my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
 my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
@@ -106,21 +109,21 @@
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppImage: $error_code", $exp_tag, $class_id, $error_code);
+	&my_die("Unable to perform ppImage: $error_code", $chip_id, $class_id, $error_code);
     }
-    &my_die("Couldn't find expected output file: $outputImage\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
-    &my_die("Couldn't find expected output file: $outputBin1\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
-    &my_die("Couldn't find expected output file: $outputBin2\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
-    &my_die("Couldn't find expected output file: $outputStats\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
+    &my_die("Couldn't find expected output file: $outputImage\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
+    &my_die("Couldn't find expected output file: $outputBin1\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
+    &my_die("Couldn't find expected output file: $outputBin2\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
+    &my_die("Couldn't find expected output file: $outputStats\n", $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
 
     # Get the statistics on the processed image
     my $statsFile;		# File handle
-    open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR);
+    open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     my @contents = <$statsFile>; # Contents of file
     close $statsFile;
     my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
     my $metadata = $mdcParser->parse(join "", @contents) or
-	&my_die("Unable to parse metadata config doc", $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to parse metadata config doc", $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
     $stats->parse($metadata) or
-	&my_die("Unable to find all values in statistics output.\n", $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to find all values in statistics output.\n", $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
 }
 
@@ -136,5 +139,5 @@
     # Command to run chiptool
     my $command = "$chiptool -addprocessedimfile";
-    $command .= " -exp_tag $exp_tag";
+    $command .= " -chip_id $chip_id";
     $command .= " -class_id $class_id";
     $command .= " -recip " . RECIPE;
@@ -159,12 +162,12 @@
 {
     my $msg = shift; # Warning message on die
-    my $exp_tag = shift; # Exposure tag
+    my $chip_id = shift; # Chiptool identifier
     my $class_id = shift; # Class identifier
     my $exit_code = shift; # Exit code to add
 
     warn($msg);
-    if ($exp_tag and $class_id and not $no_update) {
+    if ($chip_id and $class_id and not $no_update) {
 	my $command = "$chiptool -addprocessedimfile";
-	$command .= " -exp_tag $exp_tag";
+	$command .= " -chip_id $chip_id";
 	$command .= " -class_id $class_id";
 	$command .= " -code $exit_code";
