Index: /branches/eam_branches/20091201/psModules/src/detrend/pmPattern.c
===================================================================
--- /branches/eam_branches/20091201/psModules/src/detrend/pmPattern.c	(revision 26730)
+++ /branches/eam_branches/20091201/psModules/src/detrend/pmPattern.c	(revision 26731)
@@ -63,4 +63,5 @@
     float lower = stats->robustMedian - thresh * stats->robustStdev; // Lower bound for data
     float upper = stats->robustMedian + thresh * stats->robustStdev; // Upper bound for data
+    float background = stats->robustMedian;
     psFree(stats);
     psFree(rng);
@@ -113,5 +114,5 @@
 
         for (int x = 0; x < numCols; x++) {
-            image->data.F32[y][x] -= solution->data.F32[x];
+            image->data.F32[y][x] += (background - solution->data.F32[x]);
         }
         psFree(solution);
