Index: /branches/eam_branches/ipp-20110505/Ohana/src/getstar/src/getstar.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/getstar/src/getstar.c	(revision 31467)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/getstar/src/getstar.c	(revision 31468)
@@ -64,7 +64,5 @@
 	catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 	catalog.catflags = LOAD_AVES | LOAD_SECF;
-	if (needMeas) {
-	    catalog.catflags |= LOAD_MEAS;
-	}
+	catalog.catflags |= needMeas ? LOAD_MEAS : SKIP_MEAS;
 
 	// an error exit status here is a significant error
@@ -98,7 +96,5 @@
 	catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 	catalog.catflags = LOAD_AVES | LOAD_SECF;
-	if (needMeas) {
-	    catalog.catflags |= LOAD_MEAS;
-	}
+	catalog.catflags |= needMeas ? LOAD_MEAS : SKIP_MEAS;
 
 	// an error exit status here is a significant error
Index: /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/include/dvo.h	(revision 31467)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/include/dvo.h	(revision 31468)
@@ -75,5 +75,10 @@
 # define LOAD_MISS 	0x04
 # define LOAD_SECF 	0x08 
-# define LOAD_MEAS_META 0x10
+# define SKIP_AVES 	0x10
+# define SKIP_MEAS 	0x20
+# define SKIP_MISS 	0x40
+# define SKIP_SECF 	0x80
+
+// # define LOAD_MEAS_META 0x100 -- is this used??
 
 /* photometry code types */
Index: /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 31467)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 31468)
@@ -239,10 +239,13 @@
 
   /*** Measure Table ***/
-  status = dvo_catalog_open_subcat (catalog, &catalog[0].measure_catalog, ftable.header, "MEASURE", VERBOSE);
-  if (status == DVO_CAT_OPEN_FAIL) {
-    return (FALSE);
-  }
-  if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nmeas_disk > 0)) {
-    return (FALSE);
+  if (!(catalog[0].catflags & SKIP_MEAS)) {
+    // unless we specify 'skip', we still need to load the 
+    status = dvo_catalog_open_subcat (catalog, &catalog[0].measure_catalog, ftable.header, "MEASURE", VERBOSE);
+    if (status == DVO_CAT_OPEN_FAIL) {
+      return (FALSE);
+    }
+    if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nmeas_disk > 0)) {
+      return (FALSE);
+    }
   }
   if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_MEAS)) {
@@ -262,4 +265,11 @@
   } else {
     // XXX is it necessary to generate a template header here?
+    // XXX this is a memory leak, right?
+    if (catalog[0].measure_catalog) {
+      gfits_free_header (&catalog[0].measure_catalog[0].header);
+    } else {
+      ALLOCATE (catalog[0].measure_catalog, Catalog, 1);
+      dvo_catalog_init (catalog[0].measure_catalog, TRUE);
+    }
     gfits_create_header (&catalog[0].measure_catalog[0].header);
     ALLOCATE (catalog[0].measure, Measure, 1);
Index: /branches/eam_branches/ipp-20110505/Ohana/src/libfits/table/F_copy_T.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/libfits/table/F_copy_T.c	(revision 31468)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/libfits/table/F_copy_T.c	(revision 31468)
@@ -0,0 +1,37 @@
+# include <ohana.h>
+# include <gfitsio.h>
+
+/*********************** fits copy header ***********************************/
+int gfits_copy_ftable_data (FTable *table1, FTable *table2) {
+
+  off_t Nbytes, Nread;
+  char string[128];
+
+  /* find buffer size */
+  Nbytes = gfits_data_size (table[0].header);
+  ALLOCATE (table[0].buffer, char, Nbytes);
+
+  Nread = fread (table[0].buffer, sizeof (char), Nbytes, f);
+  if (Nread != Nbytes) {
+    snprintf (string, 128, "FITS file is short (%s)", __func__);
+    perror (string);
+    if (Nread < gfits_data_min_size (table[0].header)) {
+      fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__,  Nread,  gfits_data_min_size (table[0].header));
+      if (padIfShort) {
+	memset (&table[0].buffer[Nread], 0, Nbytes - Nread);
+	fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n");
+	table[0].validsize = Nread;
+	table[0].datasize = Nbytes;
+	return (TRUE);
+      } else {
+	gfits_free_table  (table);
+	return (FALSE);
+      }
+    }
+    fprintf (stderr, "warning: file missing pad\n");
+  }
+  table[0].validsize = Nread;
+  table[0].datasize = Nbytes;
+  return (TRUE);
+}	
+
Index: /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/relphot.c
===================================================================
--- /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/relphot.c	(revision 31467)
+++ /branches/eam_branches/ipp-20110505/Ohana/src/relphot/src/relphot.c	(revision 31468)
@@ -147,4 +147,27 @@
   }
   
+  if (SOMETHING) {
+    FITS_DB dbX;
+    dbX.lockstate = LCK_XCLD;
+    dbX.timeout   = 60.0;
+    gfits_db_init (&dbX);
+    char filename[1024];
+    snprintf (filename, 1024, "%s.bck", ImageCat);
+    if (!gfits_db_lock (dbX, filename)) {
+      fprintf (stderr, "can't lock backup image image catalog\n");
+      return (FALSE);
+    }
+    
+    // copy header
+    gfits_copy_header (dbX.header, db.header);
+    gfits_copy_header (dbX.theader, db.theader);
+    gfits_copy_matrix (dbX.matrix, db.matrix);
+    gfits_copy_table (dbX.matrix, db.matrix);
+
+    // copy Images.dat to another structure
+    dvo_image_update (&db, VERBOSE);
+    dvo_image_unlock (&db); 
+  }
+
   if (USE_GRID) dump_grid ();
   if (!UPDATE) exit (0);
