Index: branches/eam_branches/psphot.20100506/src/psphotStackMatchPSFsUtils.c
===================================================================
--- branches/eam_branches/psphot.20100506/src/psphotStackMatchPSFsUtils.c	(revision 27883)
+++ branches/eam_branches/psphot.20100506/src/psphotStackMatchPSFsUtils.c	(revision 27884)
@@ -259,5 +259,5 @@
 
 // perform the bulk of the PSF-matching
-bool matchKernel(pmConfig *config, pmReadout *readoutCnv, pmReadout *readoutRaw, psphotStackOptions *options, int index) {
+bool matchKernel(pmConfig *config, pmReadout *readoutOut, pmReadout *readoutSrc, psphotStackOptions *options, int index) {
 
     bool mdok;
@@ -338,16 +338,16 @@
     stampSources = stackSourcesFilter(options->sourceLists->data[index], footprint); // Filtered list of sources
 
-    fake = makeFakeReadout(config, readoutRaw, stampSources, options->psf, maskVal | maskBad, footprint + size);
+    fake = makeFakeReadout(config, readoutSrc, stampSources, options->psf, maskVal | maskBad, footprint + size);
     if (!fake) goto escape;
 
-    dumpImage(fake, readoutRaw, index, "fake");
-    dumpImage(readoutRaw,  readoutRaw, index, "real");
+    dumpImage(fake, readoutSrc, index, "fake");
+    dumpImage(readoutSrc,  readoutSrc, index, "real");
 
     if (threads) pmSubtractionThreadsInit();
 
     // Do the image matching
-    pmSubtractionKernels *kernel = psMetadataLookupPtr(&mdok, readoutRaw->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL); // Conv kernel
+    pmSubtractionKernels *kernel = psMetadataLookupPtr(&mdok, readoutSrc->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL); // Conv kernel
     if (kernel) {
-	if (!pmSubtractionMatchPrecalc(NULL, readoutCnv, fake, readoutRaw, readoutRaw->analysis, stride, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac)) {
+	if (!pmSubtractionMatchPrecalc(NULL, readoutOut, fake, readoutSrc, readoutSrc->analysis, stride, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac)) {
 	    psError(psErrorCodeLast(), false, "Unable to convolve images.");
 	    goto escape;
@@ -361,5 +361,5 @@
 	}
 
-	if (!pmSubtractionMatch(NULL, readoutCnv, fake, readoutRaw, footprint, stride, regionSize, spacing, threshold, stampSources, stampsName, type, size, order, widthsCopy, orders, inner, ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, normFrac, sysError, skyErr, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac, PM_SUBTRACTION_MODE_2)) {
+	if (!pmSubtractionMatch(NULL, readoutOut, fake, readoutSrc, footprint, stride, regionSize, spacing, threshold, stampSources, stampsName, type, size, order, widthsCopy, orders, inner, ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, normFrac, sysError, skyErr, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac, PM_SUBTRACTION_MODE_2)) {
 	    psError(psErrorCodeLast(), false, "Unable to match images.");
 	    goto escape;
@@ -369,5 +369,5 @@
     // Reject image completely if the maximum deconvolution fraction exceeds the limit
     float deconvLimit = psMetadataLookupF32(NULL, stackRecipe, "DECONV.LIMIT"); // Limit on deconvolution fraction
-    float deconv = psMetadataLookupF32(NULL, readoutCnv->analysis, PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Max deconvolution fraction
+    float deconv = psMetadataLookupF32(NULL, readoutOut->analysis, PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Max deconvolution fraction
     if (deconv > deconvLimit) {
 	psWarning("Maximum deconvolution fraction (%f) exceeds limit (%f) --- rejecting image %d\n", deconv, deconvLimit, index);
@@ -375,6 +375,6 @@
     }
 
-    dumpImage(readoutCnv, readoutRaw, index, "conv");
-    dumpImageDiff(readoutCnv, fake, readoutRaw, index, "diff");
+    dumpImage(readoutOut, readoutSrc, index, "conv");
+    dumpImageDiff(readoutOut, fake, readoutSrc, index, "diff");
 
     psFree(fake);
@@ -542,5 +542,5 @@
 
 // generate a fake readout against which to PSF match
-pmReadout *makeFakeReadout(pmConfig *config, pmReadout *readoutRaw, psArray *sources, pmPSF *psf, psImageMaskType maskVal, int fullSize) {
+pmReadout *makeFakeReadout(pmConfig *config, pmReadout *readoutSrc, psArray *sources, pmPSF *psf, psImageMaskType maskVal, int fullSize) {
 
     pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF
@@ -548,5 +548,5 @@
     psStats *bg = psStatsAlloc(PS_STAT_ROBUST_STDEV); // Statistics for background
     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
-    if (!psImageBackground(bg, NULL, readoutRaw->image, readoutRaw->mask, maskVal, rng)) {
+    if (!psImageBackground(bg, NULL, readoutSrc->image, readoutSrc->mask, maskVal, rng)) {
 	psError(PSPHOT_ERR_DATA, false, "Can't measure background for image.");
 	psFree(fake);
@@ -560,5 +560,5 @@
 
     bool oldThreads = pmReadoutFakeThreads(true); // Old threading state
-    if (!pmReadoutFakeFromSources(fake, readoutRaw->image->numCols, readoutRaw->image->numRows, sources, SOURCE_MASK, NULL, NULL, psf, minFlux, fullSize, false, true)) {
+    if (!pmReadoutFakeFromSources(fake, readoutSrc->image->numCols, readoutSrc->image->numRows, sources, SOURCE_MASK, NULL, NULL, psf, minFlux, fullSize, false, true)) {
 	psError(PSPHOT_ERR_DATA, false, "Unable to generate fake image with target PSF.");
 	psFree(fake);
@@ -567,8 +567,8 @@
     pmReadoutFakeThreads(oldThreads);
 
-    fake->mask = psImageCopy(NULL, readoutRaw->mask, PS_TYPE_IMAGE_MASK);
+    fake->mask = psImageCopy(NULL, readoutSrc->mask, PS_TYPE_IMAGE_MASK);
 
     // Add the background into the target image
-    psImage *bgImage = stackBackgroundModel(readoutRaw, config); // Image of background
+    psImage *bgImage = stackBackgroundModel(readoutSrc, config); // Image of background
     psBinaryOp(fake->image, fake->image, "+", bgImage);
     psFree(bgImage);
