Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/Makefile
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/Makefile	(revision 34866)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/Makefile	(revision 34867)
@@ -23,4 +23,6 @@
 setposangle: $(BIN)/setposangle.$(ARCH)
 setposangle_client: $(BIN)/setposangle_client.$(ARCH)
+setastrom: $(BIN)/setastrom.$(ARCH)
+setastrom_client: $(BIN)/setastrom_client.$(ARCH)
 
 install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setphot $(DESTBIN)/setphot_client $(DESTBIN)/setposangle $(DESTBIN)/setposangle_client
@@ -99,4 +101,26 @@
 $(BIN)/setposangle_client.$(ARCH): $(SETPOSANGLE_CLIENT)
 
+SETASTROM = \
+$(SRC)/setastrom.$(ARCH).o	    \
+$(SRC)/initialize_setastrom.$(ARCH).o \
+$(SRC)/astrom_correction.$(ARCH).o \
+$(SRC)/update_dvo_setastrom.$(ARCH).o \
+$(SRC)/update_catalog_setastrom.$(ARCH).o \
+$(SRC)/SetSignals.$(ARCH).o	    \
+$(SRC)/Shutdown.$(ARCH).o	    
+
+$(SETASTROM): $(INC)/setastrom.h
+$(BIN)/setastrom.$(ARCH): $(SETASTROM)
+
+SETASTROM_CLIENT = \
+$(SRC)/setastrom_client.$(ARCH).o	    \
+$(SRC)/update_dvo_setastrom.$(ARCH).o \
+$(SRC)/update_catalog_setastrom.$(ARCH).o \
+$(SRC)/astrom_correction.$(ARCH).o \
+$(SRC)/initialize_setastrom_client.$(ARCH).o
+
+$(SETASTROM_CLIENT): $(INC)/setastrom.h
+$(BIN)/setastrom_client.$(ARCH): $(SETASTROM_CLIENT)
+
 SETFWHM =                           \
 $(SRC)/setfwhm.$(ARCH).o	    \
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setastrom.h
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setastrom.h	(revision 34867)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/include/setastrom.h	(revision 34867)
@@ -0,0 +1,38 @@
+# include <ohana.h>
+# include <dvo.h>
+# include <signal.h>
+
+/* global variables set in parameter file */
+# define DVO_MAX_PATH 1024
+char         ImageCat[DVO_MAX_PATH];
+char        *CATDIR;
+int          HOST_ID;
+char        *HOSTDIR;
+int          VERBOSE;
+int          UPDATE;
+int          PARALLEL;
+int          PARALLEL_MANUAL;
+int          PARALLEL_SERIAL;
+
+/***** prototypes ****/
+int           main                            PROTO((int argc, char **argv));
+
+void          ConfigInit                      PROTO((int *argc, char **argv));
+void          usage_setastrom                 PROTO(());
+void          initialize_setastrom            PROTO((int argc, char **argv));
+int           args_setastrom                  PROTO((int argc, char **argv));
+
+void          usage_setastrom_client          PROTO(());
+void          initialize_setastrom_client     PROTO((int argc, char **argv));
+int           args_setastrom_client           PROTO((int argc, char **argv));
+
+// int           Shutdown                        PROTO((char *format, ...) OHANA_FORMAT(printf, 1, 2) );
+// void          TrapSignal                      PROTO((int sig));
+// void          SetProtect                      PROTO((int mode));
+// int           SetSignals                      PROTO((void));
+
+int           update_dvo_setastrom            PROTO(());
+int           update_dvo_setastrom_parallel   PROTO((SkyTable *sky));
+
+void          update_catalog_setastrom        PROTO((Catalog *catalog));
+
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/astrom_correction.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/astrom_correction.c	(revision 34866)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/astrom_correction.c	(revision 34867)
@@ -7,16 +7,25 @@
 // extensions have names of the form XYnn.Dx.Td
 
-// where nn = 00 - 77, the chip number
-// x is X or Y, the correction direction
-// d is 0 or 1, pre or post camera correction
+// where nn = 00 - 77, the chip number 
+// x is X or Y, the correction direction (dir)
+// d is 0 or 1, pre or post camera correction (sub)
 
-// the interpolating spline has valu
+// these are stored in an N-D array of (Spline *) splineset[sub][dir][chip]
+
+// the interpolating spline information: this is based on the spline used by opihi/cmd.data/spline.c
 typedef struct {
   int Nknots;
-  opihi_flt *xk;
-  opihi_flt *yk;
-  opihi_flt *y2;
+  double *xk;
+  double *yk;
+  double *y2;
   char *name;
 } Spline;
+
+# define N_SUB 2
+# define N_DIR 2
+# define N_CHIP 78
+// note that we are allocating pointers for XY00 - XY77, but only the octal elements are set (and not the 00,07,70,77 ones)
+
+Spline ****splineset;
 
 int load_astrom_correction (char *filename) {
@@ -26,8 +35,6 @@
   FTable ftable;
 
-  FILE *f = NULL;
-
   /* open file for input */
-  f = fopen (filename, "r");
+  FILE *f = fopen (filename, "r");
   if (f == (FILE *) NULL) {
     gprint (GP_ERR, "can't open file for read : %s\n", filename);
@@ -44,4 +51,6 @@
   ftable.header = &theader;
 
+  int sub, dir, chip;
+
   // we have a N-D array of splines:
   // splineset[subset][dir][chip]
@@ -57,7 +66,7 @@
   }
 
-  for () {
-    /* load data for this header */
-    if (!gfits_load_header (f, &theader)) return (FALSE);
+  while (TRUE) {
+    // load data for this header : if not found, assume we hit the end of the file
+    if (!gfits_load_header (f, &theader)) break;
     
     if (!gfits_fread_ftable_data (f, &table, FALSE)) return (FALSE);
Index: /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setastrom.c
===================================================================
--- /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setastrom.c	(revision 34866)
+++ /branches/eam_branches/ipp-20121219/Ohana/src/uniphot/src/initialize_setastrom.c	(revision 34867)
@@ -53,9 +53,4 @@
   }
 
-  // XXX I want to avoid running this on all data all the time
-  // some options: gpc1 only (hardwired), require photcodes (fairly tedious),
-  // exclude some photcodes?
-  // XXX for now, hardwire gpc1 photcodes
-
   PARALLEL = FALSE;
   if ((N = get_argument (argc, argv, "-parallel"))) {
