Index: /branches/eam_branch_20071023/psModules/src/astrom/Makefile.am
===================================================================
--- /branches/eam_branch_20071023/psModules/src/astrom/Makefile.am	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/astrom/Makefile.am	(revision 15398)
@@ -8,4 +8,5 @@
 	pmAstrometryDistortion.c \
 	pmAstrometryUtils.c \
+	pmAstrometryTable.c \
 	pmAstrometryWCS.c
 
@@ -15,4 +16,5 @@
 	pmAstrometryDistortion.h \
 	pmAstrometryUtils.h \
+	pmAstrometryTable.h \
 	pmAstrometryWCS.h
 
Index: /branches/eam_branch_20071023/psModules/src/astrom/pmAstrometryTable.c
===================================================================
--- /branches/eam_branch_20071023/psModules/src/astrom/pmAstrometryTable.c	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/astrom/pmAstrometryTable.c	(revision 15398)
@@ -1,16 +1,16 @@
 /** @file  pmAstrometryObjects.c
-*
-*  @brief This file defines the basic types for matching objects
-*  based on their astrometry.
-*
-*  @ingroup AstroImage
-*
-*  @author EAM, IfA
-*
-*  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-10-23 20:52:42 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
-*/
+ *
+ *  @brief This file defines the basic types for matching objects
+ *  based on their astrometry.
+ *
+ *  @ingroup AstroImage
+ *
+ *  @author EAM, IfA
+ *
+ *  @version $Revision: 1.1.2.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-10-29 01:37:48 $
+ *
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+ */
 
 #ifdef HAVE_CONFIG_H
@@ -29,7 +29,13 @@
 #include <pslib.h>
 
+#include "pmConfig.h"
+#include "pmDetrendDB.h"
 #include "pmHDU.h"
 #include "pmFPA.h"
-#include "pmAstrometryObjects.h"
+#include "pmFPALevel.h"
+#include "pmFPAview.h"
+#include "pmFPAfile.h"
+#include "pmAstrometryTable.h"
+
 
 /********************* CheckDataStatus functions *****************************/
@@ -179,24 +185,28 @@
 bool pmAstromWriteChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
-    // define the EXTNAME values used for the table data, and residual image segments
-    {
-        // lookup the EXTNAME values used for table data and image header segments
-        char *rule = NULL;
-
-        // Menu of EXTNAME rules
-        psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES");
-        if (!menu) {
-            psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
-            return false;
-        }
-
-        // EXTNAME for image header
-        rule = psMetadataLookupStr(&status, menu, "ASTROMETRY");
-        if (!rule) {
-            psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config");
-            return false;
-        }
-        extname = pmFPAfileNameFromRule (rule, file, view);
-    }
+    bool status;
+    // *** define the EXTNAME values used for the table data, and residual image segments ***
+
+    // lookup the EXTNAME values used for table data and image header segments
+    char *rule = NULL;
+
+    // Menu of EXTNAME rules
+    psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES");
+    if (!menu) {
+	psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
+	return false;
+    }
+
+    // EXTNAME for image header
+    rule = psMetadataLookupStr(&status, menu, "ASTROMETRY");
+    if (!rule) {
+	psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config");
+	return false;
+    }
+
+    // XXX need to finish this: uncomment when used
+    # if (0)
+    char *extname = pmFPAfileNameFromRule (rule, file, view);
+    # endif
 
     // write the chip elements in the following form:
@@ -244,24 +254,27 @@
 bool pmAstromReadChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
 {
-    // define the EXTNAME values used for the table data, and residual image segments
-    {
-        // lookup the EXTNAME values used for table data and image header segments
-        char *rule = NULL;
-
-        // Menu of EXTNAME rules
-        psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES");
-        if (!menu) {
-            psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
-            return false;
-        }
-
-        // EXTNAME for image header
-        rule = psMetadataLookupStr(&status, menu, "ASTROMETRY");
-        if (!rule) {
-            psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config");
-            return false;
-        }
-        extname = pmFPAfileNameFromRule (rule, file, view);
-    }
+    bool status;
+
+    // lookup the EXTNAME values used for table data and image header segments
+    char *rule = NULL;
+
+    // Menu of EXTNAME rules
+    psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES");
+    if (!menu) {
+	psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");
+	return false;
+    }
+
+    // EXTNAME for image header
+    rule = psMetadataLookupStr(&status, menu, "ASTROMETRY");
+    if (!rule) {
+	psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config");
+	return false;
+    }
+
+    // XXX finish this: uncomment when used
+    # if (0)
+    char *extname = pmFPAfileNameFromRule (rule, file, view);
+    # endif
 
     // read the chip elements in the following form:
Index: /branches/eam_branch_20071023/psModules/src/astrom/pmAstrometryTable.h
===================================================================
--- /branches/eam_branch_20071023/psModules/src/astrom/pmAstrometryTable.h	(revision 15398)
+++ /branches/eam_branch_20071023/psModules/src/astrom/pmAstrometryTable.h	(revision 15398)
@@ -0,0 +1,31 @@
+/* @file  pmAstrometryTable.h
+ * @brief Astrometry table I/O functions
+ *
+ * @author EAM, IfA
+ *
+ * @version $Revision: 1.1.2.1 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-10-29 01:37:48 $
+ * Copyright 2006 Institute for Astronomy, University of Hawaii
+ */
+
+#ifndef PM_ASTROMETRY_TABLE_H
+#define PM_ASTROMETRY_TABLE_H
+
+/// @addtogroup Astrometry
+/// @{
+
+bool pmAstromCheckDataStatusForView (const pmFPAview *view, pmFPAfile *file);
+bool pmAstromCheckDataStatusForFPA (const pmFPA *fpa);
+bool pmAstromCheckDataStatusForChip (const pmChip *chip);
+
+bool pmAstromWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
+bool pmAstromWriteForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
+bool pmAstromWriteFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
+bool pmAstromWriteChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
+
+bool pmAstromReadForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
+bool pmAstromReadFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
+bool pmAstromReadChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
+
+/// @}
+#endif
Index: /branches/eam_branch_20071023/psModules/src/camera/pmFPAfile.h
===================================================================
--- /branches/eam_branch_20071023/psModules/src/camera/pmFPAfile.h	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/camera/pmFPAfile.h	(revision 15398)
@@ -4,6 +4,6 @@
  * @author EAM, IfA
  *
- * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-10-03 21:32:43 $
+ * @version $Revision: 1.22.2.1 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-10-29 01:37:48 $
  * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
  */
@@ -35,4 +35,5 @@
     PM_FPA_FILE_FRINGE,
     PM_FPA_FILE_HEADER,
+    PM_FPA_FILE_ASTROM,
 } pmFPAfileType;
 
Index: /branches/eam_branch_20071023/psModules/src/camera/pmFPAfileIO.c
===================================================================
--- /branches/eam_branch_20071023/psModules/src/camera/pmFPAfileIO.c	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/camera/pmFPAfileIO.c	(revision 15398)
@@ -34,4 +34,5 @@
 #include "pmResiduals.h"
 #include "pmPSF_IO.h"
+#include "pmAstrometryTable.h"
 #include "pmFPA_JPEG.h"
 #include "pmSourcePlots.h"
Index: /branches/eam_branch_20071023/psModules/src/detrend/pmDetrendDB.c
===================================================================
--- /branches/eam_branch_20071023/psModules/src/detrend/pmDetrendDB.c	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/detrend/pmDetrendDB.c	(revision 15398)
@@ -101,4 +101,5 @@
         DETREND_STRING_CASE (SHUTTER);
         DETREND_STRING_CASE (FRINGE);
+        DETREND_STRING_CASE (ASTROM);
     default:
         return NULL;
Index: /branches/eam_branch_20071023/psModules/src/detrend/pmDetrendDB.h
===================================================================
--- /branches/eam_branch_20071023/psModules/src/detrend/pmDetrendDB.h	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/detrend/pmDetrendDB.h	(revision 15398)
@@ -9,6 +9,6 @@
  * @author EAM, IfA
  *
- * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-06-13 03:42:33 $
+ * @version $Revision: 1.13.14.1 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-10-29 01:37:48 $
  * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
  */
@@ -29,4 +29,5 @@
     PM_DETREND_TYPE_FRINGE,
     PM_DETREND_TYPE_BACKGROUND,
+    PM_DETREND_TYPE_ASTROM,
 } pmDetrendType;
 
Index: /branches/eam_branch_20071023/psModules/src/objects/Makefile.am
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/Makefile.am	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/objects/Makefile.am	(revision 15398)
@@ -10,4 +10,5 @@
      pmModelUtils.c \
      pmSource.c \
+     pmSourceExtendedPars.c \
      pmSourceUtils.c \
      pmSourceSky.c \
@@ -50,4 +51,5 @@
      pmModelUtils.h \
      pmSource.h \
+     pmSourceExtendedPars.h \
      pmSourceUtils.h \
      pmSourceSky.h \
Index: /branches/eam_branch_20071023/psModules/src/objects/pmModel.c
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/pmModel.c	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/objects/pmModel.c	(revision 15398)
@@ -6,6 +6,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.15.6.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-10-23 20:54:53 $
+ *  @version $Revision: 1.15.6.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-10-29 01:37:48 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -217,5 +217,5 @@
         Ro = psImageInterpolateOptionsAlloc(
             PS_INTERPOLATE_BILINEAR,
-            model->residuals->Ro, NULL, model->mask, 0, 0.0, 0.0, 1, 0, 0.0);
+            model->residuals->Ro, NULL, mask, 0, 0.0, 0.0, 1, 0, 0.0);
         Rx = psImageInterpolateOptionsAlloc(
             PS_INTERPOLATE_BILINEAR,
Index: /branches/eam_branch_20071023/psModules/src/objects/pmSource.h
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/pmSource.h	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/objects/pmSource.h	(revision 15398)
@@ -3,6 +3,6 @@
  * @author EAM, IfA; GLG, MHPCC
  *
- * @version $Revision: 1.18.2.1 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-10-23 20:54:53 $
+ * @version $Revision: 1.18.2.2 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-10-29 01:37:48 $
  * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
@@ -10,4 +10,6 @@
 # ifndef PM_SOURCE_H
 # define PM_SOURCE_H
+
+# include "pmSourceExtendedPars.h"
 
 /// @addtogroup Objects Object Detection / Analysis Functions
@@ -84,46 +86,6 @@
     psRegion region;                    ///< area on image covered by selected pixels
     float sky, skyErr;                  ///< The sky and its error at the center of the object
-    pmSourceExtendedParameters *extpars; // extended source parameters
+    pmSourceExtendedPars *extpars;      ///< extended source parameters
 };
-
-typedef struct {
-  psVector *radius;
-  psVector *flux;
-} pmSourceRadialProfile;
-
-typedef struct {
-  psVector *flux;
-  psVector *fluxVar; // measured variance
-  psVector *fluxErr; // formal error
-} pmSourceAnnuli;
-
-typedef struct {
-  float mag;
-  float magErr;
-  float rad;
-  float radErr;
-} pmSourceIsophotalValues;
-
-typedef struct {
-  float mag;
-  float magErr;
-  float rad;
-  float radErr;
-} pmSourcePetrosianValues;
-
-typedef struct {
-  float mag;
-  float magErr;
-  float rad;
-  float radErr;
-} pmSourceKronValues;
-
-typedef struct {
-  pmSourceRadialProfile   *profile;
-  pmSourceAnnuli          *annuli;
-  pmSourceIsophotalValues *isophot;
-  pmSourcePetrosianValues *petrosian;
-  pmSourceKronValues      *kron;
-} pmSourceExtendedParameters;
 
 /** pmPSFClump data structure
Index: /branches/eam_branch_20071023/psModules/src/objects/pmSourceExtendedPars.c
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/pmSourceExtendedPars.c	(revision 15398)
+++ /branches/eam_branch_20071023/psModules/src/objects/pmSourceExtendedPars.c	(revision 15398)
@@ -0,0 +1,155 @@
+/** @file  pmSourceExtendedPars.c
+ *
+ *  Functions to define and manipulate sources on images
+ *
+ *  @author GLG, MHPCC
+ *  @author EAM, IfA: significant modifications.
+ *
+ *  @version $Revision: 1.1.2.1 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-10-29 01:37:48 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <pslib.h>
+#include "pmHDU.h"
+#include "pmFPA.h"
+#include "pmFPAMaskWeight.h"
+#include "pmPeaks.h"
+#include "pmMoments.h"
+#include "pmResiduals.h"
+#include "pmGrowthCurve.h"
+#include "pmTrend2D.h"
+#include "pmPSF.h"
+#include "pmModel.h"
+#include "pmSource.h"
+
+static void pmSourceExtendedParsFree (pmSourceExtendedPars *pars) {
+    if (!pars) return;
+
+    psFree(pars->profile);
+    psFree(pars->annuli);
+    psFree(pars->isophot);
+    psFree(pars->petrosian);
+    psFree(pars->kron);
+    return;
+}
+
+pmSourceExtendedPars *pmSourceExtendedParsAlloc () {
+    pmSourceExtendedPars *pars = (pmSourceExtendedPars *) psAlloc(sizeof(pmSourceExtendedPars));
+    psMemSetDeallocator(pars, (psFreeFunc) pmSourceExtendedParsFree);
+
+    pars->profile = NULL;
+    pars->annuli = NULL;
+    pars->isophot = NULL;
+    pars->petrosian = NULL;
+    pars->kron = NULL;
+
+    return pars;
+}
+
+static void pmSourceRadialProfileFree (pmSourceRadialProfile *profile) {
+    if (!profile) return;
+
+    psFree(profile->radius);
+    psFree(profile->flux);
+    psFree(profile->weight);
+    return;
+}
+
+pmSourceRadialProfile *pmSourceRadialProfileAlloc () {
+
+    pmSourceRadialProfile *profile = (pmSourceRadialProfile *) psAlloc(sizeof(pmSourceRadialProfile));
+    psMemSetDeallocator(profile, (psFreeFunc) pmSourceRadialProfileFree);
+
+    profile->radius = NULL;
+    profile->flux = NULL;
+    profile->weight = NULL;
+
+    return profile;
+}
+
+static void pmSourceIsophotalValuesFree (pmSourceIsophotalValues *isophot) {
+    if (!isophot) return;
+    return;
+}
+
+pmSourceIsophotalValues *pmSourceIsophotalValuesAlloc () {
+
+    pmSourceIsophotalValues *isophot = (pmSourceIsophotalValues *) psAlloc(sizeof(pmSourceIsophotalValues));
+    psMemSetDeallocator(isophot, (psFreeFunc) pmSourceIsophotalValuesFree);
+
+    isophot->mag = 0.0;
+    isophot->magErr = 0.0;
+    isophot->rad = 0.0;
+    isophot->radErr = 0.0;
+
+    return isophot;
+}
+
+static void pmSourcePetrosianValuesFree (pmSourcePetrosianValues *petrosian) {
+    if (!petrosian) return;
+    return;
+}
+
+pmSourcePetrosianValues *pmSourcePetrosianValuesAlloc () {
+
+    pmSourcePetrosianValues *petrosian = (pmSourcePetrosianValues *) psAlloc(sizeof(pmSourcePetrosianValues));
+    psMemSetDeallocator(petrosian, (psFreeFunc) pmSourcePetrosianValuesFree);
+
+    petrosian->mag = 0.0;
+    petrosian->magErr = 0.0;
+    petrosian->rad = 0.0;
+    petrosian->radErr = 0.0;
+
+    return petrosian;
+}
+
+static void pmSourceKronValuesFree (pmSourceKronValues *kron) {
+    if (!kron) return;
+    return;
+}
+
+pmSourceKronValues *pmSourceKronValuesAlloc () {
+
+    pmSourceKronValues *kron = (pmSourceKronValues *) psAlloc(sizeof(pmSourceKronValues));
+    psMemSetDeallocator(kron, (psFreeFunc) pmSourceKronValuesFree);
+
+    kron->mag = 0.0;
+    kron->magErr = 0.0;
+    kron->rad = 0.0;
+    kron->radErr = 0.0;
+
+    return kron;
+}
+
+static void pmSourceAnnuliFree (pmSourceAnnuli *annuli) {
+    if (!annuli) return;
+
+    psFree (annuli->flux);
+    psFree (annuli->fluxErr);
+    psFree (annuli->fluxVar);
+
+    return;
+}
+
+pmSourceAnnuli *pmSourceAnnuliAlloc () {
+
+    pmSourceAnnuli *annuli = (pmSourceAnnuli *) psAlloc(sizeof(pmSourceAnnuli));
+    psMemSetDeallocator(annuli, (psFreeFunc) pmSourceAnnuliFree);
+
+    annuli->flux = NULL;
+    annuli->fluxErr = NULL;
+    annuli->fluxVar = NULL;
+
+    return annuli;
+}
+
Index: /branches/eam_branch_20071023/psModules/src/objects/pmSourceExtendedPars.h
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/pmSourceExtendedPars.h	(revision 15398)
+++ /branches/eam_branch_20071023/psModules/src/objects/pmSourceExtendedPars.h	(revision 15398)
@@ -0,0 +1,65 @@
+/* @file  pmSourceExtendedPars.h
+ *
+ * @author EAM, IfA
+ *
+ * @version $Revision: 1.1.2.1 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-10-29 01:37:48 $
+ * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+# ifndef PM_SOURCE_EXTENDED_PARS_H
+# define PM_SOURCE_EXTENDED_PARS_H
+
+/// @addtogroup Objects Object Detection / Analysis Functions
+/// @{
+
+typedef struct {
+  psVector *radius;
+  psVector *flux;
+  psVector *weight;
+} pmSourceRadialProfile;
+
+typedef struct {
+  psVector *flux;
+  psVector *fluxErr;
+  psVector *fluxVar;
+} pmSourceAnnuli;
+
+typedef struct {
+  float mag;
+  float magErr;
+  float rad;
+  float radErr;
+} pmSourceIsophotalValues;
+
+typedef struct {
+  float mag;
+  float magErr;
+  float rad;
+  float radErr;
+} pmSourcePetrosianValues;
+
+typedef struct {
+  float mag;
+  float magErr;
+  float rad;
+  float radErr;
+} pmSourceKronValues;
+
+typedef struct {
+  pmSourceRadialProfile   *profile;
+  pmSourceAnnuli          *annuli;
+  pmSourceIsophotalValues *isophot;
+  pmSourcePetrosianValues *petrosian;
+  pmSourceKronValues      *kron;
+} pmSourceExtendedPars;
+
+pmSourceExtendedPars *pmSourceExtendedParsAlloc ();
+pmSourceRadialProfile *pmSourceRadialProfileAlloc ();
+pmSourceIsophotalValues *pmSourceIsophotalValuesAlloc ();
+pmSourcePetrosianValues *pmSourcePetrosianValuesAlloc ();
+pmSourceKronValues *pmSourceKronValuesAlloc ();
+pmSourceAnnuli *pmSourceAnnuliAlloc ();
+
+/// @}
+# endif /* PM_SOURCE_H */
Index: /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO.c
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO.c	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO.c	(revision 15398)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.52.2.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-10-23 20:54:53 $
+ *  @version $Revision: 1.52.2.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-10-29 01:37:48 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -286,4 +286,14 @@
         // get the current header
         hdu = pmFPAviewThisHDU (view, file->fpa);
+
+	// determine the output table format
+	psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");
+	if (!status) {
+	  psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");
+	  return false;
+	}
+
+	// if this is not TRUE, the output files only contain the psf measurements.
+	bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XSRC");
 
         // define the EXTNAME values for the different data segments:
@@ -362,10 +372,4 @@
             outhead = psMetadataAlloc ();
 
-            // determine the output table format
-            psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");
-            if (!status) {
-                psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");
-                return false;
-            }
             exttype = psMemIncrRefCounter (psMetadataLookupStr(&status, recipe, "OUTPUT.FORMAT"));
             if (!exttype) {
Index: /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO.h
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO.h	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO.h	(revision 15398)
@@ -4,6 +4,6 @@
  * @author EAM, IfA; GLG, MHPCC
  *
- * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-09-27 03:35:29 $
+ * @version $Revision: 1.12.2.1 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-10-29 01:37:48 $
  * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  *
@@ -26,5 +26,6 @@
 bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
-bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
+bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, char *xsrcname);
+bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname);
 
 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
Index: /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_PS1_DEV_1.c
===================================================================
--- /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_PS1_DEV_1.c	(revision 15397)
+++ /branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_PS1_DEV_1.c	(revision 15398)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.4.2.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-10-23 20:54:53 $
+ *  @version $Revision: 1.4.2.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-10-29 01:37:48 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -60,5 +60,5 @@
     // if we request XSRC output, add the XSRC name to this header
     if (xsrcname) {
-      psMetadataAddStr (tableHeader, PS_LIST_TAIL, "EXTXSRC", PS_META_REPLACE, "name of XSRC table extension", xsrcname);
+      psMetadataAddStr (tableHeader, PS_LIST_TAIL, "XSRCNAME", PS_META_REPLACE, "name of XSRC table extension", xsrcname);
     }
 
@@ -152,5 +152,5 @@
 
     if (xsrcname) {
-      pmSourcesWriteXSRC_PS1_DEV_1 (file->fits, sources, xsrcname);
+      pmSourcesWrite_PS1_DEV_1_XSRC (fits, sources, xsrcname);
     }
 
@@ -174,4 +174,6 @@
     }
     assert (modelType > -1);
+
+    // XXX need to look up the XSRCNAME entries
 
     // validate a single row of the table (must match SMP)
@@ -251,5 +253,5 @@
 }
 
-bool pmSourcesWriteXSRC_PS1_DEV_1 (psFits *fits, psArray *sources, char *extname)
+bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname)
 {
 
@@ -263,5 +265,5 @@
 
     // create a header to hold the output data
-    outhead = psMetadataAlloc ();
+    psMetadata *outhead = psMetadataAlloc ();
 
     // write the links to the image header
