Index: trunk/ippdb/configure.ac
===================================================================
--- trunk/ippdb/configure.ac	(revision 8528)
+++ trunk/ippdb/configure.ac	(revision 8543)
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [0.0.32], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [0.0.33], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: trunk/ippdb/src/ippdb.c
===================================================================
--- trunk/ippdb/src/ippdb.c	(revision 8528)
+++ trunk/ippdb/src/ippdb.c	(revision 8543)
@@ -14057,5 +14057,5 @@
 static void detStackedImfileRowFree(detStackedImfileRow *object);
 
-detStackedImfileRow *detStackedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev)
+detStackedImfileRow *detStackedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool normalize)
 {
     detStackedImfileRow *object;
@@ -14072,4 +14072,5 @@
     object->bg_stdev = bg_stdev;
     object->bg_mean_stdev = bg_mean_stdev;
+    object->normalize = normalize;
 
     return object;
@@ -14134,4 +14135,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, false)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item normalize");
+        psFree(md);
+        return false;
+    }
 
     status = psDBCreateTable(dbh, DETSTACKEDIMFILE_TABLE_NAME, md);
@@ -14147,5 +14153,5 @@
 }
 
-bool detStackedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev)
+bool detStackedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool normalize)
 {
     psMetadata      *md;
@@ -14190,4 +14196,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, bg_mean_stdev)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, normalize)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item normalize");
         psFree(md);
         return false;
@@ -14214,5 +14225,5 @@
     return deleted;
 }
-bool detStackedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, char **recipe, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev)
+bool detStackedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, char **recipe, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev, bool *normalize)
 {
     psArray         *rowSet;
@@ -14306,4 +14317,10 @@
         return false;
     }
+    *normalize = psMetadataLookupBool(&status, row, "normalize");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item normalize");
+        psFree(row);
+        return false;
+    }
 
     psFree(row);
@@ -14314,5 +14331,5 @@
 bool detStackedImfileInsertObject(psDB *dbh, detStackedImfileRow *object)
 {
-    return detStackedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev);
+    return detStackedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->normalize);
 }
 
@@ -14338,11 +14355,12 @@
     psF64           bg_stdev;
     psF64           bg_mean_stdev;
-
-    if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev)) {
+    bool            normalize;
+
+    if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &normalize)) {
         psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
         return NULL;
     }
 
-    return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev);
+    return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, normalize);
 }
 
@@ -14480,4 +14498,9 @@
     if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, object->bg_mean_stdev)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev");
+        psFree(md);
+        return NULL;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, object->normalize)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item normalize");
         psFree(md);
         return NULL;
@@ -14498,4 +14521,5 @@
     psF64           bg_stdev;
     psF64           bg_mean_stdev;
+    bool            normalize;
 
     det_id = psMetadataLookupS32(&status, md, "det_id");
@@ -14539,6 +14563,11 @@
         return false;
     }
-
-    return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev);
+    normalize = psMetadataLookupBool(&status, md, "normalize");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item normalize");
+        return false;
+    }
+
+    return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, normalize);
 }
 psArray *detStackedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 8528)
+++ trunk/ippdb/src/ippdb.h	(revision 8543)
@@ -6058,4 +6058,5 @@
     psF64           bg_stdev;
     psF64           bg_mean_stdev;
+    bool            normalize;
 } detStackedImfileRow;
 
@@ -6073,5 +6074,6 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           bg_mean_stdev
+    psF64           bg_mean_stdev,
+    bool            normalize
 );
 
@@ -6110,5 +6112,6 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           bg_mean_stdev
+    psF64           bg_mean_stdev,
+    bool            normalize
 );
 
@@ -6138,5 +6141,6 @@
     psF64           *bg,
     psF64           *bg_stdev,
-    psF64           *bg_mean_stdev
+    psF64           *bg_mean_stdev,
+    bool            *normalize
 );
 
Index: trunk/ippdb/tests/alloc.c
===================================================================
--- trunk/ippdb/tests/alloc.c	(revision 8528)
+++ trunk/ippdb/tests/alloc.c	(revision 8543)
@@ -1007,5 +1007,5 @@
         detStackedImfileRow *object;
 
-        object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64    );
+        object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true    );
 
         if (!object) {
@@ -1042,4 +1042,8 @@
         }
         if (!object->bg_mean_stdev == 64.64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->normalize == true) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: trunk/ippdb/tests/insert.c
===================================================================
--- trunk/ippdb/tests/insert.c	(revision 8528)
+++ trunk/ippdb/tests/insert.c	(revision 8543)
@@ -388,5 +388,5 @@
         }
 
-        if (!detStackedImfileInsert(dbh, -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64)) {
+        if (!detStackedImfileInsert(dbh, -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true)) {
             exit(EXIT_FAILURE);
         }
Index: trunk/ippdb/tests/insertobject.c
===================================================================
--- trunk/ippdb/tests/insertobject.c	(revision 8528)
+++ trunk/ippdb/tests/insertobject.c	(revision 8543)
@@ -564,5 +564,5 @@
         }
 
-        object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64);
+        object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true);
         if (!object) {
             exit(EXIT_FAILURE);
Index: trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- trunk/ippdb/tests/metadatafromobject.c	(revision 8528)
+++ trunk/ippdb/tests/metadatafromobject.c	(revision 8543)
@@ -1210,5 +1210,5 @@
         bool            status;
 
-        object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64);
+        object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -1251,4 +1251,8 @@
         }
         if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataLookupBool(&status, md, "normalize") == true) {
             psFree(md);
             exit(EXIT_FAILURE);
Index: trunk/ippdb/tests/objectfrommetadata.c
===================================================================
--- trunk/ippdb/tests/objectfrommetadata.c	(revision 8528)
+++ trunk/ippdb/tests/objectfrommetadata.c	(revision 8543)
@@ -1839,4 +1839,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, true)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = detStackedImfileObjectFromMetadata(md);
@@ -1877,4 +1881,8 @@
         }
         if (!object->bg_mean_stdev == 64.64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->normalize == true) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: trunk/ippdb/tests/pop.c
===================================================================
--- trunk/ippdb/tests/pop.c	(revision 8528)
+++ trunk/ippdb/tests/pop.c	(revision 8543)
@@ -558,11 +558,12 @@
         psF64           bg_stdev;
         psF64           bg_mean_stdev;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev)) { 
+        bool            normalize;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &normalize)) { 
             exit(EXIT_FAILURE);
         }
