Index: /trunk/Ohana/src/perl/src/dads.keywords
===================================================================
--- /trunk/Ohana/src/perl/src/dads.keywords	(revision 102)
+++ /trunk/Ohana/src/perl/src/dads.keywords	(revision 103)
@@ -4,6 +4,6 @@
 
 # get list of image files:
-@ilist = <$ARGV[0]/*.fits>;
-$name = $ilist[0];
+@list = <$ARGV[0]/*.fits>;
+$name = $list[0];
 
 # get appropriate run ID
@@ -26,5 +26,5 @@
 }
 
-foreach $name (@ilist) {
+foreach $name (@list) {
 
     # files have names like /path/654321p/654321p00.fits
@@ -59,4 +59,26 @@
 }
 
+# add data for phu file:
+@list = <$ARGV[0]/*.phu>;
+$phufile = $list[0];
+
+# generate name of output header file
+$hdxfile = $name;
+$hdxfile =~ s/.fits$/.phu/;
+if ($hdxfile eq $name) {
+    print STDERR "ERROR in format of filename $name\n";
+    exit 1;
+}
+
+if (vsystem ("grab.keywords $phufile phu $hdxfile")) {
+    print STDERR "ERROR: can't get keywords for $name\n";
+    exit 1;
+}
+
+if (vsystem ("fits_insert $phufile $hdxfile -comment 5 'Fully Characterized and Analysed by Elixir @ CFHT'" )) {
+    print STDERR "ERROR inserting keywords in $name\n";
+    exit 1;
+}
+
 print STDERR "SUCCESS: applied new keywords\n";
 exit 0;
@@ -73,18 +95,2 @@
     die "@_\n";
 }
-
-
-
-sub junk {
-
-    # create the basic entries for a header
-    $line = sprintf "SIMPLE  =                    T / Standard FITS \n"; @output = (@output, $line);
-    $line = sprintf "BITPIX  =                    8 / no actual data in this file\n"; @output = (@output, $line);
-    $line = sprintf "NAXIS   =                    0 / Number of axes \n"; @output = (@output, $line);                                
-
-
-
-    # fill in the bottom of the header
-    $line = sprintf "END"; @output = (@output, $line);                                
-}
-    
