Index: branches/eam_branches/relphot.20200519/src/ImageOps.c
===================================================================
--- branches/eam_branches/relphot.20200519/src/ImageOps.c	(revision 41360)
+++ branches/eam_branches/relphot.20200519/src/ImageOps.c	(revision 41387)
@@ -586,5 +586,5 @@
 
   off_t i, j, m, c, n;
-  int mark, bad, Nfew, Nbad, Nmos, Nrel, Ngrid, Nsys;
+  int mark, bad, Nfew, Nbad, Nmos, Ngrp, Nrel, Ngrid, Nsys;
 
   StatType stats;
@@ -612,5 +612,5 @@
   StatDataSet *brightStars = StatDataSetAlloc (1, Nmax);
 
-  Nfew = Nbad = Nmos = Ngrid = Nrel = Nsys = 0;
+  Nfew = Nbad = Nmos = Ngrp = Ngrid = Nrel = Nsys = 0;
 
   int Ncalibrated = 0;
@@ -631,5 +631,7 @@
 
     // only freeze the gpc1 chips
-    if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue;
+    // XXX : when do we FREEZE_IMAGES in a mix of GPC1, GPC2, etc?
+    // if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue;
+    if (FREEZE_IMAGES) continue;
     if (image[i].photcode == 0) continue; // skip the PHU images
 
@@ -666,4 +668,9 @@
 	  continue;
       }
+      float Mgrp  = getMgrp  (m, c, catalog[c].measureT[m].airmass);
+      if (isnan(Mgrp)) {
+	  Ngrp ++;
+	  continue;
+      }
       float Mgrid = getMgrid (m, c);
       if (isnan(Mgrid)) {
@@ -706,5 +713,5 @@
 
     skip:
-      psfStars->flxlist[Nref] = MsysPSF - MrelPSF - Mmos - Mgrid + Mflat;
+      psfStars->flxlist[Nref] = MsysPSF - MrelPSF - Mmos - Mgrp - Mgrid + Mflat;
       psfStars->errlist[Nref] = MAX (catalog[c].measureT[m].dM, MIN_ERROR);
       psfStars->wgtlist[Nref] = 1;
@@ -718,5 +725,5 @@
 
       if (isfinite(MrelKron) && isfinite(MsysKron)) {
-	kronStars->flxlist[Nkron] = MsysKron - MrelKron - Mmos - Mgrid + Mflat;
+	kronStars->flxlist[Nkron] = MsysKron - MrelKron - Mmos - Mgrp - Mgrid + Mflat;
 	kronStars->errlist[Nkron] = MAX (catalog[c].measureT[m].dM, MIN_ERROR);
 	kronStars->wgtlist[Nkron] = 1;
@@ -1023,5 +1030,5 @@
   off_t i, j, m, c, n, N;
   double *list, *dlist;
-  float Mcal, Mmos, Mgrid;
+  float Mcal, Mmos, Mgrp, Mgrid;
 
   StatType stats;
@@ -1050,4 +1057,6 @@
       Mmos  = getMmos  (m, c);
       if (isnan(Mmos)) continue;
+      Mgrp  = getMgrp  (m, c, catalog[c].measureT[m].airmass);
+      if (isnan(Mgrp)) continue;
       Mgrid = getMgrid (m, c);
       if (isnan(Mgrid)) continue;
