Index: /trunk/ppStack/src/ppStackLoop.c
===================================================================
--- /trunk/ppStack/src/ppStackLoop.c	(revision 20567)
+++ /trunk/ppStack/src/ppStackLoop.c	(revision 20568)
@@ -772,4 +772,6 @@
         }
 
+        int stride = psMetadataLookupS32(NULL, ppsub, "STRIDE"); // Size of convolution patches
+
         // Reject bad pixels
         for (int i = 0; i < num; i++) {
@@ -791,5 +793,5 @@
 #endif
 
-            psPixels *reject = pmStackReject(inspect->data[i], numCols, numRows, threshold, poorFrac,
+            psPixels *reject = pmStackReject(inspect->data[i], numCols, numRows, threshold, poorFrac, stride,
                                              subRegions->data[i], subKernels->data[i]); // Rejected pixels
 
Index: /trunk/ppStack/src/ppStackMatch.c
===================================================================
--- /trunk/ppStack/src/ppStackMatch.c	(revision 20567)
+++ /trunk/ppStack/src/ppStackMatch.c	(revision 20568)
@@ -151,4 +151,5 @@
             int footprint = psMetadataLookupS32(NULL, ppsub, "STAMP.FOOTPRINT"); // Stamp half-size
             float threshold = psMetadataLookupF32(NULL, ppsub, "STAMP.THRESHOLD"); // Threshold for stmps
+            int stride = psMetadataLookupS32(NULL, ppsub, "STRIDE"); // Size of convolution patches
             int iter = psMetadataLookupS32(NULL, ppsub, "ITER"); // Rejection iterations
             float rej = psMetadataLookupF32(NULL, ppsub, "REJ"); // Rejection threshold
@@ -228,8 +229,8 @@
 
             // Do the image matching
-            if (!pmSubtractionMatch(output, NULL, readout, fake, footprint, regionSize, spacing, threshold,
-                                    sources, stampsName, type, size, order, widths, orders, inner, ringsOrder,
-                                    binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej,
-                                    sysError, maskVal, maskBad, maskPoor, poorFrac, badFrac,
+            if (!pmSubtractionMatch(output, NULL, readout, fake, footprint, stride, regionSize, spacing,
+                                    threshold, sources, stampsName, type, size, order, widths, orders, inner,
+                                    ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh,
+                                    iter, rej, sysError, maskVal, maskBad, maskPoor, poorFrac, badFrac,
                                     PM_SUBTRACTION_MODE_1)) {
                 psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
Index: /trunk/ppSub/src/ppSubArguments.c
===================================================================
--- /trunk/ppSub/src/ppSubArguments.c	(revision 20567)
+++ /trunk/ppSub/src/ppSubArguments.c	(revision 20568)
@@ -211,4 +211,5 @@
     psMetadataAddF32(arguments, PS_LIST_TAIL, "-spacing", 0, "Typical stamp spacing (pixels)", NAN);
     psMetadataAddS32(arguments, PS_LIST_TAIL, "-footprint", 0, "Stamp footprint half-size (pixels)", -1);
+    psMetadataAddS32(arguments, PS_LIST_TAIL, "-stride", 0, "Size of convolution patches (pixels)", -1);
     psMetadataAddF32(arguments, PS_LIST_TAIL, "-threshold", 0, "Minimum threshold for stamps (ADU)", NAN);
     psMetadataAddS32(arguments, PS_LIST_TAIL, "-iter", 0, "Number of rejection iterations", -1);
@@ -300,4 +301,5 @@
     VALUE_ARG_RECIPE_INT("-spam-binning", "SPAM.BINNING",    S32, 0);
     VALUE_ARG_RECIPE_INT("-footprint",    "STAMP.FOOTPRINT", S32, -1);
+    VALUE_ARG_RECIPE_INT("-stride",       "STRIDE",          S32, -1);
     VALUE_ARG_RECIPE_FLOAT("-threshold",  "STAMP.THRESHOLD", F32);
     VALUE_ARG_RECIPE_INT("-iter",         "ITER",            S32, -1);
Index: /trunk/ppSub/src/ppSubReadout.c
===================================================================
--- /trunk/ppSub/src/ppSubReadout.c	(revision 20567)
+++ /trunk/ppSub/src/ppSubReadout.c	(revision 20568)
@@ -91,4 +91,5 @@
     int footprint = psMetadataLookupS32(NULL, recipe, "STAMP.FOOTPRINT"); // Stamp half-size
     float threshold = psMetadataLookupF32(NULL, recipe, "STAMP.THRESHOLD"); // Threshold for stmps
+    int stride = psMetadataLookupS32(NULL, recipe, "STRIDE"); // Size of convolution patches
     int iter = psMetadataLookupS32(NULL, recipe, "ITER"); // Rejection iterations
     float rej = psMetadataLookupF32(NULL, recipe, "REJ"); // Rejection threshold
@@ -191,8 +192,8 @@
 
     // Match the PSFs
-    if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, regionSize, spacing, threshold, sources,
-                            stampsName, type, size, order, widths, orders, inner, ringsOrder, binning,
-                            penalty, optimum, optWidths, optOrder, optThresh, iter, rej, sys, maskVal,
-                            maskBad, maskPoor, poorFrac, badFrac, subMode)) {
+    if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize, spacing, threshold,
+                            sources, stampsName, type, size, order, widths, orders, inner, ringsOrder,
+                            binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, sys,
+                            maskVal, maskBad, maskPoor, poorFrac, badFrac, subMode)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
         psFree(inConv);
@@ -580,5 +581,6 @@
             psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources
             FILE *sourceFile = fopen("sources.dat", "w"); // File for sources
-            fprintf(sourceFile, "# x y mag mag_err psf_chisq cr_nsigma ext_nsigma psf_qf flags m_x m_y m_xx m_xy m_yy\n");
+            fprintf(sourceFile,
+                    "# x y mag mag_err psf_chisq cr_nsigma ext_nsigma psf_qf flags m_x m_y m_xx m_xy m_yy\n");
             for (int i = 0; i < sources->n; i++) {
                 pmSource *source = sources->data[i];
Index: /trunk/psModules/src/imcombine/pmStackReject.c
===================================================================
--- /trunk/psModules/src/imcombine/pmStackReject.c	(revision 20567)
+++ /trunk/psModules/src/imcombine/pmStackReject.c	(revision 20568)
@@ -126,5 +126,5 @@
 
 psPixels *pmStackReject(const psPixels *in, int numCols, int numRows, float threshold, float poorFrac,
-                        const psArray *subRegions, const psArray *subKernels)
+                        int stride, const psArray *subRegions, const psArray *subKernels)
 {
     PS_ASSERT_PIXELS_NON_NULL(in, NULL);
@@ -168,5 +168,5 @@
         psRegion *region = subRegions->data[i]; // Region of interest
         pmSubtractionKernels *kernels = subKernels->data[i]; // Kernel of interest
-        if (!pmSubtractionConvolve(convRO, NULL, inRO, NULL, NULL, 0, 0, 1.0, NAN,
+        if (!pmSubtractionConvolve(convRO, NULL, inRO, NULL, NULL, stride, 0, 0, 1.0, NAN,
                                    region, kernels, false, true)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to convolve mask image in region %d.", i);
Index: /trunk/psModules/src/imcombine/pmStackReject.h
===================================================================
--- /trunk/psModules/src/imcombine/pmStackReject.h	(revision 20567)
+++ /trunk/psModules/src/imcombine/pmStackReject.h	(revision 20568)
@@ -13,4 +13,5 @@
                         float threshold, ///< Threshold on convolved image, 0..1
                         float poorFrac, ///< Fraction for "poor"
+                        int stride,     ///< Size of convolution patches
                         const psArray *regions, ///< Array of image regions for image
                         const psArray *kernels ///< Array of kernel parameters for each region
Index: /trunk/psModules/src/imcombine/pmSubtraction.c
===================================================================
--- /trunk/psModules/src/imcombine/pmSubtraction.c	(revision 20567)
+++ /trunk/psModules/src/imcombine/pmSubtraction.c	(revision 20568)
@@ -1088,7 +1088,7 @@
 
 bool pmSubtractionConvolve(pmReadout *out1, pmReadout *out2, const pmReadout *ro1, const pmReadout *ro2,
-                           psImage *subMask, psMaskType maskBad, psMaskType maskPoor, float poorFrac,
-                           float sysError, const psRegion *region, const pmSubtractionKernels *kernels,
-                           bool doBG, bool useFFT)
+                           psImage *subMask, int stride, psMaskType maskBad, psMaskType maskPoor,
+                           float poorFrac, float sysError, const psRegion *region,
+                           const pmSubtractionKernels *kernels, bool doBG, bool useFFT)
 {
     int numCols = 0, numRows = 0;       // Image dimensions
@@ -1124,4 +1124,9 @@
         PS_ASSERT_IMAGE_SIZE(subMask, numCols, numRows, false);
     }
+    PS_ASSERT_INT_NONNEGATIVE(stride, false);
+    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(poorFrac, 0.0, false);
+    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(poorFrac, 1.0, false);
+    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(sysError, 0.0, false);
+    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(sysError, 1.0, false);
     if (region && psRegionIsNaN(*region)) {
         psString string = psRegionToString(*region);
@@ -1212,5 +1217,4 @@
 
     int size = kernels->size;           // Half-size of kernel
-    int fullSize = 2 * size + 1;        // Full size of kernel
 
     // Get region for convolution: [xMin:xMax,yMin:yMax]
@@ -1236,8 +1240,13 @@
     psImageConvolveSetThreads(false);
 
-    for (int j = yMin; j < yMax; j += fullSize) {
-        int ySubMax = PS_MIN(j + fullSize, yMax); // Range for subregion of interest
-        for (int i = xMin; i < xMax; i += fullSize) {
-            int xSubMax = PS_MIN(i + fullSize, xMax); // Range for subregion of interest
+    if (stride == 0) {
+        // Use the full size of the kernel
+        stride = 2 * size + 1;
+    }
+
+    for (int j = yMin; j < yMax; j += stride) {
+        int ySubMax = PS_MIN(j + stride, yMax); // Range for subregion of interest
+        for (int i = xMin; i < xMax; i += stride) {
+            int xSubMax = PS_MIN(i + stride, xMax); // Range for subregion of interest
 
             psRegion *subRegion = psRegionAlloc(i, xSubMax, j, ySubMax); // Bounds of subtraction
Index: /trunk/psModules/src/imcombine/pmSubtraction.h
===================================================================
--- /trunk/psModules/src/imcombine/pmSubtraction.h	(revision 20567)
+++ /trunk/psModules/src/imcombine/pmSubtraction.h	(revision 20568)
@@ -6,6 +6,6 @@
  * @author GLG, MHPCC
  *
- * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
- * @date $Date: 2008-11-01 03:36:01 $
+ * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2008-11-07 00:03:18 $
  * Copyright 2004-207 Institute for Astronomy, University of Hawaii
  */
@@ -103,4 +103,5 @@
                            const pmReadout *ro2, // Input image 2
                            psImage *subMask, ///< Subtraction mask (or NULL)
+                           int stride,  ///< Size of convolution patches
                            psMaskType maskBad, ///< Mask value to give bad pixels
                            psMaskType maskPoor, ///< Mask value to give poor pixels
Index: /trunk/psModules/src/imcombine/pmSubtractionMatch.c
===================================================================
--- /trunk/psModules/src/imcombine/pmSubtractionMatch.c	(revision 20567)
+++ /trunk/psModules/src/imcombine/pmSubtractionMatch.c	(revision 20568)
@@ -92,5 +92,5 @@
 
 bool pmSubtractionMatch(pmReadout *conv1, pmReadout *conv2, const pmReadout *ro1, const pmReadout *ro2,
-                        int footprint, float regionSize, float stampSpacing, float threshold,
+                        int footprint, int stride, float regionSize, float stampSpacing, float threshold,
                         const psArray *sources, const char *stampsName,
                         pmSubtractionKernelsType type, int size, int spatialOrder,
@@ -139,4 +139,5 @@
 
     PS_ASSERT_INT_NONNEGATIVE(footprint, false);
+    PS_ASSERT_INT_NONNEGATIVE(stride, false);
     // regionSize can be just about anything (except maybe negative, but it can be NAN)
     PS_ASSERT_FLOAT_LARGER_THAN(stampSpacing, 0.0, false);
@@ -396,5 +397,5 @@
 
             psTrace("psModules.imcombine", 2, "Convolving...\n");
-            if (!pmSubtractionConvolve(conv1, conv2, ro1, ro2, subMask, maskBad, maskPoor, poorFrac,
+            if (!pmSubtractionConvolve(conv1, conv2, ro1, ro2, subMask, stride, maskBad, maskPoor, poorFrac,
                                        sysError, region, kernels, true, useFFT)) {
                 psError(PS_ERR_UNKNOWN, false, "Unable to convolve image.");
Index: /trunk/psModules/src/imcombine/pmSubtractionMatch.h
===================================================================
--- /trunk/psModules/src/imcombine/pmSubtractionMatch.h	(revision 20567)
+++ /trunk/psModules/src/imcombine/pmSubtractionMatch.h	(revision 20568)
@@ -16,4 +16,5 @@
                         // Stamp parameters
                         int footprint,  ///< Stamp half-size
+                        int stride,     ///< Size for convolution patches
                         float regionSize, ///< Typical size of iso-kernel regions
                         float stampSpacing, ///< Typical spacing between stamps
