Index: /branches/eam_branches/ipp-20110213/ippconfig/gpc1/camera.config
===================================================================
--- /branches/eam_branches/ipp-20110213/ippconfig/gpc1/camera.config	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ippconfig/gpc1/camera.config	(revision 30772)
@@ -133,4 +133,5 @@
   CMF.DATA STR {CHIP.NAME}.psf # use .PSF and .EXT?
   CMF.XSRC STR {CHIP.NAME}.xsrc # use .PSF and .EXT?
+  CMF.XRAD STR {CHIP.NAME}.xrad # use .PSF and .EXT?
   CMF.XFIT STR {CHIP.NAME}.xfit # use .PSF and .EXT?
   CMF.DETEFF STR {CHIP.NAME}.deteff
Index: /branches/eam_branches/ipp-20110213/ppImage/src/ppImageAddNoise.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppImage/src/ppImageAddNoise.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppImage/src/ppImageAddNoise.c	(revision 30772)
@@ -90,4 +90,5 @@
   // Update the metadata about exposure time
   psMetadataAddF32(inReadout->parent->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]);
+  psMetadataAddF32(inReadout->parent->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]);
   psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "EXPTIME", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]);
   ppImageRandomGaussianFree();
Index: /branches/eam_branches/ipp-20110213/ppImage/src/ppImageArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppImage/src/ppImageArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppImage/src/ppImageArguments.c	(revision 30772)
@@ -55,4 +55,10 @@
     }
 
+    // generic arguments (version -- ignored in this case, dumpconfig)
+    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
+
     // save the following additional recipe values based on command-line options
     // these options override the PPIMAGE recipe values loaded from recipe files
@@ -84,16 +90,4 @@
         psArgumentRemove(argnum, &argc, argv);
         pmVisualSetVisual(true);
-    }
-
-    // Number of threads
-    if ((argnum = psArgumentGet(argc, argv, "-threads"))) {
-        psArgumentRemove(argnum, &argc, argv);
-        int nThreads = atoi(argv[argnum]);
-        psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NTHREADS", 0, "number of warp threads", nThreads);
-        psArgumentRemove(argnum, &argc, argv);
-
-        // create the thread pool with number of desired threads, supplying our thread launcher function
-        // XXX need to determine the number of threads from the config data
-        psThreadPoolInit (nThreads);
     }
 
@@ -152,11 +146,4 @@
     }
 
-    if ((argnum = psArgumentGet(argc, argv, "-dumpconfig"))) {
-        psArgumentRemove(argnum, &argc, argv);
-        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DUMP_CONFIG", PS_META_REPLACE,
-                         "Filename for configuration dump", argv[argnum]);
-        psArgumentRemove(argnum, &argc, argv);
-    }
-
     if (argc != 2) usage ();
 
Index: /branches/eam_branches/ipp-20110213/ppStack/src/ppStackArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppStack/src/ppStackArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppStack/src/ppStackArguments.c	(revision 30772)
@@ -110,4 +110,10 @@
 {
     assert(config);
+
+    // generic arguments (version, dumpconfig)
+    PS_ARGUMENTS_GENERIC( ppStack, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( ppStack, config, argc, argv )
 
     {
@@ -181,5 +187,4 @@
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-variance", 0, "Suffix for temporary variance maps", NULL);
     psMetadataAddBool(arguments, PS_LIST_TAIL, "-temp-delete", 0, "Delete temporary files on completion?", false);
-    psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads to use", 0);
     psMetadataAddBool(arguments, PS_LIST_TAIL, "-visual", 0, "visualisation", false);
 
@@ -238,10 +243,4 @@
     valueArgStr(arguments, "-stats", "STATS", arguments);
 
-    int numThreads = psMetadataLookupS32(NULL, arguments, "-threads"); // Number of threads
-    if (numThreads > 0 && !psThreadPoolInit(numThreads)) {
-        psError(PPSTACK_ERR_ARGUMENTS, false, "Unable to setup %d threads", numThreads);
-        return false;
-    }
-
     psMetadataAddBool(arguments, PS_LIST_TAIL, "PPSTACK.DEBUG.STACK", 0,
                       "Read old convolved images to debug stack?", debugStack);
Index: /branches/eam_branches/ipp-20110213/ppStack/src/ppStackFiles.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppStack/src/ppStackFiles.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppStack/src/ppStackFiles.c	(revision 30772)
@@ -65,6 +65,5 @@
     for (int i = 0; i < numLeaks; i++) {
         psMemBlock *mb = leaks[i];
-        fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize,
-                mb->file, mb->lineno);
+        fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, mb->file, mb->lineno);
         total += mb->userMemorySize;
     }
@@ -75,6 +74,4 @@
     num++;
 }
-
-
 
 // Activate/deactivate a list of files
Index: /branches/eam_branches/ipp-20110213/ppStack/src/ppStackLoop.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppStack/src/ppStackLoop.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppStack/src/ppStackLoop.c	(revision 30772)
@@ -55,6 +55,5 @@
     }
 
-    // Start threading
-    ppStackThreadInit();
+    // Define threading elements
     ppStackThreadData *stack = ppStackThreadDataSetup(options, config, true);
     if (!stack) {
Index: /branches/eam_branches/ipp-20110213/ppStack/src/ppStackMatch.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppStack/src/ppStackMatch.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppStack/src/ppStackMatch.c	(revision 30772)
@@ -142,5 +142,5 @@
     bool mdok;                          // Status of MD lookup
     float penalty = psMetadataLookupF32(NULL, ppsub, "PENALTY"); // Penalty for wideness
-    int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
+    int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads
 
     // Replaced pmReadoutMaskNonfinite with pmReadoutMaskInvalid (tests for already masked pixels)
Index: /branches/eam_branches/ipp-20110213/ppStack/src/ppStackReject.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppStack/src/ppStackReject.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppStack/src/ppStackReject.c	(revision 30772)
@@ -55,5 +55,5 @@
 
     // Reject bad pixels
-    if (psMetadataLookupS32(NULL, config->arguments, "-threads") > 0) {
+    if (psMetadataLookupS32(NULL, config->arguments, "NTHREADS") > 0) {
         pmStackRejectThreadsInit();
     }
Index: /branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.c	(revision 30772)
@@ -101,5 +101,5 @@
     }
 
-    int numThreads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
+    int numThreads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads
 
     // Generate readouts for each input file in each file group
@@ -248,5 +248,5 @@
 
 
-void ppStackThreadInit(void)
+void ppStackSetThreads(void)
 {
     static bool threaded = false;       // Are we running threaded?
Index: /branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.h
===================================================================
--- /branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.h	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.h	(revision 30772)
@@ -43,5 +43,5 @@
 
 // Initialise the threads
-void ppStackThreadInit(void);
+void ppStackSetThreads(void);
 
 
Index: /branches/eam_branches/ipp-20110213/ppSub/src/ppSub.h
===================================================================
--- /branches/eam_branches/ipp-20110213/ppSub/src/ppSub.h	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppSub/src/ppSub.h	(revision 30772)
@@ -128,4 +128,7 @@
 void ppSubVersionPrint(void);
 
+/// write the version info to a string
+psString ppSubVersionLong(void);
+
 /// Mark the data quality as bad and prepare to suspend processing
 void ppSubDataQuality(ppSubData *data,  ///< Processing data
@@ -185,4 +188,6 @@
 bool ppSubSetSourceImageIDs (psArray *sources, int imageID);
 
+void ppSubSetThreads (void);
+
 ///@}
 #endif
Index: /branches/eam_branches/ipp-20110213/ppSub/src/ppSubArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppSub/src/ppSubArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppSub/src/ppSubArguments.c	(revision 30772)
@@ -57,4 +57,9 @@
 }
 
+void ppSubSetThreads (void) {
+    // ppSub does not have any of its own thread handlers
+    return;
+}
+
 bool ppSubArguments(int argc, char *argv[], ppSubData *data)
 {
@@ -62,4 +67,10 @@
     pmConfig *config = data->config;
     assert(config);
+
+    // generic arguments (version, dumpconfig)
+    PS_ARGUMENTS_GENERIC( ppSub, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( ppSub, config, argc, argv )
 
     int argNum = psArgumentGet(argc, argv, "-debug"); // Debugging argument number
@@ -82,6 +93,4 @@
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL);
     psMetadataAddStr(arguments,  PS_LIST_TAIL, "-stamps", 0, "Stamps filename; x,y on each line", NULL);
-    psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads", 0);
-    psMetadataAddStr(arguments, PS_LIST_TAIL, "-dumpconfig", 0, "file to dump configuration to", NULL);
     psMetadataAddS32(arguments, PS_LIST_TAIL, "-convolve", 0, "Image to convolve [1 or 2]", 0);
     psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Perform photometry?", NULL);
@@ -166,12 +175,4 @@
     }
 
-    int threads = psMetadataLookupS32(NULL, arguments, "-threads"); // Number of threads
-    if (threads > 0) {
-        if (!psThreadPoolInit(threads)) {
-            psError(psErrorCodeLast(), false, "Unable to setup %d threads", threads);
-            return false;
-        }
-    }
-
     psTrace("ppSub", 1, "Done reading command-line arguments\n");
 
Index: /branches/eam_branches/ipp-20110213/ppSub/src/ppSubConvolve.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppSub/src/ppSubConvolve.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppSub/src/ppSubConvolve.c	(revision 30772)
@@ -39,4 +39,8 @@
 }
 
+void ppSubSetThreads (void) {
+    // ppSub does not have any of its own thread handlers
+    return;
+}
 
 int main(int argc, char *argv[])
@@ -49,4 +53,10 @@
         goto die;
     }
+
+    // generic arguments (version, dumpconfig)
+    PS_ARGUMENTS_GENERIC( ppSub, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( ppSub, config, argc, argv )
 
     bool reference = false;             // Input is actually the reference image?
@@ -59,5 +69,4 @@
         psMetadataAddStr(arguments, PS_LIST_TAIL, "-kernel", 0, "Convolution kernel", NULL);
         psMetadataAddBool(arguments, PS_LIST_TAIL, "-reference", 0, "Input is actually reference?", false);
-        psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Threads to use", 0);
         psMetadataAddBool(arguments, PS_LIST_TAIL, "-save-all", 0, "Save all outputs?", false);
 
@@ -75,5 +84,5 @@
 
         reference = psMetadataLookupBool(NULL, arguments, "-reference");
-        threads = psMetadataLookupS32(NULL, arguments, "-threads");
+        threads = psMetadataLookupS32(NULL, arguments, "NTHREADS");
         fileList("PPSUB.INPUT", inImage, "Input image", config);
         fileList("PPSUB.INPUT.MASK", inMask, "Input mask", config);
@@ -239,5 +248,4 @@
         if (threads > 0) {
             pmSubtractionThreadsInit();
-            psThreadPoolInit(threads);
         }
 
Index: /branches/eam_branches/ipp-20110213/ppSub/src/ppSubMatchPSFs.c
===================================================================
--- /branches/eam_branches/ipp-20110213/ppSub/src/ppSubMatchPSFs.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/ppSub/src/ppSubMatchPSFs.c	(revision 30772)
@@ -374,5 +374,5 @@
     }
 
-    int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
+    int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads
     if (threads > 0) {
         pmSubtractionThreadsInit();
Index: /branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.c	(revision 30772)
@@ -27,4 +27,5 @@
 #include <string.h>
 #include <assert.h>
+#include <unistd.h>
 
 #if defined(PS_MEM_BACKTRACE) && defined(HAVE_BACKTRACE)
@@ -1090,2 +1091,34 @@
     return (memBlock1->freeFunc == memBlock2->freeFunc);
 }
+
+bool static dumpMemory = false;
+
+void psMemDumpSetState (bool state) {
+    dumpMemory = state;
+}
+
+void psMemDump(const char *name)
+{
+    if (!dumpMemory) return;
+
+    char filename[1024];	  // don't make your sub-names too long!
+    static int num = 0;		  // Counter, to make files unique and give an idea of sequence
+
+    snprintf (filename, 1024, "memdump_%s_%03d.txt", name, num);
+    FILE *memFile = fopen(filename, "w");
+
+    psMemBlock **leaks = NULL;
+    int numLeaks = psMemCheckLeaks(0, &leaks, NULL, true);
+    fprintf(memFile, "# MemBlock Size Source\n");
+    unsigned long total = 0;            // Total memory used
+    for (int i = 0; i < numLeaks; i++) {
+        psMemBlock *mb = leaks[i];
+        fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, mb->file, mb->lineno);
+        total += mb->userMemorySize;
+    }
+    fclose(memFile);
+    psFree(leaks);
+
+    fprintf(stderr, "Memdump %s %d: Memory use: %ld, sbrk: %p\n", name, num, total, (void *) sbrk(0));
+    num++;
+}
Index: /branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.h
===================================================================
--- /branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.h	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.h	(revision 30772)
@@ -647,4 +647,7 @@
   );
 
+void psMemDumpSetState (bool state);
+void psMemDump(const char *name);
+
 // Ensure this is a psLib pointer
 #define PS_ASSERT_PTR_HEAVY(PTR, RVAL) \
Index: /branches/eam_branches/ipp-20110213/psLib/src/types/psArguments.h
===================================================================
--- /branches/eam_branches/ipp-20110213/psLib/src/types/psArguments.h	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psLib/src/types/psArguments.h	(revision 30772)
@@ -81,5 +81,5 @@
  *  specific routine called pkgnameVersionLong() is presumed to exist.
  */
-#define PSARGUMENTS_INSTANTIATE_GENERICS( pkgname, config, argc, argv )   \
+#define PS_ARGUMENTS_GENERIC( pkgname, config, argc, argv )   \
   { int N= psArgumentGet (argc, argv, "-version");                        \
     if (N) {                                                              \
@@ -115,5 +115,5 @@
  *  presumed to exist.
  */
-#define PSARGUMENTS_INSTANTIATE_THREADSARG( pkgname, config, argc, argv )   \
+#define PS_ARGUMENTS_THREADS( pkgname, config, argc, argv )   \
   { int N= psArgumentGet(argc, argv, "-threads");                           \
     if (N) {                                                                \
Index: /branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSF.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSF.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSF.c	(revision 30772)
@@ -430,4 +430,9 @@
         return NAN;
     }
+
+    // get the model full-width at half-max
+    float fwhmMajor = 2*model->modelRadius (model->params, 0.5);
+
+# if (0)
     psF32 *params = model->params->data.F32; // Model parameters
     psEllipseAxes axes = pmPSF_ModelToAxes(params, MAX_AXIS_RATIO); // Ellipse axes
@@ -439,3 +444,9 @@
 
     return fwhm;
-}
+# else
+
+    psFree(model);
+
+    return fwhmMajor;
+# endif
+}
Index: /branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSFtryFitPSF.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSFtryFitPSF.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psModules/src/objects/pmPSFtryFitPSF.c	(revision 30772)
@@ -109,5 +109,5 @@
 
 	// This function calculates the psf and aperture magnitudes
-        status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal, markVal); // raw PSF mag, AP mag
+        status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal, markVal, options->apRadius); // raw PSF mag, AP mag
         if (!status || isnan(source->apMag)) {
             psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); // clear the circular mask
Index: /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceMasks.h
===================================================================
--- /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceMasks.h	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceMasks.h	(revision 30772)
@@ -46,4 +46,9 @@
     PM_SOURCE_MODE2_DIFF_WITH_DOUBLE = 0x00000002, ///< diff source matched to positive detections in both images
     PM_SOURCE_MODE2_MATCHED          = 0x00000004, ///< diff source matched to positive detections in both images
+
+    PM_SOURCE_MODE2_ON_SPIKE         = 0x00000008, ///< > 25% of (PSF-weighted) pixels land on diffraction spike
+    PM_SOURCE_MODE2_ON_STARCORE      = 0x00000010, ///< > 25% of (PSF-weighted) pixels land on starcore
+    PM_SOURCE_MODE2_ON_BURNTOOL      = 0x00000020, ///< > 25% of (PSF-weighted) pixels land on burntool
+    PM_SOURCE_MODE2_ON_CONVPOOR      = 0x00000040, ///< > 25% of (PSF-weighted) pixels land on convpoor
 } pmSourceMode2;
 
Index: /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.c	(revision 30772)
@@ -23,4 +23,5 @@
 #include "pmFPAMaskWeight.h"
 
+#include "pmConfigMask.h"
 #include "pmTrend2D.h"
 #include "pmResiduals.h"
@@ -49,10 +50,26 @@
 static float AP_MIN_SN = 0.0;
 
-bool pmSourceMagnitudesInit (psMetadata *config)
-{
-    PS_ASSERT_PTR_NON_NULL(config, false);
+// make this a bit more clever and dynamic
+static psImageMaskType maskSuspect  = 0;
+static psImageMaskType maskSpike    = 0;
+static psImageMaskType maskStarCore = 0;
+static psImageMaskType maskBurntool = 0;
+static psImageMaskType maskConvPoor = 0;
+
+bool pmSourceMagnitudesInit (pmConfig *config, psMetadata *recipe)
+{
+    PS_ASSERT_PTR_NON_NULL(recipe, false);
     bool status;
 
-    float limit = psMetadataLookupF32 (&status, config, "AP_MIN_SN");
+    // we are going to test specially against these poor values
+    if (config) {
+	maskSpike    = pmConfigMaskGet("SPIKE", config);
+	maskStarCore = pmConfigMaskGet("STARCORE", config);
+	maskBurntool = pmConfigMaskGet("BURNTOOL", config);
+	maskConvPoor = pmConfigMaskGet("CONV.POOR", config);
+	maskSuspect  = maskSpike | maskStarCore | maskBurntool | maskConvPoor;
+    }
+
+    float limit = psMetadataLookupF32 (&status, recipe, "AP_MIN_SN");
     if (status) {
         AP_MIN_SN = limit;
@@ -77,5 +94,5 @@
 // XXX masked region should be (optionally) elliptical
 // if mode is PM_SOURCE_PHOT_PSFONLY, we skip all other magnitudes
-bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal)
+bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal, float radius)
 {
     PS_ASSERT_PTR_NON_NULL(source, false);
@@ -166,5 +183,5 @@
     // measure the contribution of included pixels
     if (mode & PM_SOURCE_PHOT_WEIGHT) {
-        pmSourcePixelWeight (&source->pixWeightNotBad, &source->pixWeightNotPoor, model, source->maskObj, maskVal, markVal);
+        pmSourcePixelWeight (source, model, source->maskObj, maskVal, radius);
     }
 
@@ -342,8 +359,10 @@
 
 // return source aperture magnitude
-bool pmSourcePixelWeight (float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal)
-{
-    PS_ASSERT_PTR_NON_NULL(pixWeightNotBad, false);
-    PS_ASSERT_PTR_NON_NULL(pixWeightNotPoor, false);
+bool pmSourcePixelWeight (pmSource *source, pmModel *model, psImage *mask, psImageMaskType maskVal, float radius)
+{
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    source->pixWeightNotBad = NAN;
+    source->pixWeightNotPoor = NAN;
+
     PS_ASSERT_PTR_NON_NULL(mask, false);
     PS_ASSERT_PTR_NON_NULL(model, false);
@@ -355,10 +374,14 @@
     float value;
 
+    float spikeSum = 0;
+    float starcoreSum = 0;
+    float burntoolSum = 0;
+    float convpoorSum = 0;
+
     int Xo, Yo, dP;
     int dX, DX, NX;
     int dY, DY, NY;
 
-    *pixWeightNotBad = 0.0;
-    *pixWeightNotPoor = 0.0;
+    float radius2 = PS_SQR(radius);
 
     // we only care about the value of the object model, not the local sky
@@ -387,11 +410,19 @@
     NY = mask->numRows;
 
+    psImageMaskType maskBad = maskVal;
+    maskBad &= ~maskSuspect;
+
     // measure modelSum and validSum.  this function is applied to a sources' subimage.  the
     // value of DX is chosen (see above) to cover the full possible size of the subimage if it
     // were not by an edge; ie, if the source is cut in half by an image edge, we correctly
     // count the virtual pixels off the edge in normalizing the value of the pixWeight
+
+    // we skip any pixels [real or virtual] outside of the specified radius (nominally the aperture radius)
     for (int ix = -DX; ix < DX + 1; ix++) {
+	if (ix > radius) continue;
         int mx = ix + dX;
         for (int iy = -DY; iy < DY + 1; iy++) {
+	    if (iy > radius) continue;
+	    if (ix*ix + iy*iy > radius2) continue;
             int my = iy + dY;
 
@@ -409,19 +440,52 @@
             if (my >= NY) continue;
 
-            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)) {
+	    // count pixels which are masked only with bad pixels
+            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskBad)) {
 		notBadSum += value;
 	    }
-            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & ~markVal)) {
+
+	    // count pixels which are masked with an mask bit (bad or poor)
+            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)) {
 		notPoorSum += value;
 	    }
+
+	    // count pixels which are masked with an mask bit (bad or poor)
+            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskSpike) {
+		spikeSum += value;
+	    }
+	    // count pixels which are masked with an mask bit (bad or poor)
+            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskStarCore) {
+		starcoreSum += value;
+	    }
+	    // count pixels which are masked with an mask bit (bad or poor)
+            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskBurntool) {
+		burntoolSum += value;
+	    }
+	    // count pixels which are masked with an mask bit (bad or poor)
+            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskConvPoor) {
+		convpoorSum += value;
+	    }
         }
     }
     psFree (coord);
 
-    *pixWeightNotBad  = notBadSum  / modelSum;
-    *pixWeightNotPoor = notPoorSum / modelSum;
-
-    if (false && isfinite(*pixWeightNotBad) && isfinite(*pixWeightNotPoor)) {
-	psAssert (*pixWeightNotBad <= *pixWeightNotPoor, "error: all bad pixels should also be poor");
+    source->pixWeightNotBad  = notBadSum  / modelSum;
+    source->pixWeightNotPoor = notPoorSum / modelSum;
+
+    if ((spikeSum/modelSum) > 0.25) {
+	source->mode2 |= PM_SOURCE_MODE2_ON_SPIKE;
+    }
+    if ((starcoreSum/modelSum) > 0.25) {
+	source->mode2 |= PM_SOURCE_MODE2_ON_STARCORE;
+    }
+    if ((burntoolSum/modelSum) > 0.25) {
+	source->mode2 |= PM_SOURCE_MODE2_ON_BURNTOOL;
+    }
+    if ((convpoorSum/modelSum) > 0.25) {
+	source->mode2 |= PM_SOURCE_MODE2_ON_CONVPOOR;
+    }
+
+    if (isfinite(source->pixWeightNotBad) && isfinite(source->pixWeightNotPoor)) {
+	psAssert (source->pixWeightNotBad <= source->pixWeightNotPoor, "error: all bad pixels should also be poor");
     }
 
@@ -431,5 +495,5 @@
 # define FLUX_LIMIT 3.0
 
-// measure stats that may be using in difference images for distinguishing real sources from bad residuals
+// measure stats that may be used in difference images for distinguishing real sources from bad residuals
 bool pmSourceMeasureDiffStats (pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
 {
Index: /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.h
===================================================================
--- /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.h	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.h	(revision 30772)
@@ -64,8 +64,8 @@
 );
 
-bool pmSourceMagnitudesInit (psMetadata *config);
-bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal);
+bool pmSourceMagnitudesInit (pmConfig *config, psMetadata *recipe);
+bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal, float radius);
 
-bool pmSourcePixelWeight (float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal);
+bool pmSourcePixelWeight (pmSource *source, pmModel *model, psImage *mask, psImageMaskType maskVal, float radius);
 
 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psImageMaskType maskVal, const float covarFactor, int nParams);
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotApResid.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotApResid.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotApResid.c	(revision 30772)
@@ -117,5 +117,5 @@
 
     // set limits on the aperture magnitudes
-    pmSourceMagnitudesInit (recipe);
+    pmSourceMagnitudesInit (config, recipe);
 
     // threaded measurement of the source magnitudes
@@ -466,5 +466,5 @@
         psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal);
 
-        bool status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
+        bool status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
 
         // clear the mask bit
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotArguments.c	(revision 30772)
@@ -109,12 +109,13 @@
     }
 
-    PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
+    // generic arguments (version, dumpconfig)
+    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
 
     // save the following additional recipe values based on command-line options
     // these options override the PSPHOT recipe values loaded from recipe files
     psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE);
-
-    // Number of threads is handled
-    PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
 
     // run the test model (requires X,Y coordinate)
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c	(revision 30772)
@@ -448,4 +448,7 @@
 	    }
             psFree (modelPSF);
+
+	    // float fwhmtest = pmPSFtoFWHM(psf, xc, yc);
+	    // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest);
         }
     }
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotExtendedSourceFits.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotExtendedSourceFits.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotExtendedSourceFits.c	(revision 30772)
@@ -43,4 +43,5 @@
     int NplainPass = 0;
     int Nfaint = 0;
+    int Nfail = 0;
 
     psTimerStart ("psphot.extended");
@@ -176,5 +177,6 @@
             PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nplain
             PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for NplainPass
-            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfain
+            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfaint
+            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail
 
 // set this to 0 to run without threading
@@ -204,4 +206,6 @@
 	    scalar = job->args->data[12];
 	    Nfaint += scalar->data.S32;
+	    scalar = job->args->data[13];
+	    Nfail += scalar->data.S32;
 	    psFree(job);
 # endif
@@ -234,4 +238,6 @@
                 scalar = job->args->data[12];
                 Nfaint += scalar->data.S32;
+                scalar = job->args->data[13];
+                Nfail += scalar->data.S32;
             }
             psFree(job);
@@ -244,5 +250,5 @@
     psLogMsg ("psphot", PS_LOG_INFO, "  %d convolved models (%d passed)\n", Nconvolve, NconvolvePass);
     psLogMsg ("psphot", PS_LOG_INFO, "  %d plain models (%d passed)\n", Nplain, NplainPass);
-    psLogMsg ("psphot", PS_LOG_INFO, "  %d too faint to fit\n", Nfaint);
+    psLogMsg ("psphot", PS_LOG_INFO, "  %d too faint to fit, %d failed\n", Nfaint, Nfail);
     return true;
 }
@@ -253,8 +259,9 @@
     bool status;
     int Next = 0;
+    int Nfaint = 0;
+    int Nfail = 0;
     int Nconvolve = 0;
     int NconvolvePass = 0;
     int Nplain = 0;
-    int Nfaint = 0;
     int NplainPass = 0;
     bool savePics = false;
@@ -271,5 +278,5 @@
     psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[6],PS_TYPE_IMAGE_MASK_DATA);
 
-    pthread_t tid = pthread_self();     // Thread identifier
+    // pthread_t tid = pthread_self();     // Thread identifier
 
     // Define source fitting parameters for extended source fits
@@ -305,5 +312,5 @@
         // if (source->modelEXT == NULL) continue;
 
-	fprintf (stderr, "fit %d,%d in thread %d\n", source->peak->x, source->peak->y, (int) tid);
+	// fprintf (stderr, "fit %d,%d in thread %d\n", source->peak->x, source->peak->y, (int) tid);
 
         // replace object in image
@@ -398,4 +405,5 @@
               if (!modelFit) {
                   psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->Mx, source->moments->My);
+		  Nfail ++;
                   continue;
               }
@@ -412,4 +420,5 @@
               if (!modelFit) {
                   psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->Mx, source->moments->My);
+		  Nfail ++;
                   continue;
               }
@@ -529,4 +538,7 @@
     scalar->data.S32 = Nfaint;
 
+    scalar = job->args->data[13];
+    scalar->data.S32 = Nfail;
+
     return true;
 }
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotForcedArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotForcedArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotForcedArguments.c	(revision 30772)
@@ -103,5 +103,5 @@
     }
 
-    PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
+    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
 
     // save the following additional recipe values based on command-line options
@@ -110,5 +110,5 @@
 
     // Number of threads is handled
-    PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
+    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
 
     // visual : interactive display mode
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotMagnitudes.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotMagnitudes.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotMagnitudes.c	(revision 30772)
@@ -76,5 +76,5 @@
     maskVal |= markVal;
 
-    pmSourceMagnitudesInit (recipe);
+    pmSourceMagnitudesInit (config, recipe);
 
     // the binning details are saved on the analysis metadata
@@ -176,5 +176,5 @@
         psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal);
 
-        status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
+        status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
         if (status && isfinite(source->apMag)) Nap ++;
 
@@ -295,5 +295,4 @@
     psArray *sources                = job->args->data[0];
     psImageMaskType maskVal         = PS_SCALAR_VALUE(job->args->data[1],PS_TYPE_IMAGE_MASK_DATA);
-    psImageMaskType markVal         = PS_SCALAR_VALUE(job->args->data[2],PS_TYPE_IMAGE_MASK_DATA);
 
     for (int i = 0; i < sources->n; i++) {
@@ -309,5 +308,5 @@
         }
 
-        status = pmSourcePixelWeight (&source->pixWeightNotBad, &source->pixWeightNotPoor, model, source->maskObj, maskVal, markVal);
+        status = pmSourcePixelWeight (source, model, source->maskObj, maskVal, source->apRadius);
         if (!status) {
           psTrace ("psphot", 3, "fail to measure pixel weight");
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotMakeGrowthCurve.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotMakeGrowthCurve.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotMakeGrowthCurve.c	(revision 30772)
@@ -8,5 +8,5 @@
 
     // set limits on the aperture magnitudes
-    pmSourceMagnitudesInit (recipe);
+    pmSourceMagnitudesInit (NULL, recipe);
 
     // bit-masks to test for good/bad pixels
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotMakePSFArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotMakePSFArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotMakePSFArguments.c	(revision 30772)
@@ -103,5 +103,5 @@
     }
 
-    PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
+    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
 
     // save the following additional recipe values based on command-line options
@@ -110,5 +110,5 @@
 
     // Number of threads is handled
-    PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
+    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
 
     // visual : interactive display mode
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotSetThreads.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotSetThreads.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotSetThreads.c	(revision 30772)
@@ -35,5 +35,5 @@
     psFree(task);
 
-    task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 13);
+    task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 14);
     task->function = &psphotExtendedSourceFits_Threaded;
     psThreadTaskAdd(task);
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotSourceSize.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotSourceSize.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotSourceSize.c	(revision 30772)
@@ -207,5 +207,5 @@
         num++;
 
-        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
+        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
 
         float kMag = -2.5*log10(source->moments->KronFlux);
@@ -327,5 +327,5 @@
 
         // XXX can we test if psfMag is set and calculate only if needed?
-        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
+        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
 
         // convert to Mmaj, Mmin:
@@ -501,5 +501,5 @@
         // psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(options->markVal));
         // psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", options->markVal);
-        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
+        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
 
         // clear the mask bit
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStackArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStackArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStackArguments.c	(revision 30772)
@@ -22,6 +22,9 @@
     }
 
-    // -version and -dumpconfig arguments
-    PSARGUMENTS_INSTANTIATE_GENERICS( psphot, config, argc, argv );
+    // generic arguments (version, dumpconfig)
+    PS_ARGUMENTS_GENERIC( psphot, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( psphot, config, argc, argv )
 
     // save the following additional recipe values based on command-line options
@@ -29,11 +32,14 @@
     psMetadata *options = pmConfigRecipeOptions (config, PSPHOT_RECIPE);
 
-    // Number of threads is handled
-    PSARGUMENTS_INSTANTIATE_THREADSARG( psphot, config, argc, argv )
-
     // visual : interactive display mode
     if ((N = psArgumentGet (argc, argv, "-visual"))) {
         psArgumentRemove (N, &argc, argv);
         pmVisualSetVisual(true);
+    }
+
+    // memdump : enable memory spot checks
+    if ((N = psArgumentGet (argc, argv, "-memdump"))) {
+        psArgumentRemove (N, &argc, argv);
+        psMemDumpSetState(true);
     }
 
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStackImageLoop.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStackImageLoop.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStackImageLoop.c	(revision 30772)
@@ -50,4 +50,6 @@
                 psLogMsg ("psphot", 6, "Readout %d: %x %x\n", view->readout, cell->file_exists, cell->process);
                 if (! readout->data_exists) { continue; }
+
+		psMemDump("load");
 
 		// PSF matching
@@ -57,4 +59,5 @@
                     return false;
 		}
+		psMemDump("stackmatch");
 
 		// XXX for now, we assume there is only a single chip in the PHU:
@@ -64,5 +67,5 @@
                     return false;
 		}
-
+		psMemDump("psphot");
 	    }
 	    // drop all versions of the internal files
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStackMatchPSFsUtils.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStackMatchPSFsUtils.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStackMatchPSFsUtils.c	(revision 30772)
@@ -287,5 +287,5 @@
 
     float penalty = psMetadataLookupF32(NULL, subRecipe, "PENALTY"); // Penalty for wideness
-    int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
+    int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads
 
     int order = psMetadataLookupS32(NULL, subRecipe, "SPATIAL.ORDER"); // Spatial polynomial order
Index: /branches/eam_branches/ipp-20110213/psphot/src/psphotStackPSF.c
===================================================================
--- /branches/eam_branches/ipp-20110213/psphot/src/psphotStackPSF.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/psphot/src/psphotStackPSF.c	(revision 30772)
@@ -56,8 +56,34 @@
 	}
 
-	float Sxx = sqrt(2.0)*targetFWHM / 2.35;
+	// measured scale factors (fwhm = Sxx * 2.35 * scaleFactor / sqrt(2.0))
+	// GAUSS  : 1.000
+	// PGAUSS : 1.006
+	// QGAUSS : 1.151
+	// RGAUSS : 0.883
+	// PS1_V1 : 1.134
+	
+	float scaleFactor = NAN;
+	if (!strcmp(psfModel, "PS_MODEL_GAUSS")) {
+	    scaleFactor = 1.000;
+	}
+	if (!strcmp(psfModel, "PS_MODEL_PGAUSS")) {
+	    scaleFactor = 1.0006;
+	}
+	if (!strcmp(psfModel, "PS_MODEL_QGAUSS")) {
+	    scaleFactor = 1.151;
+	}
+	if (!strcmp(psfModel, "PS_MODEL_RGAUSS")) {
+	    scaleFactor = 0.883;
+	}
+	if (!strcmp(psfModel, "PS_MODEL_PS1_V1")) {
+	    scaleFactor = 1.134;
+	}
+	psAssert (isfinite(scaleFactor), "invalid model for PSF"); 
+
+	float Sxx = sqrt(2.0)*targetFWHM / 2.35 / scaleFactor;
 
 	// XXX probably should make the model type (and par 7) optional from recipe
-	psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0);
+	// psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 1.0);
+	psf = pmPSFBuildSimple(psfModel, Sxx, Sxx, 0.0, 0.2);
 	if (!psf) {
 	    psError(PSPHOT_ERR_PSF, false, "Unable to build dummy PSF.");
Index: /branches/eam_branches/ipp-20110213/pswarp/src/pswarpArguments.c
===================================================================
--- /branches/eam_branches/ipp-20110213/pswarp/src/pswarpArguments.c	(revision 30771)
+++ /branches/eam_branches/ipp-20110213/pswarp/src/pswarpArguments.c	(revision 30772)
@@ -42,4 +42,10 @@
     }
 
+    // generic arguments (version, dumpconfig)
+    PS_ARGUMENTS_GENERIC( pswarp, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( pswarp, config, argc, argv )
+
     // save the following additional recipe values based on command-line options
     // these options override the PSWARP recipe values loaded from recipe files
@@ -76,24 +82,5 @@
     }
 
-    // Number of threads
-    if ((N = psArgumentGet(argc, argv, "-threads"))) {
-        psArgumentRemove(N, &argc, argv);
-        int nThreads = atoi(argv[N]);
-        psMetadataAddS32(config->arguments, PS_LIST_TAIL, "NTHREADS", 0, "number of warp threads", nThreads);
-        psArgumentRemove(N, &argc, argv);
-
-        // create the thread pool with number of desired threads, supplying our thread launcher function
-        // XXX need to determine the number of threads from the config data
-        psThreadPoolInit (nThreads);
-    }
     pswarpSetThreads();
-
-    if ((N = psArgumentGet(argc, argv, "-dumpconfig"))) {
-        psArgumentRemove(N, &argc, argv);
-        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DUMP_CONFIG", PS_META_REPLACE,
-                         "Filename for configuration dump", argv[N]);
-        psArgumentRemove(N, &argc, argv);
-    }
-
 
     pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
