Index: /branches/eam_branches/ipp-20191011/ippToPsps/jython/stackbatch.py
===================================================================
--- /branches/eam_branches/ipp-20191011/ippToPsps/jython/stackbatch.py	(revision 41167)
+++ /branches/eam_branches/ipp-20191011/ippToPsps/jython/stackbatch.py	(revision 41168)
@@ -422,5 +422,9 @@
             sqlLine.group("a.dvoRegionID",             "b.catID")                       # this is not filter dependent, but is re-written for each filter (if data exists)
             sqlLine.group("a.primaryDetection",        "((b.flags & 0x10000) >> 16)")   # this is not filter dependent, but is re-written for each filter (if data exists)
+            ### XXX : primaryDetection is wrong: it should have calculated if (b.flags & 0x10000) was set for all filters
+            ### b.flags is the filter-dependent STACK_PRIMARY bit -- thus only true if the y-band is primary
+
             sqlLine.group("a.bestDetection",           "((b.objflags & 0x8000) >> 15)") # this is not filter dependent, but is re-written for each filter (if data exists)
+            ### XXX : bestDetection grabs the wrong bit.  It should have been (b.filtflags & 0x8000) or (b.objflags  & 0x10000000)
 
             sqlLine.group("a."+filter+"haveData",      "'1'")
