Index: trunk/ippScripts/scripts/ipp_serial_mops.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_serial_mops.pl	(revision 24323)
+++ trunk/ippScripts/scripts/ipp_serial_mops.pl	(revision 24336)
@@ -80,5 +80,5 @@
     MAX(diffWarps.diff_id) AS diff_id,
     -- The following trick pulls out the appropriate values for the maximum diff_id
-    SUBSTRING_INDEX(GROUP_CONCAT(camProcessedExp.zpt_obs ORDER BY diffWarps.diff_id), ',', 1) AS zpt_obs,
+    SUBSTRING_INDEX(GROUP_CONCAT(camTemplate.zpt_obs ORDER BY diffWarps.diff_id), ',', 1) AS zpt_obs,
     CONVERT(SUBSTRING_INDEX(GROUP_CONCAT(diffWarps.inverse ORDER BY diffWarps.diff_id), ',', 1), UNSIGNED) AS inverse
 FROM (
@@ -87,4 +87,5 @@
         diffRun.diff_id,
         warp1 AS warp_id,
+        warp1 AS template_warp,
         0 AS inverse
     FROM diffRun
@@ -99,4 +100,5 @@
         diffRun.diff_id,
         warp2 AS warp_id,
+        warp1 AS template_warp,
         1 AS inverse
     FROM diffRun
@@ -111,7 +113,9 @@
 JOIN fakeRun USING(fake_id)
 JOIN camRun USING(cam_id)
-JOIN camProcessedExp USING(cam_id)
 JOIN chipRun USING(chip_id)
 JOIN rawExp USING(exp_id)
+JOIN warpRun AS warpTemplate ON warpTemplate.warp_id = diffWarps.template_warp
+JOIN fakeRun AS fakeTemplate ON fakeTemplate.fake_id = warpTemplate.fake_id
+JOIN camProcessedExp AS camTemplate ON camTemplate.cam_id = fakeTemplate.cam_id
 WHERE rawExp.camera = '$camera'
 GROUP BY exp_id;";
