Index: /branches/eam_branches/ipp-20150112/psModules/src/config/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/config/Makefile.am	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/config/Makefile.am	(revision 38058)
@@ -1,23 +1,8 @@
 noinst_LTLIBRARIES = libpsmodulesconfig.la
-
-if HAVE_SVNVERSION
-PSMODULES_VERSION=`$(SVNVERSION) ../..`
-else
-PSMODULES_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PSMODULES_BRANCH=`$(SVN) info ../.. | $(SED) -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'`
-PSMODULES_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PSMODULES_BRANCH="UNKNOWN"
-PSMODULES_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of pmVersion.c, since it gets the version information
 pmVersion.c: pmVersionDefinitions.h
 pmVersionDefinitions.h: pmVersionDefinitions.h.in FORCE
-	-$(RM) pmVersionDefinitions.h
-	$(SED) -e "s|@PSMODULES_VERSION@|\"$(PSMODULES_VERSION)\"|" -e "s|@PSMODULES_BRANCH@|\"$(PSMODULES_BRANCH)\"|" -e "s|@PSMODULES_SOURCE@|\"$(PSMODULES_SOURCE)\"|" pmVersionDefinitions.h.in > pmVersionDefinitions.h
+	pslib-setsvnversion.pl PSMODULES pmVersionDefinitions.h.in pmVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/psModules/src/config/pmConfigRecipes.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/config/pmConfigRecipes.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/config/pmConfigRecipes.c	(revision 38058)
@@ -228,5 +228,5 @@
         }
         psFree (words);
-        assert (valid);  // flag may be: -D, -Df, -Di, -Db
+        psAssert (valid, "invalid flag: may be: -D, -Df, -Di, -Db\n");
 
         psArgumentRemove (argNum, argc, argv);
Index: /branches/eam_branches/ipp-20150112/psModules/src/detrend/pmDetrendDB.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/detrend/pmDetrendDB.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/detrend/pmDetrendDB.c	(revision 38058)
@@ -356,12 +356,15 @@
     psTrace("psModules.detrend", 5, "detrend file: %s\n", result);
 
+    // XXX: A somewhat hacked bit of code to force the analysis to use a specific version of the detrend file
     char *is_nebulous = strstr(result,"neb://");
     if (is_nebulous) { // This file matches the nebulous string
       psString truncated = psStringCopy(is_nebulous + 6);
       //      printf("A: %s %s\n",result,truncated);
+
       psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes,"PPIMAGE");
-      psMetadata *detloc = psMetadataLookupMetadata(NULL, recipe, "DETREND.LOCATIONS");
+      psMetadata *detloc = psMetadataLookupMetadata(&status, recipe, "DETREND.LOCATIONS");
+
       if (detloc) { // This exists, so we have the information.
-	psString location = psMetadataLookupStr(NULL, detloc,classID);
+	psString location = psMetadataLookupStr(&status, detloc, classID);
 	//	printf("B: %s %s\n", classID,location);
 	if (location) { // Found a location
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/Makefile.am	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/Makefile.am	(revision 38058)
@@ -58,4 +58,5 @@
 	pmSourceIO_CMF_PS1_DV3.c \
 	pmSourceIO_CMF_PS1_DV4.c \
+	pmSourceIO_CMF_PS1_DV5.c \
 	pmSourceIO_MatchedRefs.c \
 	pmSourcePlots.c \
@@ -156,4 +157,5 @@
 pmSourceIO_CMF_PS1_DV3.c \
 pmSourceIO_CMF_PS1_DV4.c \
+pmSourceIO_CMF_PS1_DV5.c \
 pmSourceIO_CMF_PS1_SV1.c \
 pmSourceIO_CMF_PS1_SV2.c \
@@ -188,4 +190,7 @@
 	mksource.pl pmSourceIO_CMF.c.in PS1_DV4 pmSourceIO_CMF_PS1_DV4.c
 
+pmSourceIO_CMF_PS1_DV5.c : pmSourceIO_CMF.c.in mksource.pl
+	mksource.pl pmSourceIO_CMF.c.in PS1_DV5 pmSourceIO_CMF_PS1_DV5.c
+
 pmSourceIO_CMF_PS1_SV1.c : pmSourceIO_CMF.c.in mksource.pl
 	mksource.pl pmSourceIO_CMF.c.in PS1_SV1 pmSourceIO_CMF_PS1_SV1.c
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/mksource.pl
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/mksource.pl	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/mksource.pl	(revision 38058)
@@ -25,4 +25,5 @@
 		"PS1_DV3", 3,
 		"PS1_DV4", 4,
+		"PS1_DV5", 5,
     );
 %cmfmodes_sv = ("PS1_SV1", 1,
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmFootprintAssignPeaks.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmFootprintAssignPeaks.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmFootprintAssignPeaks.c	(revision 38058)
@@ -56,5 +56,5 @@
 	const int y = peak->y - row0;
 	
-	if (ids) { assert (x >= 0 && x < numCols && y >= 0 && y < numRows);}
+	if (ids) { psAssert (x >= 0 && x < numCols && y >= 0 && y < numRows, "out of range");}
 	int id = ids ? ids->data.S32[y][x] : 0;
 
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmModelFuncs.h
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmModelFuncs.h	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmModelFuncs.h	(revision 38058)
@@ -36,16 +36,19 @@
 
 typedef enum {
-    PM_MODEL_STATUS_NONE           = 0x000, ///< model fit not yet attempted, no other info
-    PM_MODEL_STATUS_FITTED         = 0x001, ///< model fit completed
-    PM_MODEL_STATUS_NONCONVERGE    = 0x002, ///< model fit did not converge
-    PM_MODEL_STATUS_OFFIMAGE       = 0x004, ///< model fit drove out of range
-    PM_MODEL_STATUS_BADARGS        = 0x008, ///< model fit called with invalid args
-    PM_MODEL_STATUS_LIMITS         = 0x010, ///< model parameters hit limits
-    PM_MODEL_STATUS_WEAK_FIT       = 0x020, ///< model fit met loose tolerance, but not tight tolerance
-    PM_MODEL_STATUS_NAN_CHISQ      = 0x040, ///< model fit failed with a NAN chisq 
-    PM_MODEL_SERSIC_PCM_FAIL_GUESS = 0x080, ///< sersic model fit failed on the initial moments-based guess
-    PM_MODEL_SERSIC_PCM_FAIL_GRID  = 0x100, ///< sersic model fit failed on the grid search
-    PM_MODEL_PCM_FAIL_GUESS        = 0x200, ///< non-sersic model fit failed on the initial moments-based guess
-    PM_MODEL_BEST_FIT              = 0x400, ///< this model was the best fit and was subtracted
+    PM_MODEL_STATUS_NONE           = 0x0000, ///< model fit not yet attempted, no other info
+    PM_MODEL_STATUS_FITTED         = 0x0001, ///< model fit completed
+    PM_MODEL_STATUS_NONCONVERGE    = 0x0002, ///< model fit did not converge
+    PM_MODEL_STATUS_OFFIMAGE       = 0x0004, ///< model fit drove out of range
+    PM_MODEL_STATUS_BADARGS        = 0x0008, ///< model fit called with invalid args
+    PM_MODEL_STATUS_LIMITS         = 0x0010, ///< model parameters hit limits
+    PM_MODEL_STATUS_WEAK_FIT       = 0x0020, ///< model fit met loose tolerance, but not tight tolerance
+    PM_MODEL_STATUS_NAN_CHISQ      = 0x0040, ///< model fit failed with a NAN chisq 
+    PM_MODEL_SERSIC_PCM_FAIL_GUESS = 0x0080, ///< sersic model fit failed on the initial moments-based guess
+    PM_MODEL_SERSIC_PCM_FAIL_GRID  = 0x0100, ///< sersic model fit failed on the grid search
+    PM_MODEL_PCM_FAIL_GUESS        = 0x0200, ///< non-sersic model fit failed on the initial moments-based guess
+    PM_MODEL_BEST_FIT              = 0x0400, ///< this model was the best fit and was subtracted
+    PM_MODEL_STATUS_NAN_SHAPE      = 0x0800, ///< model ellipse parameters do not transform to valid ellipse
+    PM_MODEL_STATUS_NAN_SHAPE_ERR  = 0x1000, ///< model ellipse parameters errors do not transform to valid ellipse
+    PM_MODEL_STATUS_FAIL_SHAPE_ERR = 0x2000, ///< could not find an MC solution for ellipse parameter errors
 } pmModelStatus;
 
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO.c	(revision 38058)
@@ -607,4 +607,5 @@
 	    PM_SOURCES_WRITE("PS1_DV3",   CMF_PS1_DV3);
 	    PM_SOURCES_WRITE("PS1_DV4",   CMF_PS1_DV4);
+	    PM_SOURCES_WRITE("PS1_DV5",   CMF_PS1_DV5);
 
 	    psFree (outhead);
@@ -1130,4 +1131,5 @@
 	    PM_SOURCES_READ_PSF("PS1_DV3",   CMF_PS1_DV3);
 	    PM_SOURCES_READ_PSF("PS1_DV4",   CMF_PS1_DV4);
+	    PM_SOURCES_READ_PSF("PS1_DV5",   CMF_PS1_DV5);
 
             if (!sources) {
@@ -1419,4 +1421,5 @@
 	PM_SOURCES_READ_XSRC("PS1_DV3",   CMF_PS1_DV3);
 	PM_SOURCES_READ_XSRC("PS1_DV4",   CMF_PS1_DV4);
+	PM_SOURCES_READ_XSRC("PS1_DV5",   CMF_PS1_DV5);
     }
     psFree(tableHeader);
@@ -1462,4 +1465,5 @@
 	PM_SOURCES_READ_XFIT("PS1_DV3",   CMF_PS1_DV3);
 	PM_SOURCES_READ_XFIT("PS1_DV4",   CMF_PS1_DV4);
+	PM_SOURCES_READ_XFIT("PS1_DV5",   CMF_PS1_DV5);
     }
     psFree(tableHeader);
@@ -1504,4 +1508,5 @@
 	PM_SOURCES_READ_XRAD("PS1_DV3",   CMF_PS1_DV3);
 	PM_SOURCES_READ_XRAD("PS1_DV4",   CMF_PS1_DV4);
+	PM_SOURCES_READ_XRAD("PS1_DV5",   CMF_PS1_DV5);
     }
     psFree(tableHeader);
@@ -1546,4 +1551,5 @@
 	PM_SOURCES_READ_XGAL("PS1_DV3",   CMF_PS1_DV3);
 	PM_SOURCES_READ_XGAL("PS1_DV4",   CMF_PS1_DV4);
+	PM_SOURCES_READ_XGAL("PS1_DV5",   CMF_PS1_DV5);
     }
     psFree(tableHeader);
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO.h
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO.h	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO.h	(revision 38058)
@@ -46,4 +46,5 @@
 MK_PROTO(CMF_PS1_DV3);
 MK_PROTO(CMF_PS1_DV4);
+MK_PROTO(CMF_PS1_DV5);
 
 int pmSourceGetDophotType (pmSource *source);
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_CMF.c.in
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_CMF.c.in	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_CMF.c.in	(revision 38058)
@@ -197,5 +197,4 @@
 	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E2_SM_OBJ",   PS_DATA_F32, "smear polarizability element (objects)",     source->lensingOBJ->smear->e2);
 	}
-
 	if (source->lensingOBJ && source->lensingOBJ->shear) {
 	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_X11_SH_OBJ",  PS_DATA_F32, "shear polarizability element (objects)",     source->lensingOBJ->shear->X11);
@@ -205,4 +204,9 @@
 	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E2_SH_OBJ",   PS_DATA_F32, "shear polarizability element (objects)",     source->lensingOBJ->shear->e2); 
 	}
+	if (false && source->lensingOBJ) {
+	  // do not bother to save these as they are equivalent to Mxx,Mxy,Myy above
+	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E1_PSF",      PS_DATA_F32, "shear polarizability element (objects)",     source->lensingOBJ->e1); 
+	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E2_PSF",      PS_DATA_F32, "shear polarizability element (objects)",     source->lensingOBJ->e2); 
+	}
 
 	if (source->lensingPSF && source->lensingPSF->smear) {
@@ -213,5 +217,4 @@
 	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E2_SM_PSF",   PS_DATA_F32, "smear polarizability element (objects)",     source->lensingPSF->smear->e2); 
 	}
-
 	if (source->lensingPSF && source->lensingPSF->shear) {
 	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_X11_SH_PSF",  PS_DATA_F32, "shear polarizability element (objects)",     source->lensingPSF->shear->X11);
@@ -221,4 +224,8 @@
 	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E2_SH_PSF",   PS_DATA_F32, "shear polarizability element (objects)",     source->lensingPSF->shear->e2); 
 	}
+	if (source->lensingPSF) {
+	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E1_PSF",      PS_DATA_F32, "shear polarizability element (objects)",     source->lensingPSF->e1); 
+	  @>PS1_V4@               psMetadataAdd (row, PS_LIST_TAIL, "LENS_E2_PSF",      PS_DATA_F32, "shear polarizability element (objects)",     source->lensingPSF->e2); 
+	}
 
         // if lensing params exist also include the backmapped chipID and chip coordinates
@@ -240,4 +247,9 @@
         @>PS1_V3@ 		  psMetadataAdd (row, PS_LIST_TAIL, "SKY_LIMIT_FLUX",   PS_DATA_F32, "Flux / pix where object hits sky",           source->skyFlux);
         @>PS1_V3@ 		  psMetadataAdd (row, PS_LIST_TAIL, "SKY_LIMIT_SLOPE",  PS_DATA_F32, "d(Flux/pix)/dRadius where object hits sky",  source->skySlope);
+
+	@>PS1_DV4@                psMetadataAdd (row, PS_LIST_TAIL, "SRC_CHIP_NUM",     PS_DATA_S16, "id of warp input chip",                      source->chipNum); 
+	@>PS1_DV4@                psMetadataAdd (row, PS_LIST_TAIL, "SRC_CHIP_X",       PS_DATA_S16, "x coord in warp input chip",     		   source->chipX); 
+	@>PS1_DV4@                psMetadataAdd (row, PS_LIST_TAIL, "SRC_CHIP_Y",       PS_DATA_S16, "y coord in warp input chip",     		   source->chipY); 
+	@>PS1_DV4@                psMetadataAdd (row, PS_LIST_TAIL, "PADDING3",         PS_DATA_S16, "more padding", 0);
 
         @PS1_DV?@          	  psMetadataAdd (row, PS_LIST_TAIL, "DIFF_NPOS",        PS_DATA_S32, "nPos (n pix > 3 sigma)",                     diffStats.nGood);
@@ -481,4 +493,6 @@
 	  @>PS1_V4@ source->lensingPSF->shear->e1  = psMetadataLookupF32 (&status, row, "LENS_E1_SH_PSF");
 	  @>PS1_V4@ source->lensingPSF->shear->e2  = psMetadataLookupF32 (&status, row, "LENS_E2_SH_PSF");
+	  @>PS1_V4@ source->lensingPSF->e1         = psMetadataLookupF32 (&status, row, "LENS_E1_PSF");
+	  @>PS1_V4@ source->lensingPSF->e2         = psMetadataLookupF32 (&status, row, "LENS_E2_PSF");
 	}
 
@@ -1238,6 +1252,6 @@
         }
 
-	// XXX : make this depend on what is in the cmf
-	if (0) {
+	// NOTE: we no longer write out the covariance matrix
+	if (false) {
 	    // read the covariance matrix
 	    int nparams = model->params->n;
@@ -1252,4 +1266,12 @@
 	    model->covar = covar;
 	}
+
+	// we are only saving the values stored in dPAR[SXX,etc]
+        dPAR[PM_PAR_SXX] = psMetadataLookupF32(&status, row, "EXT_WIDTH_MAJ_ERR");
+        dPAR[PM_PAR_SYY] = psMetadataLookupF32(&status, row, "EXT_WIDTH_MIN_ERR");
+        dPAR[PM_PAR_SXY] = psMetadataLookupF32(&status, row, "EXT_THETA_ERR");
+
+	// other parameters that we need to read
+        PAR[PM_PAR_SKY] = psMetadataLookupF32(&status, row, "SKY_EXT");
 
         if (modelType == extModelType) {
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_PS1_CAL_0.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_PS1_CAL_0.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_PS1_CAL_0.c	(revision 38058)
@@ -376,5 +376,5 @@
     psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER");
     psVector *radialBinsUpper = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER");
-    assert (radialBinsLower->n == radialBinsUpper->n);
+    psAssert (radialBinsLower->n == radialBinsUpper->n, "upper and lower bins must match");
 
     // we write out all sources, regardless of quality.  the source flags tell us the state
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_PS1_DEV_1.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_PS1_DEV_1.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceIO_PS1_DEV_1.c	(revision 38058)
@@ -322,5 +322,5 @@
     psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER");
     psVector *radialBinsUpper = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER");
-    assert (radialBinsLower->n == radialBinsUpper->n);
+    psAssert (radialBinsLower->n == radialBinsUpper->n, "upper and lower bins must match");
 
     // we write out all sources, regardless of quality.  the source flags tell us the state
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceLensing.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceLensing.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceLensing.c	(revision 38058)
@@ -55,4 +55,6 @@
   tmp->smear = NULL;
   tmp->shear = NULL;
+  tmp->e1 = NAN;
+  tmp->e2 = NAN;
 
   return tmp;
@@ -105,5 +107,5 @@
   smear->X12 = R*0.5*s4*(moments->Mxxxy - moments->Mxyyy);
 
-  smear->e1  = R*(s2*(moments->Myy - moments->Mxx) + 0.25*s4 * (moments->Myyyy - moments->Mxxxx));
+  smear->e1  = R*(s2*(moments->Myy - moments->Mxx) + 0.25*s4 * (moments->Mxxxx - moments->Myyyy));
 
   smear->e2  = R*(0.5*s4*(moments->Mxxxy + moments->Mxyyy) - 2.0*s2*moments->Mxy);
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceLensing.h
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceLensing.h	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceLensing.h	(revision 38058)
@@ -25,4 +25,6 @@
   pmLensingPars *smear;
   pmLensingPars *shear;
+  float e1;
+  float e2;
 } pmSourceLensing; 
 
Index: /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceOutputs.c
===================================================================
--- /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceOutputs.c	(revision 38057)
+++ /branches/eam_branches/ipp-20150112/psModules/src/objects/pmSourceOutputs.c	(revision 38058)
@@ -60,18 +60,32 @@
     // we need a measure of the image quality (FWHM) for this image, in order to get the positional errors
     *fwhmMajor = psMetadataLookupF32(&status1, readout->analysis, "FWHM_MAJ");
-    if (!status1) {
-	*fwhmMajor = psMetadataLookupF32(&status1, readout->analysis, "IQ_FW1");
-	if (!status1) {
-	    *fwhmMajor = 5.0; // XXX just a guess!
-	}
-    }
+    if (status1) goto got_major;
+
+    *fwhmMajor = psMetadataLookupF32(&status1, header, "FWHM_MAJ");
+    if (status1) goto got_major;
+
+    *fwhmMajor = psMetadataLookupF32(&status1, readout->analysis, "IQ_FW1");
+    if (status1) goto got_major;
+
+    *fwhmMajor = psMetadataLookupF32(&status1, header, "IQ_FW1");
+    if (status1) goto got_major;
+
+    *fwhmMajor = 5.0; // XXX just a guess!
+
+    got_major:
+
     *fwhmMinor = psMetadataLookupF32(&status1, readout->analysis, "FWHM_MIN");
-    if (!status1) {
-	*fwhmMinor = psMetadataLookupF32(&status1, readout->analysis, "IQ_FW2");
-	if (!status1) {
-	    *fwhmMinor = 5.0; // XXX just a guess!
-	}
-    }
-
+    if (status1) goto got_minor;
+    *fwhmMinor = psMetadataLookupF32(&status1, header, "FWHM_MIN");
+    if (status1) goto got_minor;
+
+    *fwhmMinor = psMetadataLookupF32(&status1, readout->analysis, "IQ_FW2");
+    if (status1) goto got_minor;
+    *fwhmMinor = psMetadataLookupF32(&status1, header, "IQ_FW2");
+    if (status1) goto got_minor;
+
+    *fwhmMinor = 5.0; // XXX just a guess!
+
+    got_minor:
     return true;
 
