Index: trunk/psModules/src/imcombine/pmSubtractionMatch.c
===================================================================
--- trunk/psModules/src/imcombine/pmSubtractionMatch.c	(revision 14804)
+++ trunk/psModules/src/imcombine/pmSubtractionMatch.c	(revision 14805)
@@ -93,7 +93,8 @@
 bool pmSubtractionMatch(pmReadout *convolved, const pmReadout *reference, const pmReadout *input,
                         int footprint, float regionSize, float stampSpacing, float threshold,
-                        const char *stampsName, float targetWidth, pmSubtractionKernelsType type,
-                        int size, int spatialOrder, const psVector *isisWidths, const psVector *isisOrders,
-                        int inner, int ringsOrder, int binning, bool optimum, psVector *optFWHMs,
+                        const psArray *sources, const char *stampsName, float targetWidth,
+                        pmSubtractionKernelsType type, int size, int spatialOrder,
+                        const psVector *isisWidths, const psVector *isisOrders,
+                        int inner, int ringsOrder, int binning, bool optimum, const psVector *optFWHMs,
                         int optOrder, float optThreshold, int iter, float rej, psMaskType maskBad,
                         psMaskType maskBlank)
@@ -132,4 +133,7 @@
     PS_ASSERT_FLOAT_LARGER_THAN(stampSpacing, 0.0, false);
     // Don't care what threshold is
+    if (sources) {
+        PS_ASSERT_ARRAY_NON_NULL(sources, false);
+    }
     // stampsName may be anything
     // targetWidth can be just about anything (except maybe negative, but it can be NAN)
@@ -231,6 +235,9 @@
             }
 
-            // Read stamps from file
-            if (stampsName && strlen(stampsName) > 0) {
+            if (sources) {
+                stamps = pmSubtractionStampsSetFromSources(sources, subMask, region, stampSpacing,
+                                                           input ? 0 : 2 * footprint);
+            } else if (stampsName && strlen(stampsName) > 0) {
+                // Read stamps from file
                 psTrace("psModules.imcombine", 3, "Reading stamps from %s...\n", stampsName);
                 const char *stampFormat = input ? "%f %f" : "%f %f %f"; // Format for reading stamp file
Index: trunk/psModules/src/imcombine/pmSubtractionMatch.h
===================================================================
--- trunk/psModules/src/imcombine/pmSubtractionMatch.h	(revision 14804)
+++ trunk/psModules/src/imcombine/pmSubtractionMatch.h	(revision 14805)
@@ -17,4 +17,5 @@
                         float stampSpacing, ///< Typical spacing between stamps
                         float threshold, ///< Threshold for stamps
+                        const psArray *sources, ///< Sources for stamps
                         const char *stampsName, ///< Filename for stamps
                         float targetWidth, ///< Width of PSF for simulated target
@@ -29,5 +30,5 @@
                         int binning,    ///< SPAM kernel binning
                         bool optimum,   ///< Search for optimum ISIS kernel?
-                        psVector *optFWHMs, ///< FWHMs for optimum search
+                        const psVector *optFWHMs, ///< FWHMs for optimum search
                         int optOrder,   ///< Maximum order for optimum search
                         float optThreshold, ///< Threshold for optimum search (0..1)
