Index: trunk/ppSub/src/ppSubCamera.c
===================================================================
--- trunk/ppSub/src/ppSubCamera.c	(revision 38709)
+++ trunk/ppSub/src/ppSubCamera.c	(revision 41528)
@@ -171,4 +171,23 @@
 }
 
+pmConfig *pmConfigMakeTemp (pmConfig *config) {
+    pmConfig *altconfig = pmConfigAlloc();
+
+    // these are NULL on pmConfigAlloc
+    altconfig->user   = psMemIncrRefCounter(config->user);   // inherit from primary camera
+    altconfig->site   = psMemIncrRefCounter(config->site);   // inherit from primary camera
+    altconfig->system = psMemIncrRefCounter(config->system); // inherit from primary camera
+
+    psFree (altconfig->files);
+    altconfig->files  = psMemIncrRefCounter(config->files); // inherit from primary camera
+
+    psFree (altconfig->arguments);
+    altconfig->arguments = psMemIncrRefCounter(config->arguments); // inherit from primary camera
+
+    psFree (altconfig->recipes);
+    altconfig->recipes = psMetadataCopy(NULL, config->recipes); // container for camera-specific recipe values (to be dropped)
+
+    return (altconfig);
+}
 
 bool ppSubCamera(ppSubData *data)
@@ -205,6 +224,13 @@
     }
 
+    // Use a temporary config for the reference image, keeping the main user, site,
+    // system, files, arguments entries.  This allows the reference image to be from a
+    // different camera than the input image.  NOTE: there is no check that these two
+    // images match in terms of size, pixel scale, etc. That is up to the user.
+    
+    pmConfig *refconfig = pmConfigMakeTemp(config);
+
     // Reference image
-    pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
+    pmFPAfile *ref = defineInputFile(&success, refconfig, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
     if (!success) {
         psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");
@@ -212,5 +238,5 @@
     }
 
-    defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
+    defineInputFile(&success, refconfig, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
     if (!success) {
         psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.MASK");
@@ -218,18 +244,25 @@
     }
 
-    pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
+    pmFPAfile *refVar = defineInputFile(&success, refconfig, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
     if (!success) {
         psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.VARIANCE");
         return false;
     }
-
-    defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
+    psFree (refconfig);
+
+    // The reference sources may not be from the same origin as the reference image, so
+    // use another temporary camera.
+    pmConfig *srcconfig = pmConfigMakeTemp(config);
+
+    defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
     if (!success) {
         psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES");
         return false;
     }
-
+    psFree (srcconfig);
+    
     // Now that the camera has been determined, we can read the recipe
     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
+
     if (!recipe) {
         psError(PPSUB_ERR_CONFIG, false, "Unable to find recipe %s", PPSUB_RECIPE);
@@ -498,3 +531,13 @@
 }
 
-
+// Test function if needed:
+bool pmConfigDumpSub (pmConfig *config, char *filename) {
+
+    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
+    psAssert (recipe, "oops");
+
+    psMetadataConfigWrite (recipe, filename, NULL);
+
+    return true;
+}
+
