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/models/parallelepiped.py
===================================================================
--- sasmodels/models/parallelepiped.py	(revision a5d0d008778409dd90a86aa3db6037187ed3ff57)
+++ sasmodels/models/parallelepiped.py	(revision 33e91b15304920ad5b2b99b7f595293978770dbe)
@@ -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,10 +96,10 @@
 *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).
 
 """
 
-from numpy import pi, inf
+from numpy import pi, inf, sqrt
 
 name = "parallelepiped"
@@ -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')
 
