Index: build_tools/pylint.rc
===================================================================
--- build_tools/pylint.rc	(revision aba58768d6904e3093102e1811f65b0c395fa555)
+++ build_tools/pylint.rc	(revision e3f77d8b34c4c57adc9d718e8b1ace18d3a4b793)
@@ -171,4 +171,5 @@
 # 
 [TYPECHECK]
+ignored-modules = numpy
 
 # Tells whether missing members accessed in mixin class should be ignored. A
Index: src/sas/calculator/sas_gen.py
===================================================================
--- src/sas/calculator/sas_gen.py	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ src/sas/calculator/sas_gen.py	(revision e3f77d8b34c4c57adc9d718e8b1ace18d3a4b793)
@@ -10,6 +10,6 @@
 import copy
 
-MFactor_AM = 2.853E-12
-MFactor_mT = 2.3164E-9
+MFACTOR_AM = 2.853E-12
+MFACTOR_MT = 2.3164E-9
 METER2ANG = 1.0E+10
 #Avogadro constant [1/mol]
@@ -21,9 +21,9 @@
     sldm = Dm * mag where Dm = gamma * classical elec. radius/(2*Bohr magneton)
     Dm ~ 2.853E-12 [A^(-2)] ==> Shouldn't be 2.90636E-12 [A^(-2)]???
-    """ 
+    """
     if v_unit == "A/m":
-        factor = MFactor_AM
+        factor = MFACTOR_AM
     elif v_unit == "mT":
-        factor = MFactor_mT
+        factor = MFACTOR_MT
     else:
         raise ValueError, "Invalid valueunit"
@@ -33,12 +33,11 @@
 def transform_center(pos_x, pos_y, pos_z):
     """
-    re-center 
-    
+    re-center
     :return: posx, posy, posz   [arrays]
-    """ 
+    """
     posx = pos_x - (min(pos_x) + max(pos_x)) / 2.0
     posy = pos_y - (min(pos_y) + max(pos_y)) / 2.0
-    posz = pos_z - (min(pos_z) + max(pos_z)) / 2.0  
-    return posx, posy, posz   
+    posz = pos_z - (min(pos_z) + max(pos_z)) / 2.0
+    return posx, posy, posz
 
 class GenSAS(BaseComponent):
@@ -49,5 +48,4 @@
         """
         Init
-        
         :Params sld_data: MagSLD object
         """
@@ -69,25 +67,25 @@
         ## Define parameters
         self.params = {}
-        self.params['scale']       = 1.0
-        self.params['background']  = 0.0
-        self.params['solvent_SLD']     = 0.0
+        self.params['scale'] = 1.0
+        self.params['background'] = 0.0
+        self.params['solvent_SLD'] = 0.0
         self.params['total_volume'] = 1.0
-        self.params['Up_frac_in']     = 1.0
-        self.params['Up_frac_out']    = 1.0
-        self.params['Up_theta']  = 0.0
+        self.params['Up_frac_in'] = 1.0
+        self.params['Up_frac_out'] = 1.0
+        self.params['Up_theta'] = 0.0
         self.description = 'GenSAS'
         ## Parameter details [units, min, max]
         self.details = {}
-        self.details['scale']      = ['', None, None]
+        self.details['scale'] = ['', None, None]
         self.details['background'] = ['[1/cm]', None, None]
-        self.details['solvent_SLD']    = ['1/A^(2)', None, None]
-        self.details['total_volume']    = ['A^(3)', None, None]
-        self.details['Up_frac_in']    = ['[u/(u+d)]', None, None]
-        self.details['Up_frac_out']   = ['[u/(u+d)]', None, None]
+        self.details['solvent_SLD'] = ['1/A^(2)', None, None]
+        self.details['total_volume'] = ['A^(3)', None, None]
+        self.details['Up_frac_in'] = ['[u/(u+d)]', None, None]
+        self.details['Up_frac_out'] = ['[u/(u+d)]', None, None]
         self.details['Up_theta'] = ['[deg]', None, None]
         # fixed parameters
         self.fixed = []
-        
-    def set_pixel_volumes(self, volume):     
+
+    def set_pixel_volumes(self, volume):
         """
         Set the volume of a pixel in (A^3) unit
@@ -97,11 +95,11 @@
             raise
         self.data_vol = volume
-    
-    def set_is_avg(self, is_avg=False):  
+
+    def set_is_avg(self, is_avg=False):
         """
         Sets is_avg: [bool]
         """
         self.is_avg = is_avg
-          
+
     def _gen(self, x, y, i):
         """
@@ -109,5 +107,5 @@
         :Param x: array of x-values
         :Param y: array of y-values
-        :Param i: array of initial i-value 
+        :Param i: array of initial i-value
         :return: function value
         """
@@ -122,9 +120,9 @@
         sldn = copy.deepcopy(self.data_sldn)
         sldn -= self.params['solvent_SLD']
-        model = mod.new_GenI(len_x, pos_x, pos_y, pos_z, 
-                             sldn, self.data_mx, self.data_my, 
+        model = mod.new_GenI(len_x, pos_x, pos_y, pos_z,
+                             sldn, self.data_mx, self.data_my,
                              self.data_mz, self.data_vol,
-                             self.params['Up_frac_in'], 
-                             self.params['Up_frac_out'], 
+                             self.params['Up_frac_in'],
+                             self.params['Up_frac_out'],
                              self.params['Up_theta'])
         if y == []:
@@ -135,6 +133,6 @@
         return  self.params['scale'] * vol_correction * i + \
                         self.params['background']
-        
-    def set_sld_data(self, sld_data=None):   
+
+    def set_sld_data(self, sld_data=None):
         """
         Sets sld_data
@@ -152,15 +150,14 @@
         self.data_total_volume = sum(sld_data.vol_pix)
         self.params['total_volume'] = sum(sld_data.vol_pix)
-        
+
     def getProfile(self):
         """
-        Get SLD profile 
-        
+        Get SLD profile
         : return: sld_data
         """
         return self.sld_data
-     
-    def run(self, x = 0.0):
-        """ 
+
+    def run(self, x=0.0):
+        """
         Evaluate the model
         :param x: simple value
@@ -173,12 +170,12 @@
             i_out = numpy.zeros_like(x[0])
             # 1D I is found at y =0 in the 2D pattern
-            out = self._gen(x[0], [], i_out )
+            out = self._gen(x[0], [], i_out)
             return out
         else:
             msg = "Q must be given as list of qx's and qy's"
             raise ValueError, msg
-   
-    def runXY(self, x = 0.0):
-        """ 
+
+    def runXY(self, x=0.0):
+        """
         Evaluate the model
         :param x: simple value
@@ -193,11 +190,14 @@
             msg = "Q must be given as list of qx's and qy's"
             raise ValueError, msg
-        
+
     def evalDistribution(self, qdist):
         """
         Evaluate a distribution of q-values.
-        * For 1D, a numpy array is expected as input: evalDistribution(q) where q is a numpy array.
-        * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime], where 1D arrays.
-        :param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays 
+        * For 1D, a numpy array is expected as input:
+            evalDistribution(q) where q is a numpy array.
+        * For 2D, a list of numpy arrays are expected:
+            [qx_prime,qy_prime], where 1D arrays.
+        :param qdist: ndarray of scalar q-values or list [qx,qy]
+                      where qx,qy are 1D ndarrays
         """
         if qdist.__class__.__name__ == 'list':
@@ -211,10 +211,10 @@
             mesg += "a list [qx,qy] where qx,qy are arrays."
             raise RuntimeError, mesg
-      
-class OMF2SLD:
+
+class OMF2SLD(object):
     """
     Convert OMFData to MAgData
     """
-    def __init__(self): 
+    def __init__(self):
         """
         Init
@@ -230,5 +230,5 @@
         self.output = None
         self.omfdata = None
-    
+
     def set_data(self, omfdata, shape='rectangular'):
         """
@@ -237,12 +237,12 @@
         self.omfdata = omfdata
         length = int(omfdata.xnodes * omfdata.ynodes * omfdata.znodes)
-        pos_x = numpy.arange(omfdata.xmin, 
-                             omfdata.xnodes*omfdata.xstepsize + omfdata.xmin, 
+        pos_x = numpy.arange(omfdata.xmin,
+                             omfdata.xnodes*omfdata.xstepsize + omfdata.xmin,
                              omfdata.xstepsize)
-        pos_y = numpy.arange(omfdata.ymin,  
-                             omfdata.ynodes*omfdata.ystepsize + omfdata.ymin, 
+        pos_y = numpy.arange(omfdata.ymin,
+                             omfdata.ynodes*omfdata.ystepsize + omfdata.ymin,
                              omfdata.ystepsize)
-        pos_z = numpy.arange(omfdata.zmin, 
-                             omfdata.znodes*omfdata.zstepsize + omfdata.zmin, 
+        pos_z = numpy.arange(omfdata.zmin,
+                             omfdata.znodes*omfdata.zstepsize + omfdata.zmin,
                              omfdata.zstepsize)
         self.pos_x = numpy.tile(pos_x, int(omfdata.ynodes * omfdata.znodes))
@@ -254,5 +254,5 @@
         self.mz = omfdata.mz
         self.sld_n = numpy.zeros(length)
-            
+
         if omfdata.mx == None:
             self.mx = numpy.zeros(length)
@@ -261,5 +261,5 @@
         if omfdata.mz == None:
             self.mz = numpy.zeros(length)
-        
+
         self._check_data_length(length)
         self.remove_null_points(False, False)
@@ -286,10 +286,10 @@
             except:
                 pass
-        self.output = MagSLD(self.pos_x[mask], self.pos_y[mask], 
-                             self.pos_z[mask], self.sld_n[mask], 
+        self.output = MagSLD(self.pos_x[mask], self.pos_y[mask],
+                             self.pos_z[mask], self.sld_n[mask],
                              self.mx[mask], self.my[mask], self.mz[mask])
         self.output.set_pix_type('pixel')
         self.output.set_pixel_symbols('pixel')
-        
+
     def get_omfdata(self):
         """
@@ -297,5 +297,5 @@
         """
         return self.omfdata
-    
+
     def get_output(self):
         """
@@ -303,5 +303,5 @@
         """
         return self.output
-    
+
     def _check_data_length(self, length):
         """
@@ -322,5 +322,5 @@
         if len(self.mz) != length:
             raise ValueError, msg
-        
+
     def remove_null_points(self, remove=False, recenter=False):
         """
@@ -328,7 +328,7 @@
         """
         if remove:
-            is_nonzero = (numpy.fabs(self.mx) + numpy.fabs(self.my) + 
-                          numpy.fabs(self.mz)).nonzero()  
-            if len(is_nonzero[0]) > 0: 
+            is_nonzero = (numpy.fabs(self.mx) + numpy.fabs(self.my) +
+                          numpy.fabs(self.mz)).nonzero()
+            if len(is_nonzero[0]) > 0:
                 self.pos_x = self.pos_x[is_nonzero]
                 self.pos_y = self.pos_y[is_nonzero]
@@ -342,5 +342,5 @@
             self.pos_y -= (min(self.pos_y) + max(self.pos_y)) / 2.0
             self.pos_z -= (min(self.pos_z) + max(self.pos_z)) / 2.0
- 
+
     def get_magsld(self):
         """
@@ -348,7 +348,7 @@
         """
         return self.output
-    
-        
-class OMFReader:
+
+
+class OMFReader(object):
     """
     Class to load omf/ascii files (3 columns w/header).
@@ -356,10 +356,10 @@
     ## File type
     type_name = "OMF ASCII"
-    
+
     ## Wildcards
     type = ["OMF files (*.OMF, *.omf)|*.omf"]
     ## List of allowed extensions
     ext = ['.omf', '.OMF']
-        
+
     def read(self, path):
         """
@@ -368,5 +368,4 @@
         :return: x, y, z, sld_n, sld_mx, sld_my, sld_mz
         """
-        #data_conv_m = None
         desc = ""
         mx = numpy.zeros(0)
@@ -374,6 +373,4 @@
         mz = numpy.zeros(0)
         try:
-            data_conv_val = None
-            data_conv_mesh = None
             input_f = open(path, 'rb')
             buff = input_f.read()
@@ -454,5 +451,4 @@
                     valuerangemaxmag = s_line[1].lstrip()
                 if s_line[0].lower().count("end") > 0:
-                    #output.set_sldms(mx, my, mz)    
                     output.filename = os.path.basename(path)
                     output.oommf = oommf
@@ -487,5 +483,5 @@
             raise RuntimeError, msg
 
-class PDBReader:
+class PDBReader(object):
     """
     PDB reader class: limited for reading the lines starting with 'ATOM'
@@ -495,14 +491,12 @@
     type = ["pdb files (*.PDB, *.pdb)|*.pdb"]
     ## List of allowed extensions
-    ext = ['.pdb', '.PDB']   
-    
+    ext = ['.pdb', '.PDB']
+
     def read(self, path):
         """
         Load data file
-        
+
         :param path: file path
-        
         :return: MagSLD
-        
         :raise RuntimeError: when the file can't be opened
         """
@@ -521,5 +515,5 @@
         x_lines = []
         y_lines = []
-        z_lines = []        
+        z_lines = []
         try:
             input_f = open(path, 'rb')
@@ -527,5 +521,4 @@
             lines = buff.split('\n')
             input_f.close()
-            pre_num = 0
             num = 0
             for line in lines:
@@ -535,5 +528,4 @@
                                 line[0:6].strip() == 'ATOM':
                         # define fields of interest
-                        atom_id = line[6:11].strip()
                         atom_name = line[12:16].strip()
                         try:
@@ -543,22 +535,16 @@
                             if len(atom_name) == 4:
                                 atom_name = atom_name[0].upper()
-                            elif line[12] != ' ': 
+                            elif line[12] != ' ':
                                 atom_name = atom_name[0].upper() + \
-                                        atom_name[1].lower() 
+                                        atom_name[1].lower()
                             else:
                                 atom_name = atom_name[0].upper()
-                        #res_name = line[17:20].strip()
-                        #chain_name = line[21:22].strip()
                         _pos_x = float(line[30:38].strip())
                         _pos_y = float(line[38:46].strip())
                         _pos_z = float(line[46:54].strip())
-                        
                         pos_x = numpy.append(pos_x, _pos_x)
                         pos_y = numpy.append(pos_y, _pos_y)
                         pos_z = numpy.append(pos_z, _pos_z)
                         try:
-                            # sld in Ang unit (from fm)
-                            #val = formula(atom_name).atoms.keys()[0].neutron.b_c
-                            #val *= 1.0e-5
                             val = nsf.neutron_sld(atom_name)[0]
                             # sld in Ang^-2 unit
@@ -571,13 +557,13 @@
                         except:
                             print "Error: set the sld of %s to zero"% atom_name
-                            sld_n = numpy.append(sld_n,  0.0)                     
+                            sld_n = numpy.append(sld_n, 0.0)
                         sld_mx = numpy.append(sld_mx, 0)
                         sld_my = numpy.append(sld_my, 0)
                         sld_mz = numpy.append(sld_mz, 0)
                         pix_symbol = numpy.append(pix_symbol, atom_name)
-                    elif line[0:6].strip().count('CONECT') > 0 :
+                    elif line[0:6].strip().count('CONECT') > 0:
                         toks = line.split()
-                        num = int(toks[1]) - 1  
-                        val_list = [] 
+                        num = int(toks[1]) - 1
+                        val_list = []
                         for val in toks[2:]:
                             try:
@@ -588,5 +574,5 @@
                                 break
                             val_list.append(int_val)
-                        #need val_list ordered      
+                        #need val_list ordered
                         for val in val_list:
                             index = val - 1
@@ -599,14 +585,10 @@
                             z_line.append((pos_z[num], pos_z[index]))
                     if len(x_line) > 0:
-                        x_lines.append(x_line) 
+                        x_lines.append(x_line)
                         y_lines.append(y_line)
-                        z_lines.append(z_line)            
+                        z_lines.append(z_line)
                 except:
                     pass
-            #re-centering
-            #pos_x -= (min(pos_x) + max(pos_x)) / 2.0
-            #pos_y -= (min(pos_y) + max(pos_y)) / 2.0
-            #pos_z -= (min(pos_z) + max(pos_z)) / 2.0
-            
+
             output = MagSLD(pos_x, pos_y, pos_z, sld_n, sld_mx, sld_my, sld_mz)
             output.set_conect_lines(x_line, y_line, z_line)
@@ -619,5 +601,5 @@
             return output
         except:
-            RuntimeError, "%s is not a sld file" % path
+            raise RuntimeError, "%s is not a sld file" % path
 
     def write(self, path, data):
@@ -625,8 +607,7 @@
         Write
         """
-        #Not implemented 
         print "Not implemented... "
 
-class SLDReader:
+class SLDReader(object):
     """
     Class to load ascii files (7 columns).
@@ -634,5 +615,4 @@
     ## File type
     type_name = "SLD ASCII"
-    
     ## Wildcards
     type = ["sld files (*.SLD, *.sld)|*.sld",
@@ -641,13 +621,9 @@
     ## List of allowed extensions
     ext = ['.sld', '.SLD', '.txt', '.TXT', '.*']
-    
     def read(self, path):
         """
         Load data file
-        
         :param path: file path
-        
         :return MagSLD: x, y, z, sld_n, sld_mx, sld_my, sld_mz
-        
         :raise RuntimeError: when the file can't be opened
         :raise ValueError: when the length of the data vectors are inconsistent
@@ -663,5 +639,5 @@
             try:
                 # Use numpy to speed up loading
-                input_f = numpy.loadtxt(path, dtype='float', skiprows=1, 
+                input_f = numpy.loadtxt(path, dtype='float', skiprows=1,
                                         ndmin=1, unpack=True)
                 pos_x = numpy.array(input_f[0])
@@ -676,5 +652,5 @@
                     vol_pix = numpy.array(input_f[7])
                 elif ncols == 7:
-                     vol_pix = None
+                    vol_pix = None
             except:
                 # For older version of numpy
@@ -693,5 +669,4 @@
                         _sld_my = float(toks[5])
                         _sld_mz = float(toks[6])
-    
                         pos_x = numpy.append(pos_x, _pos_x)
                         pos_y = numpy.append(pos_y, _pos_y)
@@ -702,5 +677,5 @@
                         sld_mz = numpy.append(sld_mz, _sld_mz)
                         try:
-                            _vol_pix =  float(toks[7])
+                            _vol_pix = float(toks[7])
                             vol_pix = numpy.append(vol_pix, _vol_pix)
                         except:
@@ -709,13 +684,6 @@
                         # Skip non-data lines
                         pass
-            
-            # re-center     
-            #pos_x -= (min(pos_x) + max(pos_x)) / 2.0
-            #pos_y -= (min(pos_y) + max(pos_y)) / 2.0
-            #pos_z -= (min(pos_z) + max(pos_z)) / 2.0
-
-            output = MagSLD(pos_x, pos_y, pos_z, sld_n, 
+            output = MagSLD(pos_x, pos_y, pos_z, sld_n,
                             sld_mx, sld_my, sld_mz)
-
             output.filename = os.path.basename(path)
             output.set_pix_type('pixel')
@@ -725,11 +693,10 @@
             return output
         except:
-            RuntimeError, "%s is not a sld file" % path
-        
+            raise RuntimeError, "%s is not a sld file" % path
+
     def write(self, path, data):
         """
         Write sld file
-        
-        :Param path: file path 
+        :Param path: file path
         :Param data: MagSLD data object
         """
@@ -738,37 +705,31 @@
         if data == None:
             raise ValueError, "Missing the data to save."
-        
         x_val = data.pos_x
         y_val = data.pos_y
         z_val = data.pos_z
         vol_pix = data.vol_pix
-        
         length = len(x_val)
-        
         sld_n = data.sld_n
         if sld_n == None:
-            sld_n = numpy.zerros(length)
-            
+            sld_n = numpy.zeros(length)
         sld_mx = data.sld_mx
         if sld_mx == None:
-            sld_mx = numpy.zerros(length)
-            sld_my = numpy.zerros(length)
-            sld_mz = numpy.zerros(length)
+            sld_mx = numpy.zeros(length)
+            sld_my = numpy.zeros(length)
+            sld_mz = numpy.zeros(length)
         else:
             sld_my = data.sld_my
             sld_mz = data.sld_mz
-            
         out = open(path, 'w')
         # First Line: Column names
         out.write("X  Y  Z  SLDN SLDMx  SLDMy  SLDMz VOLUMEpix")
         for ind in range(length):
-            out.write("\n%g  %g  %g  %g  %g  %g  %g %g" % (x_val[ind], y_val[ind], 
-                                                    z_val[ind], sld_n[ind], 
-                                                    sld_mx[ind], sld_my[ind], 
-                                                    sld_mz[ind], vol_pix[ind]))  
-        out.close()       
-            
-            
-class OMFData:
+            out.write("\n%g  %g  %g  %g  %g  %g  %g %g" % \
+                      (x_val[ind], y_val[ind], z_val[ind], sld_n[ind],
+                       sld_mx[ind], sld_my[ind], sld_mz[ind], vol_pix[ind]))
+        out.close()
+
+
+class OMFData(object):
     """
     OMF Data.
@@ -808,10 +769,10 @@
         self.valuerangeminmag = 0
         self.valuerangemaxmag = 0
-        
+
     def __str__(self):
         """
         doc strings
         """
-        _str =  "Type:            %s\n" % self.__class__.__name__
+        _str = "Type:            %s\n" % self.__class__.__name__
         _str += "File:            %s\n" % self.filename
         _str += "OOMMF:           %s\n" % self.oommf
@@ -823,9 +784,9 @@
         _str += "ybase:           %s [%s]\n" % (str(self.ybase), self.meshunit)
         _str += "zbase:           %s [%s]\n" % (str(self.zbase), self.meshunit)
-        _str += "xstepsize:       %s [%s]\n" % (str(self.xstepsize), 
+        _str += "xstepsize:       %s [%s]\n" % (str(self.xstepsize),
                                                 self.meshunit)
-        _str += "ystepsize:       %s [%s]\n" % (str(self.ystepsize), 
+        _str += "ystepsize:       %s [%s]\n" % (str(self.ystepsize),
                                                 self.meshunit)
-        _str += "zstepsize:       %s [%s]\n" % (str(self.zstepsize), 
+        _str += "zstepsize:       %s [%s]\n" % (str(self.zstepsize),
                                                 self.meshunit)
         _str += "xnodes:          %s\n" % str(self.xnodes)
@@ -840,10 +801,10 @@
         _str += "valueunit:       %s\n" % self.valueunit
         _str += "valuemultiplier: %s\n" % str(self.valuemultiplier)
-        _str += "ValueRangeMinMag:%s [%s]\n" % (str(self.valuerangeminmag), 
-                                                 self.valueunit)
-        _str += "ValueRangeMaxMag:%s [%s]\n" % (str(self.valuerangemaxmag), 
-                                                 self.valueunit)
+        _str += "ValueRangeMinMag:%s [%s]\n" % (str(self.valuerangeminmag),
+                                                self.valueunit)
+        _str += "ValueRangeMaxMag:%s [%s]\n" % (str(self.valuerangemaxmag),
+                                                self.valueunit)
         return _str
-    
+
     def set_m(self, mx, my, mz):
         """
@@ -853,6 +814,6 @@
         self.my = my
         self.mz = mz
-               
-class MagSLD:
+
+class MagSLD(object):
     """
     Magnetic SLD.
@@ -869,6 +830,6 @@
     _sld_unit = '1/A^(2)'
     _pix_type = 'pixel'
-    
-    def __init__(self, pos_x, pos_y, pos_z, sld_n=None, 
+
+    def __init__(self, pos_x, pos_y, pos_z, sld_n=None,
                  sld_mx=None, sld_my=None, sld_mz=None, vol_pix=None):
         """
@@ -907,15 +868,15 @@
             self.set_sldms(sld_mx, sld_my, sld_mz)
         self.set_nodes()
-                   
+
     def __str__(self):
         """
         doc strings
         """
-        _str =  "Type:       %s\n" % self.__class__.__name__
+        _str = "Type:       %s\n" % self.__class__.__name__
         _str += "File:       %s\n" % self.filename
         _str += "Axis_unit:  %s\n" % self.pos_unit
         _str += "SLD_unit:   %s\n" % self.sld_unit
         return _str
-    
+
     def set_pix_type(self, pix_type):
         """
@@ -924,5 +885,5 @@
         """
         self.pix_type = pix_type
-        
+
     def set_sldn(self, sld_n):
         """
@@ -931,8 +892,8 @@
         if sld_n.__class__.__name__ == 'float':
             if self.is_data:
-                # For data, put the value to only the pixels w non-zero M 
-                is_nonzero = (numpy.fabs(self.sld_mx) + 
-                                  numpy.fabs(self.sld_my) + 
-                                  numpy.fabs(self.sld_mz)).nonzero() 
+                # For data, put the value to only the pixels w non-zero M
+                is_nonzero = (numpy.fabs(self.sld_mx) +
+                              numpy.fabs(self.sld_my) +
+                              numpy.fabs(self.sld_mz)).nonzero()
                 self.sld_n = numpy.zeros(len(self.pos_x))
                 if len(self.sld_n[is_nonzero]) > 0:
@@ -945,8 +906,8 @@
         else:
             self.sld_n = sld_n
-           
+
     def set_sldms(self, sld_mx, sld_my, sld_mz):
         """
-        Sets (\|m\|, m_theta, m_phi)
+        Sets (|m|, m_theta, m_phi)
         """
         if sld_mx.__class__.__name__ == 'float':
@@ -964,8 +925,8 @@
 
         sld_m = numpy.sqrt(sld_mx * sld_mx + sld_my * sld_my + \
-                                sld_mz * sld_mz)  
+                                sld_mz * sld_mz)
         self.sld_m = sld_m
-    
-    def set_pixel_symbols(self, symbol='pixel'):  
+
+    def set_pixel_symbols(self, symbol='pixel'):
         """
         Set pixel
@@ -978,6 +939,6 @@
         else:
             self.pix_symbol = symbol
-            
-    def set_pixel_volumes(self, vol):  
+
+    def set_pixel_volumes(self, vol):
         """
         Set pixel volumes
@@ -998,17 +959,5 @@
         """
         return self.sld_n
-    
-    def get_sld_mxyz(self):
-        """
-        Returns (sld_mx, sldmy, sld_mz)
-        """
-        return (self.sld_mx, self.sldmy, self.sld_mz)
-    
-    def get_sld_m(self):
-        """
-        Returns (sldm, sld_theta, sld_phi)
-        """
-        return (self.sldm, self.sld_theta, self.sld_phi)
-    
+
     def set_nodes(self):
         """
@@ -1032,5 +981,5 @@
             self.ynodes = None
             self.znodes = None
-      
+
     def set_stepsize(self):
         """
@@ -1083,18 +1032,16 @@
             return
         self.has_conect = True
-        self.line_x = line_x 
-        self.line_y = line_y 
+        self.line_x = line_x
+        self.line_y = line_y
         self.line_z = line_z
-        
 
 def test_load():
     from sas.plottools.arrow3d import Arrow3D
-    import os
-    dir = os.path.abspath(os.path.curdir)
-    print dir
+    current_dir = os.path.abspath(os.path.curdir)
+    print current_dir
     for i in range(6):
-        dir, _ = os.path.split(dir)
-        tfile = os.path.join(dir, "test", "CoreXY_ShellZ.txt")
-        ofile = os.path.join(dir, "test", "A_Raw_Example-1.omf")
+        current_dir, _ = os.path.split(current_dir)
+        tfile = os.path.join(current_dir, "test", "CoreXY_ShellZ.txt")
+        ofile = os.path.join(current_dir, "test", "A_Raw_Example-1.omf")
         if os.path.isfile(tfile):
             tfpath = tfile
@@ -1109,20 +1056,19 @@
 
     import matplotlib.pyplot as plt
-    from mpl_toolkits.mplot3d import Axes3D
     fig = plt.figure()
     ax = fig.gca(projection='3d')
-    ax.plot(output.pos_x, output.pos_y, output.pos_z, '.', c="g", 
-            alpha = 0.7, markeredgecolor='gray',rasterized=True)
+    ax.plot(output.pos_x, output.pos_y, output.pos_z, '.', c="g",
+            alpha=0.7, markeredgecolor='gray', rasterized=True)
     gap = 7
     max_mx = max(output.sld_mx)
     max_my = max(output.sld_my)
     max_mz = max(output.sld_mz)
-    max_m = max(max_mx,max_my,max_mz)
+    max_m = max(max_mx, max_my, max_mz)
     x2 = output.pos_x+output.sld_mx/max_m * gap
     y2 = output.pos_y+output.sld_my/max_m * gap
     z2 = output.pos_z+output.sld_mz/max_m * gap
-    x_arrow = numpy.column_stack((output.pos_x,x2))
-    y_arrow = numpy.column_stack((output.pos_y,y2))
-    z_arrow = numpy.column_stack((output.pos_z,z2))
+    x_arrow = numpy.column_stack((output.pos_x, x2))
+    y_arrow = numpy.column_stack((output.pos_y, y2))
+    z_arrow = numpy.column_stack((output.pos_z, z2))
     unit_x2 = output.sld_mx / max_m
     unit_y2 = output.sld_my / max_m
@@ -1131,40 +1077,33 @@
     color_y = numpy.fabs(unit_y2 * 0.8)
     color_z = numpy.fabs(unit_z2 * 0.8)
-    colors =  numpy.column_stack((color_x, color_y, color_z))
-    a = Arrow3D(None, x_arrow,y_arrow,z_arrow, colors, mutation_scale=10, lw=1, 
-                arrowstyle="->", color="y", alpha = 0.5)
-
+    colors = numpy.column_stack((color_x, color_y, color_z))
+    a = Arrow3D(None, x_arrow, y_arrow, z_arrow, colors,
+                mutation_scale=10, lw=1, arrowstyle="->",
+                color="y", alpha=0.5)
     ax.add_artist(a)
     plt.show()
-    
 def test():
-    import os
-    dir = os.path.abspath(os.path.curdir)
+    current_dir = os.path.abspath(os.path.curdir)
     for i in range(3):
-        dir, _ = os.path.split(dir)
-        #tfile = os.path.join(dir, "test", "C_Example_Converted.txt")
-        ofile = os.path.join(dir, "test", "A_Raw_Example-1.omf")
+        current_dir, _ = os.path.split(current_dir)
+        ofile = os.path.join(current_dir, "test", "A_Raw_Example-1.omf")
         if os.path.isfile(ofile):
-            #tfpath = tfile
             ofpath = ofile
             break
-    #reader = SLDReader()
     oreader = OMFReader()
-    #output = reader.read(tfpath)
     ooutput = oreader.read(ofpath)
-    foutput = OMF2SLD() 
-    foutput.set_data(ooutput)  
-    writer =  SLDReader() 
-    writer.write(os.path.join(os.path.dirname(ofpath), "out.txt"), 
+    foutput = OMF2SLD()
+    foutput.set_data(ooutput)
+    writer = SLDReader()
+    writer.write(os.path.join(os.path.dirname(ofpath), "out.txt"),
                  foutput.output)
     model = GenSAS()
-    model.set_sld_data(foutput.output) 
+    model.set_sld_data(foutput.output)
     x = numpy.arange(1000)/10000. + 1e-5
     y = numpy.arange(1000)/10000. + 1e-5
-    #z = numpy.arange(1000)/10000. + 1e-5
     i = numpy.zeros(1000)
-    out = model.runXY([x,y,i])
-        
-if __name__ == "__main__": 
+    model.runXY([x, y, i])
+
+if __name__ == "__main__":
     test()
     test_load()
