Index: branches/eam_branches/relphot.20210521/src/TGroupOps.c
===================================================================
--- branches/eam_branches/relphot.20210521/src/TGroupOps.c	(revision 41603)
+++ branches/eam_branches/relphot.20210521/src/TGroupOps.c	(revision 41606)
@@ -2,5 +2,5 @@
 
 void assignMosaicsToTGroups (void);
-int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog, FlatCorrectionTable *flatcorr);
+int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog);
 
 // tgroupTimes carries the times of the tgroups (initially, just the photometric nights)
@@ -647,11 +647,10 @@
   Catalog *catalog;
   Image *image;
-  FlatCorrectionTable *flatcorr;
   SetMgrpInfo info;
 } ThreadInfo;
 
-int   setMgrp_tgroup (TGroup *tgroup, off_t Nmos, Image *image, Catalog *catalog, SetMgrpInfo *info, FlatCorrectionTable *flatcorr);
+int   setMgrp_tgroup (TGroup *tgroup, off_t Nmos, Image *image, Catalog *catalog, SetMgrpInfo *info);
 void *setMgrp_worker (void *data);
-int   setMgrp_threaded (Catalog *catalog, FlatCorrectionTable *flatcorr);
+int   setMgrp_threaded (Catalog *catalog);
 
 void SetMgrpInfoInit (SetMgrpInfo *info, off_t Nmax, int allocLists) {
@@ -727,5 +726,5 @@
 }
 
-int setMgrp (Catalog *catalog, FlatCorrectionTable *flatcorr) {
+int setMgrp (Catalog *catalog) {
 
   off_t N;
@@ -738,5 +737,5 @@
   // so do not run setMgrp in threaded mode if PLOTSTUFF is set
   if (NTHREADS && !PLOTSTUFF) {
-    int status = setMgrp_threaded (catalog, flatcorr);
+    int status = setMgrp_threaded (catalog);
     return status;
   }
@@ -758,5 +757,5 @@
     TGroup *tgroup = tgroupTimes[i][0].byCode;
     for (off_t j = 0; j < tgroupTimes[i][0].nCode; j++) {
-      setMgrp_tgroup (&tgroup[j], i, image, catalog, &info, flatcorr);
+      setMgrp_tgroup (&tgroup[j], i, image, catalog, &info);
       // fprintf (stderr, "TGROUP time %.0f photcode %d Mcal: %f, dK: %f, dMcal: %f, sigma: %f, chisq: %f, %d of %d, limiting negative clouds to %f\n",
       // ohana_sec_to_mjd(tgroupTimes[i][0].start), tgroup[j].photcode, tgroup[j].McalPSF, tgroup[j].dKlam, tgroup[j].dMcal, tgroup[j].stdev, tgroup[j].McalChiSq, tgroup[j].nFitPhotom, tgroup[j].nValPhotom, CLOUD_TOLERANCE);
@@ -781,5 +780,5 @@
 
 // 'tgroup' is a pointer to the current tgroup of interest (entry Ngrp)
-int setMgrp_tgroup (TGroup *myTGroup, off_t Ngrp, Image *image, Catalog *catalog, SetMgrpInfo *info, FlatCorrectionTable *flatcorr) {
+int setMgrp_tgroup (TGroup *myTGroup, off_t Ngrp, Image *image, Catalog *catalog, SetMgrpInfo *info) {
 
   off_t j;
@@ -826,5 +825,5 @@
     fout = fopen (filename, "w");
     fprintf (fout, "# tgroup %s (%.0f)\n", ohana_sec_to_date(tgroup->start), mjdStart);
-    save_test_night_measures (fout, myTGroup, catalog, flatcorr);
+    save_test_night_measures (fout, myTGroup, catalog);
     fclose (fout);
   }
@@ -877,5 +876,5 @@
     // the flat-correction.  NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat)
 
-    float Mflat = getMflat (m, c, flatcorr, catalog);
+    float Mflat = getMflat (m, c, catalog);
 
     off_t n = catalog[c].measureT[m].averef;
@@ -1000,5 +999,5 @@
 }
   
-int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog, FlatCorrectionTable *flatcorr) {
+int save_test_night_measures (FILE *fout, TGroup *myTGroup, Catalog *catalog) {
 
   int Nsecfilt = GetPhotcodeNsecfilt ();
@@ -1015,5 +1014,5 @@
     float Mgrid    = getMgridTiny (&catalog[c].measureT[m]);                    // camera offset (deprecated?)
     float MrelPSF  = getMrel  (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude
-    float Mflat    = getMflat (m, c, flatcorr, catalog); // flat-field correction
+    float Mflat    = getMflat (m, c, catalog); // flat-field correction
 
     off_t n = catalog[c].measureT[m].averef;
@@ -1037,5 +1036,5 @@
 }
 
-int setMgrp_threaded (Catalog *catalog, FlatCorrectionTable *flatcorr) {
+int setMgrp_threaded (Catalog *catalog) {
 
   int i;
@@ -1075,5 +1074,4 @@
     threadinfo[i].catalog  =  catalog;
     threadinfo[i].image    =    image;
-    threadinfo[i].flatcorr = flatcorr;
 
     // we do NOT allocate the arrays here, we only supply basic info used in the threads
@@ -1147,10 +1145,9 @@
 
     Catalog *catalog = threadinfo->catalog;
-    FlatCorrectionTable *flatcorr = threadinfo->flatcorr;
     Image *image = threadinfo->image;
 
     TGroup *tgroup = tgroupTimes[i][0].byCode;
     for (int j = 0; j < tgroupTimes[i][0].nCode; j++) {
-      setMgrp_tgroup (&tgroup[j], i, image, catalog, &results, flatcorr);
+      setMgrp_tgroup (&tgroup[j], i, image, catalog, &results);
       SetMgrpInfoAccum (&threadinfo->info, &results);
     }
@@ -1506,5 +1503,5 @@
 	float MrelPSF  = getMrel  (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); // average magnitude
 	// float Mgrid    = getMgridTiny (&catalog[c].measureT[m]); // camera offset (deprecated?)
-	// float Mflat    = getMflat (m, c, flatcorr, catalog); // flat-field correction
+	// float Mflat    = getMflat (m, c, catalog); // flat-field correction
 
 	off_t n = catalog[c].measureT[m].averef;
