Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/Makefile.Targets
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/Makefile.Targets	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/Makefile.Targets	(revision 37390)
@@ -45,4 +45,6 @@
 $(ASRC)/lensobj.$(ARCH).o \
 $(ASRC)/lensobj-ps1-v5.$(ARCH).o \
+$(ASRC)/starpar.$(ARCH).o \
+$(ASRC)/starpar-ps1-v5.$(ARCH).o \
 $(ASRC)/missing.$(ARCH).o \
 $(ASRC)/photcode.$(ARCH).o \
@@ -143,4 +145,6 @@
 $(AINC)/lensobj.h \
 $(AINC)/lensobj-ps1-v5.h \
+$(AINC)/starpar.h \
+$(AINC)/starpar-ps1-v5.h \
 $(AINC)/missing.h \
 $(AINC)/photcode.h \
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-v5.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-v5.d	(revision 37390)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-v5.d	(revision 37390)
@@ -0,0 +1,18 @@
+STRUCT       StarPar_PS1_V5
+EXTNAME      DVO_STELLAR_PARAMS_PS1_V5
+TYPE         BINTABLE
+SIZE         48
+DESCRIPTION  DVO Table of Stellar Properties
+
+FIELD galLat,         GAL_LAT,       double,         galactic latitude
+FIELD galLon,         GAL_LON,       double,         galactic longitude
+FIELD MKtype,         MK_TYPE,       float,          O0 = 0.0?
+FIELD Par,            PARALLAX,      float,          1/pc
+FIELD dPar,           PARALLAX_ERR,  float,          1/pc
+FIELD uRA,            U_RA,          float,          model guess for proper motion
+FIELD uDEC,           U_DEC,         float,          model guess for proper motion
+FIELD averef,         AVE_REF,       unsigned int,   reference to average entry      
+FIELD objID,          OBJ_ID,        unsigned int,   unique ID for object in table
+FIELD catID,          CAT_ID,        unsigned int,   unique ID for table in which object was first realized
+
+# this is the list of stellar parameters loaded from Greg Green's tables:
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar.d	(revision 37390)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar.d	(revision 37390)
@@ -0,0 +1,18 @@
+STRUCT       StarPar
+EXTNAME      DVO_STELLAR_PARAMS
+TYPE         BINTABLE
+SIZE         48
+DESCRIPTION  DVO Table of Stellar Properties
+
+FIELD galLat,         GAL_LAT,       double,         galactic latitude
+FIELD galLon,         GAL_LON,       double,         galactic longitude
+FIELD MKtype,         MK_TYPE,       float,          O0 = 0.0?
+FIELD Par,            PARALLAX,      float,          1/pc
+FIELD dPar,           PARALLAX_ERR,  float,          1/pc
+FIELD uRA,            U_RA,          float,          model guess for proper motion
+FIELD uDEC,           U_DEC,         float,          model guess for proper motion
+FIELD averef,         AVE_REF,       unsigned int,   reference to average entry      
+FIELD objID,          OBJ_ID,        unsigned int,   unique ID for object in table
+FIELD catID,          CAT_ID,        unsigned int,   unique ID for table in which object was first realized
+
+# this is the list of stellar parameters loaded from Greg Green's tables:
Index: anches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/stellarParams.d
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/stellarParams.d	(revision 37389)
+++ 	(revision )
@@ -1,18 +1,0 @@
-STRUCT       StarPars
-EXTNAME      DVO_STELLAR_PARAMS
-TYPE         BINTABLE
-SIZE         48
-DESCRIPTION  DVO Table of Stellar Properties
-
-FIELD galLat,         GAL_LAT,       double, galactic latitude
-FIELD galLon,         GAL_LON,       double, galactic longitude
-FIELD MKtype,         MK_TYPE,       float, O0 = 0.0?
-FIELD Par,            PARALLAX,      float, 1/pc
-FIELD dPar,           PARALLAX_ERR,  float, 1/pc
-FIELD uRA,            U_RA,          model guess for proper motion
-FIELD uDEC,           U_DEC,         model guess for proper motion
-FIELD averef,         AVE_REF,      unsigned int,   reference to average entry      
-FIELD objID,          OBJ_ID,       unsigned int,   unique ID for object in table
-FIELD catID,          CAT_ID,       unsigned int,   unique ID for table in which object was first realized
-
-# this is the list of stellar parameters loaded from Greg Green's tables:
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/dvo.h	(revision 37390)
@@ -54,17 +54,19 @@
 
 /* catalog values to be loaded */
-# define LOAD_NONE 	0x000
-# define LOAD_AVES 	0x001
-# define LOAD_MEAS 	0x002
-# define LOAD_MISS 	0x004
-# define LOAD_SECF 	0x008 
-# define SKIP_AVES 	0x010
-# define SKIP_MEAS 	0x020
-# define SKIP_MISS 	0x040
-# define SKIP_SECF 	0x080
-# define LOAD_LENSING 	0x100
-# define LOAD_LENSOBJ 	0x200
-# define SKIP_LENSING 	0x400
-# define SKIP_LENSOBJ 	0x800
+# define LOAD_NONE 	0x0000
+# define LOAD_AVES 	0x0001
+# define LOAD_MEAS 	0x0002
+# define LOAD_MISS 	0x0004
+# define LOAD_SECF 	0x0008 
+# define SKIP_AVES 	0x0010
+# define SKIP_MEAS 	0x0020
+# define SKIP_MISS 	0x0040
+# define SKIP_SECF 	0x0080
+# define LOAD_LENSING 	0x0100
+# define LOAD_LENSOBJ 	0x0200
+# define SKIP_LENSING 	0x0400
+# define SKIP_LENSOBJ 	0x0800
+# define LOAD_STARPAR 	0x1000
+# define SKIP_STARPAR 	0x2000
 
 /* photometry code types */
@@ -652,5 +654,4 @@
   Lensing *lensing;
   Lensobj *lensobj;
-
   StarPar *starpar;
 
@@ -1007,5 +1008,4 @@
 void dvo_lensing_init (Lensing *lensing);
 void dvo_lensobj_init (Lensobj *lensobj, int toZero);
-
 void dvo_starpar_init (StarPar *starpar);
 
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/ps1_v5_defs.h
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/ps1_v5_defs.h	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/ps1_v5_defs.h	(revision 37390)
@@ -13,4 +13,7 @@
 Lensobj_PS1_V5          *LensobjInternalTo_PS1_V5 (Lensobj *in, off_t Nvalues);
 
+StarPar 	       	*StarPar_PS1_V5_ToInternal (StarPar_PS1_V5 *in, off_t Nvalues);
+StarPar_PS1_V5          *StarParInternalTo_PS1_V5 (StarPar *in, off_t Nvalues);
+
 PhotCode                *PhotCode_PS1_V5_To_Internal (PhotCode_PS1_V5 *in, off_t Nvalues);
 PhotCode_PS1_V5         *PhotCode_Internal_To_PS1_V5 (PhotCode *in, off_t Nvalues);
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog.c	(revision 37390)
@@ -437,15 +437,15 @@
 
 // init all data, or just catalog data
-void dvo_starpars_init (StarPars *starpars) {
-  starpars->galLat = NAN;
-  starpars->galLon = NAN;
-  starpars->MKtype = NAN;
-  starpars->Par    = NAN;
-  starpars->dPar   = NAN;
-  starpars->uRA    = NAN;
-  starpars->uDEC   = NAN;
-  starpars->averef = -1;
-  starpars->objID  = -1;
-  starpars->catID  = -1;
+void dvo_starpar_init (StarPar *starpar) {
+  starpar->galLat = NAN;
+  starpar->galLon = NAN;
+  starpar->MKtype = NAN;
+  starpar->Par    = NAN;
+  starpar->dPar   = NAN;
+  starpar->uRA    = NAN;
+  starpar->uDEC   = NAN;
+  starpar->averef = -1;
+  starpar->objID  = -1;
+  starpar->catID  = -1;
 }
 
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_create.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_create.c	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_create.c	(revision 37390)
@@ -102,5 +102,5 @@
     gfits_create_header (&catalog[0].starpar_catalog[0].header);
     ALLOCATE (catalog[0].starpar_catalog[0].filename, char, length);
-    sprintf (catalog[0].starpar_catalog[0].filename, "%s/%s.cpy", path, root);
+    sprintf (catalog[0].starpar_catalog[0].filename, "%s/%s.cpz", path, root);
     file = filebasename (catalog[0].starpar_catalog[0].filename);
     gfits_modify (&catalog[0].header, "STARPAR", "%s", 1, file);
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_mef.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_mef.c	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_mef.c	(revision 37390)
@@ -4,9 +4,4 @@
   
   off_t Nbytes;
-  off_t Naverage;
-  off_t Nmeasure;
-  off_t Nmissing;
-  off_t Nlensing;
-  off_t Nlensobj;
   off_t Nitems, Nexpect;
   int Nsecfilt;
@@ -18,12 +13,4 @@
 
   ftable.header = &header;
-
-  /* get the components from the header */
-  if (!gfits_scan (&catalog[0].header, "NSTARS",   OFF_T_FMT, 1,  &Naverage)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMEAS",    OFF_T_FMT, 1,  &Nmeasure)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NMISS",    OFF_T_FMT, 1,  &Nmissing)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d",   1,               &Nsecfilt)) Nsecfilt = 0;
-  if (!gfits_scan (&catalog[0].header, "NLENSING", OFF_T_FMT, 1,  &Nlensing)) return (FALSE);
-  if (!gfits_scan (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1,  &Nlensobj)) return (FALSE);
 
   /* the OBJID is a counter that uniquely defines an average entry and never changes.  if
@@ -38,26 +25,34 @@
     catalog[0].catID = 0;
   }
+
+  // NSTARS, average, Naves_disk
+
+# define GET_TABLE_SIZES(HFIELD, CFIELD, DFIELD, REQUIRED)		\
+  off_t N##CFIELD;							\
+  if (REQUIRED) {							\
+    if (!gfits_scan (&catalog[0].header, HFIELD, OFF_T_FMT, 1, &N##CFIELD)) return (FALSE); \
+  } else {								\
+    if (!gfits_scan (&catalog[0].header, HFIELD, OFF_T_FMT, 1, &N##CFIELD)) N##CFIELD = 0; \
+  }									\
+  /* save the current number so we can do partial updates */		\
+  catalog[0].DFIELD = N##CFIELD;					\
+  /* default values, but we will assign these a valid value before we exit (even if empty) */ \
+  catalog[0].CFIELD = NULL;
   
-  /* save the current number so we can do partial updates */
-  catalog[0].Naves_disk = Naverage;
-  catalog[0].Nmeas_disk = Nmeasure;
-  catalog[0].Nmiss_disk = Nmissing;
-  catalog[0].Nsecf_disk = Naverage * Nsecfilt;
-  catalog[0].Nlensing_disk = Nlensing;
-  catalog[0].Nlensobj_disk = Nlensobj;
+  /* get the components and sizes from the header */
+  GET_TABLE_SIZES ("NSTARS",   average, Naves_disk,    TRUE);
+  GET_TABLE_SIZES ("NMEAS",    measure, Nmeas_disk,    TRUE);
+  GET_TABLE_SIZES ("NMISS",    missing, Nmiss_disk,    FALSE);
+  GET_TABLE_SIZES ("NLENSING", lensing, Nlensing_disk, FALSE);
+  GET_TABLE_SIZES ("NLENSOBJ", lensobj, Nlensobj_disk, FALSE);
+  GET_TABLE_SIZES ("NSTARPAR", starpar, Nstarpar_disk, FALSE);
 
   /**  Nsecfilt is unusual: it does not list the number of data items in the table
        instead, the number of items is Nsecfilt * Naverage.  **/
+
+  if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &Nsecfilt)) Nsecfilt = 0;
   catalog[0].Nsecfilt = Nsecfilt;
-
-  /* default values, but we will assign these a valid value before we exit (even if empty) */
-  catalog[0].average = NULL;
-  catalog[0].measure = NULL;
-  catalog[0].missing = NULL;
+  catalog[0].Nsecf_disk = Naverage * Nsecfilt;
   catalog[0].secfilt = NULL;
-  catalog[0].lensing = NULL;
-  catalog[0].lensobj = NULL;
-
-  /* validate table mode ?*/
 
   /*** Average Table ***/
@@ -259,4 +254,29 @@
   }
 
+  /* read StarPar table header */
+  if (!gfits_fread_header (catalog[0].f, &header)) {
+    if (VERBOSE) fprintf (stderr, "can't read table starpar header");
+    return (FALSE);
+  }
+  /* read StarPar table data */
+  if (catalog[0].catflags & LOAD_STARPAR) {
+    if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) {
+      if (VERBOSE) fprintf (stderr, "can't read table starpar data");
+      return (FALSE);
+    }
+    catalog[0].starpar = FtableToStarPar (&ftable, &catalog[0].Nstarpar, &catalog[0].catformat);
+    if (Nstarpar != catalog[0].Nstarpar_disk) {
+      fprintf (stderr, "Warning: mismatch between Nstarpar in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nstarpar,  catalog[0].Nstarpar_disk);
+    }
+    catalog[0].Nstarpar = catalog[0].Nstarpar_disk;
+    catalog[0].Nstarpar_off = 0;
+  } else {
+    Nbytes = gfits_data_size (&header);
+    fseeko (catalog[0].f, Nbytes, SEEK_CUR);
+    ALLOCATE (catalog[0].starpar, StarPar, 1);
+    catalog[0].Nstarpar = 0;
+    catalog[0].Nstarpar_off = catalog[0].Nstarpar_disk;
+  }
+
   return (TRUE);
 }
@@ -309,4 +329,5 @@
   gfits_modify (&catalog[0].header, "NLENSING", OFF_T_FMT, 1,  catalog[0].Nlensing);
   gfits_modify (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1,  catalog[0].Nlensobj);
+  gfits_modify (&catalog[0].header, "NSTARPAR", OFF_T_FMT, 1,  catalog[0].Nstarpar);
   gfits_modify_alt (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
   gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
@@ -403,4 +424,24 @@
   /* write out Lensobj table (convert to FITS table format) */
   LensobjToFtable (&ftable, catalog[0].lensobj, catalog[0].Nlensobj, catalog[0].catformat);
+  if (!gfits_fwrite_Theader (catalog[0].f, &header)) {
+    fprintf (stderr, "can't write table header");
+    goto failure;
+  }
+  if (!gfits_fwrite_table (catalog[0].f, &ftable)) {
+    fprintf (stderr, "can't write table data");
+    goto failure;
+  }
+  gfits_free_table (&ftable);
+  gfits_free_header (&header);
+
+  /* free temp storage */
+  if (primary != NULL) {
+    free (primary);
+    free (secfilt);
+  }
+  return (TRUE);
+
+  /* write out StarPar table (convert to FITS table format) */
+  StarParToFtable (&ftable, catalog[0].starpar, catalog[0].Nstarpar, catalog[0].catformat);
   if (!gfits_fwrite_Theader (catalog[0].f, &header)) {
     fprintf (stderr, "can't write table header");
@@ -446,4 +487,6 @@
   lensobj header
   lensobj table
+  starpar header
+  starpar table
 */
    
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 37390)
@@ -470,5 +470,5 @@
   gfits_free_header (&header);
 
-  /*** Starpar Table ***/
+  /*** StarPar Table ***/
   if (!(catalog[0].catflags & SKIP_STARPAR)) {
     // unless we specify 'skip', we still need to load the 
@@ -477,5 +477,5 @@
       return (FALSE);
     }
-    // the Starpar file need not exist, unless we expect data to exist
+    // the StarPar file need not exist, unless we expect data to exist
     if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nstarpar_disk > 0)) {
       return (FALSE);
@@ -483,6 +483,6 @@
   }
   if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_STARPAR)) {
-    // only read the Starpar table if the file actually exists
-    /* read Starpar table data */
+    // only read the StarPar table if the file actually exists
+    /* read StarPar table data */
     if (!gfits_fread_ftable_data (catalog[0].starpar_catalog[0].f, &ftable, FALSE)) {
       if (VERBOSE) fprintf (stderr, "can't read table starpar data\n");
@@ -490,5 +490,5 @@
     }
     /* convert data format to internal : returns number of row read in Nstarpar */
-    catalog[0].starpar = FtableToStarpar (&ftable, &Nstarpar, &catalog[0].catformat);
+    catalog[0].starpar = FtableToStarPar (&ftable, &Nstarpar, &catalog[0].catformat);
     if (Nstarpar != catalog[0].Nstarpar_disk) {
       fprintf (stderr, "Warning: mismatch between Nstarpar in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n",  Nstarpar,  catalog[0].Nstarpar_disk);
@@ -504,5 +504,5 @@
     }
     gfits_create_header (&catalog[0].starpar_catalog[0].header);
-    ALLOCATE (catalog[0].starpar, Starpar, 1);
+    ALLOCATE (catalog[0].starpar, StarPar, 1);
     catalog[0].Nstarpar = 0;
     catalog[0].Nstarpar_off = catalog[0].Nstarpar_disk;
@@ -729,10 +729,10 @@
     fseeko (subcat[0].f, Nbytes, SEEK_SET);
 
-    /* read Starpar table header */
+    /* read StarPar table header */
     if (!gfits_fread_header (subcat[0].f, &header)) {
       if (VERBOSE) fprintf (stderr, "can't read table starpar header");
       return (FALSE);
     }
-    /* read Starpar table data : format is irrelevant here */
+    /* read StarPar table data : format is irrelevant here */
     if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) {
       if (VERBOSE) fprintf (stderr, "can't read table starpar data");
@@ -741,5 +741,5 @@
 
     /* convert data format to internal : returns number of row read in Nstarpar */
-    catalog[0].starpar = FtableToStarpar (&ftable, &Nstarpar, &catalog[0].catformat);
+    catalog[0].starpar = FtableToStarPar (&ftable, &Nstarpar, &catalog[0].catformat);
     if (Nstarpar != Nrows) {
       // XXX this condition denotes the eof has been reached; not an error or a warning
@@ -977,5 +977,5 @@
   }
 
-  /*** Lensobj Table ***/
+  /*** StarPar Table ***/
   if ((catalog[0].catflags & LOAD_STARPAR) && (catalog[0].starpar != NULL)) {
 
@@ -990,12 +990,12 @@
 
     // convert to external table format (note that the block above does not damage or free catalog.average) 
-    if (!StarparToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) {
-      fprintf (stderr, "trouble converting format\n");
-      goto failure;
-    }
-
-    // write out Starpar table
+    if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) {
+      fprintf (stderr, "trouble converting format\n");
+      goto failure;
+    }
+
+    // write out StarPar table
     if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) {
-      fprintf (stderr, "trouble writing Starpar table\n");
+      fprintf (stderr, "trouble writing StarPar table\n");
       goto failure;
     }
@@ -1064,5 +1064,5 @@
   }
   if (catalog[0].Nstarpar_off > 0) {
-    fprintf (stderr, "ERROR: only partial catalog (Starpar) was loaded\n");
+    fprintf (stderr, "ERROR: only partial catalog (StarPar) was loaded\n");
     goto failure;
   }
@@ -1275,25 +1275,25 @@
   }
 
-  /*** Starpar Table ***/
-  if ((catalog[0].catflags & LOAD_STARPAR) && (catalog[0].lensobj != NULL)) {
+  /*** StarPar Table ***/
+  if ((catalog[0].catflags & LOAD_STARPAR) && (catalog[0].starpar != NULL)) {
 
     first  = 0;                    // first row in memory to write
-    start  = catalog[0].Nlensobj_off; // first disk row to write
-    Nrows  = catalog[0].Nlensobj - first;
-
-    assert (Nrows >= 0);
-    assert (first >= 0);
-    assert (first <= catalog[0].Nlensobj);
-    assert (catalog[0].Nlensobj_disk >= catalog[0].Nlensobj_off);
+    start  = catalog[0].Nstarpar_off; // first disk row to write
+    Nrows  = catalog[0].Nstarpar - first;
+
+    assert (Nrows >= 0);
+    assert (first >= 0);
+    assert (first <= catalog[0].Nstarpar);
+    assert (catalog[0].Nstarpar_disk >= catalog[0].Nstarpar_off);
 
     // convert to external table format
-    if (!LensobjToFtable (&ftable, &catalog[0].lensobj[first], Nrows, catalog[0].catformat)) {
-      fprintf (stderr, "trouble converting format\n");
-      goto failure;
-    }
-
-    // write out Lensobj table
-    if (!dvo_catalog_save_subcat (catalog[0].lensobj_catalog, &ftable, start, Nrows, catalog[0].Nlensobj_disk, Nlensobj_disk_new)) {
-      fprintf (stderr, "trouble writing Lensobj table\n");
+    if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) {
+      fprintf (stderr, "trouble converting format\n");
+      goto failure;
+    }
+
+    // write out StarPar table
+    if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) {
+      fprintf (stderr, "trouble writing StarPar table\n");
       goto failure;
     }
@@ -1327,5 +1327,5 @@
   SecFilt *primary, *secfilt;
   int Nsecfilt;
-  off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new, Nlensobj_disk_new;
+  off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new, Nstarpar_disk_new;
   off_t first, start, Nrows;
 
@@ -1359,5 +1359,5 @@
   Nlensing_disk_new = MAX (catalog[0].Nlensing_disk, catalog[0].Nlensing + catalog[0].Nlensing_off);
   Nlensobj_disk_new = MAX (catalog[0].Nlensobj_disk, catalog[0].Nlensobj + catalog[0].Nlensobj_off);
-  Nlensobj_disk_new = MAX (catalog[0].Nlensobj_disk, catalog[0].Nlensobj + catalog[0].Nlensobj_off);
+  Nstarpar_disk_new = MAX (catalog[0].Nstarpar_disk, catalog[0].Nstarpar + catalog[0].Nstarpar_off);
 
   /* make sure header is consistent with data */
@@ -1368,5 +1368,5 @@
   gfits_modify (&catalog[0].header, "NLENSING", OFF_T_FMT, 1,  Nlensing_disk_new);
   gfits_modify (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1,  Nlensobj_disk_new);
-  gfits_modify (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1,  Nlensobj_disk_new);
+  gfits_modify (&catalog[0].header, "NSTARPAR", OFF_T_FMT, 1,  Nstarpar_disk_new);
   gfits_modify_alt (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
   gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
@@ -1545,26 +1545,26 @@
   }
 
-  /*** Lensobj Table ***/
-  if (catalog[0].lensobj != NULL) {
-
-    first  = catalog[0].Nlensobj_disk - catalog[0].Nlensobj_off;  // first row in memory to write
-    start  = catalog[0].Nlensobj_disk; // first disk row to write
-    Nrows  = catalog[0].Nlensobj - first;
-
-    assert (Nrows >= 0);
-    assert (first >= 0);
-    assert (first <= catalog[0].Nlensobj);
-    assert (catalog[0].Nlensobj_disk >= catalog[0].Nlensobj_off);
+  /*** StarPar Table ***/
+  if (catalog[0].starpar != NULL) {
+
+    first  = catalog[0].Nstarpar_disk - catalog[0].Nstarpar_off;  // first row in memory to write
+    start  = catalog[0].Nstarpar_disk; // first disk row to write
+    Nrows  = catalog[0].Nstarpar - first;
+
+    assert (Nrows >= 0);
+    assert (first >= 0);
+    assert (first <= catalog[0].Nstarpar);
+    assert (catalog[0].Nstarpar_disk >= catalog[0].Nstarpar_off);
 
     // convert to external table format
-    // XXX does catalog.lensobj have averef correctly set up?
-    if (!LensobjToFtable (&ftable, &catalog[0].lensobj[first], Nrows, catalog[0].catformat)) {
-      fprintf (stderr, "trouble converting format\n");
-      goto failure;
-    }
-
-    // write out Lensobj table
-    if (!dvo_catalog_save_subcat (catalog[0].lensobj_catalog, &ftable, start, Nrows, catalog[0].Nlensobj_disk, Nlensobj_disk_new)) {
-      fprintf (stderr, "trouble writing Lensobj table\n");
+    // XXX does catalog.starpar have averef correctly set up?
+    if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) {
+      fprintf (stderr, "trouble converting format\n");
+      goto failure;
+    }
+
+    // write out StarPar table
+    if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) {
+      fprintf (stderr, "trouble writing StarPar table\n");
       goto failure;
     }
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert.c	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert.c	(revision 37390)
@@ -585,4 +585,98 @@
     default:
       fprintf (stderr, "table format unknown (lensobj)\n");
+      return (FALSE);
+  }
+  return (TRUE);
+}
+
+/*** StarPar / FTable conversion functions ***/
+
+StarPar *FtableToStarPar (FTable *ftable, off_t *Nstarpar, char *format) {
+
+  StarPar *starpar;
+  char extname[80];
+
+  /* convert to the internal format */
+  if (!gfits_scan (ftable[0].header, "EXTNAME", "%s", 1, extname)) {
+    fprintf (stderr, "EXTNAME missing for starpar table\n");
+    return (FALSE);
+  }
+
+# define CONVERT_FORMAT(NAME, FORMAT, TYPE)		\
+  if (!strcmp (extname, NAME)) {					\
+    StarPar_##TYPE *tmpStarPar;						\
+    tmpStarPar = gfits_table_get_StarPar_##TYPE (ftable, Nstarpar, NULL); \
+    if (!tmpStarPar) {							\
+      fprintf (stderr, "ERROR: failed to read starpar\n");		\
+      exit (2);								\
+    }									\
+    starpar = StarPar_##TYPE##_ToInternal (tmpStarPar, *Nstarpar); \
+    free (tmpStarPar);							\
+    *format = DVO_FORMAT_##FORMAT;					\
+    return (starpar); }
+
+  if (!strcmp (extname, "DVO_STARPAR")) {
+    starpar = gfits_table_get_StarPar (ftable, Nstarpar, NULL);
+    if (!starpar) {
+      fprintf (stderr, "ERROR: failed to read starpar\n");
+      exit (2);
+    }
+    *format = DVO_FORMAT_INTERNAL;
+    return (starpar);
+  }
+
+// CONVERT_FORMAT ("DVO_STARPAR_PS1_REF",         PS1_REF,         PS1_REF);
+// CONVERT_FORMAT ("DVO_STARPAR_ELIXIR", 	  ELIXIR,  	   Elixir);
+// CONVERT_FORMAT ("DVO_STARPAR_LONEOS", 	  LONEOS,          Loneos);
+// CONVERT_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_0", PANSTARRS_DEV_0, Panstarrs_DEV_0);
+// CONVERT_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1);
+// CONVERT_FORMAT ("DVO_STARPAR_PS1_DEV_1",       PS1_DEV_1,       PS1_DEV_1);
+// CONVERT_FORMAT ("DVO_STARPAR_PS1_DEV_2",       PS1_DEV_2,       PS1_DEV_2);
+// CONVERT_FORMAT ("DVO_STARPAR_PS1_V1",          PS1_V1,          PS1_V1);
+// CONVERT_FORMAT ("DVO_STARPAR_PS1_V2",          PS1_V2,          PS1_V2);
+// CONVERT_FORMAT ("DVO_STARPAR_PS1_V3",          PS1_V3,          PS1_V3);
+// CONVERT_FORMAT ("DVO_STARPAR_PS1_V4",          PS1_V4,          PS1_V4);
+  CONVERT_FORMAT ("DVO_STARPAR_PS1_V5",          PS1_V5,          PS1_V5);
+# undef CONVERT_FORMAT
+
+  fprintf (stderr, "table format unknown: %s\n", extname);
+
+  *Nstarpar = 0;
+  return (NULL);
+}
+
+// StarParToFtable needs the Average since old formats stored starpar.dR,dD only
+int StarParToFtable (FTable *ftable, StarPar *starpar, off_t Nstarpar, char format) {
+
+# define FORMAT_CASE(FORMAT, TYPE)		\
+    case DVO_FORMAT_##FORMAT: { \
+      StarPar_##TYPE *tmpStarPar; \
+      tmpStarPar = StarParInternalTo_##TYPE (starpar, Nstarpar); \
+      gfits_table_set_StarPar_##TYPE (ftable, tmpStarPar, Nstarpar); \
+      free (tmpStarPar); \
+      break; }
+
+  /* convert from the internal format */
+  switch (format) {
+    case DVO_FORMAT_INTERNAL: {
+      gfits_table_set_StarPar (ftable, starpar, Nstarpar);
+      break; }
+
+//    FORMAT_CASE (PS1_REF,         PS1_REF);
+//    FORMAT_CASE (ELIXIR, 	    Elixir);
+//    FORMAT_CASE (LONEOS, 	    Loneos);
+//    FORMAT_CASE (PANSTARRS_DEV_0, Panstarrs_DEV_0);
+//    FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1);
+//    FORMAT_CASE (PS1_DEV_1,       PS1_DEV_1);
+//    FORMAT_CASE (PS1_DEV_2,       PS1_DEV_2);
+//    FORMAT_CASE (PS1_V1,          PS1_V1);
+//    FORMAT_CASE (PS1_V2,          PS1_V2);
+//    FORMAT_CASE (PS1_V3,          PS1_V3);
+//    FORMAT_CASE (PS1_V4,          PS1_V4);
+      FORMAT_CASE (PS1_V5,          PS1_V5);
+# undef FORMAT_CASE
+
+    default:
+      fprintf (stderr, "table format unknown (starpar)\n");
       return (FALSE);
   }
Index: /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 37389)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 37390)
@@ -663,4 +663,55 @@
 }
 
+StarPar *StarPar_PS1_V5_ToInternal (StarPar_PS1_V5 *in, off_t Nvalues) {
+
+  off_t i;
+  StarPar *out;
+
+  ALLOCATE_ZERO (out, StarPar, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+    dvo_starpar_init (&out[i]);
+
+    out[i].galLat  = in[i].galLat;      
+    out[i].galLon  = in[i].galLon;      
+
+    out[i].MKtype  = in[i].MKtype;      
+    out[i].Par     = in[i].Par   ;      
+    out[i].dPar    = in[i].dPar  ;      
+    out[i].uRA     = in[i].uRA   ;      
+    out[i].uDEC    = in[i].uDEC  ;      
+
+    out[i].averef  = in[i].averef;
+    out[i].objID   = in[i].objID ;
+    out[i].catID   = in[i].catID ;
+  }
+  return (out);
+}
+
+StarPar_PS1_V5 *StarParInternalTo_PS1_V5 (StarPar *in, off_t Nvalues) {
+
+  off_t i;
+  StarPar_PS1_V5 *out;
+
+  ALLOCATE_ZERO (out, StarPar_PS1_V5, Nvalues);
+
+  for (i = 0; i < Nvalues; i++) {
+
+    out[i].galLat  = in[i].galLat;      
+    out[i].galLon  = in[i].galLon;      
+
+    out[i].MKtype  = in[i].MKtype;      
+    out[i].Par     = in[i].Par   ;      
+    out[i].dPar    = in[i].dPar  ;      
+    out[i].uRA     = in[i].uRA   ;      
+    out[i].uDEC    = in[i].uDEC  ;      
+
+    out[i].averef  = in[i].averef;
+    out[i].objID   = in[i].objID ;
+    out[i].catID   = in[i].catID ;
+  }
+  return (out);
+}
+
 # define RAW_IMAGE_NAME_LEN 117
 
