Index: explore/beta/sasfit_compare.py
===================================================================
--- explore/beta/sasfit_compare.py	(revision 01c8d9ebbcedbff594f32ae8a488e9031320e3ba)
+++ explore/beta/sasfit_compare.py	(revision 7b0abf8a1cf121fb3e4733dd887a921fb598a7a0)
@@ -3,6 +3,5 @@
 import sys, os
 BETA_DIR = os.path.dirname(os.path.realpath(__file__))
-#SASMODELS_DIR = os.path.dirname(os.path.dirname(BETA_DIR))
-SASMODELS_DIR = r"C:\Source\sasmodels"
+SASMODELS_DIR = os.path.dirname(os.path.dirname(BETA_DIR))
 sys.path.insert(0, SASMODELS_DIR)
 
@@ -41,7 +40,7 @@
         y = x[index]**2
         c1 = -1.0/10.0
-        c2 =  1.0/280.0
+        c2 = +1.0/280.0
         c3 = -1.0/15120.0
-        c4 =  1.0/1330560.0
+        c4 = +1.0/1330560.0
         c5 = -1.0/172972800.0
         retvalue[index] = 1.0 + y*(c1 + y*(c2 + y*(c3 + y*(c4 + y*c5))))
@@ -67,29 +66,29 @@
 #gives the hardsphere structure factor that sasview uses
 def _hardsphere_simple(q, radius_effective, volfraction):
-    CUTOFFHS=0.05
+    CUTOFFHS = 0.05
     if fabs(radius_effective) < 1.E-12:
-        HARDSPH=1.0
+        HARDSPH = 1.0
         return HARDSPH
-    X = 1.0/( 1.0 -volfraction)
-    D= X*X
-    A= (1.+2.*volfraction)*D
-    A *=A
-    X=fabs(q*radius_effective*2.0)
+    X = 1.0/(1.0 -volfraction)
+    D = X*X
+    A = (1.+2.*volfraction)*D
+    A *= A
+    X = fabs(q*radius_effective*2.0)
     if X < 5.E-06:
-        HARDSPH=1./A
+        HARDSPH = 1./A
         return HARDSPH
-    X2 =X*X
+    X2 = X*X
     B = (1.0 +0.5*volfraction)*D
     B *= B
     B *= -6.*volfraction
-    G=0.5*volfraction*A
+    G = 0.5*volfraction*A
     if X < CUTOFFHS:
         FF = 8.0*A +6.0*B + 4.0*G + ( -0.8*A -B/1.5 -0.5*G +(A/35. +0.0125*B +0.02*G)*X2)*X2
-        HARDSPH= 1./(1. + volfraction*FF )
+        HARDSPH = 1./(1. + volfraction*FF )
         return HARDSPH
-    X4=X2*X2
+    X4 = X2*X2
     S, C = sin(X), cos(X)
-    FF=  (( G*( (4.*X2 -24.)*X*S -(X4 -12.*X2 +24.)*C +24. )/X2 + B*(2.*X*S -(X2-2.)*C -2.) )/X + A*(S-X*C))/X
-    HARDSPH= 1./(1. + 24.*volfraction*FF/X2 )
+    FF =  ((G*( (4.*X2 -24.)*X*S -(X4 -12.*X2 +24.)*C +24. )/X2 + B*(2.*X*S -(X2-2.)*C -2.) )/X + A*(S-X*C))/X
+    HARDSPH = 1./(1. + 24.*volfraction*FF/X2)
     return HARDSPH
 
@@ -107,5 +106,5 @@
         nsigmas = NSIGMA_GAUSS
         x = np.linspace(center-sigma*nsigmas, center+sigma*nsigmas, num=N_GAUSS)
-        x= x[(x >= lb) & (x <= ub)]
+        x = x[(x >= lb) & (x <= ub)]
         px = np.exp((x-center)**2 / (-2.0 * sigma * sigma))
         return x, px
@@ -119,5 +118,5 @@
         nsigmas = NSIGMA_SCHULZ
         x = np.linspace(center-sigma*nsigmas, center+sigma*nsigmas, num=N_SCHULZ)
-        x= x[(x >= lb) & (x <= ub)]
+        x = x[(x >= lb) & (x <= ub)]
         R = x/center
         z = (center/sigma)**2
@@ -137,5 +136,5 @@
     else:
         ee = 2*radius_polar
-    if (radius_polar * radius_equatorial != 0):
+    if radius_polar * radius_equatorial != 0:
         bd = 1.0 - ee
         e1 = np.sqrt(ee)
@@ -148,5 +147,5 @@
     return 0.5*ddd**(1.0 / 3.0)
 
-def ellipsoid_volume(radius_polar,radius_equatorial):
+def ellipsoid_volume(radius_polar, radius_equatorial):
     volume = (4./3.)*pi*radius_polar*radius_equatorial**2
     return volume
@@ -210,5 +209,5 @@
     for k, Rpk in enumerate(Rp_val):
         for i, Rei in enumerate(Re_val):
-            theory = ellipsoid_theta(q,Rpk,Rei,sld,sld_solvent)
+            theory = ellipsoid_theta(q, Rpk, Rei, sld, sld_solvent)
             volume = ellipsoid_volume(Rpk, Rei)
             weight = Rp_prob[k]*Re_prob[i]
@@ -217,5 +216,5 @@
             F1 += theory.F1*weight
             F2 += theory.F2*weight
-            radius_eff += weight*ER_ellipsoid(Rpk,Rei)
+            radius_eff += weight*ER_ellipsoid(Rpk, Rei)
     F1 /= total_weight
     F2 /= total_weight
@@ -344,5 +343,5 @@
     #Sq = Iq/Pq
     #Iq = None#= Sq = None
-    r=I._kernel.results
+    r = I._kernel.results
     return Theory(Q=q, F1=None, F2=None, P=Pq, S=None, I=None, Seff=r[1], Ibeta=Iq)
 
@@ -383,5 +382,5 @@
     model = 'sphere'
     pars = dict(
-        radius=20,sld=4,sld_solvent=1,
+        radius=20, sld=4, sld_solvent=1,
         background=0,
         radius_pd=.1, radius_pd_type=pd_type,
@@ -393,6 +392,6 @@
     title = " ".join(("sasmodels", model, pd_type))
     compare(title, target, actual)
-COMPARISON[('sasview','sphere','gaussian')] = lambda: compare_sasview_sphere(pd_type='gaussian')
-COMPARISON[('sasview','sphere','schulz')] = lambda: compare_sasview_sphere(pd_type='schulz')
+COMPARISON[('sasview', 'sphere', 'gaussian')] = lambda: compare_sasview_sphere(pd_type='gaussian')
+COMPARISON[('sasview', 'sphere', 'schulz')] = lambda: compare_sasview_sphere(pd_type='schulz')
 
 def compare_sasview_ellipsoid(pd_type='gaussian'):
@@ -400,5 +399,5 @@
     model = 'ellipsoid'
     pars = dict(
-        radius_polar=20,radius_equatorial=400,sld=4,sld_solvent=1,
+        radius_polar=20, radius_equatorial=400, sld=4, sld_solvent=1,
         background=0,
         radius_polar_pd=.1, radius_polar_pd_type=pd_type,
@@ -412,6 +411,6 @@
     title = " ".join(("sasmodels", model, pd_type))
     compare(title, target, actual)
-COMPARISON[('sasview','ellipsoid','gaussian')] = lambda: compare_sasview_ellipsoid(pd_type='gaussian')
-COMPARISON[('sasview','ellipsoid','schulz')] = lambda: compare_sasview_ellipsoid(pd_type='schulz')
+COMPARISON[('sasview', 'ellipsoid', 'gaussian')] = lambda: compare_sasview_ellipsoid(pd_type='gaussian')
+COMPARISON[('sasview', 'ellipsoid', 'schulz')] = lambda: compare_sasview_ellipsoid(pd_type='schulz')
 
 def compare_yun_ellipsoid_mono():
@@ -437,6 +436,6 @@
     #compare(title, target, actual, fields="P S I Seff Ibeta")
     compare(title, target, actual)
-COMPARISON[('yun','ellipsoid','gaussian')] = compare_yun_ellipsoid_mono
-COMPARISON[('yun','ellipsoid','schulz')] = compare_yun_ellipsoid_mono
+COMPARISON[('yun', 'ellipsoid', 'gaussian')] = compare_yun_ellipsoid_mono
+COMPARISON[('yun', 'ellipsoid', 'schulz')] = compare_yun_ellipsoid_mono
 
 def compare_yun_sphere_gauss():
@@ -449,5 +448,5 @@
     }
 
-    data = np.loadtxt(data_file('testPolydisperseGaussianSphere.dat'),skiprows=2).T
+    data = np.loadtxt(data_file('testPolydisperseGaussianSphere.dat'), skiprows=2).T
     Q = data[0]
     F1 = data[1]
@@ -460,5 +459,5 @@
     title = " ".join(("yun", "sphere", "10% dispersion 10% Vf"))
     compare(title, target, actual)
-    data = np.loadtxt(data_file('testPolydisperseGaussianSphere2.dat'),skiprows=2).T
+    data = np.loadtxt(data_file('testPolydisperseGaussianSphere2.dat'), skiprows=2).T
     pars.update(radius_pd=0.15)
     Q = data[0]
@@ -472,5 +471,5 @@
     title = " ".join(("yun", "sphere", "15% dispersion 10% Vf"))
     compare(title, target, actual)
-COMPARISON[('yun','sphere','gaussian')] = compare_yun_sphere_gauss
+COMPARISON[('yun', 'sphere', 'gaussian')] = compare_yun_sphere_gauss
 
 
@@ -493,5 +492,5 @@
     compare(title, target, actual)
     #compare(title, target, actual, fields="P")
-COMPARISON[('sasfit','sphere','gaussian')] = compare_sasfit_sphere_gauss
+COMPARISON[('sasfit', 'sphere', 'gaussian')] = compare_sasfit_sphere_gauss
 
 def compare_sasfit_sphere_schulz():
@@ -512,5 +511,5 @@
     title = " ".join(("sasfit", "sphere", "pd=10% schulz"))
     compare(title, target, actual)
-COMPARISON[('sasfit','sphere','schulz')] = compare_sasfit_sphere_schulz
+COMPARISON[('sasfit', 'sphere', 'schulz')] = compare_sasfit_sphere_schulz
 
 def compare_sasfit_ellipsoid_schulz():
@@ -533,5 +532,5 @@
     title = " ".join(("sasfit", "ellipsoid", "pd=10% schulz"))
     compare(title, target, actual)
-COMPARISON[('sasfit','ellipsoid','schulz')] = compare_sasfit_ellipsoid_schulz
+COMPARISON[('sasfit', 'ellipsoid', 'schulz')] = compare_sasfit_ellipsoid_schulz
 
 
@@ -653,5 +652,5 @@
     target = Theory(Q=Q, S=SQ, Seff=SQ_EFF)
     compare("sasfit ellipsoid P(Q) 60% Rp 60% Vf", target, actual); plt.show()
-COMPARISON[('sasfit','ellipsoid','gaussian')] = compare_sasfit_ellipsoid_gaussian
+COMPARISON[('sasfit', 'ellipsoid', 'gaussian')] = compare_sasfit_ellipsoid_gaussian
 
 def main():
