Index: /trunk/ippScripts/scripts/camera_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/camera_exp.pl	(revision 12212)
+++ /trunk/ippScripts/scripts/camera_exp.pl	(revision 12213)
@@ -33,19 +33,21 @@
 use Pod::Usage qw( pod2usage );
 
-my ($exp_tag, $camera, $dbname, $workdir, $no_update, $no_op);
+my ($exp_id, $cam_id, $camera, $dbname, $workdir, $no_update, $no_op);
 GetOptions(
-    'exp_tag|e=s'       => \$exp_tag,
-    '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, # Exposure identifier
+	   'cam_id=s'          => \$cam_id, # Camtool identifier
+	   'camera|c=s'        => \$camera, # Camera
+	   'dbname|d=s'        => \$dbname, # Database name
+	   'workdir|w=s'       => \$workdir, # Working directory
+	   'no-update'         => \$no_update, # Update the database?
+	   'no-op'             => \$no_op, # Don't do any operations?
+	   ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-    -msg => "Required options: --exp_tag --camera",
+    -msg => "Required options: --exp_id --cam_id --camera",
     -exitval => 3,
-) unless defined $exp_tag
+) unless defined $exp_id
+    and defined $cam_id
     and defined $camera;
 
@@ -75,5 +77,5 @@
 my $files;			# Array of component files
 {
-    my $command = "$camtool -pendingimfile -exp_tag $exp_tag"; # Command to run
+    my $command = "$camtool -pendingimfile -cam_id $cam_id"; # Command to run
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -81,10 +83,10 @@
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform camtool: $error_code", $exp_tag, $error_code);
+	&my_die("Unable to perform camtool: $error_code", $cam_id, $error_code);
     }
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $exp_tag, $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
     $files = parse_md_list($metadata) or
-	&my_die("Unable to parse metadata list", $exp_tag, $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR);
 }
 
@@ -98,11 +100,11 @@
 #    my @zp;			# Array of photometric zero points
     foreach my $file (@$files) {
-	&my_die("Unable to find class id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{class_id};
+	&my_die("Unable to find class id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{class_id};
 	my $class_id = $file->{class_id};
-	&my_die("Unable to find bg for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg};
-	&my_die("Unable to find bg_mean_stdev for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg_mean_stdev};
-#	&my_die("Unable to find sigma_ra for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_ra};
-#	&my_die("Unable to find sigma_dec for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_dec};
-#	&my_die("Unable to find zp for class_id=$class_id", $exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{zp};
+	&my_die("Unable to find bg for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{bg};
+	&my_die("Unable to find bg_mean_stdev for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{bg_mean_stdev};
+#	&my_die("Unable to find sigma_ra for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_ra};
+#	&my_die("Unable to find sigma_dec for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_dec};
+#	&my_die("Unable to find zp for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{zp};
 	push @backgrounds, $file->{bg};
 	push @variances, $file->{bg_stdev}**2;
@@ -129,10 +131,10 @@
     $workdir = $dir;
 }
+
+$workdir = File::Spec->catfile( $workdir, $exp_id );
 system "mkdir -p $workdir" unless -d $workdir;
 
-# make this a function which generates a specific list file for a specific filename
-
 # Generate the file list, and get the statistics
-my $outputFile =  "$exp_tag.cam";
+my $outputFile =  "$exp_id.cam$cam_id";
 my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
 
@@ -182,7 +184,7 @@
 	unless ($success) {
 	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform psastro: $error_code", $exp_tag, $error_code);
-	}
-	&my_die("Unable to find expected output file: $fpaObjects", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;
+	    &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
+	}
+	&my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;
     } else {
 	$fpaObjects = $chipObjects;
@@ -198,5 +200,5 @@
 	unless ($success) {
 	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform addstar: $error_code", $exp_tag, $error_code);
+	    &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);
 	}
     }
@@ -209,7 +211,7 @@
 	unless ($success) {
 	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform ppImage: $error_code", $exp_tag, $error_code);
-	}
-	&my_die("Unable to find expected output file: $jpeg1", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg1;
+	    &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
+	}
+	&my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $jpeg1;
     }
 
@@ -221,7 +223,7 @@
 	unless ($success) {
 	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform ppImage: $error_code", $exp_tag, $error_code);
-	}
-	&my_die("Unable to find expected output file: $jpeg2", $exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg2;
+	    &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
+	}
+	&my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $jpeg2;
     }
 }
@@ -232,5 +234,5 @@
 
 unless ($no_update) {
-    my $command = "$camtool -addprocessedexp -exp_tag $exp_tag -uri UNKNOWN " .
+    my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN " .
 	"-recip " . RECIPE1() . "," . RECIPE2() . " -path_base $outputRoot " .
 	"-bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev " .
@@ -253,10 +255,10 @@
 {
     my $msg = shift; # Warning message on die
-    my $exp_tag = shift; # Exposure tag
+    my $cam_id = shift; # Camtool identifier
     my $exit_code = shift; # Exit code to add
 
     warn($msg);
-    if ($exp_tag and not $no_update) {
-	my $command = "$camtool -addprocessedexp -exp_tag $exp_tag -code $exit_code";
+    if ($cam_id and not $no_update) {
+	my $command = "$camtool -addprocessedexp -cam_id $cam_id -code $exit_code";
 	$command .= " -dbname $dbname" if defined $dbname;
         system ($command);
Index: /trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/chip_imfile.pl	(revision 12212)
+++ /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";
