Index: /trunk/Ohana/src/perl/src/grab.keywords
===================================================================
--- /trunk/Ohana/src/perl/src/grab.keywords	(revision 93)
+++ /trunk/Ohana/src/perl/src/grab.keywords	(revision 94)
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
 
-$version = 1.0;
+$version = 2.0;
 
 if (@ARGV != 3) { die "USAGE: grab.keywords (infile) (cmproot) (outfile)\n" ; }
@@ -12,4 +12,6 @@
 # $cmproot is the rootname of the processed output for this file (contains astrom keywords)
 # $outfile is the output header data file
+
+if ($cmproot eq "phu") { goto photometry; }
 
 # grab astrometry keywords from $cmpfile:
@@ -96,5 +98,5 @@
 if ($Nastro == 0) {
     print STDERR "can't find all astrometry keywords from $cmproot\n";
-    $line = sprintf "COMMENT   Elixir failed to find an astrometry solution for this image\n"; 
+    $line = sprintf "COMMENT  Elixir:  no astrometry solution for this image\n"; 
     @astrom = ($line);
 } else {
@@ -111,10 +113,15 @@
 
 # define a reference chip to grab the photometry data
-$ccd = `cameraconfig -ID 0`; chop $ccd;
-if (?) { die ("error in camera config\n"); }
+ photometry: 
+     if ($cmproot eq "phu") {
+	 $ccd = "phu";
+     } else {
+	 $ccd = `cameraconfig -ID 0`; chop $ccd;
+	 if ($?) { die ("error in camera config\n"); }
+     }
 
 # grab the appropriate photometry data
 @photom = ();
-@photlist = `transearch -image $infile $ccd split -equiv`;
+@photlist = `photsearch -trans -image $infile $ccd split -equiv`;
 if ($?) { @photlist = (); }
 
@@ -123,5 +130,5 @@
 if ($Nphot == 0) {
     print STDERR "can't get photometry data for this image\n";
-    $line = sprintf "COMMENT   Elixir failed to find photometry data for this image\n"; 
+    $line = sprintf "COMMENT  Elixir: No photometry calibrations for this night & filter\n"; 
     @photom = ($line);
 } else {
@@ -131,26 +138,28 @@
     $line = sprintf "PHOT_C0 = %20G / Nightly zero point - nominal                  \n", $words[3];  @photom = (@photom, $line);
     $line = sprintf "PHOT_CS = %20G / Nightly zero point - scatter                  \n", $words[4];  @photom = (@photom, $line);
-    $line = sprintf "PHOT_X  = %20G / Nightly zero point - color term               \n", $words[5];  @photom = (@photom, $line);
-    $line = sprintf "PHOT_K  = %20G / Nightly zero point - airmass term             \n", $words[6];  @photom = (@photom, $line);
-    $line = sprintf "PHOT_C1 = '%-18s' / Nightly zero point - color 1               \n", $words[7];  @photom = (@photom, $line);
-    $line = sprintf "PHOT_C2 = '%-18s' / Nightly zero point - color 2               \n", $words[8];  @photom = (@photom, $line);
-    $line = sprintf "PHOT_NM = %20d / Nightly zero point - N images                 \n", $words[9];  @photom = (@photom, $line);
-    $line = sprintf "PHOT_NS = %20d / Nightly zero point - N stars                  \n", $words[10]; @photom = (@photom, $line);
+    $line = sprintf "PHOT_NS = %20d / Nightly zero point - N stars                  \n", $words[5];  @photom = (@photom, $line);
+    $line = sprintf "PHOT_NM = %20d / Nightly zero point - N images                 \n", $words[6];  @photom = (@photom, $line);
+    $line = sprintf "PHOT_X  = %20G / Nightly zero point - color term               \n", $words[7];  @photom = (@photom, $line);
+    $line = sprintf "PHOT_K  = %20G / Nightly zero point - airmass term             \n", $words[8];  @photom = (@photom, $line);
+    $line = sprintf "PHOT_C1 = '%-18s' / Nightly zero point - color 1               \n", $words[9];  @photom = (@photom, $line);
+    $line = sprintf "PHOT_C2 = '%-18s' / Nightly zero point - color 2               \n", $words[10]; @photom = (@photom, $line);
     
-    # is there was no cmpfile, we should not set the SAT and LIM values.
-    if ($exptime == 0) { 
-	$line = sprintf "COMMENT   Photometric Analysis is incomplete for this image.\n";
-	@photom = (@photom, $line);
-	$line = sprintf "COMMENT   MAG_SAT and MAG_LIM cannot be determined.\n";
-	@photom = (@photom, $line);
-    } else {
-	# adjust fsatur & flimit values by phot data
-	$fsatur = $fsatur - 25.0 + $words[2] + 2.5*log($exptime) / log(10.0);
-	$line = sprintf "MAG_SAT = %20G / approx saturation (mag)                       \n", $fsatur; 
-	@photom = (@photom, $line);
-	
-	$flimit = $flimit - 25.0 + $words[2] + 2.5*log($exptime) / log(10.0);
-	$line = sprintf "MAG_LIM = %20G / approx completeness limit (mag)               \n", $flimit; 
-	@photom = (@photom, $line);
+    if ($cmproot ne "phu") {
+	# is there was no cmpfile, we should not set the SAT and LIM values.
+	if ($exptime == 0) { 
+	    $line = sprintf "COMMENT   Photometric Analysis is incomplete for this image.\n";
+	    @photom = (@photom, $line);
+	    $line = sprintf "COMMENT   MAG_SAT and MAG_LIM cannot be determined.\n";
+	    @photom = (@photom, $line);
+	} else {
+	    # adjust fsatur & flimit values by phot data
+	    $fsatur = $fsatur - 25.0 + $words[2] + 2.5*log($exptime) / log(10.0);
+	    $line = sprintf "MAG_SAT = %20G / approx saturation (mag)                       \n", $fsatur; 
+	    @photom = (@photom, $line);
+	    
+	    $flimit = $flimit - 25.0 + $words[2] + 2.5*log($exptime) / log(10.0);
+	    $line = sprintf "MAG_LIM = %20G / approx completeness limit (mag)               \n", $flimit; 
+	    @photom = (@photom, $line);
+	}
     }
 
@@ -166,10 +175,10 @@
 @comment = ();
 $line = sprintf "COMMENT  --------------- Elixir Analysis ---------------               \n"; @comment = (@comment, $line);
-$line = sprintf "COMMENT  Elixir processing performed \@ CFHT, version $version         \n"; @comment = (@comment, $line);
-$line = sprintf "COMMENT  Elixir version: $version                                      \n"; @comment = (@comment, $line);
-$line = sprintf "COMMENT  Elixir processing date: $now                                  \n"; @comment = (@comment, $line);
-$line = sprintf "COMMENT  Elixir website: http://www.cfht.hawaii.edu/Instruments/Elixir \n"; @comment = (@comment, $line);
-$line = sprintf "COMMENT  Elixir email: elixir\@cfht.hawaii.edu                         \n"; @comment = (@comment, $line);
-$line = sprintf "COMMENT  Elixir team: Eugene Magnier & Jean-Charles Cuillandre         \n"; @comment = (@comment, $line);
+$line = sprintf "COMMENT  Elixir: processing performed \@ CFHT, version $version         \n"; @comment = (@comment, $line);
+$line = sprintf "COMMENT  Elixir: version: $version                                      \n"; @comment = (@comment, $line);
+$line = sprintf "COMMENT  Elixir: processing date: $now                                  \n"; @comment = (@comment, $line);
+$line = sprintf "COMMENT  Elixir: website: http://www.cfht.hawaii.edu/Instruments/Elixir \n"; @comment = (@comment, $line);
+$line = sprintf "COMMENT  Elixir: email: elixir\@cfht.hawaii.edu                         \n"; @comment = (@comment, $line);
+$line = sprintf "COMMENT  Elixir: team: Eugene Magnier & Jean-Charles Cuillandre         \n"; @comment = (@comment, $line);
 # (line < 80)    12345678901234567890123456789012345678901234567890123456789012345678901234567890
 
