Index: test/sasrealspace/test/utest_oriented.py
===================================================================
--- test/sasrealspace/test/utest_oriented.py	(revision aaf5e497ff1af2aa7b8b3d361ab951e2a0ca7c93)
+++ test/sasrealspace/test/utest_oriented.py	(revision 1cdbcd86f80ac59e1681b673122c51157177496f)
@@ -9,49 +9,49 @@
 # Disable "missing docstring" complaint
 # pylint: disable-msg=C0111
-# Disable "too many methods" complaint 
-# pylint: disable-msg=R0904 
-# Disable "could be a function" complaint 
+# Disable "too many methods" complaint
+# pylint: disable-msg=R0904
+# Disable "could be a function" complaint
 # pylint: disable-msg=R0201
 # pylint: disable-msg=W0702
 
-try:
-    import VolumeCanvas
-    print("Testing local version")
-except:
-    print(sys.exc_value)
-    #testing the version that is working on
-    print("Testing installed version")
-    import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas
- 
+from sasmodels.sasview_model import _make_standard_model
+EllipsoidModel = _make_standard_model('ellipsoid')
+SphereModel = _make_standard_model('sphere')
+CylinderModel = _make_standard_model('cylinder')
+CoreShellModel = _make_standard_model('core_shell_sphere')
+
+import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas
+
+
 
 class TestSphere(unittest.TestCase):
     """ Tests for oriented (2D) systems """
-        
+
     def setUp(self):
         """
             Set up canvas
         """
-        from sas.models.SphereModel import SphereModel
         self.model = VolumeCanvas.VolumeCanvas()
-    
+
         handle = self.model.add('sphere')
-        
+
         radius = 10
         density = .1
-        
+
         ana = SphereModel()
         ana.setParam('scale', 1.0)
-        ana.setParam('contrast', 1.0)
         ana.setParam('background', 0.0)
+        ana.setParam('sld', 1.0)
+        ana.setParam('sld_solvent', 0.0)
         ana.setParam('radius', radius)
         self.ana = ana
-        
+
         self.model.setParam('lores_density', density)
+        self.model.setParam('scale' , 1.0)
+        self.model.setParam('background' , 0.0)
+        self.model.setParam('%s.contrast' % handle, 1.0)
         self.model.setParam('%s.radius' % handle, radius)
-        self.model.setParam('scale' , 1.0)
-        self.model.setParam('%s.contrast' % handle, 1.0)
-        self.model.setParam('background' , 0.0)
-        
-        
+
+
     def testdefault(self):
         """ Testing sphere """
@@ -60,23 +60,23 @@
         sim_val = self.model.getIq2D(0.1, 0.1)
         self.assert_( math.fabs(sim_val/ana_val-1.0)<0.1 )
-        
+
 class TestCylinderAddObject(unittest.TestCase):
     """ Tests for oriented (2D) systems """
-        
+
     def setUp(self):
         """ Set up cylinder model """
-        from sas.models.CylinderModel import CylinderModel
         radius = 5
         length = 40
         density = 20
-    
+
         # Analytical model
         self.ana = CylinderModel()
         self.ana.setParam('scale', 1.0)
-        self.ana.setParam('contrast', 1.0)
         self.ana.setParam('background', 0.0)
+        self.ana.setParam('sld', 1.0)
+        self.ana.setParam('sld_solvent', 0.0)
         self.ana.setParam('radius', radius)
         self.ana.setParam('length', length)
-    
+
         # Simulation model
         self.model = VolumeCanvas.VolumeCanvas()
@@ -84,176 +84,175 @@
         self.handle = self.model.addObject(cyl)
         self.model.setParam('lores_density', density)
+        self.model.setParam('scale' , 1.0)
+        self.model.setParam('background' , 0.0)
+        self.model.setParam('%s.contrast' % self.handle, 1.0)
         self.model.setParam('%s.radius' % self.handle, radius)
         self.model.setParam('%s.length' % self.handle, length)
-        self.model.setParam('scale' , 1.0)
-        self.model.setParam('%s.contrast' % self.handle, 1.0)
-        self.model.setParam('background' , 0.0)
-    
+
     def testalongY(self):
         """ Testing cylinder along Y axis """
-        self.ana.setParam('cyl_theta', math.pi/2.0)
-        self.ana.setParam('cyl_phi', math.pi/2.0)
-        
+        self.ana.setParam('theta', math.pi/2.0)
+        self.ana.setParam('phi', math.pi/2.0)
+
         self.model.setParam('%s.orientation' % self.handle, [0,0,0])
-        
-        ana_val = self.ana.runXY([0.1, 0.2])
-        sim_val = self.model.getIq2D(0.1, 0.2)
-        #print ana_val, sim_val, sim_val/ana_val
-        
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        
-        
+
+        ana_val = self.ana.runXY([0.1, 0.2])
+        sim_val = self.model.getIq2D(0.1, 0.2)
+        #print ana_val, sim_val, sim_val/ana_val
+
+        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+
+
 class TestCylinder(unittest.TestCase):
     """ Tests for oriented (2D) systems """
-        
+
     def setUp(self):
         """ Set up cylinder model """
-        from sas.models.CylinderModel import CylinderModel
         radius = 5
         length = 40
         density = 20
-    
+
         # Analytical model
         self.ana = CylinderModel()
         self.ana.setParam('scale', 1.0)
-        self.ana.setParam('contrast', 1.0)
         self.ana.setParam('background', 0.0)
+        self.ana.setParam('sld', 1.0)
+        self.ana.setParam('sld_solvent', 0.0)
         self.ana.setParam('radius', radius)
         self.ana.setParam('length', length)
-    
+
         # Simulation model
         self.model = VolumeCanvas.VolumeCanvas()
         self.handle = self.model.add('cylinder')
         self.model.setParam('lores_density', density)
+        self.model.setParam('scale' , 1.0)
+        self.model.setParam('background' , 0.0)
         self.model.setParam('%s.radius' % self.handle, radius)
         self.model.setParam('%s.length' % self.handle, length)
-        self.model.setParam('scale' , 1.0)
         self.model.setParam('%s.contrast' % self.handle, 1.0)
-        self.model.setParam('background' , 0.0)
-    
+
     def testalongY(self):
         """ Testing cylinder along Y axis """
-        self.ana.setParam('cyl_theta', math.pi/2.0)
-        self.ana.setParam('cyl_phi', math.pi/2.0)
-        
+        self.ana.setParam('theta', math.pi/2.0)
+        self.ana.setParam('phi', math.pi/2.0)
+
         self.model.setParam('%s.orientation' % self.handle, [0,0,0])
-        
-        ana_val = self.ana.runXY([0.1, 0.2])
-        sim_val = self.model.getIq2D(0.1, 0.2)
-        #print ana_val, sim_val, sim_val/ana_val
-        
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        
+
+        ana_val = self.ana.runXY([0.1, 0.2])
+        sim_val = self.model.getIq2D(0.1, 0.2)
+        #print ana_val, sim_val, sim_val/ana_val
+
+        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+
     def testalongZ(self):
         """ Testing cylinder along Z axis """
-        self.ana.setParam('cyl_theta', 0)
-        self.ana.setParam('cyl_phi', 0)
-        
+        self.ana.setParam('theta', 0)
+        self.ana.setParam('phi', 0)
+
         self.model.setParam('%s.orientation' % self.handle, [90,0,0])
-        
-        ana_val = self.ana.runXY([0.1, 0.2])
-        sim_val = self.model.getIq2D(0.1, 0.2)
-        #print ana_val, sim_val, sim_val/ana_val
-        
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        
+
+        ana_val = self.ana.runXY([0.1, 0.2])
+        sim_val = self.model.getIq2D(0.1, 0.2)
+        #print ana_val, sim_val, sim_val/ana_val
+
+        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+
     def testalongX(self):
         """ Testing cylinder along X axis """
-        self.ana.setParam('cyl_theta', 1.57)
-        self.ana.setParam('cyl_phi', 0)
-        
+        self.ana.setParam('theta', 1.57)
+        self.ana.setParam('phi', 0)
+
         self.model.setParam('%s.orientation' % self.handle, [0,0,90])
-        
-        ana_val = self.ana.runXY([0.1, 0.2])
-        sim_val = self.model.getIq2D(0.1, 0.2)
-        #print ana_val, sim_val, sim_val/ana_val
-        
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        
+
+        ana_val = self.ana.runXY([0.1, 0.2])
+        sim_val = self.model.getIq2D(0.1, 0.2)
+        #print ana_val, sim_val, sim_val/ana_val
+
+        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+
 class TestEllipsoid(unittest.TestCase):
     """ Tests for oriented (2D) systems """
-        
+
     def setUp(self):
         """ Set up ellipsoid """
-        from sas.models.EllipsoidModel import EllipsoidModel
-        
+
         radius_a = 60
         radius_b = 10
         density = 30
-        
+
         self.ana = EllipsoidModel()
         self.ana.setParam('scale', 1.0)
-        self.ana.setParam('contrast', 1.0)
         self.ana.setParam('background', 0.0)
-        self.ana.setParam('radius_a', radius_a)
-        self.ana.setParam('radius_b', radius_b)
+        self.ana.setParam('sld', 1.0)
+        self.ana.setParam('sld_solvent', 0.0)
+        self.ana.setParam('radius_polar', radius_a)
+        self.ana.setParam('radius_equatorial', radius_b)
         # Default orientation is there=1.57, phi=0
         # Radius_a is along the x direction
-       
+
         canvas = VolumeCanvas.VolumeCanvas()
+        self.handle = canvas.add('ellipsoid')
         canvas.setParam('lores_density', density)
-        self.handle = canvas.add('ellipsoid')
+        canvas.setParam('scale' , 1.0)
+        canvas.setParam('background' , 0.0)
         canvas.setParam('%s.radius_x' % self.handle, radius_a)
         canvas.setParam('%s.radius_y' % self.handle, radius_b)
         canvas.setParam('%s.radius_z' % self.handle, radius_b)
-        canvas.setParam('scale' , 1.0)
         canvas.setParam('%s.contrast' % self.handle, 1.0)
-        canvas.setParam('background' , 0.0)
-        self.canvas = canvas        
+        self.canvas = canvas
 
     def testalongX(self):
         """ Testing ellipsoid along X """
-        self.ana.setParam('axis_theta', 1.57)
-        self.ana.setParam('axis_phi', 0)
-        
+        self.ana.setParam('theta', 1.57)
+        self.ana.setParam('phi', 0)
+
         self.canvas.setParam('%s.orientation' % self.handle, [0,0,0])
-        
+
         ana_val = self.ana.runXY([0.1, 0.2])
         sim_val = self.canvas.getIq2D(0.1, 0.2)
         #print ana_val, sim_val, sim_val/ana_val
-        
+
         self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
     def testalongZ(self):
         """ Testing ellipsoid along Z """
-        self.ana.setParam('axis_theta', 0)
-        self.ana.setParam('axis_phi', 0)
-        
+        self.ana.setParam('theta', 0)
+        self.ana.setParam('phi', 0)
+
         self.canvas.setParam('%s.orientation' % self.handle, [0,90,0])
-        
+
         ana_val = self.ana.runXY([0.1, 0.2])
         sim_val = self.canvas.getIq2D(0.1, 0.2)
         #print ana_val, sim_val, sim_val/ana_val
-        
+
         self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
 
     def testalongY(self):
         """ Testing ellipsoid along Y """
-        self.ana.setParam('axis_theta', math.pi/2.0)
-        self.ana.setParam('axis_phi', math.pi/2.0)
-        
+        self.ana.setParam('theta', math.pi/2.0)
+        self.ana.setParam('phi', math.pi/2.0)
+
         self.canvas.setParam('%s.orientation' % self.handle, [0,0,90])
-        
+
         ana_val = self.ana.runXY([0.05, 0.15])
         sim_val = self.canvas.getIq2D(0.05, 0.15)
         #print ana_val, sim_val, sim_val/ana_val
-        
+
         try:
             self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        except:
+        except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
-            raise sys.exc_type, sys.exc_value
+            raise
 
 class TestCoreShell(unittest.TestCase):
     """ Tests for oriented (2D) systems """
-        
+
     def setUp(self):
         """ Set up zero-SLD-average core-shell model """
-        from sas.models.CoreShellModel import CoreShellModel
-        
+
         radius = 15
         thickness = 5
         density = 20
-        
+
         core_vol = 4.0/3.0*math.pi*radius*radius*radius
         self.outer_radius = radius+thickness
@@ -262,51 +261,50 @@
 
         self.density = density
-           
+
         # Core-shell
         sphere = CoreShellModel()
+        sphere.setParam('scale', 1.0)
+        sphere.setParam('background', 0.0)
         # Core radius
         sphere.setParam('radius', radius)
         # Shell thickness
         sphere.setParam('thickness', thickness)
-        sphere.setParam('core_sld', 1.0)
-        sphere.setParam('shell_sld', self.shell_sld)
-        sphere.setParam('solvent_sld', 0.0)
-        sphere.setParam('background', 0.0)
-        sphere.setParam('scale', 1.0)
+        sphere.setParam('sld_core', 1.0)
+        sphere.setParam('sld_shell', self.shell_sld)
+        sphere.setParam('sld_solvent', 0.0)
         self.ana = sphere
-       
-        canvas = VolumeCanvas.VolumeCanvas()        
+
+        canvas = VolumeCanvas.VolumeCanvas()
         canvas.setParam('lores_density', self.density)
-        
+        canvas.setParam('scale' , 1.0)
+        canvas.setParam('background' , 0.0)
+
         handle = canvas.add('sphere')
         canvas.setParam('%s.radius' % handle, self.outer_radius)
         canvas.setParam('%s.contrast' % handle, self.shell_sld)
-       
+
         handle2 = canvas.add('sphere')
         canvas.setParam('%s.radius' % handle2, radius)
         canvas.setParam('%s.contrast' % handle2, 1.0)
-               
-        canvas.setParam('scale' , 1.0)
-        canvas.setParam('background' , 0.0)
-        self.canvas = canvas 
-           
+
+        self.canvas = canvas
+
     def testdefault(self):
         """ Testing default core-shell orientation """
         ana_val = self.ana.runXY([0.1, 0.2])
         sim_val, err = self.canvas.getIq2DError(0.1, 0.2)
-        
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-                   
+
+        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+
 class TestCoreShellError(unittest.TestCase):
     """ Tests for oriented (2D) systems """
-        
+
     def setUp(self):
         """ Set up zero-SLD-average core-shell model """
-        from sas.models.CoreShellModel import CoreShellModel
-        
+
         radius = 15
         thickness = 5
         density = 5
-        
+
         core_vol = 4.0/3.0*math.pi*radius*radius*radius
         self.outer_radius = radius+thickness
@@ -315,38 +313,38 @@
 
         self.density = density
-           
+
         # Core-shell
         sphere = CoreShellModel()
+        sphere.setParam('scale', 1.0)
+        sphere.setParam('background', 0.0)
         # Core radius
         sphere.setParam('radius', radius)
         # Shell thickness
         sphere.setParam('thickness', thickness)
-        sphere.setParam('core_sld', 1.0)
-        sphere.setParam('shell_sld', self.shell_sld)
-        sphere.setParam('solvent_sld', 0.0)
-        sphere.setParam('background', 0.0)
-        sphere.setParam('scale', 1.0)
+        sphere.setParam('sld_core', 1.0)
+        sphere.setParam('sld_shell', self.shell_sld)
+        sphere.setParam('sld_solvent', 0.0)
         self.ana = sphere
-       
-        canvas = VolumeCanvas.VolumeCanvas()        
+
+        canvas = VolumeCanvas.VolumeCanvas()
         canvas.setParam('lores_density', self.density)
-        
+        canvas.setParam('scale' , 1.0)
+        canvas.setParam('background' , 0.0)
+
         handle = canvas.add('sphere')
         canvas.setParam('%s.radius' % handle, self.outer_radius)
         canvas.setParam('%s.contrast' % handle, self.shell_sld)
-       
+
         handle2 = canvas.add('sphere')
         canvas.setParam('%s.radius' % handle2, radius)
         canvas.setParam('%s.contrast' % handle2, 1.0)
-               
-        canvas.setParam('scale' , 1.0)
-        canvas.setParam('background' , 0.0)
-        self.canvas = canvas 
-                   
+
+        self.canvas = canvas
+
     def testdefault(self):
         """ Testing default core-shell orientation """
         ana_val = self.ana.runXY([0.1, 0.2])
         sim_val, err = self.canvas.getIq2DError(0.1, 0.2)
-        
+
         self.assert_( math.fabs(sim_val-ana_val) < 3.0 * err )
 
@@ -356,34 +354,34 @@
     def setUp(self):
         """ Set up ellipsoid """
-        from sas.models.EllipsoidModel import EllipsoidModel
-        
+
         radius_a = 10
         radius_b = 15
         density = 5
-        
+
         self.ana = EllipsoidModel()
         self.ana.setParam('scale', 1.0)
-        self.ana.setParam('contrast', 1.0)
         self.ana.setParam('background', 0.0)
-        self.ana.setParam('radius_a', radius_a)
-        self.ana.setParam('radius_b', radius_b)
-
-       
+        self.ana.setParam('sld', 1.0)
+        self.ana.setParam('sld_solvent', 1.0)
+        self.ana.setParam('radius_polar', radius_a)
+        self.ana.setParam('radius_equatorial', radius_b)
+
+
         canvas = VolumeCanvas.VolumeCanvas()
+        self.handle = canvas.add('ellipsoid')
         canvas.setParam('lores_density', density)
-        self.handle = canvas.add('ellipsoid')
+        canvas.setParam('scale' , 1.0)
+        canvas.setParam('background' , 0.0)
         canvas.setParam('%s.radius_x' % self.handle, radius_a)
         canvas.setParam('%s.radius_y' % self.handle, radius_b)
         canvas.setParam('%s.radius_z' % self.handle, radius_b)
-        canvas.setParam('scale' , 1.0)
         canvas.setParam('%s.contrast' % self.handle, 1.0)
-        canvas.setParam('background' , 0.0)
-        self.canvas = canvas     
-           
-        self.ana.setParam('axis_theta', 1.57)
-        self.ana.setParam('axis_phi', 0)
-        
+        self.canvas = canvas
+
+        self.ana.setParam('theta', 1.57)
+        self.ana.setParam('phi', 0)
+
         self.canvas.setParam('%s.orientation' % self.handle, [0,0,0])
-        
+
 
     def testRunXY_List(self):
@@ -392,10 +390,10 @@
         sim_val = self.canvas.runXY([0.1, 0.2])
         #print ana_val, sim_val, sim_val/ana_val
-        
+
         try:
             self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        except:
+        except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
-            raise sys.exc_type, sys.exc_value
+            raise
 
     def testRunXY_float(self):
@@ -404,10 +402,10 @@
         sim_val = self.canvas.runXY(0.1)
         #print ana_val, sim_val, sim_val/ana_val
-        
+
         try:
             self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        except:
+        except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
-            raise sys.exc_type, sys.exc_value
+            raise
 
     def testRun_float(self):
@@ -416,10 +414,10 @@
         sim_val = self.canvas.run(0.1)
         #print ana_val, sim_val, sim_val/ana_val
-        
+
         try:
             self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        except:
+        except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
-            raise sys.exc_type, sys.exc_value
+            raise
 
     def testRun_list(self):
@@ -428,42 +426,42 @@
         sim_val = self.canvas.run([0.1, 33.0])
         #print ana_val, sim_val, sim_val/ana_val
-        
+
         try:
             self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        except:
+        except Exception:
             print("Error", ana_val, sim_val, sim_val/ana_val)
-            raise sys.exc_type, sys.exc_value
+            raise
 
 class TestParamChange(unittest.TestCase):
     """ Tests for oriented (2D) systems """
-        
+
     def setUp(self):
         """ Set up cylinder model """
-        from sas.models.CylinderModel import CylinderModel
         radius = 5
         length = 40
         density = 20
-    
+
         # Analytical model
         self.ana = CylinderModel()
         self.ana.setParam('scale', 1.0)
-        self.ana.setParam('contrast', 1.0)
         self.ana.setParam('background', 0.0)
+        self.ana.setParam('sld', 1.0)
+        self.ana.setParam('sld_solvent', 0.0)
         self.ana.setParam('radius', radius)
         self.ana.setParam('length', length)
-        self.ana.setParam('cyl_theta', math.pi/2.0)
-        self.ana.setParam('cyl_phi', math.pi/2.0)
-    
+        self.ana.setParam('theta', math.pi/2.0)
+        self.ana.setParam('phi', math.pi/2.0)
+
         # Simulation model
         self.model = VolumeCanvas.VolumeCanvas()
         self.handle = self.model.add('cylinder')
         self.model.setParam('lores_density', density)
+        self.model.setParam('scale' , 1.0)
+        self.model.setParam('background' , 0.0)
         self.model.setParam('%s.radius' % self.handle, radius)
         self.model.setParam('%s.length' % self.handle, length)
-        self.model.setParam('scale' , 1.0)
         self.model.setParam('%s.contrast' % self.handle, 1.0)
-        self.model.setParam('background' , 0.0)
         self.model.setParam('%s.orientation' % self.handle, [0,0,0])
-    
+
     def testalongY(self):
         """ Test that a parameter change forces the generation
@@ -472,11 +470,11 @@
         ana_val = self.ana.runXY([0.1, 0.2])
         sim_val = self.model.getIq2D(0.1, 0.2)
-        
-        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
-        
+
+        self.assert_( math.fabs(sim_val/ana_val-1.0)<0.05 )
+
         # Change the radius a re-evaluate
         self.ana.setParam('radius', 10)
         self.model.setParam('%s.radius' % self.handle, 10)
-        
+
         ana_val = self.ana.runXY([0.1, 0.2])
         sim_val = self.model.getIq2D(0.1, 0.2)
@@ -485,3 +483,3 @@
 
 if __name__ == '__main__':
-    unittest.main()        
+    unittest.main()
Index: test/sasrealspace/test/utest_realspace.py
===================================================================
--- test/sasrealspace/test/utest_realspace.py	(revision aaf5e497ff1af2aa7b8b3d361ab951e2a0ca7c93)
+++ test/sasrealspace/test/utest_realspace.py	(revision 1cdbcd86f80ac59e1681b673122c51157177496f)
@@ -9,22 +9,20 @@
 # Disable "missing docstring" complaint
 # pylint: disable-msg=C0111
-# Disable "too many methods" complaint 
-# pylint: disable-msg=R0904 
-# Disable "could be a function" complaint 
+# Disable "too many methods" complaint
+# pylint: disable-msg=R0904
+# Disable "could be a function" complaint
 # pylint: disable-msg=R0201
 
-try:
-    import VolumeCanvas
-    print("Testing local version")
-except:
-    import sys
-    print(sys.exc_value)
-    #testing the version that is working on
-    print("Testing installed version")
-    import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas
-     
+from sasmodels.sasview_model import _make_standard_model
+EllipsoidModel = _make_standard_model('ellipsoid')
+SphereModel = _make_standard_model('sphere')
+CylinderModel = _make_standard_model('cylinder')
+CoreShellModel = _make_standard_model('core_shell_sphere')
+
+import sas.sascalc.realspace.VolumeCanvas as VolumeCanvas
+
 class TestRealSpaceModel(unittest.TestCase):
     """ Unit tests for sphere model """
-    
+
     def setUp(self):
         self.model = VolumeCanvas.VolumeCanvas()
@@ -33,7 +31,7 @@
         self.model.add('ellipsoid', 'elli')
         self.model.add('singlehelix', 'shelix')
-        
+
     def testAdding(self):
-        self.assertEqual('cyl', self.model.add('cylinder', 'cyl'))   
+        self.assertEqual('cyl', self.model.add('cylinder', 'cyl'))
 
     def testDeleting(self):
@@ -55,5 +53,5 @@
         #print "pr is calculated", self.model.hasPr
         result = self.model.getIq(0.1)
-        #print "I(0.1) is calculated: ", result       
+        #print "I(0.1) is calculated: ", result
 
 class TestSphere(unittest.TestCase):
@@ -62,13 +60,13 @@
     def setUp(self):
         self.canvas = VolumeCanvas.VolumeCanvas()
-        
-        
+
+
     def testSetQmax(self):
         old_value = self.canvas.getParam('q_max')
         new_value = old_value + 0.1
         self.canvas.setParam('q_max', new_value)
-        self.assertEqual(self.canvas.getParam("Q_MAx"), new_value)         
-        
-    def testSetDensity(self):        
+        self.assertEqual(self.canvas.getParam("Q_MAx"), new_value)
+
+    def testSetDensity(self):
         self.canvas.setParam('lores_density', 0.1)
         handle = self.canvas.add('sphere')
@@ -77,22 +75,22 @@
         npts_1 = vol/0.1
         value_1 = self.canvas.getIq(0.001)
-        
+
         # Change density, the answer should be the same
         self.canvas.setParam('lores_density', 0.2)
         npts_2 = vol/0.2
         value_2 = self.canvas.getIq(0.001)
-        
-        self.assert_( (value_1-value_2)/value_1 < 0.1)         
-        
-    def testSetDensityTiming(self):      
+
+        self.assert_( (value_1-value_2)/value_1 < 0.1)
+
+    def testSetDensityTiming(self):
         """Testing change in computation time with density"""
         handle = self.canvas.add('sphere')
         self.canvas.setParam("%s.radius" % handle, 15.0)
-        
+
         self.canvas.setParam('lores_density', 0.6)
         t_0 = time.time()
         self.canvas.getIq(0.001)
         t_1 = time.time()-t_0
-        
+
         # Change density, the answer should be the same
         self.canvas.setParam('lores_density', 0.1)
@@ -100,62 +98,62 @@
         self.canvas.getIq(0.001)
         t_2 = time.time()-t_0
-        
-        self.assert_( t_2 < t_1 and (t_1-t_2)/t_2 > 2)         
-        
+
+        self.assert_( t_2 < t_1 and (t_1-t_2)/t_2 > 2)
+
     def testGetParamList(self):
         """ Test GetParamList on empty canvas"""
         self.assert_('lores_density' in self.canvas.getParamList())
         handle = self.canvas.add('sphere')
-        
+
     def testGetParamListWithShape(self):
         """ Test GetParamList on filled canvas"""
         self.canvas.add('sphere')
         self.assert_('lores_density' in self.canvas.getParamList())
-        
+
     def testAdd(self):
         handle = "s1"
         self.assertEqual(handle, self.canvas.add('sphere', handle))
- 
+
         #TODO: test for current list of shape
         self.assertEqual( [handle] , self.canvas.getShapeList())
-        
+
     def testSetRadius(self):
         handle = self.canvas.add('sphere')
-        self.canvas.setParam("%s.rAdius" % handle, 24.0)
-        self.assertEqual(self.canvas.getParam("%s.rAdius" % handle), 24.0)
+        self.canvas.setParam("%s.radius" % handle, 24.0)
+        self.assertEqual(self.canvas.getParam("%s.radius" % handle), 24.0)
 
     def testGetIq(self):
         """ Test the output of I(q) to the analytical solution
             If the normalization is wrong, we will have to fix it.
-            
+
             getIq() should call getPr() behind the scenes so that
             the user doesnt have to do it if he doesn't need to.
         """
-        from sas.models.SphereModel import SphereModel
         sphere = SphereModel()
+        sphere.setParam('scale', 1.0)
+        sphere.setParam('background', 0.0)
+        sphere.setParam('sld', 1.0)
+        sphere.setParam('sld_solvent', 0.0)
         sphere.setParam('radius', 10.0)
-        sphere.setParam('contrast', 1.0)
-        sphere.setParam('background', 0.0)
-        sphere.setParam('scale', 1.0)
-                
+
         handle = self.canvas.add('sphere')
         self.canvas.setParam('%s.radius' % handle, 10.0)
         self.canvas.setParam('%s.contrast' % handle, 1.0)
-        
-        
+
+
         sim_1 = self.canvas.getIq(0.001)
         ana_1 = sphere.run(0.001)
         sim_2 = self.canvas.getIq(0.01)
         ana_2 = sphere.run(0.01)
-        
-        # test the shape of the curve (calculate relative error 
+
+        # test the shape of the curve (calculate relative error
         # on the output and it should be compatible with zero
         # THIS WILL DEPEND ON THE NUMBER OF SPACE POINTS:
         # that why we need some error analysis.
         self.assert_( (sim_2*ana_1/sim_1 - ana_2)/ana_2 < 0.1)
-        
+
         # test the absolute amplitude
         self.assert_( math.fabs(sim_2-ana_2)/ana_2 < 0.1)
-        
+
     def testGetIq2(self):
         """ Test two different q values
@@ -163,10 +161,10 @@
         handle = self.canvas.add('sphere')
         self.canvas.setParam('%s.radius' % handle, 10.0)
-        
+
         sim_1 = self.canvas.getIq(0.001)
         sim_2 = self.canvas.getIq(0.01)
-        
+
         self.assertNotAlmostEqual(sim_2, sim_1, 3)
-        
+
     def testGetIq_Identical(self):
         """ Test for identical model / no param change
@@ -174,10 +172,10 @@
         handle = self.canvas.add('sphere')
         self.canvas.setParam('%s.radius' % handle, 10.0)
-        
+
         sim_1 = self.canvas.getIq(0.01)
         sim_2 = self.canvas.getIq(0.01)
-        
+
         self.assertEqual(sim_2, sim_1)
-        
+
     def testGetIq_Identical2(self):
         """ Test for identical model after a parameter change
@@ -187,17 +185,17 @@
         handle = self.canvas.add('sphere')
         self.canvas.setParam('%s.radius' % handle, 10.0)
-        
+
         self.canvas.setParam('lores_density', 0.1)
         sim_1 = self.canvas.getIq(0.01)
-        
+
         # Try to fool the code by changing to a different value
         self.canvas.setParam('lores_density', 0.2)
         self.canvas.getIq(0.01)
-        
-        self.canvas.setParam('lores_density', 0.1)
-        sim_2 = self.canvas.getIq(0.01)
-        
+
+        self.canvas.setParam('lores_density', 0.1)
+        sim_2 = self.canvas.getIq(0.01)
+
         self.assert_((sim_2-sim_1)/sim_1<0.05)
-        
+
     def testGetIq_time(self):
         """ Time profile
@@ -205,20 +203,20 @@
         handle = self.canvas.add('sphere')
         self.canvas.setParam('%s.radius' % handle, 15.0)
-        
-        
+
+
         self.canvas.setParam('lores_density', 0.1)
         t_0 = time.time()
         sim_1 = self.canvas.getIq(0.01)
         delta_1 = time.time()-t_0
-        
-        self.canvas.setParam('lores_density', 0.1)
-        
+
+        self.canvas.setParam('lores_density', 0.1)
+
         t_0 = time.time()
         sim_2 = self.canvas.getIq(0.01)
         delta_2 = time.time()-t_0
-        
+
         self.assert_((delta_2-delta_1)/delta_1<0.05)
-        
-        
+
+
     def testGetPr(self):
         """Compare the output of P(r) to the theoretical value"""
@@ -231,5 +229,5 @@
             get the right output after changing a parameter
         """
-        
+
         handle = self.canvas.add('sphere')
         self.canvas.setParam('%s.radius' % handle, 10.0)
@@ -291,10 +289,9 @@
         result_3 = self.canvas.getIq(0.1)
         self.assertNotEqual(result_1, result_3)
-        
+
 class TestOrdering(unittest.TestCase):
     """ Unit tests for all shapes in canvas model """
 
     def setUp(self):
-        from sas.models.CoreShellModel import CoreShellModel
         radius = 15
         thickness = 5
@@ -303,31 +300,34 @@
         shell_vol = 4.0/3.0*math.pi*outer_radius*outer_radius*outer_radius - core_vol
         self.shell_sld = -1.0*core_vol/shell_vol
-        
+
         self.canvas = VolumeCanvas.VolumeCanvas()
         self.canvas.params['lores_density'] = 0.1
-        
+
         # Core shell model
         sphere = CoreShellModel()
+        sphere.setParam('scale', 1.0)
+        sphere.setParam('background', 0.0)
+        sphere.setParam('sld_core', 1.0)
+        sphere.setParam('sld_shell', self.shell_sld)
+        sphere.setParam('sld_solvent', 0.0)
         # Core radius
         sphere.setParam('radius', radius)
         # Shell thickness
         sphere.setParam('thickness', thickness)
-        sphere.setParam('core_sld', 1.0)
-        sphere.setParam('shell_sld', self.shell_sld)
-        sphere.setParam('solvent_sld', 0.0)
-        sphere.setParam('background', 0.0)
-        sphere.setParam('scale', 1.0)
         self.sphere = sphere
         self.radius = radius
         self.outer_radius = outer_radius
-        
+
     def set_coreshell_on_canvas(self, order1=None, order2=None):
 
         handle = self.canvas.add('sphere')
+        self.canvas.setParam('scale' , 1.0)
+        self.canvas.setParam('background' , 0.0)
+
         self.canvas.setParam('%s.radius' % handle, self.outer_radius)
         self.canvas.setParam('%s.contrast' % handle, self.shell_sld)
         if order1 is not None:
             self.canvas.setParam('%s.order' % handle, order1)
-       
+
         handle2 = self.canvas.add('sphere')
         self.canvas.setParam('%s.radius' % handle2, self.radius)
@@ -335,43 +335,37 @@
         if order2 is not None:
             self.canvas.setParam('%s.order' % handle2, order2)
-               
-        self.canvas.setParam('scale' , 1.0)
-        self.canvas.setParam('background' , 0.0)
-        
-        
+
+
     def testDefaultOrder(self):
         self.set_coreshell_on_canvas()
-        
+
         ana = self.sphere.run(0.05)
         val, err = self.canvas.getIqError(0.05)
         self.assert_(math.fabs(ana-val)<2.0*err)
-        
+
     def testRightOrder(self):
         self.set_coreshell_on_canvas(3.0, 6.0)
-        
+
         ana = self.sphere.run(0.05)
         val, err = self.canvas.getIqError(0.05)
         #print 'right', ana, val, err
         self.assert_(math.fabs(ana-val)/ana < 1.1)
-        
+
     def testWrongOrder(self):
-        from sas.models.SphereModel import SphereModel
         self.set_coreshell_on_canvas(1, 0)
-        
-        # Core shell model
+
         sphere = SphereModel()
-        # Core radius
+        sphere.setParam('scale', 1.0)
+        sphere.setParam('background', 0.0)
         sphere.setParam('radius', self.outer_radius)
-        # Shell thickness
-        sphere.setParam('contrast', self.shell_sld)
-        sphere.setParam('background', 0.0)
-        sphere.setParam('scale', 1.0)
-        
+        sphere.setParam('sld', self.shell_sld)
+        sphere.setParam('sld_solvent', 0.0)
+
         ana = sphere.run(0.05)
         val, err = self.canvas.getIqError(0.05)
         #print 'wrong', ana, val, err
         self.assert_(math.fabs(ana-val)/ana < 1.1)
-            
-        
+
+
 if __name__ == '__main__':
     unittest.main()
