Index: trunk/ippScripts/scripts/phase0exp.pl
===================================================================
--- trunk/ippScripts/scripts/phase0exp.pl	(revision 8551)
+++ trunk/ippScripts/scripts/phase0exp.pl	(revision 8709)
@@ -16,5 +16,5 @@
 use constant PHASE0_URI => 'uri'; # Key for the URI
 use constant PHASE0_CLASSID => 'class_id'; # Key for the class id
-use constant PHASE0_BG => 'bg';	# Key for the background
+use constant PHASE0_BG => 'bg';        # Key for the background
 use constant PHASE0_BG_STDEV => 'bg_stdev'; # Key for the background standard deviation
 use constant PHASE0_BG_MEAN_STDEV => 'bg_mean_stdev'; # Key for the mean of the background standard deviation
@@ -26,25 +26,25 @@
 # These values should be constant for all components
 use constant CONSTANTS => [
-			   "filter", # Filter used
-			   "airmass", # Airmass
-			   "ra", # Right ascension
-			   "decl", # Declination
-			   "posang", # Position angle
-			   "alt", # Altitude
-			   "az", # Azimuth
-			   "ccd_temp" # CCD temperature
-		       ];
+                           "filter", # Filter used
+                           "airmass", # Airmass
+                           "ra", # Right ascension
+                           "decl", # Declination
+                           "posang", # Position angle
+                           "alt", # Altitude
+                           "az", # Azimuth
+                           "ccd_temp" # CCD temperature
+                       ];
 
 # These values may vary across components; we will take the average
 use constant VARIABLES => [
-			   "exp_time", # Exposure time
-###			   "time" # Time of exposure --- not yet implemented
-			   ];
+                           "exp_time", # Exposure time
+###                           "time" # Time of exposure --- not yet implemented
+                           ];
 
 if (scalar @ARGV == 0 || scalar @ARGV >= 2) {
     die "Perform phase 0 processing at the exposure level.\n\n" .
-	"Usage: $0 EXP_ID\n\n";
+        "Usage: $0 EXP_ID\n\n";
 }
-my $expid = shift @ARGV;	# Exposure id
+my $expid = shift @ARGV;        # Exposure id
 
 
@@ -57,5 +57,5 @@
 die "Can't find required tools.\n" if $missing_tools;
 
-my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
+my $mdcParser = PS::IPP::Metadata::Config->new;        # Parser for metadata config files
 
 # Get the list of imfiles
@@ -64,5 +64,5 @@
     my $command = "$p0tool -rawimfile -exp_id $expid";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
+        run(command => $command, verbose => 1);
     die "Unable to perform p0tool on exposure id $expid: $error_code\n" if not $success;
     my $metadata = $mdcParser->parse(join "", @$stdout_buf); # Parsed metadata
@@ -71,27 +71,27 @@
 
 # Process the values
-my %values;			# Values to update
+my %values;                        # Values to update
 foreach my $variable (@{VARIABLES()}) {
     $values{$variable} = [];
 }
-my @backgrounds;		# Array of backgrounds
-my @stdevs;			# Array of background standard deviations\
-my $obsType;			# Observation type
+my @backgrounds;                # Array of backgrounds
+my @stdevs;                        # Array of background standard deviations\
+my $obsType;                        # Observation type
   
 foreach my $imfile (@$imfiles) {
     foreach my $constant (@{CONSTANTS()}) {
-	my $value = get_value($imfile, $constant); # Value for imfile
-	if (not defined $values{$constant}) {
-	    $values{$constant} = $value;
-	} elsif ($values{$constant} ne $value) {
-	    die "Value of $constant for " . $imfile->{PHASE0_CLASSID} .
-		" doesn't match previous value.\n";
-	}
+        my $value = get_value($imfile, $constant); # Value for imfile
+        if (not defined $values{$constant}) {
+            $values{$constant} = $value;
+        } elsif ($values{$constant} ne $value) {
+            die "Value of $constant for " . $imfile->{PHASE0_CLASSID} .
+                " doesn't match previous value.\n";
+        }
     }
     
     foreach my $variable (@{VARIABLES()}) {
-	my $value = get_value($imfile, $variable); # Value for imfile
-	my $array = $values{$variable};	# Array of data
-	push @$array, $value;
+        my $value = get_value($imfile, $variable); # Value for imfile
+        my $array = $values{$variable};        # Array of data
+        push @$array, $value;
     }
     
@@ -104,7 +104,7 @@
     my $type = get_value($imfile, TYPE());
     if (not defined $obsType) {
-	$obsType = $type;
+        $obsType = $type;
     } elsif ($obsType ne $type) {
-	die "Observation types differ.\n";
+        die "Observation types differ.\n";
     }
 }
@@ -116,40 +116,40 @@
     # Add the values of interest
     foreach my $constant (@{CONSTANTS()}) {
-	$command .= " -" . $constant . " " . $values{$constant};
+        $command .= " -" . $constant . " " . $values{$constant};
     }
     foreach my $variable (@{VARIABLES()}) {
-	my $array = $values{$variable};	# Array of values
-	my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
-	$stats->add_data(@$array);
-	$command .= " -" . $variable . " " . $stats->mean();
+        my $array = $values{$variable};        # Array of values
+        my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
+        $stats->add_data(@$array);
+        $command .= " -" . $variable . " " . $stats->mean();
     }
 
     # Add the statistics
     {
-	my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
-	$stats->add_data(@backgrounds);
-	$command .= " -" . PHASE0_BG() . " " . $stats->mean();
-	if (scalar @backgrounds == 1) {
-	    $command .= ' -' . PHASE0_BG_STDEV() . " 0.0";
-	} else {
-	    $command .= " -" . PHASE0_BG_STDEV() . " " . $stats->standard_deviation();
-	}
+        my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
+        $stats->add_data(@backgrounds);
+        $command .= " -" . PHASE0_BG() . " " . $stats->mean();
+        if (scalar @backgrounds == 1) {
+            $command .= ' -' . PHASE0_BG_STDEV() . " 0.0";
+        } else {
+            $command .= " -" . PHASE0_BG_STDEV() . " " . $stats->standard_deviation();
+        }
     }
     {
-	my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
-	$stats->add_data(@stdevs);
-	$command .= " -" . PHASE0_BG_MEAN_STDEV() . " " . $stats->mean();
+        my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
+        $stats->add_data(@stdevs);
+        $command .= " -" . PHASE0_BG_MEAN_STDEV() . " " . $stats->mean();
     }
     
     # Add the detrend flag
     foreach my $detrendType (@{DETRENDS()}) {
-	if (lc($obsType) eq lc($detrendType)) {
-	    $command .= " " . DETREND_FLAG;
-	    last;
-	}
+        if (lc($obsType) eq lc($detrendType)) {
+            $command .= " " . DETREND_FLAG;
+            last;
+        }
     }
  
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
+        run(command => $command, verbose => 1);
     die "Unable to run phase0 update for $expid: $error_code\n" if not $success;
 }
@@ -160,6 +160,6 @@
 # Get the value for a particular imfile, along with a strong check for its existence
 sub get_value {
-    my $imfile = shift;		# The hash of values
-    my $name = shift;		# The name of the value to check
+    my $imfile = shift;                # The hash of values
+    my $name = shift;                # The name of the value to check
 
     my $source = $imfile->{PHASE0_CLASSID()}; # Where it comes from
