Index: src/sas/sasgui/perspectives/fitting/model_thread.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/model_thread.py	(revision 7432acb919f4013119ca918a73350297e0d4c93f)
+++ src/sas/sasgui/perspectives/fitting/model_thread.py	(revision ba8d326f0f4ceb55c77296a9b5af8bd013c7dd92)
@@ -1,4 +1,4 @@
 """
-    Calculation thread for modeling
+Calculation thread for modeling
 """
 
@@ -28,5 +28,5 @@
                  worktime=0.04,
                  exception_handler=None,
-                 ):
+                ):
         CalcThread.__init__(self, completefn, updatefn, yieldtime, worktime,
                             exception_handler=exception_handler)
@@ -57,9 +57,7 @@
         if self.qmax is None:
             if self.data is not None:
-                newx = math.pow(max(math.fabs(self.data.xmax),
-                                   math.fabs(self.data.xmin)), 2)
-                newy = math.pow(max(math.fabs(self.data.ymax),
-                                   math.fabs(self.data.ymin)), 2)
-                self.qmax = math.sqrt(newx + newy)
+                newx = max(math.fabs(self.data.xmax), math.fabs(self.data.xmin))
+                newy = max(math.fabs(self.data.ymax), math.fabs(self.data.ymin))
+                self.qmax = math.sqrt(newx**2 + newy**2)
 
         if self.data is None:
@@ -68,12 +66,11 @@
 
         # Define matrix where data will be plotted
-        radius = np.sqrt((self.data.qx_data * self.data.qx_data) + \
-                    (self.data.qy_data * self.data.qy_data))
-
-        # For theory, qmax is based on 1d qmax 
+        radius = np.sqrt(self.data.qx_data**2 + self.data.qy_data**2)
+
+        # For theory, qmax is based on 1d qmax
         # so that must be mulitified by sqrt(2) to get actual max for 2d
         index_model = (self.qmin <= radius) & (radius <= self.qmax)
-        index_model = index_model & self.data.mask
-        index_model = index_model & np.isfinite(self.data.data)
+        index_model &= self.data.mask
+        index_model &= np.isfinite(self.data.data)
 
         if self.smearer is not None:
@@ -100,18 +97,18 @@
         elapsed = time.time() - self.starttime
         self.complete(image=output,
-                       data=self.data,
-                       page_id=self.page_id,
-                       model=self.model,
-                       state=self.state,
-                       toggle_mode_on=self.toggle_mode_on,
-                       elapsed=elapsed,
-                       index=index_model,
-                       fid=self.fid,
-                       qmin=self.qmin,
-                       qmax=self.qmax,
-                       weight=self.weight,
-                       #qstep=self.qstep,
-                       update_chisqr=self.update_chisqr,
-                       source=self.source)
+                      data=self.data,
+                      page_id=self.page_id,
+                      model=self.model,
+                      state=self.state,
+                      toggle_mode_on=self.toggle_mode_on,
+                      elapsed=elapsed,
+                      index=index_model,
+                      fid=self.fid,
+                      qmin=self.qmin,
+                      qmax=self.qmax,
+                      weight=self.weight,
+                      #qstep=self.qstep,
+                      update_chisqr=self.update_chisqr,
+                      source=self.source)
 
 
@@ -137,5 +134,5 @@
                  worktime=0.01,
                  exception_handler=None,
-                 ):
+                ):
         """
         """
@@ -192,7 +189,7 @@
                                                         * unsmeared_output[first_bin:last_bin+1]\
                                                         / output[first_bin:last_bin+1]
-                unsmeared_output=unsmeared_output[index]
-                unsmeared_data=unsmeared_data[index]
-                unsmeared_error=unsmeared_error
+                unsmeared_output = unsmeared_output[index]
+                unsmeared_data = unsmeared_data[index]
+                unsmeared_error = unsmeared_error
         else:
             output[index] = self.model.evalDistribution(self.data.x[index])
