Index: /branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/relphot.c
===================================================================
--- /branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/relphot.c	(revision 42519)
+++ /branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/relphot.c	(revision 42520)
@@ -36,5 +36,5 @@
       // calculate zero points for images (may group by exposure [mosaic], night [tgroups]; may measure flat-correction)
       // IF CALLED WITH NLOOP == 0, DOES NOT LOAD bcatalog, just loads image table and generates ImageSubset.dat
-      // If called with -update, calls reload_catalogs() just like apply_offsets
+      // If called with -update, calls reload_catalogs() just like apply_offsets, UNLESS -only-stacks-and-warps is selected
       relphot_images (skylist);
       relphot_free (sky, skylist);
Index: /branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/setMrelCatalog.c
===================================================================
--- /branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/setMrelCatalog.c	(revision 42519)
+++ /branches/eam_branches/ipp-20230313/Ohana/src/relphot/src/setMrelCatalog.c	(revision 42520)
@@ -948,18 +948,22 @@
   }
 
-  // for a diff db, we just want primary, if available or not. for warp we want to use the
-  // skycell which provided the stack best entry
-  int tessID, projID, skycellID;
-  if (IS_DIFF_DB) {
-    get_tess_ids(&tessID, &projID, &skycellID, average[0].R, average[0].D);
-  }
-  for (Nsec = 0; Nsec < Nsecfilt; Nsec++) {
-    if (!IS_DIFF_DB) {
-      myAssert (secfilt[Nsec].stackBestOff <= catalog->Nmeasure, "stackBestOff out of range");
-      if (!FindImageSkycellID (secfilt[Nsec].stackBestOff, cat, &tessID, &projID, &skycellID)) continue;
-    }
-    results->tessID[Nsec]    = tessID;
-    results->projID[Nsec]    = projID;
-    results->skycellID[Nsec] = skycellID;
+  if (BOUNDARY_TREE) {
+    int tessID, projID, skycellID;
+
+    // for a diff db, we just want primary, if available or not.
+    if (IS_DIFF_DB) {
+      get_tess_ids(&tessID, &projID, &skycellID, average[0].R, average[0].D);
+    }
+    // save the tess ID for each secfilt
+    for (Nsec = 0; Nsec < Nsecfilt; Nsec++) {
+      // for warps, we want to use the skycell which provided the stack best entry
+      if (!IS_DIFF_DB) {
+	myAssert (secfilt[Nsec].stackBestOff <= catalog->Nmeasure, "stackBestOff out of range");
+	if (!FindImageSkycellID (secfilt[Nsec].stackBestOff, cat, &tessID, &projID, &skycellID)) continue;
+      }
+      results->tessID[Nsec]    = tessID;
+      results->projID[Nsec]    = projID;
+      results->skycellID[Nsec] = skycellID;
+    }
   }
 
@@ -987,7 +991,10 @@
     if (isfinite(measure[k].psfQF)     && (measure[k].psfQF     > 0.00)) average->NwarpOK ++;
 
-    // use primary skycell for DIFF, stack skycell for WARP
-    if (!MatchImageSkycellID (meas, cat, results->tessID[Nsec], results->projID[Nsec], results->skycellID[Nsec])) {
-      continue;
+    // restrict to measurements from the desired skycell
+    if (BOUNDARY_TREE) {
+      // use primary skycell for DIFF, stack skycell for WARP, otherwise skip this measurement
+      if (!MatchImageSkycellID (meas, cat, results->tessID[Nsec], results->projID[Nsec], results->skycellID[Nsec])) {
+	continue;
+      }
     }
 
