Index: sanscalculator/src/sans/calculator/instrument.py
===================================================================
--- sanscalculator/src/sans/calculator/instrument.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/instrument.py	(revision 8a621ac9d763959262ca1e2300d8049f7968e089)
@@ -1,5 +1,5 @@
 """
-This module is a small tool to allow user to 
-control instrumental parameters 
+This module is a small tool to allow user to
+control instrumental parameters
 """
 import numpy
@@ -7,12 +7,12 @@
 # defaults in cgs unit
 _SAMPLE_A_SIZE = [1.27]
-_SOURCE_A_SIZE = [3.81] 
-_SAMPLE_DISTANCE = [1627, 0] 
-_SAMPLE_OFFSET = [0, 0] 
-_SAMPLE_SIZE = [2.54] 
-_SAMPLE_THICKNESS = 0.2  
-_D_DISTANCE = [1000, 0] 
+_SOURCE_A_SIZE = [3.81]
+_SAMPLE_DISTANCE = [1627, 0]
+_SAMPLE_OFFSET = [0, 0]
+_SAMPLE_SIZE = [2.54]
+_SAMPLE_THICKNESS = 0.2
+_D_DISTANCE = [1000, 0]
 _D_SIZE = [128, 128]
-_D_PIX_SIZE = [0.5, 0.5]  
+_D_PIX_SIZE = [0.5, 0.5]
 
 _MIN = 0.0
@@ -21,6 +21,7 @@
 _WAVE_LENGTH = 6.0
 _WAVE_SPREAD = 0.125
-_MASS = 1.67492729E-24 #[gr]
-_LAMBDA_ARRAY = [[0, 1e+16],[_INTENSITY, _INTENSITY]]
+_MASS = 1.67492729E-24  # [gr]
+_LAMBDA_ARRAY = [[0, 1e+16], [_INTENSITY, _INTENSITY]]
+
 
 class Aperture(object):
@@ -36,29 +37,30 @@
         self.sample_distance = _SAMPLE_DISTANCE
         
-    def set_source_size(self, size =[]):
+    def set_source_size(self, size=[]):
         """
         Set the source aperture size
         """
         if len(size) == 0:
-            self.source_size = 0.0 
+            self.source_size = 0.0
         else:
             self.source_size = size
             validate(size[0])
-    def set_sample_size(self, size =[]):
+            
+    def set_sample_size(self, size=[]):
         """
         Set the sample aperture size
         """
         if len(size) == 0:
-            self.sample_size = 0.0 
+            self.sample_size = 0.0
         else:
             self.sample_size = size
             validate(size[0])
             
-    def set_sample_distance(self, distance = []):
+    def set_sample_distance(self, distance=[]):
         """
         Set the sample aperture distance
         """
         if len(distance) == 0:
-            self.sample_distance = 0.0 
+            self.sample_distance = 0.0
         else:
             self.sample_distance = distance
@@ -78,16 +80,15 @@
         self.thickness = _SAMPLE_THICKNESS
 
-    
-    def set_size(self, size =[]):
+    def set_size(self, size=[]):
         """
         Set the sample size
         """
         if len(size) == 0:
-            self.sample_size = 0.0 
+            self.sample_size = 0.0
         else:
             self.sample_size = size
             validate(size[0])
             
-    def set_thickness(self, thickness = 0.0):
+    def set_thickness(self, thickness=0.0):
         """
         Set the sample thickness
@@ -96,10 +97,10 @@
         validate(thickness)
     
-    def set_distance(self, distance = []):
+    def set_distance(self, distance=[]):
         """
         Set the sample distance
         """
         if len(distance) == 0:
-            self.distance = 0.0 
+            self.distance = 0.0
         else:
             self.distance = distance
@@ -122,5 +123,5 @@
     
         
-    def set_size(self, size =[]):
+    def set_size(self, size=[]):
         """
         Set the detector  size
@@ -132,15 +133,15 @@
             validate(size[0])
             
-    def set_pix_size(self, size = []):
+    def set_pix_size(self, size=[]):
         """
         Set the detector pix_size
         """
         if len(size) == 0:
-            self.pix_size = 0 
+            self.pix_size = 0
         else:
             self.pix_size = size
             validate(size[0])
     
-    def set_distance(self, distance = []):
+    def set_distance(self, distance=[]):
         """
         Set the detector distance
@@ -166,8 +167,8 @@
         # wavelength spread (FWHM)
         self.wavelength_spread = _WAVE_SPREAD
-        # wavelength spectrum 
-        self.spectrum = self.get_default_spectrum()        
+        # wavelength spectrum
+        self.spectrum = self.get_default_spectrum()
         # intensity in counts/sec
-        self.intensity = numpy.interp(self.wavelength, 
+        self.intensity = numpy.interp(self.wavelength,
                                       self.spectrum[0],
                                       self.spectrum[1],
@@ -188,5 +189,6 @@
         """
         self.band = self.spectrum
-    def set_spectrum(self, spectrum):  
+        
+    def set_spectrum(self, spectrum):
         """
         Set spectrum
@@ -194,14 +196,14 @@
         :param spectrum: numpy array
         """
-        self.spectrum = spectrum 
+        self.spectrum = spectrum
         self.setup_spectrum()
          
     def setup_spectrum(self):
         """
-        To set the wavelength spectrum, and intensity, assumes 
+        To set the wavelength spectrum, and intensity, assumes
         wavelength is already within the spectrum
         """
         spectrum = self.spectrum
-        intensity = numpy.interp(self.wavelength, 
+        intensity = numpy.interp(self.wavelength,
                                       spectrum[0],
                                       spectrum[1],
@@ -213,5 +215,5 @@
         self.max = max(self.spectrum[0])
         # set default band
-        self.set_band([self.min,self.max])
+        self.set_band([self.min, self.max])
         
     def set_band(self, band=[]):
@@ -224,16 +226,15 @@
         if min(band) < self.min or\
                 max(band) > self.max:
-            raise 
+            raise
         self.band = band
-
          
-    def set_intensity(self, intensity = 368428):
+    def set_intensity(self, intensity=368428):
         """
         Sets the intensity in counts/sec
         """
-        self.intensity = intensity  
-        validate(intensity) 
-            
-    def set_wavelength(self, wavelength = _WAVE_LENGTH):
+        self.intensity = intensity
+        validate(intensity)
+            
+    def set_wavelength(self, wavelength=_WAVE_LENGTH):
         """
         Sets the wavelength
@@ -242,8 +243,8 @@
         if wavelength < min(self.band) or\
                 wavelength > max(self.band):
-            raise 
+            raise
         self.wavelength = wavelength
         validate(wavelength)
-        self.intensity = numpy.interp(self.wavelength, 
+        self.intensity = numpy.interp(self.wavelength,
                                   self.spectrum[0],
                                   self.spectrum[1],
@@ -251,6 +252,5 @@
                                   0.0)
 
-
-    def set_mass(self, mass = _MASS):
+    def set_mass(self, mass=_MASS):
         """
         Sets the wavelength
@@ -259,5 +259,5 @@
         validate(mass)
         
-    def set_wavelength_spread(self, spread = _WAVE_SPREAD):
+    def set_wavelength_spread(self, spread=_WAVE_SPREAD):
         """
         Sets the wavelength spread
@@ -302,4 +302,5 @@
         """
         return self.spectrum
+    
     def get_default_spectrum(self):
         """
@@ -307,9 +308,10 @@
         """
         return numpy.array(_LAMBDA_ARRAY)
+    
     def get_band(self):
         """
         To get the wavelength band
         """
-        return self.band 
+        return self.band
     
     def plot_spectrum(self):
@@ -320,6 +322,6 @@
         try:
             import matplotlib.pyplot as plt
-            plt.plot(self.spectrum[0], self.spectrum[1], linewidth = 2, color = 'r')
-            plt.legend(['Spectrum'], loc = 'best')
+            plt.plot(self.spectrum[0], self.spectrum[1], linewidth=2, color='r')
+            plt.legend(['Spectrum'], loc='best')
             plt.show()
         except:
@@ -345,5 +347,5 @@
         get list of the intensity wrt wavelength_list
         """
-        out = numpy.interp(self.wavelength_list, 
+        out = numpy.interp(self.wavelength_list,
                                       self.spectrum[0],
                                       self.spectrum[1],
@@ -375,5 +377,5 @@
         
         
-def validate(value = None):
+def validate(value=None):
     """
     Check if the value is folat > 0.0
@@ -389,4 +391,2 @@
     except:
         val = False
-    #if not val:
-    #    raise ValueError, "Got improper value..."
Index: sanscalculator/src/sans/calculator/kiessig_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/kiessig_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/kiessig_calculator.py	(revision 8a621ac9d763959262ca1e2300d8049f7968e089)
@@ -1,9 +1,11 @@
 """
 This module is a small tool to allow user to quickly
-determine the size value in real space  from the 
+determine the size value in real space  from the
 fringe width in q space.
 """
 from math import pi, fabs
 _DQ_DEFAULT = 0.05
+
+
 class KiessigThicknessCalculator(object):
     """
@@ -13,5 +15,5 @@
         
         # dq value
-        self.deltaq = _DQ_DEFAULT 
+        self.deltaq = _DQ_DEFAULT
         # thickenss value
         self.thickness = None
@@ -26,5 +28,5 @@
         """
         # set dq
-        self.deltaq  = dq
+        self.deltaq = dq
         
     def get_deltaq(self):
@@ -33,5 +35,5 @@
         """
         # return dq
-        return self.deltaq 
+        return self.deltaq
 
     def compute_thickness(self):
@@ -51,9 +53,9 @@
         else:
             # calculate thickness
-            thickness = 2*pi/fabs(dq) 
-            # return thickness value      
+            thickness = 2*pi/fabs(dq)
+            # return thickness value
             return thickness
   
-    def get_thickness_unit(self): 
+    def get_thickness_unit(self):
         """
         :return: the thickness unit.
@@ -61,4 +63,2 @@
         # unit of thickness
         return self.thickness_unit
-
-
Index: sanscalculator/src/sans/calculator/resolution_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/resolution_calculator.py	(revision 5f3164cf9442d429a63f2580db570f5569f9fd01)
+++ sanscalculator/src/sans/calculator/resolution_calculator.py	(revision 8a621ac9d763959262ca1e2300d8049f7968e089)
@@ -1,5 +1,5 @@
 """
 This object is a small tool to allow user to quickly
-determine the variance in q  from the 
+determine the variance in q  from the
 instrumental parameters.
 """
@@ -11,6 +11,5 @@
 from math import pi
 from math import sqrt
-import math 
-import scipy
+import math
 import numpy
 
@@ -19,4 +18,5 @@
 #Gravitational acc. in cgs unit
 _GRAVITY = 981.0
+
 
 class ResolutionCalculator(object):
@@ -86,6 +86,6 @@
         self.qyrange = []
         
-    def compute_and_plot(self, qx_value, qy_value, qx_min, qx_max, 
-                          qy_min, qy_max, coord = 'cartesian'):
+    def compute_and_plot(self, qx_value, qy_value, qx_min, qx_max,
+                          qy_min, qy_max, coord='cartesian'):
         """
         Compute the resolution
@@ -98,6 +98,5 @@
         # wavelength etc.
         lamda_list, dlamb_list = self.get_wave_list()
-        intens_list = []#self.get_intensity_list()
-
+        intens_list = []
         sig1_list = []
         sig2_list = []
@@ -120,9 +119,9 @@
                         self.compute(lam, dlam, qx_value, qy_value, coord, tof)
             # make image
-            image = self.get_image(qx_value, qy_value, sigma_1, sigma_2, 
+            image = self.get_image(qx_value, qy_value, sigma_1, sigma_2,
                             sigma_r, qx_min, qx_max, qy_min, qy_max,
                             coord, False)
             
-            # Non tof mode to be speed up 
+            # Non tof mode to be speed up
             #if num_lamda < 2:
             #    return self.plot_image(image)
@@ -140,10 +139,9 @@
             self.qxrange = [qx_min, qx_max]
             self.qyrange = [qy_min, qy_max]
-            #print qy_max+qy_min,qy_max,qy_min
             sig1_list.append(sigma_1)
             sig2_list.append(sigma_2)
             sigr_list.append(sigma_r)
             sigma1d_list.append(sigma1d)
-        # redraw image in global 2d q-space.   
+        # redraw image in global 2d q-space.
         self.image_lam = []
         total_intensity = 0
@@ -156,6 +154,6 @@
             dlam = dlamb_list[ind]
             intens = self.setup_tof(lam, dlam)
-            out = self.get_image(qx_value, qy_value, sig1_list[ind], 
-                                   sig2_list[ind], sigr_list[ind], 
+            out = self.get_image(qx_value, qy_value, sig1_list[ind],
+                                   sig2_list[ind], sigr_list[ind],
                                    qx_min, qx_max, qy_min, qy_max, coord)
             # this is the case of q being outside the detector
@@ -164,5 +162,5 @@
             image = out
             # set variance as sigmas
-            sigma_1 += sig1_list[ind] *  sig1_list[ind] * self.intensity
+            sigma_1 += sig1_list[ind] * sig1_list[ind] * self.intensity
             sigma_r += sigr_list[ind] * sigr_list[ind] * self.intensity
             sigma_2 += sig2_list[ind] * sig2_list[ind] * self.intensity
@@ -182,6 +180,6 @@
             self.sigma_2 = sqrt(sigma_2)
             self.sigma_1d = sqrt(sigma1d)
-            # rescale 
-            max_im_val = 1 #image_out.max()
+            # rescale
+            max_im_val = 1
             if max_im_val > 0:
                 image_out /= max_im_val
@@ -199,5 +197,5 @@
         
         # plot image
-        return self.plot_image(self.image) 
+        return self.plot_image(self.image)
     
     def setup_tof(self, wavelength, wavelength_spread):
@@ -214,10 +212,10 @@
         
         if wavelength == 0:
-            msg = "Can't compute the resolution: the wavelength is zero..." 
+            msg = "Can't compute the resolution: the wavelength is zero..."
             raise RuntimeError, msg
         return self.intensity
         
-    def compute(self, wavelength, wavelength_spread, qx_value, qy_value, 
-                coord = 'cartesian', tof=False):
+    def compute(self, wavelength, wavelength_spread, qx_value, qy_value,
+                coord='cartesian', tof=False):
         """
         Compute the Q resoltuion in || and + direction of 2D
@@ -232,8 +230,8 @@
         if tof:
             # rectangular
-            tof_factor =  2
+            tof_factor = 2
         else:
             # triangular
-            tof_factor =  1
+            tof_factor = 1
         # Find polar values
         qr_value, phi = self._get_polar_value(qx_value, qy_value)
@@ -285,16 +283,16 @@
         sigma_1 += self.get_variance(rthree, l_two, phi, comp1)
         # for gravity term for 1d
-        sigma_1grav1d =  self.get_variance_gravity(l_ssa, l_sad, lamb, lamb_spread, 
-                             phi, comp1, 'on') / tof_factor
+        sigma_1grav1d = self.get_variance_gravity(l_ssa, l_sad, lamb,
+                            lamb_spread, phi, comp1, 'on') / tof_factor
         # for wavelength spread
         # reserve for 1d calculation
         A_value = self._cal_A_value(lamb, l_ssa, l_sad)
-        sigma_wave_1, sigma_wave_1_1d = self.get_variance_wave(A_value, 
-                                          radius, l_two, lamb_spread, 
+        sigma_wave_1, sigma_wave_1_1d = self.get_variance_wave(A_value,
+                                          radius, l_two, lamb_spread,
                                           phi, 'radial', 'on')
         sigma_wave_1 /= tof_factor
-        sigma_wave_1_1d /=  tof_factor
+        sigma_wave_1_1d /= tof_factor
         # for 1d
-        variance_1d_1 = (sigma_1 + sigma_1grav1d) /2 + sigma_wave_1_1d
+        variance_1d_1 = (sigma_1 + sigma_1grav1d) / 2 + sigma_wave_1_1d
         # normalize
         variance_1d_1 = knot * knot * variance_1d_1 / 12
@@ -303,6 +301,6 @@
         #sigma_1 += sigma_wave_1
         # normalize
-        sigma_1 = knot*sqrt(sigma_1 / 12)
-        sigma_r = knot*sqrt(sigma_wave_1 / (tof_factor *12))
+        sigma_1 = knot * sqrt(sigma_1 / 12)
+        sigma_r = knot * sqrt(sigma_wave_1 / (tof_factor *12))
         # sigma in the phi/y direction
         # for source apperture
@@ -316,19 +314,18 @@
 
         # for gravity term for 1d
-        sigma_2grav1d =  self.get_variance_gravity(l_ssa, l_sad, lamb, lamb_spread, 
-                             phi, comp2, 'on') / tof_factor
-
-        
+        sigma_2grav1d = self.get_variance_gravity(l_ssa, l_sad, lamb,
+                                lamb_spread, phi, comp2, 'on') / tof_factor
+
         # for wavelength spread
         # reserve for 1d calculation
-        sigma_wave_2, sigma_wave_2_1d = self.get_variance_wave(A_value, 
-                                          radius, l_two, lamb_spread, 
-                                          phi, 'phi', 'on') 
-        sigma_wave_2 /=  tof_factor
-        sigma_wave_2_1d /=  tof_factor
+        sigma_wave_2, sigma_wave_2_1d = self.get_variance_wave(A_value,
+                                          radius, l_two, lamb_spread,
+                                          phi, 'phi', 'on')
+        sigma_wave_2 /= tof_factor
+        sigma_wave_2_1d /= tof_factor
         # for 1d
         variance_1d_2 = (sigma_2 + sigma_2grav1d) / 2 + sigma_wave_2_1d
         # normalize
-        variance_1d_2 = knot*knot*variance_1d_2 / 12
+        variance_1d_2 = knot * knot * variance_1d_2 / 12
         
         # for 2d
@@ -336,5 +333,5 @@
         #sigma_2 += sigma_wave_2
         # normalize
-        sigma_2 =  knot * sqrt(sigma_2 / 12)
+        sigma_2 = knot * sqrt(sigma_2 / 12)
         sigma1d = sqrt(variance_1d_1 + variance_1d_2)
         # set sigmas
@@ -345,5 +342,5 @@
         return qr_value, phi, sigma_1, sigma_2, sigma_r, sigma1d
     
-    def _within_detector_range(self,qx_value, qy_value):
+    def _within_detector_range(self, qx_value, qy_value):
         """
         check if qvalues are within detector range
@@ -369,6 +366,6 @@
     
     def get_image(self, qx_value, qy_value, sigma_1, sigma_2, sigma_r,
-                  qx_min, qx_max, qy_min, qy_max, 
-                  coord = 'cartesian', full_cal=True): 
+                  qx_min, qx_max, qy_min, qy_max,
+                  coord='cartesian', full_cal=True):
         """
         Get the resolution in polar coordinate ready to plot
@@ -380,10 +377,10 @@
         """
         # Get  qx_max and qy_max...
-        output = self._get_detector_qxqy_pixels()
+        self._get_detector_qxqy_pixels()
        
         qr_value, phi = self._get_polar_value(qx_value, qy_value)
 
         # Check whether the q value is within the detector range
-        msg = "Invalid input: Q value out of the detector range..."
+        #msg = "Invalid input: Q value out of the detector range..."
         if qx_min < self.qx_min:
             self.qx_min = qx_min
@@ -416,5 +413,5 @@
             qc_2 = 0.0
             # Calculate the 2D Gaussian distribution image
-            image = self._gaussian2d_polar(q_1, q_2, qc_1, qc_2, 
+            image = self._gaussian2d_polar(q_1, q_2, qc_1, qc_2,
                                  sigma_1, sigma_2, sigma_r)
         else:
@@ -426,5 +423,5 @@
             
             # Calculate the 2D Gaussian distribution image
-            image = self._gaussian2d(q_1, q_2, qc_1, qc_2, 
+            image = self._gaussian2d(q_1, q_2, qc_1, qc_2,
                                      sigma_1, sigma_2, sigma_r)
         # out side of detector
@@ -445,5 +442,5 @@
         """
         Plot image using pyplot
-        : image: 2d resolution image 
+        : image: 2d resolution image
         
         : return plt: pylab object
@@ -455,10 +452,10 @@
         plt.ylabel('$\\rm{Q}_{y} [A^{-1}]$')
         # Max value of the image
-        max = numpy.max(image)
+        # max = numpy.max(image)
         qx_min, qx_max, qy_min, qy_max = self.get_detector_qrange()
 
         # Image
-        im = plt.imshow(image, 
-                extent = [qx_min, qx_max, qy_min, qy_max])
+        im = plt.imshow(image,
+                extent=[qx_min, qx_max, qy_min, qy_max])
 
         # bilinear interpolation to make it smoother
@@ -473,8 +470,8 @@
         self.image = []
         
-    def get_variance(self, size = [], distance = 0, phi = 0, comp = 'radial'):
+    def get_variance(self, size=[], distance=0, phi=0, comp='radial'):
         """
         Get the variance when the slit/pinhole size is given
-        : size: list that can be one(diameter for circular) 
+        : size: list that can be one(diameter for circular)
                 or two components(lengths for rectangular)
         : distance: [z, x] where z along the incident beam, x // qx_value
@@ -482,5 +479,5 @@
         
         : return variance: sigma^2
-        """   
+        """
         # check the length of size (list)
         len_size = len(size)
@@ -509,11 +506,11 @@
         # for rectangular slit
         elif len_size == 2:
-            x_comp = size[0] * phi_x 
+            x_comp = size[0] * phi_x
             y_comp = size[1] * phi_y
         # otherwise
         else:
             raise ValueError, " Improper input..."
-        # get them squared  
-        sigma  = x_comp * x_comp 
+        # get them squared
+        sigma  = x_comp * x_comp
         sigma += y_comp * y_comp
         # normalize by distance
@@ -522,6 +519,6 @@
         return sigma
 
-    def get_variance_wave(self, A_value, radius, distance, spread, phi, 
-                          comp = 'radial', switch = 'on'):
+    def get_variance_wave(self, A_value, radius, distance, spread, phi,
+                          comp='radial', switch='on'):
         """
         Get the variance when the wavelength spread is given
@@ -547,13 +544,13 @@
                 sigma1d *= (math.sin(phi)*math.sin(phi))
             else:
-                sigma1d *= 1  
-            # sigma^2 for 2d  
+                sigma1d *= 1
+            # sigma^2 for 2d
             # shift the coordinate due to the gravitational shift
             rad_x = radius * math.cos(phi)
             rad_y = A_value - radius * math.sin(phi)
             radius = math.sqrt(rad_x * rad_x + rad_y * rad_y)
-            # new phi 
+            # new phi
             phi = math.atan2(-rad_y, rad_x)
-            self.gravity_phi = phi 
+            self.gravity_phi = phi
             # calculate sigma^2
             sigma = 2 * math.pow(radius/distance*spread, 2)
@@ -563,10 +560,10 @@
                 sigma *= (math.sin(phi)*math.sin(phi))
             else:
-                sigma *= 1          
+                sigma *= 1
                 
             return sigma, sigma1d
 
-    def get_variance_gravity(self, s_distance, d_distance, wavelength, spread, 
-                             phi, comp = 'radial', switch = 'on'):
+    def get_variance_gravity(self, s_distance, d_distance, wavelength, spread,
+                             phi, comp='radial', switch='on'):
         """
         Get the variance from gravity when the wavelength spread is given
@@ -603,5 +600,5 @@
             return sigma
     
-    def _cal_A_value(self, lamda, s_distance, d_distance):    
+    def _cal_A_value(self, lamda, s_distance, d_distance):
         """
         Calculate A value for gravity
@@ -617,5 +614,5 @@
         gravy = _GRAVITY
         # m/h
-        m_over_h = self.mass /h_constant
+        m_over_h = self.mass / h_constant
         # A value
         a_value = d_distance * (s_distance + d_distance)
@@ -641,21 +638,22 @@
         return self.wave.wavelength
     
+    #TODO: why was this method duplicated?
+    #def get_spectrum(self):
+    #    """
+    #    Get spectrum
+    #    """
+    #    return self.wave.spectrum
+    
+    def get_default_spectrum(self):
+        """
+        Get default_spectrum
+        """
+        return self.wave.get_default_spectrum()
+    
     def get_spectrum(self):
         """
-        Get spectrum
-        """
-        return self.wave.spectrum   
-    
-    def get_default_spectrum(self):
-        """
-        Get default_spectrum
-        """
-        return self.wave.get_default_spectrum()    
-    
-    def get_spectrum(self):
-        """
         Get _spectrum
         """
-        return self.wave.get_spectrum() 
+        return self.wave.get_spectrum()
          
     def get_wavelength_spread(self):
@@ -693,5 +691,5 @@
         Get detector size
         """
-        return self.detector.size   
+        return self.detector.size
      
     def get_source2sample_distance(self):
@@ -755,5 +753,5 @@
         """
         self.spectrum = spectrum
-        self.wave.set_spectrum(spectrum)  
+        self.wave.set_spectrum(spectrum)
           
     def set_wavelength_spread(self, wavelength_spread):
@@ -787,5 +785,5 @@
         
         : param size: [dia_value] or [x_value, y_value]
-        """        
+        """
         if len(size) < 1 or len(size) > 2:
             raise RuntimeError, "The length of the size must be one or two."
@@ -884,5 +882,5 @@
         return qx_min, qx_max, qy_min, qy_max
     
-    def _rotate_z(self, x_value, y_value, theta= 0.0):
+    def _rotate_z(self, x_value, y_value, theta=0.0):
         """
         Rotate x-y cordinate around z-axis by theta
@@ -895,9 +893,9 @@
         # rotate by theta
         x_prime = x_value * math.cos(theta) + y_value * math.sin(theta)
-        y_prime =  -x_value * math.sin(theta) + y_value * math.cos(theta)
+        y_prime = -x_value * math.sin(theta) + y_value * math.cos(theta)
     
         return x_prime, y_prime
     
-    def _gaussian2d(self, x_val, y_val, x0_val, y0_val, 
+    def _gaussian2d(self, x_val, y_val, x0_val, y0_val,
                     sigma_x, sigma_y, sigma_r):
         """
@@ -927,6 +925,6 @@
         y_p = -x_value * sin_phi + y_value * cos_phi
         
-        new_sig_x = sqrt(sigma_r * sigma_r / (sigma_x * sigma_x ) + 1)
-        new_sig_y = sqrt(sigma_r * sigma_r / (sigma_y * sigma_y ) + 1)
+        new_sig_x = sqrt(sigma_r * sigma_r / (sigma_x * sigma_x) + 1)
+        new_sig_y = sqrt(sigma_r * sigma_r / (sigma_y * sigma_y) + 1)
         new_x = x_p * cos_phi / new_sig_x - y_p * sin_phi
         new_x /= sigma_x
@@ -934,5 +932,5 @@
         new_y /= sigma_y
 
-        nu_value = -0.5 *(new_x * new_x + new_y * new_y)
+        nu_value = -0.5 * (new_x * new_x + new_y * new_y)
 
         gaussian = numpy.exp(nu_value)
@@ -942,8 +940,8 @@
         return gaussian
 
-    def _gaussian2d_polar(self, x_val, y_val, x0_val, y0_val, 
+    def _gaussian2d_polar(self, x_val, y_val, x0_val, y0_val,
                         sigma_x, sigma_y, sigma_r):
         """
-        Calculate 2D Gaussian distribution for polar coodinate 
+        Calculate 2D Gaussian distribution for polar coodinate
         : x_val: x value
         : y_val: y value
@@ -957,5 +955,5 @@
         """
         sigma_x = sqrt(sigma_x * sigma_x + sigma_r * sigma_r)
-        # call gaussian1d 
+        # call gaussian1d
         gaussian  = self._gaussian1d(x_val, x0_val, sigma_x)
         gaussian *= self._gaussian1d(y_val, y0_val, sigma_y)
@@ -971,5 +969,5 @@
         : value: value
         : mean: mean value
-        : sigma: variance 
+        : sigma: variance
         
         : return: gaussian (value)
@@ -1028,5 +1026,5 @@
         wavelength = self.wave.wavelength
         # Gavity correction
-        delta_y = self._get_beamcenter_drop() # in cm
+        delta_y = self._get_beamcenter_drop()  # in cm
         
         # detector_pix size
@@ -1042,5 +1040,5 @@
         else:
             raise ValueError, " Input value format error..."
-        # Sample to detector distance = sample slit to detector 
+        # Sample to detector distance = sample slit to detector
         # minus sample offset
         sample2detector_distance = self.sample2detector_distance[0] - \
@@ -1098,7 +1096,7 @@
             
         # qx_value and qy_value values in array
-        qx_value = qx_value.repeat(detector_pix_nums_y) 
+        qx_value = qx_value.repeat(detector_pix_nums_y)
         qx_value = qx_value.reshape(detector_pix_nums_x, detector_pix_nums_y)
-        qy_value = qy_value.repeat(detector_pix_nums_x)  
+        qy_value = qy_value.repeat(detector_pix_nums_x)
         qy_value = qy_value.reshape(detector_pix_nums_y, detector_pix_nums_x)
         qy_value = qy_value.transpose()
@@ -1110,14 +1108,14 @@
         self.qy_max = numpy.max(qy_value)
                 
-        # Appr. min and max values of the detector display limits 
+        # Appr. min and max values of the detector display limits
         # i.e., edges of the last pixels.
-        self.qy_min += self._get_qx(-0.5 * pix_y_size, 
+        self.qy_min += self._get_qx(-0.5 * pix_y_size,
                                 sample2detector_distance, wavelength)
-        self.qy_max += self._get_qx(0.5 * pix_y_size, 
+        self.qy_max += self._get_qx(0.5 * pix_y_size,
                                 sample2detector_distance, wavelength)
         #if self.qx_min == self.qx_max:
-        self.qx_min += self._get_qx(-0.5 * pix_x_size, 
+        self.qx_min += self._get_qx(-0.5 * pix_x_size,
                                 sample2detector_distance, wavelength)
-        self.qx_max += self._get_qx(0.5 * pix_x_size, 
+        self.qx_max += self._get_qx(0.5 * pix_x_size,
                                     sample2detector_distance, wavelength)
         
@@ -1128,6 +1126,4 @@
         self.detector_qy_max = self.qy_max
         
-        
-
         # try to set it as a Data2D otherwise pass (not required for now)
         try:
@@ -1135,11 +1131,11 @@
             output = Data2D()
             inten = numpy.zeros_like(qx_value)
-            output.data     = inten
-            output.qx_data  = qx_value
-            output.qy_data  = qy_value            
+            output.data    = inten
+            output.qx_data = qx_value
+            output.qy_data = qy_value
         except:
             pass
         
-        return output#qx_value,qy_value
+        return output
         
     def _get_qx(self, dx_size, det_dist, wavelength):
@@ -1153,7 +1149,7 @@
         plane_dist = dx_size
         # full scattering angle on the x-axis
-        theta  = numpy.arctan(plane_dist / det_dist)
-        qx_value     = (2.0 * pi / wavelength) * numpy.sin(theta)
-        return qx_value  
+        theta = numpy.arctan(plane_dist / det_dist)
+        qx_value = (2.0 * pi / wavelength) * numpy.sin(theta)
+        return qx_value
     
     def _get_polar_value(self, qx_value, qy_value):
@@ -1187,5 +1183,5 @@
         pos_y -= offset_y
 
-        return pos_x, pos_y     
+        return pos_x, pos_y
 
     def _get_beamcenter_drop(self):
@@ -1195,5 +1191,5 @@
         :return delta y: the beam center drop in cm
         """
-        # Check if mass == 0 (X-ray). 
+        # Check if mass == 0 (X-ray).
         if self.mass == 0:
             return 0
@@ -1211,5 +1207,3 @@
         delta_y /= (velocity * velocity)
 
-        return delta_y     
-
-    
+        return delta_y
Index: sanscalculator/src/sans/calculator/slit_length_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/slit_length_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/slit_length_calculator.py	(revision 8a621ac9d763959262ca1e2300d8049f7968e089)
@@ -3,4 +3,5 @@
 determine the slit length value of data.
 """
+
 
 class SlitlengthCalculator(object):
@@ -18,6 +19,6 @@
         self.slit_length = 0.0
         
-        # The unit is unknown from SAXSess profile: 
-        # It seems 1/nm but it could be not fixed, 
+        # The unit is unknown from SAXSess profile:
+        # It seems 1/nm but it could be not fixed,
         # so users should be notified to determine the unit by themselves.
         self.slit_length_unit = "unknown"
@@ -25,5 +26,5 @@
     def set_data(self, x=None, y=None):
         """
-         Receive two vector x, y and prepare the slit calculator for 
+         Receive two vector x, y and prepare the slit calculator for
          computation.
         
@@ -50,19 +51,19 @@
         max_y = y.max()
         
-        # initial values 
+        # initial values
         y_sum = 0.0
         y_max = 0.0
         ind = 0.0
         
-        # sum 10 or more y values until getting max_y, 
+        # sum 10 or more y values until getting max_y,
         while (True):
             if ind >= 10 and y_max == max_y:
                 break
             y_sum = y_sum + y[ind]
-            if y[ind] > y_max: 
+            if y[ind] > y_max:
                 y_max = y[ind]
             ind += 1
      
-        # find the average value/2 of the top values  
+        # find the average value/2 of the top values
         y_half = y_sum/(2.0*ind)
         
@@ -73,16 +74,16 @@
         while (True):
             # no need to check when ind == 0
-            ind += 1     
-            # y value and ind just after passed the spot of the half height            
-            y_half_d = y[ind]       
-            if y[ind] < y_half: 
+            ind += 1
+            # y value and ind just after passed the spot of the half height
+            y_half_d = y[ind]
+            if y[ind] < y_half:
                 break
         
         # y value and ind just before passed the spot of the half height
-        y_half_u = y[ind-1]        
+        y_half_u = y[ind-1]
         
         # get corresponding x values
         x_half_d = x[ind]
-        x_half_u = x[ind-1] 
+        x_half_u = x[ind-1]
         
         # calculate x at y = y_half using linear interpolation
@@ -91,6 +92,6 @@
         else:
             x_half = (x_half_u * (y_half - y_half_d)  \
-                       + x_half_d*(y_half_u-y_half)) \
-                        /(y_half_u - y_half_d)
+                       + x_half_d * (y_half_u - y_half)) \
+                        / (y_half_u - y_half_d)
         
         # Our slit length is half width, so just give half beam value
@@ -101,5 +102,5 @@
         return self.slit_length
   
-    def get_slit_length_unit(self): 
+    def get_slit_length_unit(self):
         """
         :return: the slit length unit.
