Index: extra/pylint.rc
===================================================================
--- extra/pylint.rc	(revision 49f92c10eadb7060bb1aed8916c0899cb9f14527)
+++ extra/pylint.rc	(revision 6c8db9efd45ba4aaa8733a4b46abb1bd56306a76)
@@ -57,5 +57,5 @@
 
 # Disable the message(s) with the given id(s).
-disable=W0702,W0613
+disable=W0702,W0613,W0703,W0142
 
 [REPORTS]
@@ -343,5 +343,5 @@
 
 # Minimum number of public methods for a class (see R0903).
-min-public-methods=2
+min-public-methods=0
 
 # Maximum number of public methods for a class (see R0904).
Index: sasmodels/generate.py
===================================================================
--- sasmodels/generate.py	(revision a5d0d008778409dd90a86aa3db6037187ed3ff57)
+++ sasmodels/generate.py	(revision 33e91b15304920ad5b2b99b7f595293978770dbe)
@@ -201,6 +201,6 @@
 # Scale and background, which are parameters common to every form factor
 COMMON_PARAMETERS = [
-    [ "scale", "", 1, [0, np.inf], "", "Source intensity" ],
-    [ "background", "1/cm", 0, [0, np.inf], "", "Source background" ],
+    ["scale", "", 1, [0, np.inf], "", "Source intensity"],
+    ["background", "1/cm", 0, [0, np.inf], "", "Source background"],
     ]
 
@@ -233,5 +233,5 @@
 # description and its parameter table.  The remainder of the doc comes
 # from the module docstring.
-DOC_HEADER=""".. _%(name)s:
+DOC_HEADER = """.. _%(name)s:
 
 %(label)s
@@ -259,18 +259,18 @@
         ]
     column_widths = [max(w, len(h))
-                     for w,h in zip(column_widths, PARTABLE_HEADERS)]
+                     for w, h in zip(column_widths, PARTABLE_HEADERS)]
 
     sep = " ".join("="*w for w in column_widths)
     lines = [
         sep,
-        " ".join("%-*s"%(w,h) for w,h in zip(column_widths, PARTABLE_HEADERS)),
+        " ".join("%-*s" % (w, h) for w, h in zip(column_widths, PARTABLE_HEADERS)),
         sep,
         ]
     for p in pars:
         lines.append(" ".join([
-            "%-*s"%(column_widths[0],p[0]),
-            "%-*s"%(column_widths[1],p[-1]),
-            "%-*s"%(column_widths[2],RST_UNITS[p[1]]),
-            "%*g"%(column_widths[3],p[2]),
+            "%-*s" % (column_widths[0], p[0]),
+            "%-*s" % (column_widths[1], p[-1]),
+            "%-*s" % (column_widths[2], RST_UNITS[p[1]]),
+            "%*g" % (column_widths[3], p[2]),
             ]))
     lines.append(sep)
@@ -287,5 +287,5 @@
         if exists(target):
             return target
-    raise ValueError("%r not found in %s"%(filename, search_path))
+    raise ValueError("%r not found in %s" % (filename, search_path))
 
 def sources(info):
@@ -293,6 +293,6 @@
     Return a list of the sources file paths for the module.
     """
-    search_path = [ dirname(info['filename']),
-                    abspath(joinpath(dirname(__file__),'models')) ]
+    search_path = [dirname(info['filename']),
+                   abspath(joinpath(dirname(__file__), 'models'))]
     return [_search(search_path, f) for f in info['source']]
 
@@ -333,5 +333,5 @@
 
     for p in pars:
-        name,ptype = p[0],p[4]
+        name, ptype = p[0], p[4]
         if ptype == 'volume':
             partype['pd-1d'].append(name)
@@ -346,5 +346,5 @@
             partype['fixed-2d'].append(name)
         else:
-            raise ValueError("unknown parameter type %r"%ptype)
+            raise ValueError("unknown parameter type %r" % ptype)
         partype[ptype].append(name)
 
@@ -356,5 +356,5 @@
     """
     spaces = " "*depth
-    sep = "\n"+spaces
+    sep = "\n" + spaces
     return spaces + sep.join(s.split("\n"))
 
@@ -366,5 +366,5 @@
     Returns loop opening and loop closing
     """
-    LOOP_OPEN="""\
+    LOOP_OPEN = """\
 for (int %(name)s_i=0; %(name)s_i < N%(name)s; %(name)s_i++) {
   const double %(name)s = loops[2*(%(name)s_i%(offset)s)];
@@ -376,12 +376,12 @@
     loop_end = []
     for name in pd_pars:
-        subst = { 'name': name, 'offset': offset }
-        loop_head.append(indent(LOOP_OPEN%subst, depth))
+        subst = {'name': name, 'offset': offset}
+        loop_head.append(indent(LOOP_OPEN % subst, depth))
         loop_end.insert(0, (" "*depth) + "}")
-        offset += '+N'+name
+        offset += '+N' + name
         depth += 2
     return "\n".join(loop_head), "\n".join(loop_end)
 
-C_KERNEL_TEMPLATE=None
+C_KERNEL_TEMPLATE = None
 def make_model(info):
     """
@@ -416,12 +416,12 @@
 
     iq_parameters = [p[0]
-        for p in info['parameters'][2:] # skip scale, background
-        if p[0] in set(fixed_1d+pd_1d)]
+                     for p in info['parameters'][2:] # skip scale, background
+                     if p[0] in set(fixed_1d + pd_1d)]
     iqxy_parameters = [p[0]
-        for p in info['parameters'][2:] # skip scale, background
-        if p[0] in set(fixed_2d+pd_2d)]
+                       for p in info['parameters'][2:] # skip scale, background
+                       if p[0] in set(fixed_2d + pd_2d)]
     volume_parameters = [p[0]
-        for p in info['parameters']
-        if p[4]=='volume']
+                         for p in info['parameters']
+                         if p[4] == 'volume']
 
     # Fill in defintions for volume parameters
@@ -430,10 +430,10 @@
                         ','.join(volume_parameters)))
         defines.append(('VOLUME_WEIGHT_PRODUCT',
-                        '*'.join(p+'_w' for p in volume_parameters)))
+                        '*'.join(p + '_w' for p in volume_parameters)))
 
     # Generate form_volume function from body only
     if info['form_volume'] is not None:
         if volume_parameters:
-            vol_par_decl = ', '.join('double '+p for p in volume_parameters)
+            vol_par_decl = ', '.join('double ' + p for p in volume_parameters)
         else:
             vol_par_decl = 'void'
@@ -445,28 +445,28 @@
     %(body)s
 }
-"""%{'body':info['form_volume']}
+""" % {'body':info['form_volume']}
         source.append(fn)
 
     # Fill in definitions for Iq parameters
-    defines.append(('IQ_KERNEL_NAME', info['name']+'_Iq'))
+    defines.append(('IQ_KERNEL_NAME', info['name'] + '_Iq'))
     defines.append(('IQ_PARAMETERS', ', '.join(iq_parameters)))
     if fixed_1d:
         defines.append(('IQ_FIXED_PARAMETER_DECLARATIONS',
-                        ', \\\n    '.join('const double %s'%p for p in fixed_1d)))
+                        ', \\\n    '.join('const double %s' % p for p in fixed_1d)))
     if pd_1d:
         defines.append(('IQ_WEIGHT_PRODUCT',
-                        '*'.join(p+'_w' for p in pd_1d)))
+                        '*'.join(p + '_w' for p in pd_1d)))
         defines.append(('IQ_DISPERSION_LENGTH_DECLARATIONS',
-                        ', \\\n    '.join('const int N%s'%p for p in pd_1d)))
+                        ', \\\n    '.join('const int N%s' % p for p in pd_1d)))
         defines.append(('IQ_DISPERSION_LENGTH_SUM',
-                        '+'.join('N'+p for p in pd_1d)))
+                        '+'.join('N' + p for p in pd_1d)))
         open_loops, close_loops = build_polydispersity_loops(pd_1d)
         defines.append(('IQ_OPEN_LOOPS',
-                        open_loops.replace('\n',' \\\n')))
+                        open_loops.replace('\n', ' \\\n')))
         defines.append(('IQ_CLOSE_LOOPS',
-                        close_loops.replace('\n',' \\\n')))
+                        close_loops.replace('\n', ' \\\n')))
     if info['Iq'] is not None:
         defines.append(('IQ_PARAMETER_DECLARATIONS',
-                       ', '.join('double '+p for p in iq_parameters)))
+                        ', '.join('double ' + p for p in iq_parameters)))
         fn = """\
 double Iq(double q, IQ_PARAMETER_DECLARATIONS);
@@ -474,28 +474,28 @@
     %(body)s
 }
-"""%{'body':info['Iq']}
+""" % {'body':info['Iq']}
         source.append(fn)
 
     # Fill in definitions for Iqxy parameters
-    defines.append(('IQXY_KERNEL_NAME', info['name']+'_Iqxy'))
+    defines.append(('IQXY_KERNEL_NAME', info['name'] + '_Iqxy'))
     defines.append(('IQXY_PARAMETERS', ', '.join(iqxy_parameters)))
     if fixed_2d:
         defines.append(('IQXY_FIXED_PARAMETER_DECLARATIONS',
-                        ', \\\n    '.join('const double %s'%p for p in fixed_2d)))
+                        ', \\\n    '.join('const double %s' % p for p in fixed_2d)))
     if pd_2d:
         defines.append(('IQXY_WEIGHT_PRODUCT',
-                        '*'.join(p+'_w' for p in pd_2d)))
+                        '*'.join(p + '_w' for p in pd_2d)))
         defines.append(('IQXY_DISPERSION_LENGTH_DECLARATIONS',
-                        ', \\\n    '.join('const int N%s'%p for p in pd_2d)))
+                        ', \\\n    '.join('const int N%s' % p for p in pd_2d)))
         defines.append(('IQXY_DISPERSION_LENGTH_SUM',
-                        '+'.join('N'+p for p in pd_2d)))
+                        '+'.join('N' + p for p in pd_2d)))
         open_loops, close_loops = build_polydispersity_loops(pd_2d)
         defines.append(('IQXY_OPEN_LOOPS',
-                        open_loops.replace('\n',' \\\n')))
+                        open_loops.replace('\n', ' \\\n')))
         defines.append(('IQXY_CLOSE_LOOPS',
-                        close_loops.replace('\n',' \\\n')))
+                        close_loops.replace('\n', ' \\\n')))
     if info['Iqxy'] is not None:
         defines.append(('IQXY_PARAMETER_DECLARATIONS',
-                       ', '.join('double '+p for p in iqxy_parameters)))
+                        ', '.join('double ' + p for p in iqxy_parameters)))
         fn = """\
 double Iqxy(double qx, double qy, IQXY_PARAMETER_DECLARATIONS);
@@ -503,5 +503,5 @@
     %(body)s
 }
-"""%{'body':info['Iqxy']}
+""" % {'body':info['Iqxy']}
         source.append(fn)
 
@@ -513,7 +513,7 @@
 
     #for d in defines: print d
-    DEFINES='\n'.join('#define %s %s'%(k,v) for k,v in defines)
-    SOURCES='\n\n'.join(source)
-    return C_KERNEL_TEMPLATE%{
+    DEFINES = '\n'.join('#define %s %s' % (k, v) for k, v in defines)
+    SOURCES = '\n\n'.join(source)
+    return C_KERNEL_TEMPLATE % {
         'DEFINES':DEFINES,
         'SOURCES':SOURCES,
@@ -531,20 +531,20 @@
     #print kernelfile
     info = dict(
-        filename = abspath(kernel_module.__file__),
-        name = kernel_module.name,
-        title = kernel_module.title,
-        description = kernel_module.description,
-        parameters = COMMON_PARAMETERS + kernel_module.parameters,
-        source = getattr(kernel_module, 'source', []),
-        oldname = kernel_module.oldname,
-        oldpars = kernel_module.oldpars,
+        filename=abspath(kernel_module.__file__),
+        name=kernel_module.name,
+        title=kernel_module.title,
+        description=kernel_module.description,
+        parameters=COMMON_PARAMETERS + kernel_module.parameters,
+        source=getattr(kernel_module, 'source', []),
+        oldname=kernel_module.oldname,
+        oldpars=kernel_module.oldpars,
         )
     # Fill in attributes which default to None
-    info.update((k,getattr(kernel_module, k, None))
+    info.update((k, getattr(kernel_module, k, None))
                 for k in ('ER', 'VR', 'form_volume', 'Iq', 'Iqxy'))
     # Fill in the derived attributes
-    info['limits'] = dict((p[0],p[3]) for p in info['parameters'])
+    info['limits'] = dict((p[0], p[3]) for p in info['parameters'])
     info['partype'] = categorize_parameters(info['parameters'])
-    info['defaults'] = dict((p[0],p[2]) for p in info['parameters'])
+    info['defaults'] = dict((p[0], p[2]) for p in info['parameters'])
 
     # Assume if one part of the kernel is python then all parts are.
@@ -556,10 +556,10 @@
     Return the documentation for the model.
     """
-    subst = dict(name=kernel_module.name.replace('_','-'),
+    subst = dict(name=kernel_module.name.replace('_', '-'),
                  label=" ".join(kernel_module.name.split('_')).capitalize(),
                  title=kernel_module.title,
                  parameters=make_partable(kernel_module.parameters),
                  docs=kernel_module.__doc__)
-    return DOC_HEADER%subst
+    return DOC_HEADER % subst
 
 
@@ -568,8 +568,8 @@
     import datetime
     from .models import cylinder
-    toc = lambda: (datetime.datetime.now()-tic).total_seconds()
     tic = datetime.datetime.now()
-    source, info = make(cylinder)
-    print "time:",toc()
+    toc = lambda: (datetime.datetime.now() - tic).total_seconds()
+    make(cylinder)
+    print "time:", toc()
 
 def main():
@@ -579,8 +579,8 @@
         name = sys.argv[1]
         import sasmodels.models
-        __import__('sasmodels.models.'+name)
+        __import__('sasmodels.models.' + name)
         model = getattr(sasmodels.models, name)
-        source, info = make(model); print source
-        #print doc(model)
+        source, _ = make(model)
+        print source
 
 if __name__ == "__main__":
Index: sasmodels/kernelcl.py
===================================================================
--- sasmodels/kernelcl.py	(revision 664c8e7c9b7f15e584d3dee365484f8ac74ae4d5)
+++ sasmodels/kernelcl.py	(revision c85db69ebc61ae093eb2e72b7a6bf64a0142d56d)
@@ -32,5 +32,5 @@
     context = cl.create_some_context(interactive=False)
     del context
-except Exception,exc:
+except Exception, exc:
     warnings.warn(str(exc))
     raise RuntimeError("OpenCL not available")
@@ -39,5 +39,5 @@
 
 from . import generate
-from .kernelpy import PyInput, PyModel
+from .kernelpy import PyModel
 
 F64_DEFS = """\
@@ -63,5 +63,5 @@
     """
     source, info = generate.make(kernel_module)
-    if callable(info.get('Iq',None)):
+    if callable(info.get('Iq', None)):
         return PyModel(info)
     ## for debugging, save source to a .cl file, edit it, and reload as model
@@ -110,8 +110,8 @@
     device.min_data_type_align_size//4.
     """
-    remainder = vector.size%boundary
+    remainder = vector.size % boundary
     if remainder != 0:
         size = vector.size + (boundary - remainder)
-        vector = np.hstack((vector, [extra]*(size-vector.size)))
+        vector = np.hstack((vector, [extra] * (size - vector.size)))
     return np.ascontiguousarray(vector, dtype=dtype)
 
@@ -126,5 +126,5 @@
     """
     dtype = np.dtype(dtype)
-    if dtype==generate.F64 and not all(has_double(d) for d in context.devices):
+    if dtype == generate.F64 and not all(has_double(d) for d in context.devices):
         raise RuntimeError("Double precision not supported for devices")
 
@@ -135,5 +135,5 @@
     if context.devices[0].type == cl.device_type.GPU:
         header += "#define USE_SINCOS\n"
-    program  = cl.Program(context, header+source).build()
+    program = cl.Program(context, header + source).build()
     return program
 
@@ -173,5 +173,5 @@
         try:
             self.context = cl.create_some_context(interactive=False)
-        except Exception,exc:
+        except Exception, exc:
             warnings.warn(str(exc))
             warnings.warn("pyopencl.create_some_context() failed")
@@ -230,12 +230,12 @@
         self.__dict__ = state.copy()
 
-    def __call__(self, input):
-        if self.dtype != input.dtype:
+    def __call__(self, input_value):
+        if self.dtype != input_value.dtype:
             raise TypeError("data and kernel have different types")
         if self.program is None:
-            self.program = environment().compile_program(self.info['name'],self.source, self.dtype)
-        kernel_name = generate.kernel_name(self.info, input.is_2D)
+            self.program = environment().compile_program(self.info['name'], self.source, self.dtype)
+        kernel_name = generate.kernel_name(self.info, input_value.is_2D)
         kernel = getattr(self.program, kernel_name)
-        return GpuKernel(kernel, self.info, input)
+        return GpuKernel(kernel, self.info, input_value)
 
     def release(self):
@@ -285,5 +285,5 @@
         self.q_vectors = [_stretch_input(q, self.dtype, 32) for q in q_vectors]
         self.q_buffers = [
-            cl.Buffer(env.context,  mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=q)
+            cl.Buffer(env.context, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=q)
             for q in self.q_vectors
         ]
@@ -320,6 +320,6 @@
         self.res = np.empty(input.nq, input.dtype)
         dim = '2d' if input.is_2D else '1d'
-        self.fixed_pars = info['partype']['fixed-'+dim]
-        self.pd_pars = info['partype']['pd-'+dim]
+        self.fixed_pars = info['partype']['fixed-' + dim]
+        self.pd_pars = info['partype']['pd-' + dim]
 
         # Inputs and outputs for each kernel call
@@ -327,8 +327,8 @@
         env = environment()
         self.loops_b = [cl.Buffer(env.context, mf.READ_WRITE,
-                                  2*MAX_LOOPS*input.dtype.itemsize)
+                                  2 * MAX_LOOPS * input.dtype.itemsize)
                         for _ in env.queues]
         self.res_b = [cl.Buffer(env.context, mf.READ_WRITE,
-                                input.global_size[0]*input.dtype.itemsize)
+                                input.global_size[0] * input.dtype.itemsize)
                       for _ in env.queues]
 
@@ -344,5 +344,5 @@
             cutoff = real(cutoff)
             loops_N = [np.uint32(len(p[0])) for p in pd_pars]
-            loops = np.hstack(pd_pars) if pd_pars else np.empty(0,dtype=self.input.dtype)
+            loops = np.hstack(pd_pars) if pd_pars else np.empty(0, dtype=self.input.dtype)
             loops = np.ascontiguousarray(loops.T, self.input.dtype).flatten()
             #print "loops",Nloops, loops
@@ -350,5 +350,5 @@
             #import sys; print >>sys.stderr,"opencl eval",pars
             #print "opencl eval",pars
-            if len(loops) > 2*MAX_LOOPS:
+            if len(loops) > 2 * MAX_LOOPS:
                 raise ValueError("too many polydispersity points")
 
Index: sasmodels/kernelpy.py
===================================================================
--- sasmodels/kernelpy.py	(revision f734e7d992ea6f2199f478553447ff0dbe047559)
+++ sasmodels/kernelpy.py	(revision c85db69ebc61ae093eb2e72b7a6bf64a0142d56d)
@@ -1,13 +1,13 @@
 import numpy as np
-from numpy import pi, sin, cos, sqrt
-
-from .generate import F32, F64
+from numpy import pi, cos
+
+from .generate import F64
 
 class PyModel(object):
     def __init__(self, info):
         self.info = info
-    def __call__(self, input):
-        kernel = self.info['Iqxy'] if input.is_2D else self.info['Iq']
-        return PyKernel(kernel, self.info, input)
+    def __call__(self, input_value):
+        kernel = self.info['Iqxy'] if input_value.is_2D else self.info['Iq']
+        return PyKernel(kernel, self.info, input_value)
     def make_input(self, q_vectors):
         return PyInput(q_vectors, dtype=F64)
@@ -38,5 +38,5 @@
         self.dtype = dtype
         self.is_2D = (len(q_vectors) == 2)
-        self.q_vectors = [np.ascontiguousarray(q,self.dtype) for q in q_vectors]
+        self.q_vectors = [np.ascontiguousarray(q, self.dtype) for q in q_vectors]
         self.q_pointers = [q.ctypes.data for q in q_vectors]
 
@@ -73,13 +73,13 @@
             if dim == '2d':
                 def vector_kernel(qx, qy, *args):
-                    return np.array([kernel(qxi,qyi,*args) for qxi,qyi in zip(qx,qy)])
+                    return np.array([kernel(qxi, qyi, *args) for qxi, qyi in zip(qx, qy)])
             else:
                 def vector_kernel(q, *args):
-                    return np.array([kernel(qi,*args) for qi in q])
+                    return np.array([kernel(qi, *args) for qi in q])
             self.kernel = vector_kernel
         else:
             self.kernel = kernel
-        fixed_pars = info['partype']['fixed-'+dim]
-        pd_pars = info['partype']['pd-'+dim]
+        fixed_pars = info['partype']['fixed-' + dim]
+        pd_pars = info['partype']['pd-' + dim]
         vol_pars = info['partype']['volume']
 
@@ -87,9 +87,9 @@
         pars = [p[0] for p in info['parameters'][2:]]
         offset = len(self.input.q_vectors)
-        self.args = self.input.q_vectors + [None]*len(pars)
-        self.fixed_index = np.array([pars.index(p)+offset for p in fixed_pars[2:] ])
-        self.pd_index = np.array([pars.index(p)+offset for p in pd_pars])
-        self.vol_index = np.array([pars.index(p)+offset for p in vol_pars])
-        try: self.theta_index = pars.index('theta')+offset
+        self.args = self.input.q_vectors + [None] * len(pars)
+        self.fixed_index = np.array([pars.index(p) + offset for p in fixed_pars[2:]])
+        self.pd_index = np.array([pars.index(p) + offset for p in pd_pars])
+        self.vol_index = np.array([pars.index(p) + offset for p in vol_pars])
+        try: self.theta_index = pars.index('theta') + offset
         except ValueError: self.theta_index = -1
 
@@ -105,7 +105,7 @@
         # First two fixed
         scale, background = fixed[:2]
-        for index,value in zip(self.fixed_index, fixed[2:]):
+        for index, value in zip(self.fixed_index, fixed[2:]):
             args[index] = float(value)
-        res = _loops(form, form_volume, cutoff, scale, background,  args,
+        res = _loops(form, form_volume, cutoff, scale, background, args,
                      pd, self.pd_index, self.vol_index, self.theta_index)
 
@@ -185,8 +185,8 @@
     for k in range(stride[-1]):
         # update polydispersity parameter values
-        fast_index = k%stride[0]
+        fast_index = k % stride[0]
         if fast_index == 0:  # bottom loop complete ... check all other loops
             if weight.size > 0:
-                for i,index, in enumerate(k%stride):
+                for i, index, in enumerate(k % stride):
                     args[pd_index[i]] = pd[i][0][index]
                     weight[i] = pd[i][1][index]
@@ -202,13 +202,13 @@
         if w > cutoff:
             I = form(*args)
-            positive = (I>=0.0)
+            positive = (I >= 0.0)
 
             # Note: can precompute spherical correction if theta_index is not the fast index
             # Correction factor for spherical integration p(theta) I(q) sin(theta) dtheta
             #spherical_correction = abs(sin(pi*args[theta_index])) if theta_index>=0 else 1.0
-            spherical_correction = abs(cos(pi*args[theta_index]))*pi/2 if theta_index>=0 else 1.0
+            spherical_correction = abs(cos(pi * args[theta_index])) * pi / 2 if theta_index >= 0 else 1.0
             #spherical_correction = 1.0
-            ret += w*I*spherical_correction*positive
-            norm += w*positive
+            ret += w * I * spherical_correction * positive
+            norm += w * positive
 
             # Volume normalization.
@@ -220,9 +220,9 @@
                 vol_args = [args[index] for index in vol_index]
                 vol_weight = np.prod(weight[vol_weight_index])
-                vol += vol_weight*form_volume(*vol_args)*positive
-                vol_norm += vol_weight*positive
-
-    positive = (vol*vol_norm != 0.0)
+                vol += vol_weight * form_volume(*vol_args) * positive
+                vol_norm += vol_weight * positive
+
+    positive = (vol * vol_norm != 0.0)
     ret[positive] *= vol_norm[positive] / vol[positive]
-    result = scale*ret/norm+background
+    result = scale * ret / norm + background
     return result
Index: sasmodels/models/parallelepiped.py
===================================================================
--- sasmodels/models/parallelepiped.py	(revision 989005365096670e54afec254875979f35bd395a)
+++ sasmodels/models/parallelepiped.py	(revision 989005365096670e54afec254875979f35bd395a)
@@ -9,7 +9,7 @@
 ----------
 
-This model provides the form factor, *P(q)*, for a rectangular parallelepiped 
-(below) where the form factor is normalized by the volume of the 
-parallelepiped. If you need to apply polydispersity, see also the 
+This model provides the form factor, *P(q)*, for a rectangular parallelepiped
+(below) where the form factor is normalized by the volume of the
+parallelepiped. If you need to apply polydispersity, see also the
 RectangularPrismModel_.
 
@@ -20,5 +20,5 @@
     P(Q) = {\text{scale} \over V} F^2(Q) + \text{background}
 
-where the volume *V* = *A B C* and the averaging < > is applied over all 
+where the volume *V* = *A B C* and the averaging < > is applied over all
 orientations for 1D.
 
@@ -27,11 +27,11 @@
 *Figure. Parallelepiped with the corresponding Definition of sides.
 
-The edge of the solid must satisfy the condition that** *A* < *B* < *C*. 
-Then, assuming *a* = *A* / *B* < 1, *b* = *B* / *B* = 1, and 
+The edge of the solid must satisfy the condition that** *A* < *B* < *C*.
+Then, assuming *a* = *A* / *B* < 1, *b* = *B* / *B* = 1, and
 *c* = *C* / *B* > 1, the form factor is
 
 .. math::
 
-    P(q) = \frac{\textstyle{scale}}{V}\int_0^1 \phi(\mu \sqrt{1-\sigma^2},a) 
+    P(q) = \frac{\textstyle{scale}}{V}\int_0^1 \phi(\mu \sqrt{1-\sigma^2},a)
     [S(\mu c \sigma/2)]^2 d\sigma
 
@@ -40,9 +40,9 @@
 .. math::
 
-    \phi(\mu,a) = \int_0^1 \{S[\frac{\mu}{2}\cos(\frac{\pi}{2}u)] 
+    \phi(\mu,a) = \int_0^1 \{S[\frac{\mu}{2}\cos(\frac{\pi}{2}u)]
     S[\frac{\mu a}{2}\sin(\frac{\pi}{2}u)]\}^2 du
 
     S(x) = \frac{\sin x}{x}
-    
+
     \mu = qB
 
@@ -53,17 +53,17 @@
     \Delta\rho = \rho_{\textstyle p} - \rho_{\textstyle solvent}
 
-The scattering intensity per unit volume is returned in units of |cm^-1|; 
+The scattering intensity per unit volume is returned in units of |cm^-1|;
 ie, *I(q)* = |phi| *P(q)*\ .
 
-NB: The 2nd virial coefficient of the parallelpiped is calculated based on 
-the averaged effective radius (= sqrt(*short_a* \* *short_b* / |pi|)) and 
+NB: The 2nd virial coefficient of the parallelpiped is calculated based on
+the averaged effective radius (= sqrt(*short_a* \* *short_b* / |pi|)) and
 length(= *long_c*) values, and used as the effective radius for
 *S(Q)* when *P(Q)* \* *S(Q)* is applied.
 
-To provide easy access to the orientation of the parallelepiped, we define 
+To provide easy access to the orientation of the parallelepiped, we define
 three angles |theta|, |phi| and |bigpsi|. The definition of |theta| and |phi|
-is the same as for the cylinder model (see also figures below). 
-The angle |bigpsi| is the rotational angle around the *long_c* axis against 
-the *q* plane. For example, |bigpsi| = 0 when the *short_b* axis is parallel 
+is the same as for the cylinder model (see also figures below).
+The angle |bigpsi| is the rotational angle around the *long_c* axis against
+the *q* plane. For example, |bigpsi| = 0 when the *short_b* axis is parallel
 to the *x*-axis of the detector.
 
@@ -83,9 +83,9 @@
 ----------
 
-Validation of the code was done by comparing the output of the 1D calculation 
-to the angular average of the output of a 2D calculation over all possible 
-angles. The Figure below shows the comparison where the solid dot refers to 
-averaged 2D while the line represents the result of the 1D calculation (for 
-the averaging, 76, 180, 76 points are taken for the angles of |theta|, |phi|, 
+Validation of the code was done by comparing the output of the 1D calculation
+to the angular average of the output of a 2D calculation over all possible
+angles. The Figure below shows the comparison where the solid dot refers to
+averaged 2D while the line represents the result of the 1D calculation (for
+the averaging, 76, 180, 76 points are taken for the angles of |theta|, |phi|,
 and |psi| respectively).
 
@@ -96,5 +96,5 @@
 *Figure. Comparison between 1D and averaged 2D.*
 
-This model reimplements the form factor calculations implemented in a c-library 
+This model reimplements the form factor calculations implemented in a c-library
 provided by the NIST Center for Neutron Research (Kline, 2006).
 
@@ -108,34 +108,34 @@
      P(q)= scale/V*integral from 0 to 1 of ...
            phi(mu*sqrt(1-sigma^2),a) * S(mu*c*sigma/2)^2 * dsigma
-     
+
             phi(mu,a) = integral from 0 to 1 of ..
-	    (S((mu/2)*cos(pi*u/2))*S((mu*a/2)*sin(pi*u/2)))^2 * du
+        (S((mu/2)*cos(pi*u/2))*S((mu*a/2)*sin(pi*u/2)))^2 * du
             S(x) = sin(x)/x
-	    mu = q*B
+        mu = q*B
 """
 category = "shape:parallelpiped"
 
 parameters = [
-#   [ "name", "units", default, [lower, upper], "type",
-#     "description" ],
-    [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "",
-      "Parallelepiped scattering length density" ],
-    [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "",
-      "Solvent scattering length density" ],
-    [ "a_side", "Ang",  35, [0, inf], "volume",
-      "Shorter side of the parallelepiped" ],
-    [ "b_side", "Ang",  75, [0, inf], "volume",
-      "Second side of the parallelepiped" ],
-    [ "c_side", "Ang",  400, [0, inf], "volume",
-      "Larger side of the parallelepiped" ],
-    [ "theta", "degrees", 60, [-inf, inf], "orientation",
-      "In plane angle" ],
-    [ "phi", "degrees", 60, [-inf, inf], "orientation",
-      "Out of plane angle" ],
-    [ "psi", "degrees", 60, [-inf, inf], "orientation",
-      "Rotation angle around its own c axis against q plane" ],
+    #   [ "name", "units", default, [lower, upper], "type",
+    #     "description" ],
+    ["sld", "1e-6/Ang^2", 4, [-inf, inf], "",
+     "Parallelepiped scattering length density"],
+    ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "",
+     "Solvent scattering length density"],
+    ["a_side", "Ang", 35, [0, inf], "volume",
+     "Shorter side of the parallelepiped"],
+    ["b_side", "Ang", 75, [0, inf], "volume",
+     "Second side of the parallelepiped"],
+    ["c_side", "Ang", 400, [0, inf], "volume",
+     "Larger side of the parallelepiped"],
+    ["theta", "degrees", 60, [-inf, inf], "orientation",
+     "In plane angle"],
+    ["phi", "degrees", 60, [-inf, inf], "orientation",
+     "Out of plane angle"],
+    ["psi", "degrees", 60, [-inf, inf], "orientation",
+     "Rotation angle around its own c axis against q plane"],
     ]
 
-source = [ "lib/J1.c", "lib/gauss76.c", "parallelepiped.c" ]
+source = ["lib/J1.c", "lib/gauss76.c", "parallelepiped.c"]
 
 def ER(a_side, b_side, c_side):
@@ -148,8 +148,8 @@
     b = 0.5 * c_side
     t1 = a * a * b
-    t2 = 1.0 + (b/a)*(1.0+a/b/2.0)*(1.0+pi*a/b/2.0)
+    t2 = 1.0 + (b / a) * (1.0 + a / b / 2.0) * (1.0 + pi * a / b / 2.0)
     ddd = 3.0 * t1 * t2
 
-    return 0.5 * (ddd)**(1./3.)
+    return 0.5 * (ddd) ** (1. / 3.)
 
 # parameters for demo
@@ -169,7 +169,7 @@
 # For testing against the old sasview models, include the converted parameter
 # names and the target sasview model name.
-oldname='ParallelepipedModel'
-oldpars=dict(theta='parallel_theta', phi='parallel_phi', psi='parallel_psi',
-             a_side='short_a', b_side='short_b', c_side='long_c',
-             sld='sldPipe', solvent_sld='sldSolv')
+oldname = 'ParallelepipedModel'
+oldpars = dict(theta='parallel_theta', phi='parallel_phi', psi='parallel_psi',
+               a_side='short_a', b_side='short_b', c_side='long_c',
+               sld='sldPipe', solvent_sld='sldSolv')
 
Index: sasmodels/sasview_model.py
===================================================================
--- sasmodels/sasview_model.py	(revision 0a82216fe41763d3d9ab2277f58228a0921edcce)
+++ sasmodels/sasview_model.py	(revision de0c4baaebb72d2cb7c4db56d90e0fc508888f7d)
@@ -26,5 +26,5 @@
 try:
     from .kernelcl import load_model
-except ImportError,exc:
+except ImportError, exc:
     warnings.warn(str(exc))
     warnings.warn("using ctypes instead")
@@ -41,9 +41,9 @@
     will produce a class with a name compatible with SasView
     """
-    model =  load_model(kernel_module, dtype=dtype)
+    model = load_model(kernel_module, dtype=dtype)
     def __init__(self, multfactor=1):
         SasviewModel.__init__(self, model)
     attrs = dict(__init__=__init__)
-    ConstructedModel = type(model.info[namestyle],  (SasviewModel,), attrs)
+    ConstructedModel = type(model.info[namestyle], (SasviewModel,), attrs)
     return ConstructedModel
 
@@ -69,7 +69,7 @@
         self.dispersion = dict()
         partype = model.info['partype']
-        for name,units,default,limits,ptype,description in model.info['parameters']:
+        for name, units, default, limits, ptype, description in model.info['parameters']:
             self.params[name] = default
-            self.details[name] = [units]+limits
+            self.details[name] = [units] + limits
 
         for name in partype['pd-2d']:
@@ -83,15 +83,15 @@
         self.orientation_params = (
             partype['orientation']
-            + [n+'.width' for n in partype['orientation']]
+            + [n + '.width' for n in partype['orientation']]
             + partype['magnetic'])
         self.magnetic_params = partype['magnetic']
-        self.fixed = [n+'.width' for n in partype['pd-2d']]
+        self.fixed = [n + '.width' for n in partype['pd-2d']]
         self.non_fittable = []
 
         ## independent parameter name and unit [string]
-        self.input_name = model.info.get("input_name","Q")
-        self.input_unit = model.info.get("input_unit","A^{-1}")
-        self.output_name = model.info.get("output_name","Intensity")
-        self.output_unit = model.info.get("output_unit","cm^{-1}")
+        self.input_name = model.info.get("input_name", "Q")
+        self.input_unit = model.info.get("input_unit", "A^{-1}")
+        self.output_name = model.info.get("output_name", "Intensity")
+        self.output_unit = model.info.get("output_unit", "cm^{-1}")
 
         ## _persistency_dict is used by sas.perspectives.fitting.basepage
@@ -139,7 +139,7 @@
         # Look for dispersion parameters
         toks = name.split('.')
-        if len(toks)==2:
+        if len(toks) == 2:
             for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
+                if item.lower() == toks[0].lower():
                     for par in self.dispersion[item]:
                         if par.lower() == toks[1].lower():
@@ -149,5 +149,5 @@
             # Look for standard parameter
             for item in self.params.keys():
-                if item.lower()==name.lower():
+                if item.lower() == name.lower():
                     self.params[item] = value
                     return
@@ -164,7 +164,7 @@
         # Look for dispersion parameters
         toks = name.split('.')
-        if len(toks)==2:
+        if len(toks) == 2:
             for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
+                if item.lower() == toks[0].lower():
                     for par in self.dispersion[item]:
                         if par.lower() == toks[1].lower():
@@ -173,5 +173,5 @@
             # Look for standard parameter
             for item in self.params.keys():
-                if item.lower()==name.lower():
+                if item.lower() == name.lower():
                     return self.params[item]
 
@@ -182,8 +182,8 @@
         Return a list of all available parameters for the model
         """
-        list = self.params.keys()
+        param_list = self.params.keys()
         # WARNING: Extending the list with the dispersion parameters
-        list.extend(self.getDispParamList())
-        return list
+        param_list.extend(self.getDispParamList())
+        return param_list
 
     def getDispParamList(self):
@@ -192,5 +192,5 @@
         """
         # TODO: fix test so that parameter order doesn't matter
-        ret = ['%s.%s'%(d.lower(), p)
+        ret = ['%s.%s' % (d.lower(), p)
                for d in self._model.info['partype']['pd-2d']
                for p in ('npts', 'nsigmas', 'width')]
@@ -212,5 +212,5 @@
         **DEPRECATED**: use calculate_Iq instead
         """
-        if isinstance(x, (list,tuple)):
+        if isinstance(x, (list, tuple)):
             q, phi = x
             return self.calculate_Iq([q * math.cos(phi)],
@@ -230,6 +230,6 @@
         **DEPRECATED**: use calculate_Iq instead
         """
-        if isinstance(x, (list,tuple)):
-            return self.calculate_Iq([float(x[0])],[float(x[1])])[0]
+        if isinstance(x, (list, tuple)):
+            return self.calculate_Iq([float(x[0])], [float(x[1])])[0]
         else:
             return self.calculate_Iq([float(x)])[0]
@@ -265,10 +265,10 @@
         :param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays
         """
-        if isinstance(qdist, (list,tuple)):
+        if isinstance(qdist, (list, tuple)):
             # Check whether we have a list of ndarrays [qx,qy]
             qx, qy = qdist
             partype = self._model.info['partype']
             if not partype['orientation'] and not partype['magnetic']:
-                return self.calculate_Iq(np.sqrt(qx**2+qy**2))
+                return self.calculate_Iq(np.sqrt(qx ** 2 + qy ** 2))
             else:
                 return self.calculate_Iq(qx, qy)
@@ -279,5 +279,5 @@
 
         else:
-            raise TypeError("evalDistribution expects q or [qx, qy], not %r"%type(qdist))
+            raise TypeError("evalDistribution expects q or [qx, qy], not %r" % type(qdist))
 
     def calculate_Iq(self, *args):
@@ -313,5 +313,5 @@
             fv = ER(*values)
             #print values[0].shape, weights.shape, fv.shape
-            return np.sum(weights*fv) / np.sum(weights)
+            return np.sum(weights * fv) / np.sum(weights)
 
     def calculate_VR(self):
@@ -327,6 +327,6 @@
             vol_pars = self._model.info['partype']['volume']
             values, weights = self._dispersion_mesh(vol_pars)
-            whole,part = VR(*values)
-            return np.sum(weights*part)/np.sum(weights*whole)
+            whole, part = VR(*values)
+            return np.sum(weights * part) / np.sum(weights * whole)
 
     def set_dispersion(self, parameter, dispersion):
@@ -373,4 +373,8 @@
 
     def _get_weights(self, par):
+        """
+            Return dispersion weights
+            :param par parameter name
+        """
         from . import weights
 
@@ -378,7 +382,7 @@
         limits = self._model.info['limits']
         dis = self.dispersion[par]
-        v,w = weights.get_weights(
+        v, w = weights.get_weights(
             dis['type'], dis['npts'], dis['width'], dis['nsigmas'],
             self.params[par], limits[par], par in relative)
-        return v,w/w.max()
-
+        return v, w / w.max()
+
