Index: sasmodels/kernelpy.py
===================================================================
--- sasmodels/kernelpy.py	(revision c85db69ebc61ae093eb2e72b7a6bf64a0142d56d)
+++ sasmodels/kernelpy.py	(revision 3c56da87f0995bdde77f4183b68e77b81584dde0)
@@ -7,9 +7,13 @@
     def __init__(self, info):
         self.info = info
-    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 __call__(self, q_input):
+        kernel = self.info['Iqxy'] if q_input.is_2D else self.info['Iq']
+        return PyKernel(kernel, self.info, q_input)
+
+    # pylint: disable=no-self-use
     def make_input(self, q_vectors):
         return PyInput(q_vectors, dtype=F64)
+
     def release(self):
         pass
@@ -52,5 +56,5 @@
     *info* is the module information
 
-    *input* is the DllInput q vectors at which the kernel should be
+    *q_input* is the DllInput q vectors at which the kernel should be
     evaluated.
 
@@ -63,9 +67,9 @@
     Call :meth:`release` when done with the kernel instance.
     """
-    def __init__(self, kernel, info, input):
+    def __init__(self, kernel, info, q_input):
         self.info = info
-        self.input = input
-        self.res = np.empty(input.nq, input.dtype)
-        dim = '2d' if input.is_2D else '1d'
+        self.q_input = q_input
+        self.res = np.empty(q_input.nq, q_input.dtype)
+        dim = '2d' if q_input.is_2D else '1d'
         # Loop over q unless user promises that the kernel is vectorized by
         # taggining it with vectorized=True
@@ -73,8 +77,10 @@
             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:
@@ -86,9 +92,12 @@
         # First two fixed pars are scale and background
         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])
+        offset = len(self.q_input.q_vectors)
+        self.args = self.q_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
@@ -113,5 +122,5 @@
 
     def release(self):
-        self.input = None
+        self.q_input = None
 
 def _loops(form, form_volume, cutoff, scale, background,
@@ -194,7 +203,7 @@
             args[pd_index[0]] = fast_value[fast_index]
             weight[0] = fast_weight[fast_index]
-        # This computes the weight, and if it is sufficient, calls the scattering
-        # function and adds it to the total.  If there is a volume normalization,
-        # it will also be added here.
+        # This computes the weight, and if it is sufficient, calls the
+        # scattering function and adds it to the total.  If there is a volume
+        # normalization, it will also be added here.
         # Note: make sure this is consistent with the code in PY_LOOP_BODY!!
         # Note: can precompute w1*w2*...*wn
@@ -204,8 +213,9 @@
             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
+            # Note: can precompute spherical correction if theta_index is not
+            # the fast index. Correction factor for spherical integration
+            #spherical_correction = abs(cos(pi*args[phi_index])) if phi_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
@@ -213,8 +223,8 @@
 
             # Volume normalization.
-            # If there are "volume" polydispersity parameters, then these will be used
-            # to call the form_volume function from the user supplied kernel, and accumulate
-            # a normalized weight.
-            # Note: can precompute volume norm if the fast index is not a volume index
+            # If there are "volume" polydispersity parameters, then these
+            # will be used to call the form_volume function from the user
+            # supplied kernel, and accumulate a normalized weight.
+            # Note: can precompute volume norm if fast index is not a volume
             if form_volume:
                 vol_args = [args[index] for index in vol_index]
