Index: nsmodels/src/sans/models/test/CMSphere5.txt
===================================================================
--- sansmodels/src/sans/models/test/CMSphere5.txt	(revision 458c93012c3d10917123fcc7df826c1ce162fb12)
+++ 	(revision )
@@ -1,100 +1,0 @@
-0.001278	54.9380924003798	37.0601175120843	0.0002847	0.001309	0.9969
-0.001562	55.9867418157196	18.7060721785266	0.0002905	0.001586	1
-0.001846	53.560827622232	12.1975438809796	0.0002956	0.001866	1
-0.00213	56.0611368219615	9.35924816875345	0.0003017	0.002147	1
-0.002414	54.9105450986387	7.41016498457617	0.0003087	0.002429	1
-0.002698	52.6206676026623	6.045008707986	0.0003165	0.002712	1
-0.002982	54.3487185926871	5.26582738584293	0.0003249	0.002994	1
-0.003266	53.1519252869778	4.55658543376789	0.000334	0.003277	1
-0.00355	50.3956985471045	3.94388487999297	0.0003437	0.00356	1
-0.003834	52.3077243923509	3.61620396245673	0.0003539	0.003843	1
-0.004118	48.9775315111468	3.18108860178174	0.0003646	0.004127	1
-0.004402	47.851863958769	2.88229340467268	0.0003757	0.00441	1
-0.004686	48.120403795601	2.66803353208751	0.0003872	0.004694	1
-0.00497	46.6358007278057	2.43894320769947	0.000399	0.004977	1
-0.005253	46.7096327873935	2.27814819504774	0.0004112	0.005261	1
-0.005537	44.7668346304486	2.0908757003657	0.0004237	0.005544	1
-0.005821	44.5102618760759	1.9622356317224	0.0004365	0.005828	1
-0.006105	43.8317929116779	1.83904398707451	0.0004495	0.006111	1
-0.006389	42.8115820491762	1.7218568467313	0.0004628	0.006395	1
-0.006673	40.6287017456067	1.59351619354822	0.0004762	0.006679	1
-0.006957	38.9273825772724	1.48551934346209	0.0004899	0.006963	1
-0.007241	39.4347686851588	1.42720701725474	0.0005037	0.007246	1
-0.007525	37.3896037689509	1.32928345624222	0.0005177	0.00753	1
-0.007809	35.6306787321893	1.24357164292396	0.0005318	0.007814	1
-0.008093	35.530501695638	1.19214934795332	0.0005461	0.008098	1
-0.008377	34.0993161167952	1.12297345606099	0.0005605	0.008381	1
-0.008661	32.9897133648153	1.06364208149705	0.000575	0.008665	1
-0.008945	32.1518950821748	1.01254716257906	0.0005896	0.008949	1
-0.009229	29.8897142444819	0.942611834366517	0.0006044	0.009233	1
-0.009513	28.9877911868164	0.897338521326267	0.0006192	0.009517	1
-0.009797	28.8671346812142	0.866582969308467	0.0006341	0.0098	1
-0.01008	26.9433496519676	0.811046621571466	0.0006491	0.01008	1
-0.01036	26.6574283650013	0.782285336779699	0.0006641	0.01037	1
-0.01065	24.3082221946571	0.725049547803642	0.0006793	0.01065	1
-0.01093	23.8126250954449	0.697116877376645	0.0006945	0.01094	1
-0.01122	23.1785075655241	0.668667535089826	0.0007097	0.01122	1
-0.0115	21.9740009615986	0.633465328879644	0.0007251	0.0115	1
-0.01178	20.6925854394778	0.59854083649735	0.0007404	0.01179	1
-0.01207	19.7807301988479	0.570199138755696	0.0007558	0.01207	1
-0.01235	18.3816218241588	0.535922420693967	0.0007713	0.01235	1
-0.01264	18.3908707649353	0.522982665113434	0.0007868	0.01264	1
-0.01292	16.6161700838934	0.485273055949626	0.0008024	0.01292	1
-0.0132	16.0777395370208	0.466244845015208	0.000818	0.01321	1
-0.01349	15.263459197006	0.443959969486881	0.0008336	0.01349	1
-0.01377	14.1821386233677	0.418435336883356	0.0008493	0.01377	1
-0.01406	13.502938686688	0.399416793154326	0.000865	0.01406	1
-0.01434	12.7120240406905	0.379297079863246	0.0008807	0.01434	1
-0.01462	12.3555872971682	0.366151201613803	0.0008965	0.01463	1
-0.01491	11.2547046019901	0.342326858530752	0.0009123	0.01491	1
-0.01519	10.9244250567462	0.330521180210077	0.0009281	0.01519	1
-0.01547	10.035672955121	0.310579708660702	0.000944	0.01548	1
-0.01576	9.54857095265672	0.297122712018445	0.0009598	0.01576	1
-0.01604	9.13262277183969	0.285096505677118	0.0009757	0.01604	1
-0.01633	8.08125471450095	0.263218034782734	0.0009916	0.01633	1
-0.01661	7.81396931095573	0.25412252707745	0.001008	0.01661	1
-0.01689	7.15622633154717	0.238849321076674	0.001024	0.0169	1
-0.01718	6.58315875573461	0.225067254333071	0.001039	0.01718	1
-0.01746	6.43230960958337	0.218637916921313	0.001055	0.01746	1
-0.01774	5.90542211293399	0.205941307480525	0.001071	0.01775	1
-0.01803	5.4581186471037	0.194688473505747	0.001088	0.01803	1
-0.01831	5.22827912984443	0.187421561660762	0.001104	0.01831	1
-0.0186	4.88437306640718	0.178230788618277	0.00112	0.0186	1
-0.01888	4.42899966633438	0.167025306994807	0.001136	0.01888	1
-0.01916	4.17549684846924	0.159640879027805	0.001152	0.01917	1
-0.01945	3.78069785571845	0.149569359258851	0.001168	0.01945	1
-0.01973	3.57736677843592	0.143287334425684	0.001184	0.01973	1
-0.02002	3.32715311708635	0.136123026207964	0.0012	0.02002	1
-0.0203	3.0976943461779	0.129413735491718	0.001216	0.0203	1
-0.02058	2.8778429506358	0.122929031089926	0.001232	0.02058	1
-0.02087	2.59549794256613	0.115075351147255	0.001249	0.02087	1
-0.02115	2.34203393868523	0.107772572065675	0.001265	0.02115	1
-0.02143	2.23234126433142	0.103757094440139	0.001281	0.02144	1
-0.02172	2.06670267290386	0.0984659657480468	0.001297	0.02172	1
-0.022	1.96040951516539	0.0946044762011819	0.001313	0.022	1
-0.02228	1.77196064410215	0.088743341386574	0.001329	0.02229	1
-0.02257	1.63708077448337	0.0841766166945712	0.001346	0.02257	1
-0.02285	1.53159863781081	0.0803621902602349	0.001362	0.02285	1
-0.02314	1.42479800116411	0.0765159633096708	0.001378	0.02314	1
-0.02342	1.34419916363248	0.073379495822172	0.001394	0.02342	1
-0.0237	1.28950309519543	0.0709726811217327	0.001411	0.0237	1
-0.02399	1.18575259309099	0.0672174491013361	0.001427	0.02399	1
-0.02427	1.11661367746353	0.0644328918452755	0.001443	0.02427	1
-0.02455	1.03725820906637	0.0613529362624028	0.001459	0.02456	1
-0.02484	0.963936666624243	0.0584406406908292	0.001476	0.02484	1
-0.02512	0.946666784713813	0.0572334134481483	0.001492	0.02512	1
-0.02541	0.85517174555837	0.0537648235548803	0.001508	0.02541	1
-0.02569	0.837653826942447	0.0525996725094271	0.001524	0.02569	1
-0.02597	0.779716006334579	0.0501713234228845	0.001541	0.02597	1
-0.02626	0.758831276438753	0.0489387203301556	0.001557	0.02626	1
-0.02654	0.737853170893451	0.0477213222943686	0.001573	0.02654	1
-0.02682	0.683436680838241	0.0454232028983561	0.00159	0.02682	1
-0.02711	0.687265505181365	0.0450551510778741	0.001606	0.02711	1
-0.02739	0.655078310492671	0.0435144667607471	0.001622	0.02739	1
-0.02767	0.638970027703769	0.0425189366016694	0.001639	0.02767	1
-0.02796	0.60633272894638	0.0409828262439632	0.001655	0.02796	1
-0.02824	0.604236153070516	0.0404857440009898	0.001671	0.02824	1
-0.02852	0.56286255473902	0.0386722507332448	0.001688	0.02853	1
-0.02881	0.568578929096012	0.0384715167864823	0.001704	0.02881	1
-0.02909	0.55573597175355	0.0376503540172005	0.00172	0.02909	1
-0.02937	0.534835145987317	0.0365662120675398	0.001737	0.02938	1
Index: nsmodels/src/sans/models/test/CMSphere5smearsphere.txt
===================================================================
--- sansmodels/src/sans/models/test/CMSphere5smearsphere.txt	(revision 458c93012c3d10917123fcc7df826c1ce162fb12)
+++ 	(revision )
@@ -1,100 +1,0 @@
-0.001278 2538.41176383
-0.001562 2536.91820405
-0.001846 2535.13182479
-0.00213 2533.06217813
-0.002414 2530.70378586
-0.002698 2528.05024192
-0.002982 2525.10408349
-0.003266 2521.86667499
-0.00355 2518.3390775
-0.003834 2514.52246995
-0.004118 2510.41798319
-0.004402 2506.02690988
-0.004686 2501.35067884
-0.00497 2496.38678318
-0.005253 2491.16237596
-0.005537 2485.63911673
-0.005821 2479.83657083
-0.006105 2473.75676948
-0.006389 2467.4014599
-0.006673 2460.77293372
-0.006957 2453.86724627
-0.007241 2446.69623838
-0.007525 2439.25775219
-0.007809 2431.55421398
-0.008093 2423.58785521
-0.008377 2415.36158137
-0.008661 2406.87009473
-0.008945 2398.12841186
-0.009229 2389.13360806
-0.009513 2379.88958042
-0.009797 2370.39776774
-0.01008 2360.69528793
-0.01036 2350.85169027
-0.01065 2340.42023633
-0.01093 2330.11206013
-0.01122 2319.20109972
-0.0115 2308.43503981
-0.01178 2297.44820179
-0.01207 2285.83853677
-0.01235 2274.41290746
-0.01264 2262.36219581
-0.01292 2250.51169731
-0.0132 2238.45596231
-0.01349 2225.76495666
-0.01377 2213.29618391
-0.01406 2200.19110751
-0.01434 2187.34050325
-0.01462 2174.30529864
-0.01491 2160.61632548
-0.01519 2147.21038112
-0.01547 2133.6202358
-0.01576 2119.37907426
-0.01604 2105.45234903
-0.01633 2090.86319102
-0.01661 2076.60576032
-0.01689 2062.19214565
-0.01718 2047.10550219
-0.01746 2032.38715621
-0.01774 2017.52560123
-0.01803 2001.99124318
-0.01831 1986.8466206
-0.0186 1971.03389745
-0.01888 1955.61395119
-0.01916 1940.08291563
-0.01945 1923.87672225
-0.01973 1908.10656374
-0.02002 1891.66297192
-0.0203 1875.66789021
-0.02058 1859.56357196
-0.02087 1842.7946829
-0.02115 1826.50064489
-0.02143 1810.11533702
-0.02172 1793.06840882
-0.022 1776.5115358
-0.02228 1759.87201249
-0.02257 1742.57354412
-0.02285 1725.79397319
-0.02314 1708.3583155
-0.02342 1691.45256069
-0.0237 1674.48561783
-0.02399 1656.86525366
-0.02427 1639.79847285
-0.02455 1622.68887088
-0.02484 1604.964211
-0.02512 1587.85768129
-0.02541 1569.99297335
-0.02569 1552.84580279
-0.02597 1535.54074115
-0.02626 1517.75249337
-0.02654 1500.40115023
-0.02682 1483.03632237
-0.02711 1465.05942429
-0.02739 1447.67682181
-0.02767 1430.46495191
-0.02796 1412.49232282
-0.02824 1395.13182318
-0.02852 1377.93439837
-0.02881 1359.99528971
-0.02909 1342.67274512
-0.02937 1325.55375609
Index: nsmodels/src/sans/models/test/EllipticalCylinderModel_avg.txt
===================================================================
--- sansmodels/src/sans/models/test/EllipticalCylinderModel_avg.txt	(revision 5ff9d7f581d83de6312b17d694acbe0239984b09)
+++ 	(revision )
@@ -1,40 +1,0 @@
-<q_average> <2d_average> <1d_average>
-      0.01    450.507    450.538
-      0.02    228.525    228.583
-      0.03    146.842    146.905
-      0.04    99.4289    99.4891
-      0.05    68.9421    68.9963
-      0.06    48.1995    48.2457
-      0.07    33.0792    33.1168
-      0.08    22.2588    22.2879
-      0.09    14.5974     14.619
-       0.1     9.1764    9.19152
-      0.11    5.56643    5.57647
-      0.12    3.24083    3.24712
-      0.13     1.7993    1.80306
-      0.14    1.00787    1.01007
-      0.15   0.594417   0.595781
-      0.16   0.402388   0.403396
-      0.17    0.34266   0.343579
-      0.18   0.317975   0.318926
-      0.19   0.306544   0.307546
-       0.2   0.296341   0.297366
-      0.21   0.269339   0.270346
-      0.22    0.24207   0.243026
-      0.23    0.21435   0.215236
-      0.24   0.183616   0.184429
-      0.25   0.160746   0.161486
-      0.26   0.138993   0.139665
-      0.27   0.117419   0.118023
-      0.28   0.100312   0.100842
-      0.29  0.0813972  0.0818505
-       0.3  0.0637594  0.0641323
-      0.31  0.0498591  0.0501547
-      0.32  0.0365552   0.036785
-      0.33  0.0280352  0.0282178
-      0.34  0.0237687  0.0239272
-      0.35  0.0212566  0.0214156
-      0.36  0.0225586  0.0227386
-      0.37  0.0246106  0.0248264
-      0.38  0.0258744   0.026131
-      0.39  0.0274088   0.027696
Index: nsmodels/src/sans/models/test/ParallelepipedModel_avg.txt
===================================================================
--- sansmodels/src/sans/models/test/ParallelepipedModel_avg.txt	(revision 861a2d319586bc15dff1cc29da8013efd2e2df76)
+++ 	(revision )
@@ -1,23 +1,0 @@
-<q_average> <2d_average> <1d_average>
-      0.01    1726.15    1726.27
-      0.02    844.977     845.19
-      0.03    512.608    512.824
-      0.04    320.271    320.463
-      0.05    200.963    201.119
-      0.06    126.024    126.142
-      0.07    77.5119    77.5985
-      0.08    47.8721    47.9338
-      0.09    30.4693    30.5136
-       0.1    19.9932     20.026
-      0.11    13.8137    13.8388
-      0.12    9.73278     9.7521
-      0.13    6.59619    6.61053
-      0.14    4.24385    4.25362
-      0.15    2.42973    2.43556
-      0.16    1.17877    1.18168
-      0.17   0.547226    0.54844
-      0.18   0.307981   0.308673
-      0.19   0.338138    0.33912
-       0.2   0.488894     0.4905
-      0.21    0.58072   0.582884
-      0.22   0.611786   0.614215
Index: nsmodels/src/sans/models/test/SmearList.py
===================================================================
--- sansmodels/src/sans/models/test/SmearList.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,197 +1,0 @@
-
-from sans.models.ModelFactory import ModelFactory
-from sans.models.BaseComponent import BaseComponent
-import math
-
-class Smear:
-    
-    def __init__(self, model, param, sigma):
-        """
-            @param model: model to smear
-            @param param: parameter to smear
-            @param sigma: std deviations for parameter
-        """
-
-        
-        ## Model to smear
-        #self.model = factory.getModel(model_name)
-        self.model = model
-        ## Standard deviation of the smearing
-        self.sigmas = sigma
-        ## Parameter to smear
-        self.params = param
-        ## Nominal value of the smeared parameter
-        self.centers = []
-        ## Error on last evaluation
-        self.error = 0.0
-        ## Error flag
-        self.doErrors = False
-        for par in self.params:
-            self.centers.append(self.model.getParam(par))
-        
-    def smearParam(self, id, x):
-        """
-            @param x: input value
-        """
-        # from random import random
-        # If we exhausted the parameter array, simply evaluate
-        # the model
-        if id < len(self.params):
-            #print "smearing", self.params[id]
-            
-            # Average over Gaussian distribution (2 sigmas)
-            value_sum = 0.0
-            gauss_sum = 0.0
-            
-            min_value = self.centers[id] - 2*self.sigmas[id]
-            max_value = self.centers[id] + 2*self.sigmas[id]
-            n_pts = 25
-            step = (max_value - min_value)/(n_pts-1)
-            #print min_value, max_value, step, max_value-min_value
-            if step == 0.0:
-                return self.smearParam(id+1,x)
-            
-            # Gaussian function used to weigh points
-            #gaussian = ModelFactory().getModel("Gaussian")
-            gaussian = Gaussian()
-            gaussian.setParam('sigma', self.sigmas[id])
-            gaussian.setParam('mean', self.centers[id])
-                    
-            # Compute average
-            prev_value = None
-            error_sys = 0.0
-            for i in range(n_pts):
-                # Set the parameter value           
-                value = min_value + i*step
-                # value = random()*4.0*self.sigmas[id] + min_value
-                # print value
-                self.model.setParam(self.params[id], value)
-                gauss_value = gaussian.run(value)
-                #gauss_value = 1.0
-                #if id==0: print value, gauss_value
-                func_value, error_1 = self.smearParam(id+1, x)
-                if self.doErrors:
-                    if not prev_value == None:
-                        error_sys += (func_value-prev_value)*(func_value-prev_value)/4.0
-                    prev_value = func_value
-
-                value_sum += gauss_value * func_value
-                gauss_sum += gauss_value
-                
-            #print "Error", math.sqrt(error)
-            return value_sum/gauss_sum, math.sqrt(error_sys)
-        
-        else:
-            return self.model.run(x), 0.0
-        
-    def run(self, x):
-        """
-            @param x: input
-        """
-        
-        # Go through the list of parameters
-        n_par = len(self.params)
-        
-        # Check array lengths
-        if not len(self.centers) == n_par or\
-            not len(self.sigmas) == n_par:
-            raise ValueError, "Incompatible array lengths"
-        
-        # Smear first parameters
-        if n_par > 0:
-            value, error = self.smearParam(0, x)
-            self.error = error
-            
-            # Put back original values
-            for i in range(len(self.centers)):
-                self.model.setParam(self.params[i], self.centers[i])
-            
-            
-            return value
-        
-class Gaussian(BaseComponent):
-    """ Gaussian function """
-    
-    def __init__(self):
-        """ Initialization """
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Gaussian"
-        ## Scale factor
-        self.params['scale']  = 1.0
-        ## Mean value
-        self.params['mean']   = 0.0
-        ## Standard deviation
-        self.params['sigma']  = 1.0
-        ## Internal log
-        self.log = {}
-        return
-    
-    def run(self, x=0):
-        """ Evaluate the function 
-            @param x: input q or [q,phi]
-            @return: scattering function
-        """
-        if(type(x)==type([])):
-            # vector input
-            if(len(x)==2):
-                return self.analytical_2D(x)
-            else:
-                raise ValueError, "Gaussian takes a scalar or a 2D point"
-        else:
-            return self.analytical_1D(x)
-
-    def analytical_2D(self, x):
-        """ Evaluate 2D model 
-            @param x: input [q,phi]
-            @return: scattering function
-        """
-        
-        # 2D sphere is the same as 1D sphere
-        return self.analytical_1D(x[0])
-
-    def analytical_1D(self, x):
-        """ Evaluate 1D model
-            @param x: input q
-            @return: scattering function
-        """
-        vary = x-self.params['mean']
-        expo_value = -vary*vary/(2*self.params['sigma']*self.params['sigma'])
-        value = self.params['scale'] *  math.exp(expo_value)
-        
-        return value
-        
-# main
-if __name__ == '__main__':
-    import math
-    if True:
-        cyl = ModelFactory().getModel("CylinderModel")
-        cyl.setParam('length', 2000.0)
-        cyl.setParam('cyl_phi', .45)
-        cyl.setParam('cyl_theta', 2.)
-        #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [.01, .01])
-        #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [2.0, 2.0])
-        #app = Smear(cyl,['cyl_theta'], [2.5])
-        app = Smear(cyl, ['cyl_phi', 'cyl_theta'], [math.pi, math.pi])
-        #app = Smear(cyl,['scale', 'scale'],[.5,1.0])
-        val_no = cyl.run([.001, 1.0])
-        print "Cylinder (no smear) f(.1):", val_no
-        val_sm =  app.run([.001, 1.0])
-        print "Cylinder (smear)    f(.1):", val_sm, app.error, app.error/val_sm
-        print "Cylinder (1D)    f(.1):", cyl.run(.001), cyl.run(.001)/val_sm
-      
-      
-    print "--------------"
-    sinsin = ModelFactory().getModel("SinSin")
-    sinsin.setParam('a', -1.7)
-    sinsin.setParam('b', 5.45)
-    #app = Smear(sinsin, ['A'], [3.1])
-    #app = Smear(sinsin, ['A', 'b'], [math.pi/2.0, .0])
-    app = Smear(sinsin, ['A'], [math.pi/2.0])
-    #app = Smear(cyl,['scale', 'scale'],[.5,1.0])
-    val_no = sinsin.run(1.0)
-    print "SinSin (no smear) :", val_no
-    val_sm =  app.run(1.0)
-    print "SinSin (smear)    : %g +- %g" % (val_sm, app.error)
-      
Index: nsmodels/src/sans/models/test/TriaxialEllipsoidModel_avg.txt
===================================================================
--- sansmodels/src/sans/models/test/TriaxialEllipsoidModel_avg.txt	(revision 9ce41c6f9cb652f9c0a81a779f2dd143382ac661)
+++ 	(revision )
@@ -1,23 +1,0 @@
-<q_average> <2d_average> <1d_average>
-      0.01    6165.45    6166.44
-      0.02    2194.74    2195.78
-      0.03    874.216    874.921
-      0.04    373.155    373.577
-      0.05    180.257    180.513
-      0.06    92.2976    92.4552
-      0.07    45.6908    45.7821
-      0.08    22.4177     22.466
-      0.09    11.5738    11.5978
-       0.1    6.33202    6.34288
-      0.11    4.00772    4.01228
-      0.12    3.12529    3.12787
-      0.13    2.61889    2.62135
-      0.14    2.17612     2.1788
-      0.15    1.77645    1.77924
-      0.16    1.36894    1.37152
-      0.17   0.993054    0.99509
-      0.18   0.717117   0.718548
-      0.19   0.530954   0.531899
-       0.2   0.412607   0.412982
-      0.21   0.352447    0.35239
-      0.22   0.318321   0.319034
Index: nsmodels/src/sans/models/test/cansas1d_slit.xml
===================================================================
--- sansmodels/src/sans/models/test/cansas1d_slit.xml	(revision d771c72405f4d4bfef8dbcaefb75a3664c56f618)
+++ 	(revision )
@@ -1,141 +1,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="example.xsl" ?>
-<SASroot version="1.0"
-    xmlns="cansas1d/1.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="cansas1d/1.0 http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd"
-    >
-	<SASentry>
-		<Title>Test title</Title>
-		<Run name='run name'>1234</Run>
-		<SASdata>
-			<Idata>
-				<Q unit="1/A">0.02</Q>
-				<I unit="1/cm">1000</I>
-				<Idev unit="1/cm">3</Idev>
-				<dQl unit="1/A">0.005</dQl>
-				<dQw unit="1/A">0.001</dQw>
-				<Shadowfactor><!-- Shadowfactor is optional --></Shadowfactor>
-			</Idata>
-			<Idata>
-				<Q unit="1/A">0.03</Q>
-				<I unit="1/cm">1001</I>
-				<Idev unit="1/cm">4</Idev>
-				<dQl unit="1/A">0.005</dQl>
-				<dQw unit="1/A">0.001</dQw>
-				<Shadowfactor><!-- Shadowfactor is optional --></Shadowfactor>
-			</Idata>
-		</SASdata>
-		<SASsample name='my sample'>
-			<ID>SI600-new-long</ID>
-			<thickness unit="mm">1.03</thickness>
-			<transmission>0.327</transmission>
-			<temperature unit="C">0.0000</temperature>
-			<position>
-				<x unit="mm">10.00</x>
-				<y unit="mm">0.00</y>
-			</position>
-			<orientation>
-				<roll unit="degree">22.5<!-- was: sample_orientation --></roll>
-				<pitch unit="degree">0.020<!-- was: sample_offset_angle --></pitch>
-			</orientation>
-			<details>
-				<!-- was: sample_prep -->
-				http://chemtools.chem.soton.ac.uk/projects/blog/blogs.php/bit_id/2720
-			</details>
-			<details>
-				Some text here
-			</details>
-			
-		</SASsample>
-		<SASinstrument name="TEST instrument">
-			<name>canSAS instrument</name>
-			<SASsource name="source name">
-				<radiation>neutron</radiation>
-				<beam_size name='bm'>
-					<x unit="mm">12.00</x>
-					<y unit="mm">13.00</y>
-				</beam_size>
-				<beam_shape>disc</beam_shape>
-				<wavelength unit="A">6.00</wavelength>
-				<wavelength_min unit="nm">0.22</wavelength_min>
-				<wavelength_max unit="nm">1.00</wavelength_max>
-				<wavelength_spread unit="percent">
-					14.3
-				</wavelength_spread>
-			</SASsource>
-			<SAScollimation name="test coll name">
-				<length unit='mm'> 123.0</length>
-				<aperture name="source" type="radius">
-					<size>
-						<x unit="mm">50</x>
-					</size>
-					<distance unit="m">11.000<!-- was: distance_coll --></distance>
-				</aperture>
-				<aperture name="sample" type="radius">
-					<size name='size name'>
-						<x unit="mm">1</x>
-					</size>
-				</aperture>
-			</SAScollimation>
-			<SASdetector>
-				<name>fictional hybrid</name>
-				<SDD unit="m">
-					<!-- sample-to-detector distance -->
-					4.150
-				</SDD>
-				<orientation>
-					<roll unit="degree">1.00</roll>
-					<pitch unit="degree">0.00</pitch>
-					<yaw unit="degree">0.00</yaw>
-				</orientation>
-				<offset>
-					<x unit="mm">1</x>
-					<y unit="mm">2</y>
-				</offset>
-				<beam_center>
-					<x unit="mm">322.64</x>
-					<y unit="mm">327.68</y>
-				</beam_center>
-				<pixel_size>
-					<x unit="mm">5.00</x>
-					<y unit="mm">5.00</y>
-				</pixel_size>
-			</SASdetector>
-		</SASinstrument>
-		<SASprocess>
-			<name>spol</name>
-			<date>04-Sep-2007 18:35:02</date>
-			<term name="radialstep" unit="mm">10.000</term>
-			<term name="sector_width" unit="degree">180.0</term>
-			<term name="sector_orient" unit="degree">0.0</term>
-			<term name="MASK_file">USER:MASK.COM</term>
-			<SASprocessnote>
-				AvA1 0.0000E+00 AsA2 1.0000E+00 XvA3 1.0526E+03 XsA4
-				5.2200E-02 XfA5 0.0000E+00
-			</SASprocessnote>
-			<SASprocessnote>
-				S... 13597 0 2.26E+02 2A 5mM 0%D2O Sbak 13594 0 1.13E+02
-				H2O Buffer
-			</SASprocessnote>
-			<SASprocessnote>V... 13552 3 1.00E+00 H2O5m</SASprocessnote>
-		</SASprocess>
-		<SASprocess>
-			<name>NCNR-IGOR</name>
-			<date>03-SEP-2006 11:42:47</date>
-			<description />
-			<term name="average_type">Circular</term>
-			<term name="SAM_file">SEP06064.SA3_AJJ_L205</term>
-			<term name="BKD_file">SEP06064.SA3_AJJ_L205</term>
-			<term name="EMP_file">SEP06064.SA3_AJJ_L205</term>
-			<term name="DIV_file">SEP06064.SA3_AJJ_L205</term>
-			<term name="MASK_file">SEP06064.SA3_AJJ_L205</term>
-			<term name="ABS:TSTAND">1</term>
-			<term name="ABS:DSTAND" unit="mm">1</term>
-			<term name="ABS:IZERO">230.09</term>
-			<term name="ABS:XSECT" unit="mm">1</term>
-			<SASprocessnote/>
-		</SASprocess>
-		<SASnote />
-	</SASentry>
-</SASroot>
Index: nsmodels/src/sans/models/test/core_shell_cyl_testdata.txt
===================================================================
--- sansmodels/src/sans/models/test/core_shell_cyl_testdata.txt	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,139 +1,0 @@
-pythonclass = CoreShellCylinderModel
-scale = 1
-radius = 20
-thickness = 10
-length = 400
-core_sld = 1e-6
-shell_sld = 4e-6
-solvent_sld = 1e-6
-background = 0.01
-
-DATA
-0.001	353.560132167546
-0.00105251266011778	353.353125068201
-0.00110778289970821	353.124000569665
-0.00116595552660488	352.87041875967
-0.00122718295288593	352.58979743803
-0.00129162559419317	352.279288228264
-0.00135945229002046	351.935750610798
-0.00143084074607265	351.555723763133
-0.00150597799985384	351.13539610369
-0.00158506091070502	350.67057245352
-0.00166829667557485	350.156638755392
-0.00175590337187494	349.588524324878
-0.00184811052884188	348.96066165541
-0.00194515972890305	348.2669438617
-0.00204730524062173	347.50067992682
-0.00215481468487986	346.654548021734
-0.00226796973604376	345.720547296668
-0.00238706685995004	344.689948707106
-0.00251241809064502	343.553245639307
-0.00264435184791283	342.300105348302
-0.00278321379773411	340.919322522823
-0.00292936775792964	339.398776654985
-0.00308319665136179	337.725395326242
-0.00324510350919104	335.885126033787
-0.00341551252681621	333.862919780817
-0.00359487017526494	331.642730345873
-0.00378364637094618	329.207533933654
-0.00398233570682956	326.539374789731
-0.00419145874827721	323.619443324298
-0.0044115633969232	320.42819431362
-0.00464322632617388	316.945513794367
-0.00488705449209019	313.150944275563
-0.0051436867236104	309.023978776314
-0.0054137953962797	304.544434827648
-0.00569808819387176	299.692919778901
-0.00599730996251769	294.451398290194
-0.00631224466220038	288.803871471549
-0.00664371742072679	282.737174369416
-0.00699259669556001	276.241893948161
-0.00735979654917468	269.313402842951
-0.00774627904389752	261.952994401996
-0.00815305676250721	254.169091326557
-0.00858119546119774	245.978483087029
-0.00903181686185589	237.40752600812
-0.00950610159096858	228.493214681787
-0.0100052922728602	219.284005115922
-0.010530696785364	209.840240785234
-0.0110836916864573	200.234006071171
-0.0116657258208385	190.548212990096
-0.0122783241158954	180.874724485493
-0.0129230915770094	171.311341206724
-0.0136017174926639	161.957540886819
-0.0143159798603742	152.908972976731
-0.0150677500450351	144.250886565509
-0.0158589976818897	136.05091014724
-0.0166917958369675	128.351896721801
-0.0175683264385096	121.165863476228
-0.0184908859936133	114.4703267421
-0.0194618916050726	108.208458104453
-0.0204838873041789	102.294332218686
-0.0215595507160742	96.6239575011789
-0.0226917000751195	91.0916748532794
-0.0238833016086589	85.6098975590415
-0.0251374773085249	80.1282952267494
-0.0264575131106459	74.6469601970146
-0.027846867504187	69.2177167568136
-0.0293091805927793	63.9295437880283
-0.0308482836315787	58.8787182407255
-0.0324682090651407	54.1312654799973
-0.0341732010924115	49.69226426132
-0.035967726786514	45.4991807718727
-0.0378564877984635	41.4499135076893
-0.0398444326754772	37.4589544254216
-0.0419367698261504	33.5130282576843
-0.0441389811664687	29.686116638358
-0.0464568364824087	26.0906695351733
-0.0488964085467568	22.7896027400326
-0.0514640890297529	19.7418575728741
-0.0541666052452436	16.8470027329151
-0.0570110377762212	14.0641733834676
-0.0600048390259259	11.4767624934243
-0.0631558527431166	9.2013416146032
-0.0664723345726646	7.23621720450609
-0.0699629736853145	5.47667717868581
-0.0736369155432808	3.90694235857881
-0.0775037858613269	2.64520254302911
-0.0815737158261042	1.71888244584613
-0.085857368639825	1.00616951922904
-0.0903659674578153	0.505746479270218
-0.0951113247931421	0.309316869918116
-0.100105873465356	0.308828468967212
-0.105362699174436	0.429865649540495
-0.110895574785276	0.739968811735628
-0.116718996412541	1.09493668549302
-0.122848221400442	1.46082520272542
-0.129299308296917	1.82653039088647
-0.136089158926978	2.05737723523194
-0.143235562675425	2.20629099045896
-0.150757243094979	2.15813904059397
-0.158673906961919	1.99386071154923
-0.167006295907771	1.66050707894721
-0.175776240762306	1.26841056680328
-0.185006718750238	0.836447930777851
-0.194721913691476	0.449693930627265
-0.20494727936264	0.185700967900882
-0.215709606185875	0.0512394957384413
-0.227037091419654	0.0559048063587326
-0.238959413035505	0.168095485620378
-0.251507807474183	0.311108248903106
-0.264715151485044	0.406870878371388
-0.278616048263005	0.408344224667358
-0.2932469181088	0.316510838067329
-0.308646093850034	0.178888365548314
-0.324853921273063	0.0632726105995981
-0.341912864828804	0.0166666303781699
-0.359867618889456	0.0363079940206598
-0.378765224847594	0.0772563511682604
-0.398655194364451	0.0908219781360385
-0.4195896390903	0.0626486424147243
-0.441623407196792	0.0256750929944015
-0.464814227078974	0.0110636566475161
-0.489222858603482	0.0167465728125504
-0.514913252299177	0.0199946004105147
-0.541952716907305	0.0145028620055464
-0.570412095730168	0.0104003959468734
-0.600365952240318	0.0104967016337968
-0.631892765436603	0.0102949185411522
-0.665075135458861	0.0106147900550481
Index: nsmodels/src/sans/models/test/core_shell_testdata.txt
===================================================================
--- sansmodels/src/sans/models/test/core_shell_testdata.txt	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,138 +1,0 @@
-pythonclass = CoreShellModel
-scale = 1
-radius = 60
-thickness = 10
-core_sld = 1e-6
-shell_sld = 2e-6
-solvent_sld = 3e-6
-background = 0.001
-
-DATA
-0.001	381.274046971472
-0.00105251266011778	381.237899910898
-0.00110778289970821	381.19786027418
-0.00116595552660488	381.153509293754
-0.00122718295288593	381.104383244174
-0.00129162559419317	381.049968637346
-0.00135945229002046	380.989696908168
-0.00143084074607265	380.922938539463
-0.00150597799985384	380.848996566762
-0.00158506091070502	380.767099400611
-0.00166829667557485	380.676392895334
-0.00175590337187494	380.575931589119
-0.00184811052884188	380.464669030575
-0.00194515972890305	380.341447101163
-0.00204730524062173	380.204984233923
-0.00215481468487986	380.053862419402
-0.00226796973604376	379.886512882077
-0.00238706685995004	379.701200298987
-0.00251241809064502	379.49600542349
-0.00264435184791283	379.268805965744
-0.00278321379773411	379.017255571336
-0.00292936775792964	378.738760728792
-0.00308319665136179	378.430455426155
-0.00324510350919104	378.08917336769
-0.00341551252681621	377.711417552685
-0.00359487017526494	377.293327011804
-0.00378364637094618	376.830640491906
-0.00398233570682956	376.318656879007
-0.00419145874827721	375.752192152612
-0.0044115633969232	375.125532673916
-0.00464322632617388	374.432384627427
-0.00488705449209019	373.665819462742
-0.0051436867236104	372.818215222885
-0.0054137953962797	371.881193701371
-0.00569808819387176	370.845553445896
-0.00599730996251769	369.701198727091
-0.00631224466220038	368.437064721844
-0.00664371742072679	367.041039329271
-0.00699259669556001	365.499882251454
-0.00735979654917468	363.799142240043
-0.00774627904389752	361.923073744821
-0.00815305676250721	359.854554613775
-0.00858119546119774	357.575007000233
-0.00903181686185589	355.064324247026
-0.00950610159096858	352.300807257296
-0.0100052922728602	349.261114744241
-0.010530696785364	345.920232795758
-0.0110836916864573	342.251470410986
-0.0116657258208385	338.226489077737
-0.0122783241158954	333.81537607021
-0.0129230915770094	328.986772953036
-0.0136017174926639	323.708072763327
-0.0143159798603742	317.945701467637
-0.0150677500450351	311.665501484756
-0.0158589976818897	304.833237213943
-0.0166917958369675	297.415244439261
-0.0175683264385096	289.379246945833
-0.0184908859936133	280.695364337768
-0.0194618916050726	271.337334425244
-0.0204838873041789	261.283971041376
-0.0215595507160742	250.520872986184
-0.0226917000751195	239.042391027563
-0.0238833016086589	226.853846399068
-0.0251374773085249	213.973974766497
-0.0264575131106459	200.437542879074
-0.027846867504187	186.298049862679
-0.0293091805927793	171.630380485316
-0.0308482836315787	156.533223593014
-0.0324682090651407	141.131006418686
-0.0341732010924115	125.57502775677
-0.035967726786514	110.043406138698
-0.0378564877984635	94.7394031434915
-0.0398444326754772	79.8876517594616
-0.0419367698261504	65.7278357602731
-0.0441389811664687	52.5054542084486
-0.0464568364824087	40.4594948569723
-0.0488964085467568	29.8071600221693
-0.0514640890297529	20.726258352271
-0.0541666052452436	13.336494524359
-0.0570110377762212	7.68161679902745
-0.0600048390259259	3.71512224140784
-0.0631558527431166	1.29279888095064
-0.0664723345726646	0.175550519014221
-0.0699629736853145	0.0453924538681532
-0.0736369155432808	0.535923418986669
-0.0775037858613269	1.27580609656724
-0.0815737158261042	1.93998544566538
-0.085857368639825	2.29923118349953
-0.0903659674578153	2.25545560606361
-0.0951113247931421	1.85001590113763
-0.100105873465356	1.23672780785815
-0.105362699174436	0.621355016508782
-0.110895574785276	0.183149542475723
-0.116718996412541	0.00639177282429009
-0.122848221400442	0.0529088860080835
-0.129299308296917	0.193331375536727
-0.136089158926978	0.285780213218503
-0.143235562675425	0.258850751719227
-0.150757243094979	0.144682310792552
-0.158673906961919	0.0362122531752963
-0.167006295907771	0.00113663058210361
-0.175776240762306	0.0277097331697254
-0.185006718750238	0.0531103329757048
-0.194721913691476	0.0401179463806756
-0.20494727936264	0.010881272301514
-0.215709606185875	0.0011822843814875
-0.227037091419654	0.00839678281024765
-0.238959413035505	0.00914771323458895
-0.251507807474183	0.00271488007246614
-0.264715151485044	0.00119017076116013
-0.278616048263005	0.00209189028269908
-0.2932469181088	0.00118078317349688
-0.308646093850034	0.00108286779061982
-0.324853921273063	0.00100867939845478
-0.341912864828804	0.00130885256583451
-0.359867618889456	0.00111691184987341
-0.378765224847594	0.00155107403368663
-0.398655194364451	0.00179962321843482
-0.4195896390903	0.00131961072539651
-0.441623407196792	0.00251915473759882
-0.464814227078974	0.00118345764149102
-0.489222858603482	0.0026873874933769
-0.514913252299177	0.00137597045735508
-0.541952716907305	0.00210439596198283
-0.570412095730168	0.00207013597449065
-0.600365952240318	0.00107370624743048
-0.631892765436603	0.00208956797079987
-0.665075135458861	0.00152395959676715
Index: nsmodels/src/sans/models/test/cylinder_testdata.txt
===================================================================
--- sansmodels/src/sans/models/test/cylinder_testdata.txt	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,136 +1,0 @@
-pythonclass = CylinderModel
-scale = 1
-radius = 20
-length = 400
-contrast = 3e-6
-background = 0.01
-
-DATA
-0.001	450.365065779858
-0.00105251266011778	450.146580159158
-0.00110778289970821	449.904721058613
-0.00116595552660488	449.637008936793
-0.00122718295288593	449.340705967062
-0.00129162559419317	449.012790215663
-0.00135945229002046	448.649927487565
-0.00143084074607265	448.248440688541
-0.00150597799985384	447.804276557381
-0.00158506091070502	447.312969632777
-0.00166829667557485	446.769603336734
-0.00175590337187494	446.16876808224
-0.00184811052884188	445.504516349513
-0.00194515972890305	444.770314725176
-0.00204730524062173	443.958992965425
-0.00215481468487986	443.06269023145
-0.00226796973604376	442.072798757619
-0.00238706685995004	440.979905355641
-0.00251241809064502	439.773731337189
-0.00264435184791283	438.443071660573
-0.00278321379773411	436.975734382002
-0.00292936775792964	435.358481827868
-0.00308319665136179	433.576975311161
-0.00324510350919104	431.615725703122
-0.00341551252681621	429.45805275105
-0.00359487017526494	427.086056715235
-0.00378364637094618	424.480606690776
-0.00398233570682956	421.621350889575
-0.00419145874827721	418.48675518485
-0.0044115633969232	415.054177358106
-0.00464322632617388	411.299985718283
-0.00488705449209019	407.199732049438
-0.0051436867236104	402.728390128864
-0.0054137953962797	397.860672252773
-0.00569808819387176	392.571437181701
-0.00599730996251769	386.836203490749
-0.00631224466220038	380.631782234131
-0.00664371742072679	373.937041785537
-0.00699259669556001	366.733815283289
-0.00735979654917468	359.007956784618
-0.00774627904389752	350.750545416413
-0.00815305676250721	341.959226825518
-0.00858119546119774	332.639667374524
-0.00903181686185589	322.807078144569
-0.00950610159096858	312.487742427288
-0.0100052922728602	301.720451940157
-0.010530696785364	290.557724098633
-0.0110836916864573	279.066637024047
-0.0116657258208385	267.329083828761
-0.0122783241158954	255.441218487576
-0.0129230915770094	243.511850295617
-0.0136017174926639	231.659553491498
-0.0143159798603742	220.008306831172
-0.0150677500450351	208.681580188645
-0.0158589976818897	197.79495631257
-0.0166917958369675	187.447625061693
-0.0175683264385096	177.713411852586
-0.0184908859936133	168.632377005123
-0.0194618916050726	160.204390996683
-0.0204838873041789	152.38635368558
-0.0215595507160742	145.094741759756
-0.0226917000751195	138.214768436832
-0.0238833016086589	131.616467303681
-0.0251374773085249	125.176404569476
-0.0264575131106459	118.801620763363
-0.027846867504187	112.450266533729
-0.0293091805927793	106.142075700885
-0.0308482836315787	99.9524453550689
-0.0324682090651407	93.9874997719109
-0.0341732010924115	88.3443041234747
-0.035967726786514	83.0688232388444
-0.0378564877984635	78.1304426729725
-0.0398444326754772	73.4304494970684
-0.0419367698261504	68.8486707842003
-0.0441389811664687	64.3094541736059
-0.0464568364824087	59.8273466085108
-0.0488964085467568	55.4936826961488
-0.0514640890297529	51.4009604588362
-0.0541666052452436	47.5581111282103
-0.0570110377762212	43.8774155688553
-0.0600048390259259	40.2624605003613
-0.0631558527431166	36.7152777493163
-0.0664723345726646	33.3300934619011
-0.0699629736853145	30.1616336003056
-0.0736369155432808	27.1450621666718
-0.0775037858613269	24.2065619286448
-0.0815737158261042	21.3959787911772
-0.085857368639825	18.7909944516912
-0.0903659674578153	16.3453512004984
-0.0951113247931421	14.0105824738489
-0.100105873465356	11.8613539021756
-0.105362699174436	9.91011586652733
-0.110895574785276	8.09924233046156
-0.116718996412541	6.48721642322365
-0.122848221400442	5.07262211522658
-0.129299308296917	3.8241007701892
-0.136089158926978	2.7902311341927
-0.143235562675425	1.92376715107624
-0.150757243094979	1.25195840473638
-0.158673906961919	0.739247462316389
-0.167006295907771	0.39034943849544
-0.175776240762306	0.166847976328158
-0.185006718750238	0.0638252857300758
-0.194721913691476	0.0371817504957719
-0.20494727936264	0.0700301931370014
-0.215709606185875	0.132358655755811
-0.227037091419654	0.193912768174811
-0.238959413035505	0.239497654621447
-0.251507807474183	0.257679805850731
-0.264715151485044	0.243166233829726
-0.278616048263005	0.200630401151877
-0.2932469181088	0.142354013759544
-0.308646093850034	0.083781005054643
-0.324853921273063	0.0388578776547404
-0.341912864828804	0.0157446742258134
-0.359867618889456	0.0142232167943077
-0.378765224847594	0.0263426031970756
-0.398655194364451	0.0404298608524238
-0.4195896390903	0.0459660214615077
-0.441623407196792	0.0387976446053645
-0.464814227078974	0.0251520976537578
-0.489222858603482	0.0133956386353553
-0.514913252299177	0.0108065514382524
-0.541952716907305	0.0152710060258391
-0.570412095730168	0.0196514304875119
-0.600365952240318	0.0182845678719795
-0.631892765436603	0.0130198222806718
-0.665075135458861	0.0101535864652661
Index: nsmodels/src/sans/models/test/ellipsoid_testdata.txt
===================================================================
--- sansmodels/src/sans/models/test/ellipsoid_testdata.txt	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,136 +1,0 @@
-pythonclass = EllipsoidModel
-scale = 1
-radius_a = 20
-radius_b = 400
-contrast = 3e-6
-background = 0.01
-
-DATA
-0.001	11808.8528968632
-0.00105251266011778	11781.7147338649
-0.00110778289970821	11751.726514487
-0.00116595552660488	11718.5978599118
-0.00122718295288593	11682.01083219
-0.00129162559419317	11641.6177848645
-0.00135945229002046	11597.0391584392
-0.00143084074607265	11547.8612513417
-0.00150597799985384	11493.6340074247
-0.00158506091070502	11433.8688737723
-0.00166829667557485	11368.0367979944
-0.00175590337187494	11295.5664527249
-0.00184811052884188	11215.8427971077
-0.00194515972890305	11128.2061110769
-0.00204730524062173	11031.951668581
-0.00215481468487986	10926.3302508532
-0.00226796973604376	10810.5497404861
-0.00238706685995004	10683.7780812871
-0.00251241809064502	10545.1479370896
-0.00264435184791283	10393.7634337298
-0.00278321379773411	10228.7094202917
-0.00292936775792964	10049.0637353733
-0.00308319665136179	9853.91300696029
-0.00324510350919104	9642.37254402161
-0.00341551252681621	9413.61088528121
-0.00359487017526494	9166.879543996
-0.00378364637094618	8901.54841182498
-0.00398233570682956	8617.14714114096
-0.00419145874827721	8313.41259076583
-0.0044115633969232	7990.34206915047
-0.00464322632617388	7648.25161351986
-0.00488705449209019	7287.83787614165
-0.0051436867236104	6910.24132742693
-0.0054137953962797	6517.10741990347
-0.00569808819387176	6110.64109931719
-0.00599730996251769	5693.64864736002
-0.00631224466220038	5269.55939642207
-0.00664371742072679	4842.41854557534
-0.00699259669556001	4416.8413977311
-0.00735979654917468	3997.91920819247
-0.00774627904389752	3591.06797139074
-0.00815305676250721	3201.81444399825
-0.00858119546119774	2835.51908599765
-0.00903181686185589	2497.04384279986
-0.00950610159096858	2190.38388293401
-0.0100052922728602	1918.29597467291
-0.010530696785364	1681.97052793915
-0.0110836916864573	1480.80647627844
-0.0116657258208385	1312.35366329635
-0.0122783241158954	1172.4806119466
-0.0129230915770094	1055.80087419096
-0.0136017174926639	956.345199427954
-0.0143159798603742	868.401686020703
-0.0150677500450351	787.373295795928
-0.0158589976818897	710.444579006174
-0.0166917958369675	636.839691442685
-0.0175683264385096	567.524137445761
-0.0184908859936133	504.366315112346
-0.0194618916050726	449.001613576719
-0.0204838873041789	401.841966414852
-0.0215595507160742	361.713843354515
-0.0226917000751195	326.376840678275
-0.0238833016086589	293.695004896232
-0.0251374773085249	262.744038847928
-0.0264575131106459	234.039847131565
-0.027846867504187	208.639158819275
-0.0293091805927793	186.837277235271
-0.0308482836315787	167.70997478874
-0.0324682090651407	150.021720507628
-0.0341732010924115	133.469048132347
-0.035967726786514	118.660929907549
-0.0378564877984635	105.851355256071
-0.0398444326754772	94.3663066816175
-0.0419367698261504	83.6578396413674
-0.0441389811664687	74.0303846471908
-0.0464568364824087	65.6488966587392
-0.0488964085467568	58.0126389704112
-0.0514640890297529	51.0164068972012
-0.0541666052452436	44.9003014032841
-0.0570110377762212	39.3721336546038
-0.0600048390259259	34.3529627586149
-0.0631558527431166	29.958497372189
-0.0664723345726646	25.9550620560306
-0.0699629736853145	22.4261198409402
-0.0736369155432808	19.2679866604944
-0.0775037858613269	16.4682212334822
-0.0815737158261042	13.9888621639924
-0.085857368639825	11.805997960264
-0.0903659674578153	9.88077806606173
-0.0951113247931421	8.21127352905187
-0.100105873465356	6.74958811344309
-0.105362699174436	5.49602638898874
-0.110895574785276	4.42590111015658
-0.116718996412541	3.51634335501236
-0.122848221400442	2.7564115317264
-0.129299308296917	2.13145505928053
-0.136089158926978	1.62491960968472
-0.143235562675425	1.22192025374086
-0.150757243094979	0.908755828531692
-0.158673906961919	0.672118368226188
-0.167006295907771	0.499015180776053
-0.175776240762306	0.376993265291224
-0.185006718750238	0.294475487249178
-0.194721913691476	0.240999006101438
-0.20494727936264	0.206976804274189
-0.215709606185875	0.184084804995347
-0.227037091419654	0.166799187053838
-0.238959413035505	0.150583285805888
-0.251507807474183	0.133330958053468
-0.264715151485044	0.113698351753489
-0.278616048263005	0.0866638841974435
-0.2932469181088	0.0612447728443078
-0.308646093850034	0.07146333544507
-0.324853921273063	0.0642081900887752
-0.341912864828804	0.0396251834721476
-0.359867618889456	0.0210274910924806
-0.378765224847594	0.0199010559646776
-0.398655194364451	0.0279754666458064
-0.4195896390903	0.0319472487548983
-0.441623407196792	0.0268350754071031
-0.464814227078974	0.0181555013515734
-0.489222858603482	0.0134732506169512
-0.514913252299177	0.0143447123658664
-0.541952716907305	0.0163992637354073
-0.570412095730168	0.0156477366167964
-0.600365952240318	0.012898427036931
-0.631892765436603	0.0114950061180364
-0.665075135458861	0.0126814563174163
Index: nsmodels/src/sans/models/test/elliptical_cylinder_testdata.txt
===================================================================
--- sansmodels/src/sans/models/test/elliptical_cylinder_testdata.txt	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,51 +1,0 @@
-pythonclass = EllipticalCylinderModel
-scale = 1
-r_minor = 20
-r_ratio = 1.5
-length = 400
-contrast = 3e-6
-background = 0.00
-
-DATA
-0.001	675.50440232505
-0.00113999241252094	674.585621554061
-0.00129958270060531	673.394210762832
-0.00148151441813353	671.850289410856
-0.00168891519571259	669.851269662357
-0.00192535050850367	667.265881328373
-0.00219488497113752	663.926958947588
-0.00250215221345301	659.622979404263
-0.00285243453830891	654.088557911805
-0.00325175373088482	646.99452081442
-0.00370697458059535	637.938887875081
-0.00422592289528669	626.441265201386
-0.00481752003652534	611.944943469895
-0.00549193628880649	593.833534033594
-0.0062607656992878	571.472138550979
-0.00713722539375944	544.286072836033
-0.00813638279533754	511.890903244197
-0.0092754146520507	474.281385973753
-0.0105739023263233	432.06585649542
-0.0120541684227461	386.686741391944
-0.0137416605411801	340.493801750454
-0.0156653887523837	296.461181585324
-0.0178584243169082	257.357995056469
-0.0203584682208548	224.472404683279
-0.0232084993023232	196.656975592684
-0.0264575131106459	171.051533112635
-0.0301613642003096	145.892282588722
-0.0343837263396336	122.492775456219
-0.0391971871413787	102.387787023423
-0.044684495933335	83.9644239362009
-0.0509399863213247	66.6884221063028
-0.0580711979002305	51.7673903991309
-0.0662007249922647	38.2008300068913
-0.0754683241945671	26.8220307031804
-0.0860333169674769	17.3310728335251
-0.0980773285669326	10.0671608021353
-0.111807410406626	5.06032753961084
-0.127459599527169	2.09807907940937
-0.14530297636393	0.74349155534215
-0.165644290571589	0.362431309457757
-0.188833234429025	0.310054845776307
-
Index: nsmodels/src/sans/models/test/load_test_model.xml
===================================================================
--- sansmodels/src/sans/models/test/load_test_model.xml	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,10 +1,0 @@
-<Component class='AddComponent' name='AddComponent'>
-  <operateOn>
-    <Component class='SphereModel' name='SphereModel'>
-</Component>
-  </operateOn>
-  <toAdd>
-    <Component class='SphereModel' name='SphereModel'>
-</Component>
-  </toAdd>
-</Component>
Index: nsmodels/src/sans/models/test/polyexclvol_default_igor.txt
===================================================================
--- sansmodels/src/sans/models/test/polyexclvol_default_igor.txt	(revision ec1c5540bf9c8569d36dada948bf6b12cd3bf1be)
+++ 	(revision )
@@ -1,131 +1,0 @@
-#PolymerExclVolume model 
-#Data was calculated from Igor/NIST 
-#package using SansView default values
-0.001	0.998801
-0.00105251	0.998672
-0.00110778	0.998529
-0.00116596	0.99837
-0.00122718	0.998195
-0.00129163	0.998001
-0.00135945	0.997785
-0.00143084	0.997547
-0.00150598	0.997283
-0.00158506	0.996991
-0.0016683	0.996667
-0.0017559	0.996309
-0.00184811	0.995912
-0.00194516	0.995473
-0.00204731	0.994986
-0.00215481	0.994448
-0.00226797	0.993852
-0.00238707	0.993192
-0.00251242	0.992462
-0.00264435	0.991653
-0.00278321	0.990759
-0.00292937	0.98977
-0.0030832	0.988675
-0.0032451	0.987464
-0.00341551	0.986125
-0.00359487	0.984644
-0.00378365	0.983007
-0.00398234	0.981197
-0.00419146	0.979197
-0.00441156	0.976988
-0.00464323	0.974548
-0.00488705	0.971854
-0.00514369	0.968881
-0.0054138	0.965601
-0.00569809	0.961984
-0.00599731	0.957997
-0.00631224	0.953605
-0.00664372	0.94877
-0.0069926	0.94345
-0.0073598	0.937601
-0.00774628	0.931175
-0.00815306	0.924123
-0.0085812	0.91639
-0.00903182	0.90792
-0.0095061	0.898654
-0.0100053	0.888531
-0.0105307	0.877486
-0.0110837	0.865457
-0.0116657	0.852378
-0.0122783	0.838186
-0.0129231	0.822819
-0.0136017	0.806219
-0.014316	0.788334
-0.0150678	0.769119
-0.015859	0.74854
-0.0166918	0.726576
-0.0175683	0.703223
-0.0184909	0.678493
-0.0194619	0.652424
-0.0204839	0.625076
-0.0215596	0.596538
-0.0226917	0.566929
-0.0238833	0.5364
-0.0251375	0.505131
-0.0264575	0.473333
-0.0278469	0.441243
-0.0293092	0.409122
-0.0308483	0.377244
-0.0324682	0.345891
-0.0341732	0.315341
-0.0359677	0.285861
-0.0378565	0.257691
-0.0398444	0.23104
-0.0419368	0.206075
-0.044139	0.182913
-0.0464568	0.161625
-0.0488964	0.142232
-0.0514641	0.124708
-0.0541666	0.108991
-0.057011	0.0949896
-0.0600048	0.0825877
-0.0631559	0.0716579
-0.0664723	0.0620666
-0.069963	0.0536799
-0.0736369	0.0463687
-0.0775038	0.0400111
-0.0815737	0.0344944
-0.0858574	0.0297157
-0.090366	0.0255826
-0.0951113	0.0220122
-0.100106	0.0189313
-0.105363	0.0162751
-0.110896	0.0139869
-0.116719	0.0120168
-0.122848	0.0103217
-0.129299	0.00886379
-0.136089	0.00761043
-0.143236	0.00653329
-0.150757	0.00560785
-0.158674	0.00481295
-0.167006	0.00413032
-0.175776	0.00354422
-0.185007	0.00304106
-0.194722	0.00260918
-0.204947	0.00223851
-0.21571	0.00192041
-0.227037	0.00164746
-0.238959	0.00141325
-0.251508	0.0012123
-0.264715	0.0010399
-0.278616	0.000892001
-0.293247	0.000765121
-0.308646	0.000656279
-0.324854	0.000562913
-0.341913	0.000482824
-0.359868	0.000414126
-0.378765	0.000355199
-0.398655	0.000304655
-0.41959	0.000261302
-0.441623	0.000224117
-0.464814	0.000192222
-0.489223	0.000164866
-0.514913	0.000141403
-0.541953	0.000121279
-0.570412	0.000104018
-0.600366	8.92138e-05
-0.631893	7.65164e-05
-0.665075	6.56261e-05
Index: nsmodels/src/sans/models/test/prototypes/test_2dsim.py
===================================================================
--- sansmodels/src/sans/models/test/prototypes/test_2dsim.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,82 +1,0 @@
-from sans_extension.prototypes.c_models import CCanvas
-from sans.models.SphereModel import SphereModel
-from sans.models.CoreShellModel import CoreShellModel
-
-import math
-
-# Sphere ###############################
-sphere = SphereModel()
-sphere.setParam('radius',40.0)
-sphere.setParam('contrast',1.0)
-sphere.setParam('scale',1.0)
-sphere.setParam('background',0.0)
-
-can = CCanvas()
-
-print "ID", can.add()
-can.setParam(0,1,40.0)
- 
-
-for q in [1,0.1,0.05,0.02,0.01,0.001,0.0001]:
-    ana = sphere.run([q,1.0])
-    sim = can.evaluate([q,1.0])
-
-    print "Sphere: ANA = %g   SIM = %g   (%g)" %(ana, sim, sim/ana)
-
-
-
-
-# Core-shell ###########################
-# This is a core shell model where the weight-average
-# of the SLDs is zero. The I(q) should go to zero as q->0.
-
-import time
-t_0 = time.time()
-
-sphere = CoreShellModel()
-# Core radius
-radius = 10.0
-thickness = 5.0
-sphere.setParam('radius', radius)
-# Shell thickness
-sphere.setParam('thickness', thickness)
-sphere.setParam('core_sld', 1.0)
-
-core_vol = 4.0/3.0*math.pi*radius*radius*radius
-outer_radius = radius+thickness
-shell_vol = 4.0/3.0*math.pi*outer_radius*outer_radius*outer_radius - core_vol
-shell_sld = -1.0*core_vol/shell_vol
-print "Shell SLD", shell_sld
-
-sphere.setParam('shell_sld', shell_sld)
-sphere.setParam('solvent_sld',0.0)
-sphere.setParam('background',0.0)
-sphere.setParam('scale',1.0)
-
-can = CCanvas()
-
-print "ID", can.add()
-can.setParam(0,1, outer_radius)
-can.setParam(0,2, shell_sld)
-
-
-print "ID", can.add()
-can.setParam(1,1, radius)
-can.setParam(1,2, 1.0)
-
-print "VOLS inner = %g, outer = %g, shell = %g" % (core_vol, shell_vol+core_vol, shell_vol)
-
-f = open('core-shell.txt','w')
-f.write("<q_cs>   <ans_cs>   <sim_cs>\n")
-for q in [1,0.1,0.05,0.04,0.03,0.02,0.01,0.005,0.001,0.0001]:
-#for i in range(400):
-    #q = 0.0001+i*0.005
-    ana = sphere.run([q,1.0])
-    sim = can.evaluate([q,1.0])
-    f.write("%g  %g  %g\n" %(q, ana, sim))
-    print "Core-shell: q=%g  ANA = %g   SIM = %g   (%g)" %(q, ana, sim, sim/ana)
-
-f.close()
-
-
-print "Time: ", time.time()-t_0
Index: nsmodels/src/sans/models/test/prototypes/test_cyl_err2.py
===================================================================
--- sansmodels/src/sans/models/test/prototypes/test_cyl_err2.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,164 +1,0 @@
-try:
-    from sans.models.prototypes.SimCylinderF import SimCylinderF
-except:
-    print "This test uses the prototypes module."
-from sans.models.CylinderModel import CylinderModel
-import time, math, random
-
-def reset(seed=0):
-    sim = SimCylinderF()
-    sim.setParam('radius', 20)
-    sim.setParam('length', 200)
-    sim.setParam('phi', 1)
-    sim.setParam('theta', 1)
-    sim.setParam('seed', math.fmod(time.time()*100+seed,10000))
-    return sim
-
-# number of times to repeat each point
-N_q = 50
-# Relative error on the simulation
-sig_val = 0.20
-
-
-counter = 0
-
-sim = reset()
-sph = CylinderModel()
-
-
-sph.setParam('radius', 20)
-sph.setParam('length', 200)
-sph.setParam('scale', 1)
-sph.setParam('contrast',1)
-sph.setParam('length', 200)
-sph.setParam('cyl_phi', 1)
-sph.setParam('cyl_theta', 1)
-
-vol = math.pi*20*20*200
-
-f = open('sim_err_cyl.txt', 'w')
-f.write("<q>  <npts>  <sigma>\n")
-
-
-
-
-for i_npts in range(1):
-
-    # Find which q has an error of sig_val
-    #print err    
-    q_sigma = 0
-    i_min = 0
-    i_max = 0
-    i_last_max = 0
-    val_min = 0
-    val_max = 0
-    last_error = 0
-    last_val = 0
-    error_vec = []
-    
-    found_it = False
-    i_vec = 0
-        
-    
-    t_0 = time.time()
-    npts = 50000
-    #npts = 50000*i_npts+1000
-    #npts = 1000 * math.pow(2.0,(i_npts+1))
-    
-    sim = reset()
-    #sim.setParam('npoints', npts)
-    
-    # Vectors of errors
-    err = []
-    for i in range(80):
-        q = 0.40*(i) /50
-        
-        
-        # For each Q, repeat the simulation N_q times
-        sum_q_ana = 0
-        sum_q_sim = 0
-        sum = 0
-        vec = []
-        for i_q in range(N_q):
-            counter += 1
-            sim = reset(counter)
-            #sim.setParam('npoints', npts)
-                    
-            simval = sim.run([q, 0])
-            sum_q_ana += sph.run([q, 0])
-            sum_q_sim += simval
-            
-            vec.append(simval)
-            
-        mean = sum_q_sim/N_q
-        for val in range(N_q):
-            diff = vec[val] - mean
-            sum += diff * diff
-        sum /= (N_q-1)
-
-        ana_value = sum_q_ana/N_q
-        sim_value = sum_q_sim/N_q
-        
-         
-        try:    
-            err_i = [q, (sim_value-ana_value)/ana_value, ana_value, math.sqrt(sum)/ana_value]
-        except:
-            err_i = [q,0,0,0]
-        
-        err.append(err_i)
-                    
-        print err_i
-    
-        
-        # update extrema
-        if val_min > err_i[2]:
-            val_min = err_i[2]
-            
-        if val_max < err_i[2]:
-            val_max = err_i[2]
-        
-        # Find a minimum, where the error changes sign
-        if last_val==val_min and err_i[2] > val_min:
-            
-            
-            #print "  min", err_i[0]
-            if i_min > 0:
-                i_plateau = i_last_max
-      
-                # check error for plateau
-                #if math.fabs(err[i_plateau][1])>sig_val:
-                if math.fabs(err[i_max][3])>sig_val:
-                    error_vec.append(err[i_plateau])
-                    t_f = time.time()
-                    pred = sph.run([err[i_plateau][0],0])
-                    print '[',t_f-t_0,']',math.pow((vol/npts),-.6666), 'n=',npts, 'q=',err[i_plateau][0], \
-                        'err=',math.fabs(err[i_plateau][1]), i_min, 'sig=',err[i_plateau][3]
-                        
-                    f.write("%10g %10g %10g\n" % (err[i_plateau][0], npts, err[i_plateau][3]))
-                    found_it = True
-                    break
-                
-            i_min = i_vec
-            # Get ready for next maximum
-            val_max = val_min
-            
-        # check if we are at max
-        elif last_val==val_max and err_i[2]<val_max:
-            #print "   max", err[i_vec-1][0], err[i_vec-1][1]
-            i_last_max = i_max
-            i_max = i_vec-1
-            # get ready for next minimum
-            val_min = val_max
-
-        last_error = err_i[1]
-        last_val = err_i[2]
-        i_vec += 1
-
-        
-    if found_it == False:
-        print "Could not complete", npts
-    #print "Npts = %g; %s" %(npts, str(len(error_vec)))
-        
-
-f.close()
-
Index: nsmodels/src/sans/models/test/prototypes/test_cyl_iq.py
===================================================================
--- sansmodels/src/sans/models/test/prototypes/test_cyl_iq.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,77 +1,0 @@
-try:
-    from sans.models.prototypes.TestSphere2 import TestSphere2
-    from sans.models.prototypes.SimCylinderF import SimCylinderF
-    from sans.models.prototypes.SimCylinder import SimCylinder
-except:
-    print "This test uses the prototypes module."
-from sans.models.SphereModel import SphereModel
-from sans.models.CylinderModel import CylinderModel
-import math, time
-
-
-def test_lores():
-
-    lores = open('lores.iq', 'r')
-    f = open('lores_check.txt', 'w')
-    content = lores.read()
-    lines = content.split('\n')
-    inum = 0
-    norma = 0.
-    for line in lines:
-        toks = line.split()
-        if len(toks)==2:
-            inum += 1
-            q = float(toks[0])
-            ana = sph.run(q)
-            if inum==1:
-                continue
-            elif inum==2:
-                norma = ana/float(toks[1])
-            lor = float(toks[1])*norma
-            f.write("%g %g %g\n" % (q, ana, lor))
-    f.close()
-            
-
-#sim = TestSphere2()
-#sph = SphereModel()
-sim = SimCylinderF()
-sph = CylinderModel()
-
-sim.setParam('radius', 20)
-sim.setParam('length', 200)
-sim.setParam('phi', 1)
-sim.setParam('theta', 1)
-sim.setParam('npoints',2500)
-#print sph.params
-
-sph.setParam('radius', 20)
-sph.setParam('scale', 1)
-sph.setParam('contrast',1)
-sph.setParam('length', 200)
-sph.setParam('cyl_phi', 1)
-sph.setParam('cyl_theta', 1)
-
-#print "ANA", sph.run(0.1)
-#print "SIM", sim.run(0.1)
-
-f = open('sim_iq.txt', 'w')
-f.write("<q>  <ana>  <sim>\n")
-
-t_0 = time.time()
-
-for i in range(60):
-    q = 0.01 * (i+1) /3.0
-    #ana_value = sph.run([q,0])
-    #sim_value = sim.run([q,0])
-    ana_value = sph.run(q)
-    sim_value = sim.run(q)
-    ratio = 0
-    if sim_value>0:
-        ratio = sim_value/ana_value
-    print q, ana_value, sim_value, ratio
-    f.write("%10g %10g %10g\n" % (q, ana_value, sim_value))
-
-t_f = time.time()
-print "Time = ", t_f-t_0
-f.close()
-
Index: nsmodels/src/sans/models/test/prototypes/test_simulation.py
===================================================================
--- sansmodels/src/sans/models/test/prototypes/test_simulation.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,275 +1,0 @@
-try:
-    from sans.models.prototypes.SimCylinder import SimCylinder
-except:
-    print "This test uses the prototypes module."
-    
-from sans.models.CylinderModel import CylinderModel
-
-import os, sys
-
-def simulate(filename="simul.txt", npts=500):
-    output_file = open(filename, 'w')
-    #output_file = open("simul_phi=0_theta=1_57_l=400_r=20_9.txt", 'w')
-    
-    sim = SimCylinder()
-    sim.setParam('scale', 1.0)
-    #sim.setParam('length', 100.0)
-    #sim.setParam('radius', 40.0)
-    sim.setParam('length', 400.0)
-    sim.setParam('radius', 20.0)
-    sim.setParam('theta', 1.57)
-    sim.setParam('phi', 0.0)
-    sim.setParam('qmax', 0.2)
-    
-    output_file.write("<q_value>  <ana_value>  <sim_value>\n")
-    norma = 0
-    for i in range(npts):
-        q = 1.0/npts*(i+1)
-        
-        cyl_val = sim.run(q)
-        sim_val = sim.run([q, 0.0])
-        if i==0:
-            norma = cyl_val/sim_val
-        
-        #print q, cyl_val, sim_val, sim_val/cyl_val
-        output_file.write("%10g %10g %10g\n" % (q, cyl_val, sim_val*norma))
-        
-    output_file.close()
-     
-def create_model():
-    sim = SimCylinder()
-    sim.setParam('scale', 1.0)
-    sim.setParam('length', 100.0)
-    sim.setParam('radius', 40.0)
-    # simul and simul_2
-    #sim.setParam('theta', 1.57)
-    #sim.setParam('phi', 0.0)
-    sim.setParam('theta', 0.0)
-    sim.setParam('phi', 1.0)
-    sim.setParam('qmax', 0.2)
-    return sim
-    
-def comp(): 
-    """
-        Simple test that should give 1 for the ratio
-        of simulated and analytical
-    """
-    sim = create_model()
-    
-    ana_val = sim.run(.05)
-    sim_val = sim.run([0.05, 0])
-    print ana_val, sim_val, ana_val/sim_val
-    
-    
-#    ana_val = sim.run(.05)
-#    sim_val = sim.run([0.05, 1])
-#    print ana_val, sim_val, ana_val/sim_val
-    
-#    sim = create_model()
-#    sim.setParam('theta', 1.0)
-#    sim.setParam('phi', 1.0)   
-#    ana_val = sim.run(.05)
-#    sim_val = sim.run([0.05, 1])
-#    print ana_val, sim_val, ana_val/sim_val
-    
-#    sim = create_model()
-#    sim.setParam('theta', 1.0)
-#    sim.setParam('phi', 2.0)
-#    ana_val = sim.run(.05)
-#    sim_val = sim.run([0.05, 1])
-#    print ana_val, sim_val, ana_val/sim_val
-    
-    sim = create_model()
-    sim.setParam('theta', 1.0)
-    sim.setParam('phi', -2.0)
-    ana_val = sim.run(.05)
-    sim_val = sim.run([0.15, 1])
-    print ana_val, sim_val, ana_val/sim_val
-    
-def add_error_to_file(prefix = "", dir = "output"):
-    import os, math
-    
-    # Open standard deviation file
-    std_file = open("%s/std_simul.txt" % dir, 'r')
-    std_content = std_file.read()
-    std_lines = std_content.split('\n')
-    
-    std_values = {}
-    for line in std_lines:
-        if line == std_lines[0]:
-            continue
-        
-        toks = line.split()
-        if not len(toks) > 3:
-            continue
-
-        std_values[toks[0]] = float(toks[2])
-    
-    std_file.close()
-    
-    # Read the files
-    
-    file_list = os.listdir(dir)
-    
-    for file in file_list:
-        if file.count(prefix)>0:
-            print "Reading", file
-    
-            file_obj = open("%s/%s" % (dir, file), 'r')
-            
-            # open new file
-            file_new = open("%s/error-%s" % (dir, file), 'w')
-            file_content = file_obj.read()
-            lines = file_content.split('\n')
-            for line in lines:
-                if line == lines[0]:
-                    file_new.write(line+'\n')
-                    continue
-                    
-                toks = line.split()
-                
-                if not len(toks) == 3:
-                    file_new.write(line+'\n')
-                    continue
-            
-                error = 0
-                if toks[0].lower() in std_values:
-                    error = float(toks[2]) * std_values[toks[0].lower()]
-                    
-                file_new.write(line+" %10g\n" % error)
-                
-            file_obj.close()
-            file_new.close()
-    
-    
-    
-def std_estimate(prefix = "", dir="output"):
-    import os, math
-    
-    file_list = os.listdir(dir)
-    output_file = open("%s/std_simul.txt" % dir, 'w')
-    output_file.write("<q_value>   <std>  <frac>\n")
-    values = {}
-    
-    for file in file_list:
-        if file.count(prefix)>0:
-            print "Reading", file
-            file_obj = open("%s/%s" % (dir, file), 'r')
-            file_content = file_obj.read()
-            lines = file_content.split('\n')
-            for line in lines:
-                if line == lines[0]:
-                    continue
-                toks = line.split()
-                
-                if not len(toks) == 3:
-                    continue
-                
-                if toks[0] not in values:
-                    values[toks[0]] = []
-                    
-                values[toks[0]].append(float(toks[2]))
-                                       
-    q_list = values.keys()
-    q_list.sort()                 
-    for q in q_list:
-        num = len(values[q])
-        sum = 0
-        mean = 0
-        for val in range(num):
-            mean += values[q][val] 
-        mean /= num
-            
-        for val in range(num):
-            diff = values[q][val] - mean
-            sum += diff * diff
-        sum /= (num-1)
-        #print q, math.sqrt(sum)
-    
-        output_file.write("%10s %10g %10g %10g\n" % (q, math.sqrt(sum), math.sqrt(sum)/mean, math.sqrt(sum)/mean*100.0))
-        
-    output_file.close()
-    
-    
-    # sqrt( 1/(N-1) sum[ (x-mean)**2 ] )
-    
-def test_volume_pts():
-    import random, math, time
-    
-    print "Generating points"
-    pt_list = []
-    for i in range(50000):
-        x = random.random()
-        y = random.random()
-        z = random.random()
-        pt_list.append([x, y, z])
-        
-    # Compute list of closest distance for each point
-    print "Computing distances"
-    closest_list = []
-    t_init = time.time()
-    
-    for i in range(len(pt_list)):
-        if math.fmod(i,100)==0:
-            print i, time.time()-t_init
-            t_init = time.time()
-        pt = pt_list[i]
-        
-        min_dist = -1.0
-        for j in range(i+1, len(pt_list)):
-            pt_2 = pt_list[j]
-            #print pt_2
-            dx = pt[0]-pt_2[0]
-            dy = pt[1]-pt_2[1]
-            dz = pt[2]-pt_2[2]
-            dist = math.sqrt( dx*dx + dy*dy + dz*dz ) 
-            if min_dist<0 or dist < min_dist:
-                min_dist = dist
-             
-        closest_list.append(min_dist)        
-        
-    # Analyze list of distances
-    print "Analyzing"
-    sum = 0
-    for d in closest_list:
-        sum += d
-    average = sum/len(closest_list)
-    
-    sum = 0
-    for d in closest_list:
-        diff = d - average
-        sum += diff*diff
-    sum /= len(closest_list)
-    
-    print "%5g +/- %5g)" % (average, math.sqrt(sum))
-    
-                              
-            
-    
-if __name__ == '__main__':
-    #test_volume_pts()
-    #simulate("simul_phi=0_theta=1_57_l=400_r=20_test.txt")
-    #std_estimate("simul_phi=0_theta=1_57_l=400_r=20")
-    #add_error_to_file("l=400_r=20.txt")
-    
-    option = "error"
-    
-    #if len(sys.argv)>1:
-    if len(option)>0:
-        if option=="gen":
-            ifile = 0
-            for i in range(100):
-                ifile += 1
-                #print "simul_qmax=1_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile
-                #simulate("simul_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile)
-                print "simul_qmax=1_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile
-                simulate("output/pt5000/simul_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile)
-        elif option=="comp":
-            comp()
-        elif option=="std":
-            #std_estimate("simul_phi=0_theta=1_57_l=400_r=20")
-            std_estimate("simul_phi=0_theta=1_57_l=400_r=20", "output/pt5000")
-        elif option=="error":
-            #add_error_to_file("l=400_r=20.txt")
-            add_error_to_file("l=400_r=20_1.txt", "output/pt5000")
-            
Index: nsmodels/src/sans/models/test/prototypes/test_sphere_err2.py
===================================================================
--- sansmodels/src/sans/models/test/prototypes/test_sphere_err2.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,156 +1,0 @@
-try:
-    from sans.models.prototypes.SimSphereF import SimSphereF
-except:
-    print "This test uses the prototypes module."
-from sans.models.SphereModel import SphereModel
-import time, math, random
-
-def reset(seed=0):
-    sim = SimSphereF()
-    sim.setParam('radius', 60)
-    sim.setParam('seed', math.fmod(time.time()*100+seed,10000))
-    return sim
-
-# number of times to repeat each point
-N_q = 50
-# Relative error on the simulation
-sig_val = 0.10
-
-
-counter = 0
-
-sim = reset()
-sph = SphereModel()
-
-
-sph.setParam('radius', 60)
-sph.setParam('scale', 1)
-
-vol = 4/3*math.pi*60*60*60
-
-f = open('sim_err_4.txt', 'w')
-f.write("<q>  <npts>  <sigma>\n")
-
-
-
-
-for i_npts in range(15):
-
-    # Find which q has an error of sig_val
-    #print err    
-    q_sigma = 0
-    i_min = 0
-    i_max = 0
-    i_last_max = 0
-    val_min = 0
-    val_max = 0
-    last_error = 0
-    last_val = 0
-    error_vec = []
-    
-    found_it = False
-    i_vec = 0
-        
-    
-    t_0 = time.time()
-    npts = 50000*i_npts+1000
-    #npts = 1000 * math.pow(2.0,(i_npts+1))
-    
-    sim = reset()
-    sim.setParam('npoints', npts)
-    
-    # Vectors of errors
-    err = []
-    for i in range(80):
-        q = 0.40*(i) /50
-        
-        
-        # For each Q, repeat the simulation N_q times
-        sum_q_ana = 0
-        sum_q_sim = 0
-        sum = 0
-        vec = []
-        for i_q in range(N_q):
-            counter += 1
-            sim = reset(counter)
-            sim.setParam('npoints', npts)
-                    
-            simval = sim.run([q, 0])
-            sum_q_ana += sph.run([q, 0])
-            sum_q_sim += simval
-            
-            vec.append(simval)
-            
-        mean = sum_q_sim/N_q
-        for val in range(N_q):
-            diff = vec[val] - mean
-            sum += diff * diff
-        sum /= (N_q-1)
-
-        ana_value = sum_q_ana/N_q
-        sim_value = sum_q_sim/N_q
-        
-        
-        
-        try:    
-            err_i = [q, (sim_value-ana_value)/ana_value, ana_value, math.sqrt(sum)/ana_value]
-        except:
-            err_i = [q,0,0,0]
-        
-        err.append(err_i)
-                    
-         
-    
-        
-        # update extrema
-        if val_min > err_i[2]:
-            val_min = err_i[2]
-            
-        if val_max < err_i[2]:
-            val_max = err_i[2]
-        
-        # Find a minimum, where the error changes sign
-        if last_val==val_min and err_i[2] > val_min:
-            
-            
-            #print "  min", err_i[0]
-            if i_min > 0:
-                i_plateau = i_last_max
-      
-                # check error for plateau
-                #if math.fabs(err[i_plateau][1])>sig_val:
-                if math.fabs(err[i_max][3])>sig_val:
-                    error_vec.append(err[i_plateau])
-                    t_f = time.time()
-                    pred = sph.run([err[i_plateau][0],0])
-                    print '[',t_f-t_0,']',math.pow((vol/npts),-.6666), 'n=',npts, 'q=',err[i_plateau][0], \
-                        'err=',math.fabs(err[i_plateau][1]), i_min, 'sig=',err[i_plateau][3]
-                        
-                    f.write("%10g %10g %10g\n" % (err[i_plateau][0], npts, err[i_plateau][3]))
-                    found_it = True
-                    break
-                
-            i_min = i_vec
-            # Get ready for next maximum
-            val_max = val_min
-            
-        # check if we are at max
-        elif last_val==val_max and err_i[2]<val_max:
-            #print "   max", err[i_vec-1][0], err[i_vec-1][1]
-            i_last_max = i_max
-            i_max = i_vec-1
-            # get ready for next minimum
-            val_min = val_max
-
-        last_error = err_i[1]
-        last_val = err_i[2]
-        i_vec += 1
-
-        
-    if found_it == False:
-        print "Could not complete", npts
-    #print "Npts = %g; %s" %(npts, str(len(error_vec)))
-        
-
-f.close()
-
Index: nsmodels/src/sans/models/test/prototypes/test_sphere_iq.py
===================================================================
--- sansmodels/src/sans/models/test/prototypes/test_sphere_iq.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,43 +1,0 @@
-try:
-    from sans.models.prototypes.SimSphereF import SimSphereF
-except:
-    print "This test uses the prototypes module."
-from sans.models.SphereModel import SphereModel
-import math, time
-
-
-
-sim = SimSphereF()
-sph = SphereModel()
-
-sim.setParam('radius', 60)
-sim.setParam('npoints', 50000)
-
-sph.setParam('radius', 60)
-sph.setParam('scale', 1)
-
-
-f = open('sim_iq.txt', 'w')
-f.write("<q>  <ana>  <sim> <err>\n")
-
-t_0 = time.time()
-
-#for i in range(60):
-for i in range(100):
-    #q = 0.01 * (i+1) /3.0
-    q = 0.05 + 0.20*(i+1) /100
-    
-    ana_value = sph.run([q,0])
-    sim_value = sim.run([q,0])
-#    ana_value = sph.run(q)
-#    sim_value = sim.run(q)
-    ratio = 0
-    if sim_value>0:
-        ratio = sim_value/ana_value
-    print q, ana_value, sim_value, ratio
-    f.write("%10g %10g %10g %10g\n" % (q, ana_value, sim_value, (sim_value-ana_value)/ana_value))
-
-t_f = time.time()
-print "Time = ", t_f-t_0
-f.close()
-
Index: nsmodels/src/sans/models/test/sphere_testdata.txt
===================================================================
--- sansmodels/src/sans/models/test/sphere_testdata.txt	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,135 +1,0 @@
-pythonclass = SphereModel
-scale = 1
-radius = 60
-contrast = 1e-6
-background = 0.01
-
-DATA
-0.001	90.4227444561307
-0.00105251266011778	90.4157276053359
-0.00110778289970821	90.4079550029624
-0.00116595552660488	90.3993453156916
-0.00122718295288593	90.3898084718774
-0.00129162559419317	90.3792447263187
-0.00135945229002046	90.3675436251717
-0.00143084074607265	90.3545828615347
-0.00150597799985384	90.3402270095186
-0.00158506091070502	90.3243261248614
-0.00166829667557485	90.3067141976634
-0.00175590337187494	90.287207442629
-0.00184811052884188	90.2656024098205
-0.00194515972890305	90.2416738978344
-0.00204730524062173	90.2151726495366
-0.00215481468487986	90.185822808414
-0.00226796973604376	90.1533191119972
-0.00238706685995004	90.1173237963576
-0.00251241809064502	90.0774631837544
-0.00264435184791283	90.0333239229256
-0.00278321379773411	89.9844488493339
-0.00292936775792964	89.9303324299529
-0.00308319665136179	89.8704157547851
-0.00324510350919104	89.8040810347349
-0.00341551252681621	89.7306455629486
-0.00359487017526494	89.6493550944954
-0.00378364637094618	89.5593765971608
-0.00398233570682956	89.4597903244572
-0.00419145874827721	89.3495811609297
-0.0044115633969232	89.2276291894534
-0.00464322632617388	89.0926994310602
-0.00488705449209019	88.9434307099749
-0.0051436867236104	88.7783236005616
-0.0054137953962797	88.5957274193056
-0.00569808819387176	88.393826234303
-0.00599730996251769	88.1706238779775
-0.00631224466220038	87.9239279666488
-0.00664371742072679	87.6513329544612
-0.00699259669556001	87.3502022802804
-0.00735979654917468	87.0176497061855
-0.00774627904389752	86.6505199970915
-0.00815305676250721	86.2453691549684
-0.00858119546119774	85.7984445008535
-0.00903181686185589	85.3056649962709
-0.00950610159096858	84.7626023162297
-0.0100052922728602	84.1644633324426
-0.010530696785364	83.5060748418634
-0.0110836916864573	82.7818715864011
-0.0116657258208385	81.9858888591154
-0.0122783241158954	81.1117612843166
-0.0129230915770094	80.1527296972877
-0.0136017174926639	79.1016584357033
-0.0143159798603742	77.9510657891023
-0.0150677500450351	76.6931708311579
-0.0158589976818897	75.3199603730699
-0.0166917958369675	73.8232803087866
-0.0175683264385096	72.1949561473611
-0.0184908859936133	70.4269480041077
-0.0194618916050726	68.5115456917836
-0.0204838873041789	66.4416097339716
-0.0215595507160742	64.2108640045017
-0.0226917000751195	61.8142451337187
-0.0238833016086589	59.248312629239
-0.0251374773085249	56.5117216066172
-0.0264575131106459	53.605756841905
-0.027846867504187	50.5349222351867
-0.0293091805927793	47.3075733855052
-0.0308482836315787	43.9365725134711
-0.0324682090651407	40.4399341936915
-0.0341732010924115	36.8414172059712
-0.035967726786514	33.1710025095031
-0.0378564877984635	29.4651805895993
-0.0398444326754772	25.7669546222864
-0.0419367698261504	22.1254514069004
-0.0441389811664687	18.5950234076791
-0.0464568364824087	15.2337275099316
-0.0488964085467568	12.1010856393634
-0.0514640890297529	9.2550766770957
-0.0541666052452436	6.74838567895613
-0.0570110377762212	4.62405104866114
-0.0600048390259259	2.9108039900483
-0.0631558527431166	1.61857916581746
-0.0664723345726646	0.734868643264245
-0.0699629736853145	0.222751268886955
-0.0736369155432808	0.021493170785741
-0.0775037858613269	0.0505007176184419
-0.0815737158261042	0.217030561955665
-0.085857368639825	0.427366151211124
-0.0903659674578153	0.600177099372201
-0.0951113247931421	0.679643993347096
-0.100105873465356	0.644995876938007
-0.105362699174436	0.512882672304445
-0.110895574785276	0.330050926618079
-0.116718996412541	0.156436599531048
-0.122848221400442	0.0427161530728255
-0.129299308296917	0.0102364291202494
-0.136089158926978	0.0427676396140632
-0.143235562675425	0.0962906936732686
-0.150757243094979	0.124412512424065
-0.158673906961919	0.106245316452041
-0.167006295907771	0.0581157186256502
-0.175776240762306	0.0180003127669836
-0.185006718750238	0.0120232942917672
-0.194721913691476	0.0314717764737715
-0.20494727936264	0.0445914093009115
-0.215709606185875	0.0335942223501167
-0.227037091419654	0.0143439512133508
-0.238959413035505	0.0113779690004859
-0.251507807474183	0.0214441689681625
-0.264715151485044	0.0221334416546839
-0.278616048263005	0.012423248413131
-0.2932469181088	0.0111309676391173
-0.308646093850034	0.0164251291976273
-0.324853921273063	0.0133484308747301
-0.341912864828804	0.0100937607456987
-0.359867618889456	0.0133061305111565
-0.378765224847594	0.0115497267629865
-0.398655194364451	0.0103763850351245
-0.4195896390903	0.0120165913778557
-0.441623407196792	0.0100464754133085
-0.464814227078974	0.0111896261669603
-0.489222858603482	0.0102144295433158
-0.514913252299177	0.0106974772728633
-0.541952716907305	0.0101315993523187
-0.570412095730168	0.0105409279971524
-0.600365952240318	0.0100029843668479
-0.631892765436603	0.0103719406877445
-0.665075135458861	0.0101206894788735
Index: nsmodels/src/sans/models/test/testModel.xml
===================================================================
--- sansmodels/src/sans/models/test/testModel.xml	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ 	(revision )
@@ -1,2 +1,0 @@
-<Component class='EllipticalCylinderModel' name='EllipticalCylinderModel'>
-</Component>
Index: nsmodels/src/sans/models/test/test_pickle_cyl.py
===================================================================
--- sansmodels/src/sans/models/test/test_pickle_cyl.py	(revision c7a7e1b43ffc376e5c441f8a90c5291a702ff4b3)
+++ 	(revision )
@@ -1,9 +1,0 @@
-import pickle
-from sans.models.CylinderModel import CylinderModel
-import copy
-
-model = CylinderModel()
-model.setParam('cyl_theta', 1.234)
-p = copy.deepcopy(model)
-
-assert p.getParam('cyl_theta') == model.getParam('cyl_theta')
Index: nsmodels/src/sans/models/test/testcase_generator.py
===================================================================
--- sansmodels/src/sans/models/test/testcase_generator.py	(revision ae60f8613faa37cf4fa6112ca8cc43e854b4cdbd)
+++ 	(revision )
@@ -1,770 +1,0 @@
-"""
-    Random test-case generator for BaseComponents
-    
-"""
-import time
-
-def randomModel():
-    """ Return a random model name """
-    from sans.models.ModelFactory import ModelFactory
-    from random import random
-    from math import floor
-    
-    model_list = ModelFactory().getAllModels()
-    ready = False
-    while not ready:
-        rnd_id = int(floor(random()*len(model_list)))
-        if model_list[rnd_id] not in ["TestSphere2", "DataModel"]:
-            ready = True
-    return model_list[rnd_id]
-
-class ReportCard: # pylint: disable-msg=R0902
-    """ Class to hold test-case results """
-    
-    def __init__(self):
-        """ Initialization """
-        ## Number of test cases
-        self.n_cases = 0
-        ## Number of passed test cases
-        self.n_cases_pass = 0
-        ## Number of Evaluation calls
-        self.n_eval = 0
-        ## Number of passed Evaluation calls
-        self.n_eval_pass = 0
-        ## Number of SetParam calls
-        self.n_set = 0
-        ## Number of passed Set calls
-        self.n_set_pass = 0
-        ## Number of GetParam calls
-        self.n_get = 0
-        ## Number of passed Get calls
-        self.n_get_pass = 0
-        ## Number of load calls
-        self.n_load = 0
-        ## Number of passed Load calls
-        self.n_load_pass = 0
-        ## Number of save calls
-        self.n_save = 0
-        ## Number of passed Save calls
-        self.n_save_pass = 0
-        ## Number of Add calls
-        self.n_add = 0
-        ## Number of passed Add calls
-        self.n_add_pass = 0
-        ## Number of Sub calls
-        self.n_sub = 0
-        ## Number of passed Sub calls
-        self.n_sub_pass = 0
-        ## Number of Div calls
-        self.n_div = 0
-        ## Number of passed Div calls
-        self.n_div_pass = 0
-        ## Number of mul calls
-        self.n_mul = 0
-        ## Number of passed Mul calls
-        self.n_mul_pass = 0
-        ## Test log
-        self.log = ""
-        ## Trace
-        self.trace = ""
-        ## Model tested
-        self.model = ""
-        ## List of all models tested
-        self.modelList = []
-        
-        
-    def __add__(self, other):
-        """ Add two report cards
-            @param other: other report to add
-            @return: updated self
-        """
-        
-        self.n_cases += other.n_cases
-        self.n_cases_pass += other.n_cases_pass
-        self.n_eval += other.n_eval
-        self.n_eval_pass += other.n_eval_pass
-        self.n_set += other.n_set
-        self.n_set_pass += other.n_set_pass
-        self.n_get += other.n_get
-        self.n_get_pass += other.n_get_pass
-        self.n_load += other.n_load
-        self.n_load_pass += other.n_load_pass
-        self.n_save += other.n_save
-        self.n_save_pass += other.n_save_pass
-        self.n_add += other.n_add
-        self.n_add_pass += other.n_add_pass
-        self.n_sub += other.n_sub
-        self.n_sub_pass += other.n_sub_pass
-        self.n_mul += other.n_mul
-        self.n_mul_pass += other.n_mul_pass
-        self.n_div += other.n_div
-        self.n_div_pass += other.n_div_pass
-        if len(other.log)>0:
-            self.log += other.log
-        if len(other.trace)>0:
-            self.trace += other.trace
-            
-        if not other.model in self.modelList:
-            self.modelList.append(other.model)
-            
-        return self
-        
-    def isPassed(self):
-        """ Returns true if no error was found """
-        if self.n_cases_pass < self.n_cases \
-            or self.n_save_pass < self.n_save \
-            or self.n_load_pass < self.n_load \
-            or self.n_set_pass < self.n_set \
-            or self.n_get_pass < self.n_get \
-            or self.n_eval_pass < self.n_eval \
-            or self.n_add_pass < self.n_add \
-            or self.n_sub_pass < self.n_sub \
-            or self.n_mul_pass < self.n_mul \
-            or self.n_div_pass < self.n_div:
-            return False
-        return True
-        
-    def __str__(self):
-        """ String representation of the report card """
-        from sans.models.ModelFactory import ModelFactory
-        
-        rep = "Detailed output:\n"
-        rep += self.log
-        rep += "\n"
-        rep += "Total number of cases: %g\n" % self.n_cases
-        rep += "   Passed:             %g\n" % self.n_cases_pass
-        rep += "\n"
-        self.modelList.sort()
-        rep += "Models tested: %s\n" % self.modelList
-        all_models = ModelFactory().getAllModels()
-        all_models.sort()
-        rep += "\n"
-        rep += "Available models: %s\n" % all_models
-        rep += "\n"
-        rep += "Breakdown:\n"
-        rep += "   Eval:          %g / %g\n" % (self.n_eval_pass, self.n_eval)
-        rep += "   Set:           %g / %g\n" % (self.n_set_pass, self.n_set)
-        rep += "   Get:           %g / %g\n" % (self.n_get_pass, self.n_get)
-        rep += "   Load:          %g / %g\n" % (self.n_load_pass, self.n_load)
-        rep += "   Save:          %g / %g\n" % (self.n_save_pass, self.n_save)
-        rep += "   Add:           %g / %g\n" % (self.n_add_pass, self.n_add)
-        rep += "   Sub:           %g / %g\n" % (self.n_sub_pass, self.n_sub)
-        rep += "   Mul:           %g / %g\n" % (self.n_mul_pass, self.n_mul)
-        rep += "   Div:           %g / %g\n" % (self.n_div_pass, self.n_div)
-        return rep
-    
-        
-
-class TestCaseGenerator:
-    """ Generator for suite of test-cases
-    """
-    
-    def __init__(self):
-        """ Initialization
-        """
-        
-        self.n_tests = 0
-        self.n_passed = 0
-        self.time = 0
-        self.reportCard = ReportCard()
-    
-    def generateFiles(self, number, file_prefix):
-        """ Generate test-case files
-            @param number: number of files to generate
-            @param file_prefix: prefix for the file names
-        """
-        
-        for i in range(number):
-            filename = "%s_%d.xml" % (file_prefix, i)
-            self.generateFileTest(filename)
-            self.n_tests += 1
-            
-    def generateAndRun(self, number):
-        """ Generate test-cases and run them
-            @param number: number of test-cases to generate
-        """
-        start_time = time.time()
-        for i in range(number):
-            textcase = self.generateTest()
-            t = TestCase(text = textcase)
-            passed = t.run()
-            self.reportCard += t.reportCard
-            if not passed:
-                t = time.localtime()
-                xmloutput = open("error_%i-%i-%i-%i-%i-%i_%i.xml" % \
-                 (t[0],t[1],t[2],t[3],t[4],t[5],self.reportCard.n_cases),'w')
-                xmloutput.write(textcase)
-                xmloutput.close()
-
-                
-        self.time += time.time()-start_time
-        print self.reportCard        
-        
-    def generateFileTest(self, filename = "tmp.xml"):
-        """
-            Write a random test-case in an XML file
-            @param filename: name of file to write to
-        """
-        text = self.generateTest()
-        # Write test case in file
-        xmlfile = open(filename,'w')
-        xmlfile.write(text)
-        xmlfile.close()
-    
-    
-    def generateTest(self):
-        """
-            Generate an XML representation of a random test-case
-        """
-        import random
-        
-        #t = TestCase()
-        text = "<?xml version=\"1.0\"?>\n"
-        text  += "<TestCase>\n"
-        stimulus = "eval"
-    
-        loop = True
-        while loop:
-            rnd = random.random()
-            
-            # run 50%
-            if rnd <= 0.5:
-                stimulus = "eval"
-            elif rnd>0.5 and rnd<=0.7:
-                stimulus = "set"
-            elif rnd>0.7 and rnd<=0.72:
-                stimulus = "save"
-            elif rnd>0.72 and rnd<=0.74:
-                stimulus = "load"
-            elif rnd>0.74 and rnd<=0.8:
-                stimulus = "get"
-            elif rnd>0.8 and rnd<=0.81:
-                stimulus = "add"
-            elif rnd>0.81 and rnd<=0.82:
-                stimulus = "div"
-            elif rnd>0.82 and rnd<=0.83:
-                stimulus = "mul"
-            elif rnd>0.83 and rnd<=0.84:
-                stimulus = "sub"
-            else:
-                # just run and quit
-                stimulus = "eval"
-                loop = False
-                
-            text += "  <Stimulus id=\"%s\"/>\n" % stimulus
-        text += "</TestCase>"
-        
-        return text
-    
-        
-class TestCase:
-    """ Test-case class """
-    
-    def __init__(self, filename = None, text = None):
-        """ Initialization
-            @param filename: name of file containing the test case
-        """
-        #from sans.models.ModelFactory import ModelFactory
-        self.filename = filename
-        self.text = text
-        #self.model = ModelFactory().getModel(randomModel())
-        self.model = getRandomModelObject()
-        #self.model = ModelFactory().getModel("SphereModel")
-        self.passed = True
-        self.reportCard = ReportCard()
-        
-    
-    def run(self):
-        """ Read the test case and execute it """
-        from xml.dom.minidom import parse
-        from xml.dom.minidom import parseString
-        
-        # Initialize report
-        self.reportCard = ReportCard()
-        self.reportCard.model = self.model.name
-        self.reportCard.n_cases = 1
-        
-        if not self.text == None:
-            dom = parseString(self.text)
-        elif not self.filename == None:
-            dom = parse(self.filename)
-        else:
-            print "No input to parse"
-            return False
-        
-        if dom.hasChildNodes():
-            for n in dom.childNodes:
-                if n.nodeName == "TestCase":
-                    self.processStimuli(n)
-            
-        # Update report card        
-        if self.passed:
-            self.reportCard.n_cases_pass = 1
-            
-        return self.passed
-                          
-    def processStimuli(self, node):
-        """ Process the stimuli list in the TestCase node 
-            of an XML test-case file
-            @param node: test-case node
-        """
-        import testcase_generator as generator
-        report = ReportCard()
-        report.trace = "%s\n" % self.model.name
-        
-        self.passed = True
-        if node.hasChildNodes():
-            for n in node.childNodes:
-                if n.nodeName == "Stimulus":
-                    
-                    s_type = None
-                    if n.hasAttributes():
-                        # Get stilumus ID
-                        for i in range(len(n.attributes)):
-                            attr_name = n.attributes.item(i).name
-                            if attr_name == "id":
-                                s_type = n.attributes.item(i).nodeValue
-                    if hasattr(generator,"%sStimulus" % s_type):
-                        stimulus = getattr(generator,"%sStimulus" % s_type)
-                        #print s_type, self.model.name
-                        m, res = stimulus(self.model)
-                        #print "     ", m.name
-                        self.model = m
-                        if not res.isPassed():
-                            self.passed = False
-                        
-                        report += res
-                        
-                    else:
-                        print "Stimulus %s not found" % s_type
-                        
-        self.reportCard += report
-        
-        if not self.passed:
-            print "\nFailure:"
-            print report.trace
-        return self.passed
-        
-    
-def evalStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwise
-    """
-    minval = 0.001
-    maxval = 1.0
-    # Call run with random input
-    import random, math
-    input_value = random.random()*(maxval-minval)+minval
-    
-    # Catch division by zero, which can happen
-    # when creating random models
-    try:
-        # Choose whether we want 1D or 2D
-        if random.random()>0.5:
-            output = model.run(input_value)
-        else:
-            output = model.run([input_value, 2*math.pi*random.random()])            
-    except ZeroDivisionError:
-        print "Error evaluating model %s: %g" % (model.name, input_value)
-        output = None
-        
-    #print "Eval: %g" % output
-    
-    # Oracle bit - just check that we have a number...
-    passed = False
-    try:
-        if output != None and math.fabs(output) >= 0: 
-            passed = True
-    except:
-        print "---> Could not compute abs val", output, model.name
-        
-    
-    report = ReportCard()
-    report.n_eval = 1
-    if passed:
-        report.n_eval_pass = 1
-    else:
-        report.log = "Eval: bad output value %s\n" % str(output)
-        
-    report.trace = "Eval(%g) = %s %i\n" % (input_value, str(output), passed)    
-    return model, report
-
-def setStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    # Call run with random input
-    import random, math
-    minval = 1
-    maxval = 5
-    
-    # Choose a parameter to change
-    keys = model.getParamList()
-    if len(keys)==0:
-        #print model.name+" has no params"
-        return model, ReportCard()
-    
-    p_len = len(keys)
-    i_param = int(math.floor(random.random()*p_len))
-    p_name  = keys[i_param]
-    
-    # Choose a value
-    # Check for min/max
-    if hasattr(model, "details"):
-        if model.details.has_key(p_name):
-            if model.details[p_name][1] != None:
-                minval = model.details[p_name][1]
-            if model.details[p_name][2] != None:
-                maxval = model.details[p_name][2]
-        elif model.other.details.has_key(p_name):
-            if model.other.details[p_name][1] != None:
-                minval = model.other.details[p_name][1]
-            if model.other.details[p_name][2] != None:
-                maxval = model.other.details[p_name][2]
-        elif model.operateOn.details.has_key(p_name):
-            if model.operateOn.details[p_name][1] != None:
-                minval = model.operateOn.details[p_name][1]
-            if model.operateOn.details[p_name][2] != None:
-                maxval = model.operateOn.details[p_name][2]
-            
-    input_val = random.random()*(maxval-minval)+minval
-    model.setParam(p_name, input_val)
-    
-    # Read back
-    check_val = model.getParam(p_name)
-    #print "Set: %s = %g" % (p_name, check_val)
-    
-    # Oracle bit
-    passed = False
-    if check_val == input_val: 
-        passed = True
-    
-    report = ReportCard()
-    report.n_set = 1
-    if passed:
-        report.n_set_pass = 1
-    else:
-        report.log = "Set: parameter %s not set properly %g <> %g\n" % \
-            (p_name, input_val, check_val)
-        
-    report.trace = "Set %s = %g %i\n" % (p_name, input_val, passed)    
-    return model, report
-
-def getStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwise
-    """
-    import random, math
-    # Choose a parameter to change
-    keys = model.getParamList()
-    if len(keys)==0:
-        #print model.name+" has no params"
-        return model, ReportCard()    
-    
-    p_len = len(keys)
-    i_param = int(math.floor(random.random()*p_len))
-    p_name  = keys[i_param]
-    
-    # Read back
-    check_val = model.getParam(p_name)
-    #print "Get: %s = %g" % (p_name, check_val)
-    
-    # Oracle bit
-    passed = False
-    if math.fabs(check_val) >= 0: 
-        passed = True
-        
-    report = ReportCard()
-    report.n_get = 1
-    if passed:
-        report.n_get_pass = 1
-    else:
-        report.log = "Get: bad value for parameter %s: %g\n" % \
-            (p_name, check_val)
-        
-    report.trace = "Get %s = %g %i\n" % (p_name, check_val, passed)    
-    return model, report
-
-def loadStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    from sans.models.ModelIO import ModelIO
-    from sans.models.ModelFactory import ModelFactory
-    factory = ModelFactory()
-    io = ModelIO(factory)
-    
-    # testModel.xml should be in the directory
-    loaded = io.load("load_test_model.xml")
-    value2 = loaded.run(1)
-    
-    # Oracle bit
-    passed = False
-    if not value2 == 0: 
-        passed = True
-        
-    report = ReportCard()
-    report.n_load = 1
-    if passed:
-        report.n_load_pass = 1
-    else:
-        report.log = "Load: bad loaded model\n"
-        
-    report.trace = "Load = %s %i\n" % (loaded.name, passed)    
-    return model, report
-
-def saveStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    from sans.models.ModelIO import ModelIO
-    from sans.models.ModelFactory import ModelFactory
-    factory = ModelFactory()
-    io = ModelIO(factory)
-    io.save(model,"testModel.xml")
-    #value = model.run(1)
-
-    # Check it 
-    loaded = io.load("testModel.xml")
-    try:
-        value2 = loaded.run(1)
-    except ZeroDivisionError:
-        value2 = -1
-    
-    # Oracle bit
-    passed = False
-    
-    # The two outputs do not need to be the same
-    # since we do not save the parameters!
-    # If it's the subtraction of two identical models, 
-    # we will also get zero!
-    #if value2 == value: 
-    #    passed = True
-    
-    passed = True
-
-        
-    report = ReportCard()
-    report.n_save = 1
-    if passed:
-        report.n_save_pass = 1
-    else:
-        report.log = "Save: bad output from saved model %g\n" % value2
-        
-    report.trace = "Save %s %i\n" % (model.name, passed)    
-    return model, report
-
-def getRandomModelObject():
-    """
-        Return a random model object
-    """
-    from sans.models.ModelFactory import ModelFactory
-    while True:
-        try:
-            modelname = randomModel()
-            add_model = ModelFactory().getModel(modelname)
-            return add_model
-        except:
-            # Don't complain when a model can't be loaded.
-            # A list of tested models will appear in the 
-            # file report, which can be compared with the 
-            # list of available models, also printed.
-            pass
-            #print "Could not load ", modelname
-    
-
-def addStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    #from sans.models.ModelFactory import ModelFactory
-    #factory = ModelFactory()
-    #add_model = factory.getModel("SphereModel")
-    add_model = getRandomModelObject()
-            
-    tmp = model + add_model
-    model = tmp
-    
-    # Oracle bit
-    passed = False
-    
-    try:
-        value2 = model.run(1)
-        value2 = float(value2)
-    except:
-        passed = False
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_add = 1
-    if passed:
-        report.n_add_pass = 1
-    else:
-        report.log = "Add: bad output from composite model\n"
-        
-    report.trace = "Div %s %i\n" % (model.name, passed)    
-    return model, report
-
-def subStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    from sans.models.ModelFactory import ModelFactory
-    from random import random
-    
-    #factory = ModelFactory()
-    #sub_model = factory.getModel("CylinderModel")
-    #sub_model = factory.getModel(randomModel())
-    sub_model = getRandomModelObject()
-
-    
-    sub_model.params["scale"] = 1.1*random()
-    tmp = model - sub_model
-    
-    # Oracle bit
-    passed = False
-    
-    try:
-        value2 = tmp.run(1.1 * (1.0 + random()))
-        value2 = float(value2)
-    except:
-        value2 = None
-        passed = False
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_sub = 1
-    if passed:
-        report.n_sub_pass = 1
-    else:
-        report.log = "Sub: bad output from composite model\n"
-
-    report.trace = "Sub %s (%g - %g = %s) %i\n" % \
-        (model.name, model.run(1), \
-         sub_model.run(1), str(value2), passed)                
-    return tmp, report
-
-def mulStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    #from sans.models.ModelFactory import ModelFactory
-    #factory = ModelFactory()
-    #mul_model = factory.getModel("SphereModel")
-    #mul_model = factory.getModel(randomModel())
-    mul_model = getRandomModelObject()
-    tmp = model * mul_model
-    
-    # Oracle bit
-    passed = False
-    
-    from random import random
-    input_val = 1.1 * (1.0 + random())
-    v1 = None
-    v2 = None
-    try:
-        v1 = mul_model.run(input_val)
-        v2 = model.run(input_val)
-        value2 = tmp.run(input_val)
-        value2 = float(value2)
-    except ZeroDivisionError:
-        value2 = None
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_mul = 1
-    if passed:
-        report.n_mul_pass = 1
-    else:
-        report.log = "Mul: bad output from composite model\n"
-        
-    report.trace = "Mul %s (%s * %s = %s) %i\n" % \
-      (model.name, str(v1), str(v2), str(value2), passed)                
-    return tmp, report
-
-def divStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwise
-    """
-    #from sans.models.ModelFactory import ModelFactory
-    #factory = ModelFactory()
-    #div_model = factory.getModel("SphereModel")
-    #div_model = factory.getModel(randomModel())
-
-    from random import random
-    input_val = 1.5 * random()
-    
-    # Find a model that will not evaluate to zero
-    # at the input value
-    try_again = True
-    while try_again:
-        div_model = getRandomModelObject()
-        try:
-            v2 = div_model.run(input_val)
-            try_again = False
-        except:
-            pass
-        
-    tmp = model / div_model
-    
-    # Oracle bit
-    passed = False
-    
-    v1 = None
-    v2 = None
-    try:
-        
-        # Check individual models against bad combinations,
-        # which happen from time to time given that all 
-        # parameters are random
-        try:
-            v2 = div_model.run(input_val)
-            v1 = model.run(input_val)
-            value2 = tmp.run(input_val)
-            value2 = float(value2)
-        except ZeroDivisionError:
-            value2 = None
-    except:
-        passed = False
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_div = 1
-    if passed:
-        report.n_div_pass = 1
-    else:
-        report.log = "Div: bad output from composite model\n"
-        
-    report.trace = "Div %s/%s (%g) = %s / %s = %s %i\n" % \
-      (model.name, div_model.name, input_val, str(v1), str(v2), str(value2), passed)                
-    return tmp, report
-
-if __name__ == '__main__':
-    print "Model operations are no longer supported."
-    print "The TestCase generator for model operation can't be used with this version of sansmodels." 
-    
-    
-    #print randomModel()
-    #g = TestCaseGenerator()
-    #g.generateAndRun(20000)
-    
-    #t = TestCase(filename = "error_1.17721e+009.xml")
-    #print t.run()
-    
Index: nsmodels/src/sans/models/test/utest_disperser.py
===================================================================
--- sansmodels/src/sans/models/test/utest_disperser.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,106 +1,0 @@
-"""
-    Unit tests for specific models
-    @author: Mathieu Doucet / UTK
-"""
-
-import unittest
-from SmearList import Smear
-
-# Disable "missing docstring" complaint
-# pylint: disable-msg=C0111
-# Disable "too many methods" complaint 
-# pylint: disable-msg=R0904 
-# Disable "could be a function" complaint 
-# pylint: disable-msg=R0201
-
-from sans_extension.c_models import Disperser
-from sans.models.ModelFactory import ModelFactory
-from sans.models.DisperseModel import DisperseModel
-      
-class TestDisperser(unittest.TestCase):
-    """ Unit tests for sphere model """
-    
-    def setUp(self):
-        self.model = ModelFactory().getModel("CylinderModel")
-        self.model.setParam("cyl_theta", 1.57)
-        self.model.setParam("cyl_phi", 0.1)
-        
-        
-
-    def testNoDisp(self):
-        """ Test 1D model for a sphere """
-        q = 0.005
-        d = Disperser(self.model, [], [])
-        value = d.run([q, 0])
-        self.assertEqual(value, self.model.run([q, 0]))
-
-    def testComp(self):
-        q = 0.005
-        phi = 0.10
-        sigma = 0.3
-        value_0 = self.model.run([q, phi])
-        app = Smear(self.model, ['cyl_phi'], [sigma])
-        val_py = app.run([q, phi])
-        
-        # Check that the parameters were returned to original values
-        self.assertEqual(value_0, self.model.run([q, phi]))
-        d = Disperser(self.model, ["cyl_phi"], [sigma])
-        val_c = d.run([q, phi])
-        self.assertEqual(val_py, val_c)
-        
-    def test2Disp(self):
-        q = 0.005
-        phi = 0.10
-        sigma = 0.3
-        value_0 = self.model.run([q, phi])
-        app = Smear(self.model, ['cyl_phi', 'cyl_theta'], [sigma, sigma])
-        val_py = app.run([q, phi])
-        
-        # Check that the parameters were returned to original values
-        self.assertEqual(value_0, self.model.run([q, phi]))
-        d = Disperser(self.model, ["cyl_phi", "cyl_theta"], [sigma, sigma])
-        val_c = d.run([q, phi])
-        self.assertEqual(val_py, val_c)
-        
-    def test3Disp(self):
-        q = 0.005
-        phi = 0.10
-        sigma = 0.3
-        value_0 = self.model.run([q, phi])
-        app = Smear(self.model, 
-                    ['cyl_phi', 'cyl_theta', 'radius'], [sigma, sigma, 1.0])
-        val_py = app.run([q, phi])
-        
-        # Check that the parameters were returned to original values
-        self.assertEqual(value_0, self.model.run([q, phi]))
-        d = Disperser(self.model, 
-                      ["cyl_phi", "cyl_theta", 'radius'], [sigma, sigma, 1.0])
-        val_c = d.run([q, phi])
-        self.assertEqual(val_py, val_c)
-        
-        
-class TestDisperserModel(unittest.TestCase):
-    """ Unit tests for sphere model """
-    
-    def setUp(self):
-        self.model = ModelFactory().getModel("CylinderModel")
-        self.model.setParam("cyl_theta", 1.57)
-        self.model.setParam("cyl_phi", 0.1)
-        
-    def test2Disp(self):
-        q = 0.005
-        phi = 0.10
-        sigma = 0.3
-        value_0 = self.model.run([q, phi])
-        app = Smear(self.model, ['cyl_phi', 'cyl_theta'], [sigma, sigma])
-        val_py = app.run([q, phi])
-        
-        # Check that the parameters were returned to original values
-        self.assertEqual(value_0, self.model.run([q, phi]))
-        d = DisperseModel(self.model, ["cyl_phi", "cyl_theta"], [sigma, sigma])
-        val_c = d.run([q, phi])
-        self.assertEqual(val_py, val_c)
-
-
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_dispersity.py
===================================================================
--- sansmodels/src/sans/models/test/utest_dispersity.py	(revision 49c92de9817748ce2471af7d9f6642d57b96bda8)
+++ 	(revision )
@@ -1,523 +1,0 @@
-"""
-    Unit tests for dispersion functionality of 
-    C++ model classes
-"""
-
-#Note: The 'sans.models.DisperseModel' is for only the test. We use 
-#'sans.models.dispersion_models', instead in the application.
-#The first uses width = sigma, while the second uses width = ratio (=sigma/mean)
-#for length parameters and width = sigma for angle parameters.
-#In Feb. 2011, we found and fixed the some precision problems in the C, so that
-#this test was updated too.
-
-
-import unittest, math, numpy
-
-class TestCylinder(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        self.model= CylinderModel()
-        
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('radius', 20.0)
-        self.model.setParam('length', 400.0)
-        self.model.setParam('sldCyl', 4.e-6)
-        self.model.setParam('sldSolv', 1.e-6)
-        self.model.setParam('background', 0.0)
-        self.model.setParam('cyl_theta', 0.0)
-        self.model.setParam('cyl_phi', 0.0)
-        
-    def test_simple(self):
-        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
-        
-    def test_constant(self):
-        from sans.models.dispersion_models import DispersionModel
-        disp = DispersionModel()
-        self.model.setParam('scale', 10.0)
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 0.25
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.5
-        
-        self.assertAlmostEqual(self.model.run(0.001), 1.021051*4527.47250339, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001, 0.001]), 
-                               1.021048*4546.997777604715, 2)
-        
-    def test_gaussian(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp = GaussianDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 0.25
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2
-        self.model.setParam('scale', 10.0)
-        
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               1.1804794*4723.32213339, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               1.180454*4743.56, 2)
-        
-    def test_clone(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp = GaussianDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 0.25
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2
-        self.model.setParam('scale', 10.0)
-        
-        new_model = self.model.clone()
-        self.assertAlmostEqual(new_model.run(0.001), 
-                               1.1804794*4723.32213339, 3)
-        self.assertAlmostEqual(new_model.runXY([0.001,0.001]), 
-                               1.180454*4743.56, 2)
-        
-    def test_gaussian_zero(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp = GaussianDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 0.0
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.5
-        self.model.setParam('scale', 1.0)
-        
-        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
-        
-    def test_array(self):
-        """
-            Perform complete rotational average and
-            compare to 1D
-        """
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_ph = ArrayDispersion()
-        disp_th = ArrayDispersion()
-        
-        values_ph = numpy.zeros(100)
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_ph[i]=(360/99.0*i)
-            values_th[i]=(180/99.0*i)
-            weights[i]=(1.0)
-        
-        disp_ph.set_weights(values_ph, weights)
-        disp_th.set_weights(values_th, weights)
-        
-        self.model.set_dispersion('cyl_theta', disp_th)
-        self.model.set_dispersion('cyl_phi', disp_ph)
-        
-        val_1d = self.model.run(math.sqrt(0.0002))
-        val_2d = self.model.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        
-class TestCoreShellCylinder(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
-        self.model= CoreShellCylinderModel()
-        
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('radius', 20.0)
-        self.model.setParam('thickness', 10.0)
-        self.model.setParam('length', 400.0)
-        self.model.setParam('core_sld', 1.e-6)
-        self.model.setParam('shell_sld', 4.e-6)
-        self.model.setParam('solvent_sld', 1.e-6)
-        self.model.setParam('background', 0.0)
-        self.model.setParam('axis_theta', 0.0)
-        self.model.setParam('axis_phi', 0.0)
-        
-    def test_simple(self):
-        """
-            Test simple 1D and 2D values
-            Numbers taken from model that passed validation, before
-            the update to C++ underlying class.
-        """
-        self.assertAlmostEqual(self.model.run(0.001), 353.55013216754583, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               355.25355270620543, 3)
-        
-    def test_dispersion(self):
-        """
-            Test with dispersion
-        """
-        from sans.models.DisperseModel import DisperseModel
-        disp = DisperseModel(self.model, ['radius', 
-                                          'thickness', 
-                                          'length'], [5, 2, 50])
-        disp.setParam('n_pts', 10)
-        self.assertAlmostEqual(disp.run(0.001), 358.44062724936009, 3)
-        self.assertAlmostEqual(disp.runXY([0.001,0.001]), 360.22673635224584, 3)
-
-    def test_new_disp(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp_rm = GaussianDispersion()
-        self.model.set_dispersion('radius', disp_rm)
-        self.model.dispersion['radius']['width'] = 0.25
-        self.model.dispersion['radius']['npts'] = 10
-        self.model.dispersion['radius']['nsigmas'] = 2
-
-        disp_rr = GaussianDispersion()
-        self.model.set_dispersion('thickness', disp_rr)
-        self.model.dispersion['thickness']['width'] = 0.2
-        self.model.dispersion['thickness']['npts'] = 10
-        self.model.dispersion['thickness']['nsigmas'] = 2
-
-        disp_len = GaussianDispersion()
-        self.model.set_dispersion('length', disp_len)
-        self.model.dispersion['length']['width'] = 1.0/8.0
-        self.model.dispersion['length']['npts'] = 10
-        self.model.dispersion['length']['nsigmas'] = 2
-
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               1.07832610*358.44062724936009, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               1.07844010*360.22673635224584, 3)
-        
-
-    def test_array(self):
-        """
-            Perform complete rotational average and
-            compare to 1D
-        """
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_ph = ArrayDispersion()
-        disp_th = ArrayDispersion()
-        
-        values_ph = numpy.zeros(100)
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_ph[i]=(360/99.0*i)
-            values_th[i]=(180/99.0*i)
-            weights[i]=(1.0)
-        
-        disp_ph.set_weights(values_ph, weights)
-        disp_th.set_weights(values_th, weights)
-        
-        self.model.set_dispersion('axis_theta', disp_th)
-        self.model.set_dispersion('axis_phi', disp_ph)
-        
-        val_1d = self.model.run(math.sqrt(0.0002))
-        val_2d = self.model.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        
-        
-        
-class TestCoreShell(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.CoreShellModel import CoreShellModel
-        self.model= CoreShellModel()
-        
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('radius', 60.0)
-        self.model.setParam('thickness', 10.0)
-        self.model.setParam('core_sld', 1.e-6)
-        self.model.setParam('shell_sld', 2.e-6)
-        self.model.setParam('solvent_sld', 3.e-6)
-        self.model.setParam('background', 0.0)
-        
-    def test_simple(self):
-        """
-            Test simple 1D and 2D values
-            Numbers taken from model that passed validation, before
-            the update to C++ underlying class.
-        """
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               381.27304697150055, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               380.93779156218682, 3)
-        
-    def test_dispersion(self):
-        """
-            Test with dispersion
-        """
-        from sans.models.DisperseModel import DisperseModel
-        disp = DisperseModel(self.model, ['radius', 'thickness'], [10, 2])
-        disp.setParam('n_pts', 10)
-        self.assertAlmostEqual(disp.run(0.001), 407.344127907553, 3)
-    
-    def test_new_disp(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp_rm = GaussianDispersion()
-        self.model.set_dispersion('radius', disp_rm)
-        self.model.dispersion['radius']['width'] = 0.1666666667
-        self.model.dispersion['radius']['npts'] = 10
-        self.model.dispersion['radius']['nsigmas'] = 2
-
-        disp_rr = GaussianDispersion()
-        self.model.set_dispersion('thickness', disp_rr)
-        self.model.dispersion['thickness']['width'] = 0.2
-        self.model.dispersion['thickness']['npts'] = 10
-        self.model.dispersion['thickness']['nsigmas'] = 2
-
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               1.16747510*407.344127907553, 3)
-
-        
-class TestEllipsoid(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.EllipsoidModel import EllipsoidModel
-        self.model= EllipsoidModel()
-        
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('radius_a', 20.0)
-        self.model.setParam('radius_b', 400.0)
-        self.model.setParam('sldEll', 4.e-6)
-        self.model.setParam('sldSolv', 1.e-6)
-        self.model.setParam('background', 0.0)
-        self.model.setParam('axis_theta', 89.95445)
-        self.model.setParam('axis_phi', 0.0)
-        
-    def test_simple(self):
-        """
-            Test simple 1D and 2D values
-            Numbers taken from model that passed validation, before
-            the update to C++ underlying class.
-        """
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               11808.842896863147, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               11681.990374929677, 3)
-
-    def test_dispersion(self):
-        """
-            Test with dispersion
-        """
-        from sans.models.DisperseModel import DisperseModel
-        disp = DisperseModel(self.model, ['radius_a', 'radius_b'], [5, 50])
-        disp.setParam('n_pts', 10)
-
-        self.assertAlmostEqual(disp.run(0.001), 11948.72581312305, 3)
-        self.assertAlmostEqual(disp.runXY([0.001,0.001]), 11811.972359807551, 3)
-        
-    def test_new_disp(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp_rm = GaussianDispersion()
-        self.model.set_dispersion('radius_a', disp_rm)
-        self.model.dispersion['radius_a']['width'] = 0.25
-        self.model.dispersion['radius_a']['npts'] = 10
-        self.model.dispersion['radius_a']['nsigmas'] = 2
-
-        disp_rr = GaussianDispersion()
-        self.model.set_dispersion('radius_b', disp_rr)
-        self.model.dispersion['radius_b']['width'] = 0.125
-        self.model.dispersion['radius_b']['npts'] = 10
-        self.model.dispersion['radius_b']['nsigmas'] = 2
-
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               1.10650710*11948.72581312305, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               1.105898*11811.972359807551, 2)
-
-    def test_array(self):
-        """
-            Perform complete rotational average and
-            compare to 1D
-        """
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_ph = ArrayDispersion()
-        disp_th = ArrayDispersion()
-        
-        values_ph = numpy.zeros(100)
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_ph[i]=(360/99.0*i)
-            values_th[i]=(180/99.0*i)
-            weights[i]=(1.0)
-        
-        disp_ph.set_weights(values_ph, weights)
-        disp_th.set_weights(values_th, weights)
-        
-        self.model.set_dispersion('axis_theta', disp_th)
-        self.model.set_dispersion('axis_phi', disp_ph)
-        
-        val_1d = self.model.run(math.sqrt(0.0002))
-        val_2d = self.model.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        
-        
-        
-class TestSphere(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        self.model= SphereModel()
-        
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('radius', 60.0)
-        self.model.setParam('sldSph', 2.0)
-        self.model.setParam('sldSolv', 1.0)
-        self.model.setParam('background', 0.0)
-        
-    def test_simple(self):
-        """
-            Test simple 1D and 2D values
-            Numbers taken from model that passed validation, before
-            the update to C++ underlying class.
-        """
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               90412744456130.672, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               90347660670656.391, 1)
-
-    def test_dispersion(self):
-        """
-            Test with dispersion
-        """
-        from sans.models.DisperseModel import DisperseModel
-        disp = DisperseModel(self.model, ['radius'], [10])
-        disp.setParam('n_pts', 10)
-        disp.setParam('radius.npts', 10)
-        disp.setParam('radius.nsigmas', 2.5)
-        self.assertAlmostEqual(disp.run(0.001), 96795008379480.859, 1)
-        
-    def test_new_disp(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp_rm = GaussianDispersion()
-        self.model.set_dispersion('radius', disp_rm)
-        self.model.dispersion['radius']['width'] = 0.1666666667
-        self.model.dispersion['radius']['npts'] = 10
-        self.model.dispersion['radius']['nsigmas'] = 2
-
-        #self.assertAlmostEqual(self.model.run(0.001), 96795008379475.25,3)
-        
-        
-        
-class TestEllipticalCylinder(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
-        self.model= EllipticalCylinderModel()
-        
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('r_minor', 20.0)
-        self.model.setParam('r_ratio', 1.5)
-        self.model.setParam('length', 400.0)
-        self.model.setParam('sldCyl', 4.0e-6)
-        self.model.setParam('sldSolv', 1.0e-6)
-        self.model.setParam('background', 0.0)
-        self.model.setParam('cyl_theta', 90)
-        self.model.setParam('cyl_phi', 0.0)
-        self.model.setParam('cyl_psi', 0.0)
-        
-    def test_simple(self):
-        """
-            Test simple 1D and 2D values
-            Numbers taken from model that passed validation, before
-            the update to C++ underlying class.
-        """
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               675.50440232504991, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               669.5173937622792, 0)
-        
-    def test_dispersion(self):
-        """
-            Test with dispersion
-        """
-        from sans.models.DisperseModel import DisperseModel
-        disp = DisperseModel(self.model, ['r_minor', 'r_ratio', 'length'], 
-                             [5, 0.25, 50])
-        disp.setParam('n_pts', 10)
-        self.assertAlmostEqual(disp.run(0.001), 711.18048194151925, 3)
-        self.assertAlmostEqual(disp.runXY([0.001,0.001]), 704.63525988095705, 0)
-
-    def test_new_disp(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp_rm = GaussianDispersion()
-        self.model.set_dispersion('r_minor', disp_rm)
-        self.model.dispersion['r_minor']['width'] = 0.25
-        self.model.dispersion['r_minor']['npts'] = 10
-        self.model.dispersion['r_minor']['nsigmas'] = 2
-
-        disp_rr = GaussianDispersion()
-        self.model.set_dispersion('r_ratio', disp_rr)
-        self.model.dispersion['r_ratio']['width'] = 0.25/1.5
-        self.model.dispersion['r_ratio']['npts'] = 10
-        self.model.dispersion['r_ratio']['nsigmas'] = 2
-
-        disp_len = GaussianDispersion()
-        self.model.set_dispersion('length', disp_len)
-        self.model.dispersion['length']['width'] = 50.0/400
-        self.model.dispersion['length']['npts'] = 10
-        self.model.dispersion['length']['nsigmas'] = 2
-
-        self.assertAlmostEqual(self.model.run(0.001), 
-                               1.23925910*711.18048194151925, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
-                               1.238955*704.63525988095705, 0)
-        
-
-    def test_array(self):
-        """
-            Perform complete rotational average and
-            compare to 1D
-        """
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_ph = ArrayDispersion()
-        disp_th = ArrayDispersion()
-        disp_ps = ArrayDispersion()
-        
-        values_ph = numpy.zeros(100)
-        values_th = numpy.zeros(100)
-        values_ps = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_ps[i]=(360/99.0*i)
-            values_ph[i]=(360/99.0*i)
-            values_th[i]=(180/99.0*i)
-            weights[i]=(1.0)
-        
-        disp_ph.set_weights(values_ph, weights)
-        disp_th.set_weights(values_th, weights)
-        disp_ps.set_weights(values_ps, weights)
-        
-        self.model.set_dispersion('cyl_theta', disp_th)
-        self.model.set_dispersion('cyl_phi', disp_ph)
-        self.model.set_dispersion('cyl_psi', disp_ps)
-        
-        val_1d = self.model.run(math.sqrt(0.0002))
-        val_2d = self.model.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        
-class TestDispModel(unittest.TestCase):
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        self.model = CylinderModel()
-        
-        
-    def test_disp_params(self):
-        
-        self.assertEqual(self.model.dispersion['radius']['width'], 0.0)
-        self.model.setParam('radius.width', 0.25)
-        self.assertEqual(self.model.dispersion['radius']['width'], 0.25)
-        self.assertEqual(self.model.getParam('radius.width'), 0.25)
-        self.assertEqual(self.model.dispersion['radius']['type'], 'gaussian')
-        
-  
-if __name__ == '__main__':
-    unittest.main()
-   
Index: nsmodels/src/sans/models/test/utest_evaldist.py
===================================================================
--- sansmodels/src/sans/models/test/utest_evaldist.py	(revision 7e99f5cc71fdc6f1ff15758f175c55bc843b65ec)
+++ 	(revision )
@@ -1,184 +1,0 @@
-"""
-    Test for the BaseComponent.evalDistribution
-    See method documentation for more details
-"""
-import unittest
-import numpy, math
-from sans.models.SphereModel import SphereModel
-from sans.models.Cos import Cos
-
-
-class TestEvalPythonMethods(unittest.TestCase):
-    """ Testing evalDistribution for pure python models """
-
-    def setUp(self):
-        self.model= Cos()
-        
-    def test_scalar_methods(self):
-        """
-            Simple test comparing the run(), runXY() and
-            evalDistribution methods
-        """
-        q1 = self.model.run(0.001)
-        q2 = self.model.runXY(0.001)
-        qlist3 = numpy.asarray([0.001, 0.002])
-        q3 = self.model.evalDistribution(qlist3)
-        q4 = self.model.run(0.002)
-
-        self.assertEqual(q1, q2)
-        self.assertEqual(q1, q3[0])
-        self.assertEqual(q4, q3[1])
-        
-    def test_XY_methods(self):
-        """
-            Compare to the runXY() method for 2D models.
-            
-                      +--------+--------+--------+
-            qy=0.009  |        |        |        | 
-                      +--------+--------+--------+
-            qy-0.006  |        |        |        |
-                      +--------+--------+--------+            
-            qy=0.003  |        |        |        | 
-                      +--------+--------+--------+
-                      qx=0.001   0.002   0.003
-            
-        """
-        # These are the expected values for all bins
-        expected = numpy.zeros([3,3])
-        for i in range(3):
-            for j in range(3):
-                q_length = math.sqrt( (0.001*(i+1.0))*(0.001*(i+1.0)) + (0.003*(j+1.0))*(0.003*(j+1.0)) )
-                expected[i][j] = self.model.run(q_length)
-        
-        qx_values = [0.001, 0.002, 0.003]
-        qy_values = [0.003, 0.006, 0.009]
-        
-        qx = numpy.asarray(qx_values)
-        qy = numpy.asarray(qy_values)
-                     
-        new_x = numpy.tile(qx, (len(qy),1))
-        new_y = numpy.tile(qy, (len(qx),1))
-        new_y = new_y.swapaxes(0,1)
-    
-        #iq is 1d array now (since 03-12-2010)
-        qx_prime = new_x.flatten()
-        qy_prime = new_y.flatten()
-        
-        iq = self.model.evalDistribution([qx_prime, qy_prime])
-
-        for i in range(3):
-            for j in range(3):
-                k = i+len(qx)*j
-                self.assertAlmostEquals(iq[k], expected[i][j])
-
-    def test_rectangle_methods(self):
-        """
-            Compare to the runXY() method for 2D models
-            with a non-square matrix.
-            TODO: Doesn't work for C models apparently
-        
-                      +--------+--------+--------+
-            qy-0.006  |        |        |        |
-                      +--------+--------+--------+            
-            qy=0.003  |        |        |        | 
-                      +--------+--------+--------+
-                      qx=0.001   0.002   0.003
-            
-        """
-        # These are the expected values for all bins
-        expected = numpy.zeros([3,3])
-        for i in range(3):
-            for j in range(2):
-                q_length = math.sqrt( (0.001*(i+1.0))*(0.001*(i+1.0)) + (0.003*(j+1.0))*(0.003*(j+1.0)) )
-                expected[i][j] = self.model.run(q_length)
-        
-        qx_values = [0.001, 0.002, 0.003]
-        qy_values = [0.003, 0.006]
-        
-        qx = numpy.asarray(qx_values)
-        qy = numpy.asarray(qy_values)
-                     
-        new_x = numpy.tile(qx, (len(qy),1))
-        new_y = numpy.tile(qy, (len(qx),1))
-        new_y = new_y.swapaxes(0,1)
-    
-        #iq is 1d array now (since 03-12-2010)
-        qx_prime = new_x.flatten()
-        qy_prime = new_y.flatten()
-        
-        iq = self.model.evalDistribution([qx_prime, qy_prime])
-        
-        for i in range(3):
-            for j in range(2):
-                k = i+len(qx)*j
-                self.assertAlmostEquals(iq[k], expected[i][j])
-
-
-                
-class TestEvalMethods(unittest.TestCase):
-    """ Testing evalDistribution for C models """
-
-    def setUp(self):
-        self.model= SphereModel()
-        
-    def test_scalar_methods(self):
-        """
-            Simple test comparing the run(), runXY() and
-            evalDistribution methods
-        """
-        q1 = self.model.run(0.001)
-        q2 = self.model.runXY(0.001)
-        q4 = self.model.run(0.002)
-        qlist3 = numpy.asarray([0.001, 0.002])
-        q3 = self.model.evalDistribution(qlist3)
-
-        self.assertEqual(q1, q2)
-        self.assertEqual(q1, q3[0])
-        self.assertEqual(q4, q3[1])
-        
-    def test_XY_methods(self):
-        """
-            Compare to the runXY() method for 2D models.
-            
-                      +--------+--------+--------+
-            qy=0.009  |        |        |        | 
-                      +--------+--------+--------+
-            qy-0.006  |        |        |        |
-                      +--------+--------+--------+            
-            qy=0.003  |        |        |        | 
-                      +--------+--------+--------+
-                      qx=0.001   0.002   0.003
-            
-        """
-        # These are the expected values for all bins
-        expected = numpy.zeros([3,3])
-        for i in range(3):
-            for j in range(3):
-                q_length = math.sqrt( (0.001*(i+1.0))*(0.001*(i+1.0)) + (0.003*(j+1.0))*(0.003*(j+1.0)) )
-                expected[i][j] = self.model.run(q_length)
-        
-        qx_values = [0.001, 0.002, 0.003]
-        qy_values = [0.003, 0.006, 0.009]
-        
-        qx = numpy.asarray(qx_values)
-        qy = numpy.asarray(qy_values)
-              
-        new_x = numpy.tile(qx, (len(qy),1))
-        new_y = numpy.tile(qy, (len(qx),1))
-        new_y = new_y.swapaxes(0,1)
-    
-        #iq is 1d array now (since 03-12-2010)
-        qx_prime = new_x.flatten()
-        qy_prime = new_y.flatten()
-        
-        iq = self.model.evalDistribution([qx_prime, qy_prime])
-        
-        for i in range(3):
-            for j in range(3):
-                # convert index into 1d array
-                k = i+len(qx)*j
-                self.assertAlmostEquals(iq[k], expected[i][j])
-                
-
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_extra_models.py
===================================================================
--- sansmodels/src/sans/models/test/utest_extra_models.py	(revision 1d4f4c82f35a87457229abf1a5a4bb0a52121744)
+++ 	(revision )
@@ -1,366 +1,0 @@
-"""
-Unit tests for extra models,PolymerexclVolume, RPA10Model
-The reference values are calculated on IGOR/NIST package(Oct.,2010)
-@author: JHJ Cho / UTK
-"""
-import unittest
-class TestPolymerExclVolume(unittest.TestCase):
-    """
-    Unit tests for PolymerexclVolume (non-shape) function
-    """
-    def setUp(self):
-        from sans.models.PolymerExclVolume import PolymerExclVolume
-        self.model= PolymerExclVolume()
-        
-    def test1D(self):          
-        # the values are from Igor pro calculation    
-        self.assertAlmostEqual(self.model.run(0.001), 0.998801, 6)
-        self.assertAlmostEqual(self.model.run(0.21571), 0.00192041, 6)
-        self.assertAlmostEqual(self.model.runXY(0.41959), 0.000261302, 6)
-        
-class TestRPA10Case(unittest.TestCase):
-    """
-    Unit tests for RPA10Model (non-shape) function
-    """
-    def setUp(self):
-        from sans.models.RPA10Model import RPA10Model
-        self.model0= RPA10Model(0)
-        self.model1= RPA10Model(1)
-        self.model2= RPA10Model(2)
-        self.model3= RPA10Model(3)
-        self.model4= RPA10Model(4)
-        self.model5= RPA10Model(5)
-        self.model6= RPA10Model(6)
-        self.model7= RPA10Model(7)
-        self.model8= RPA10Model(8)
-        self.model9= RPA10Model(9)
-        
-    def test1D(self):          
-        # the test values are from Igor pro calculation   
-        # case 0 
-        # set default of vol fration consistent with IGor
-        self.model0.setParam('Phic',0.5)
-        self.model0.setParam('Phid',0.5)
-        self.assertAlmostEqual(self.model0.run(0.001), 0.0716863, 6)
-        self.assertAlmostEqual(self.model0.runXY(0.414955), 0.00396997, 6)
-        # case 1
-        # set default of vol fration consistent with IGor
-        self.model1.setParam('Phic',0.5)
-        self.model1.setParam('Phid',0.5)
-        self.assertAlmostEqual(self.model1.run(0.001), 0.00395016, 6)
-        self.assertAlmostEqual(self.model1.runXY(0.414955), 0.00396735, 6)
-        # case 2 
-        # set default of vol fration consistent with IGor
-        self.model2.setParam('Phib',0.33)
-        self.model2.setParam('Phic',0.33)
-        self.model2.setParam('Phid',0.33)
-        self.assertAlmostEqual(self.model2.run(0.001), 0.0932902, 6)
-        self.assertAlmostEqual(self.model2.runXY(0.414955), 0.00355736, 6)
-        # case 3
-        # set default of vol fration consistent with IGor
-        self.model3.setParam('Phib',0.33)
-        self.model3.setParam('Phic',0.33)
-        self.model3.setParam('Phid',0.33)
-        self.assertAlmostEqual(self.model3.run(0.001), 0.026254, 6)
-        self.assertAlmostEqual(self.model3.runXY(0.414955), 0.00355577, 6)
-        # case 4
-        # set default of vol fration consistent with IGor
-        self.model4.setParam('Phib',0.33)
-        self.model4.setParam('Phic',0.33)
-        self.model4.setParam('Phid',0.33)
-        self.assertAlmostEqual(self.model4.run(0.001), 0.0067433, 6)
-        self.assertAlmostEqual(self.model4.runXY(0.414955), 0.00355656, 6)
-        # case 5
-        self.assertAlmostEqual(self.model5.run(0.001), 0.102636, 6)
-        self.assertAlmostEqual(self.model5.runXY(0.414955), 0.00305812, 6)
-        # case 6
-        self.assertAlmostEqual(self.model6.run(0.001), 0.0370357, 6)
-        self.assertAlmostEqual(self.model6.runXY(0.414955), 0.00305708, 6)
-        # case 7
-        self.assertAlmostEqual(self.model7.run(0.001), 0.0167775, 6)
-        self.assertAlmostEqual(self.model7.runXY(0.414955), 0.00305743, 6)
-        # case 8
-        self.assertAlmostEqual(self.model8.run(0.001), 0.0378691, 6)
-        self.assertAlmostEqual(self.model8.runXY(0.414955), 0.00305743, 6)
-        # case 9
-        self.assertAlmostEqual(self.model9.run(0.001), 0.00839376, 6)
-        self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6)  
-              
-class TestBarBell(unittest.TestCase):
-    """
-    Unit tests for BarBell function
-    """
-    def setUp(self):
-        from sans.models.BarBellModel import BarBellModel
-        self.model= BarBellModel()
-        
-    def test1D(self):          
-        # the values are from Igor pro calculation    
-        self.assertAlmostEqual(self.model.run(0.001), 2864.7, 1)
-        self.assertAlmostEqual(self.model.run(0.215268), 0.526351, 4)
-        self.assertAlmostEqual(self.model.runXY(0.414467), 0.0685892, 6)
-
-class TestCappedCylinder(unittest.TestCase):
-    """
-    Unit tests for CappedCylinder function
-    """
-    def setUp(self):
-        from sans.models.CappedCylinderModel import CappedCylinderModel
-        self.model= CappedCylinderModel()
-        
-    def test1D(self):          
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 1424.72, 2)
-        self.assertAlmostEqual(self.model.run(0.215268), 0.360736, 4)
-        self.assertAlmostEqual(self.model.runXY(0.414467), 0.110283, 5)
-
-class TestLamellarParaCrystal(unittest.TestCase):
-    """
-    Unit tests for LamellarParaCystal function
-    """
-    def setUp(self):
-        from sans.models.LamellarPCrystalModel import LamellarPCrystalModel
-        self.model= LamellarPCrystalModel()
-        
-    def test1D(self):    
-        self.model.setParam("pd_spacing", 0.2)      
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 21829.3, 1)
-        self.assertAlmostEqual(self.model.run(0.215268), 0.00487686, 6)
-        self.assertAlmostEqual(self.model.runXY(0.414467), 0.00062029, 6)
-
-
-class TestSCParaCrystal(unittest.TestCase):
-    """
-    Unit tests for Simple Cubic ParaCrystal Model function
-    """
-    def setUp(self):
-        from sans.models.SCCrystalModel import SCCrystalModel
-        self.model= SCCrystalModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 10.3038, 4)
-        self.assertAlmostEqual(self.model.run(0.215268), 0.00714905, 6)
-        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000313289, 6)
-
-class TestFCParaCrystal(unittest.TestCase):
-    """
-    Unit tests for Face Centered Cubic ParaCrystal Model function
-    """
-    def setUp(self):
-        from sans.models.FCCrystalModel import FCCrystalModel
-        self.model= FCCrystalModel()
-        
-    def test1D(self):       
-        self.model.setParam("d_factor", 0.05)  
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 0.121017, 6)
-        self.assertAlmostEqual(self.model.run(0.215268), 0.0107218, 6)
-        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000443282, 6)
-
-class TestBCParaCrystal(unittest.TestCase):
-    """
-    Unit tests for Body Centered Cubic ParaCrystal Model function
-    """
-    def setUp(self):
-        from sans.models.BCCrystalModel import BCCrystalModel
-        self.model= BCCrystalModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 1.77267, 4)
-        self.assertAlmostEqual(self.model.run(0.215268), 0.00927739, 6)
-        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000406973, 6)
-                               
-
-class TestGuinierPorod(unittest.TestCase):
-    """
-    Unit tests for GuinierPorod Model function
-    """
-    def setUp(self):
-        from sans.models.GuinierPorodModel import GuinierPorodModel 
-        self.model= GuinierPorodModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 995.112, 3)
-        self.assertAlmostEqual(self.model.run(0.105363), 0.162904, 5)
-        self.assertAlmostEqual(self.model.runXY(0.441623), 0.100854, 6)
-
-class TestGaussLorentzGel(unittest.TestCase):
-    """
-    Unit tests for GuinierPorod Model function
-    """
-    def setUp(self):
-        from sans.models.GaussLorentzGelModel import GaussLorentzGelModel
-        self.model= GaussLorentzGelModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 149.481, 3)
-        self.assertAlmostEqual(self.model.run(0.105363), 9.1903, 4)
-        self.assertAlmostEqual(self.model.runXY(0.441623), 0.632811, 5)
-                                
-
-class TestTwoPowerLaw(unittest.TestCase):
-    """
-    Unit tests for TwoPowerLaw Model function
-    """
-    def setUp(self):
-        from sans.models.TwoPowerLawModel import TwoPowerLawModel
-        self.model= TwoPowerLawModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertEqual(self.model.run(0.001), 1000)
-        self.assertAlmostEqual(self.model.run(0.150141), 0.125945, 5)
-        self.assertAlmostEqual(self.model.runXY(0.442528), 0.00166884, 7)
-                                
-class TestTwoLorentzian(unittest.TestCase):
-    """
-    Unit tests for TwoLorentzian Model function
-    """
-    def setUp(self):
-        from sans.models.TwoLorentzianModel import TwoLorentzianModel
-        self.model= TwoLorentzianModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 11.0899, 3)
-        self.assertAlmostEqual(self.model.run(0.150141), 0.410245, 5)
-        self.assertAlmostEqual(self.model.runXY(0.442528), 0.148699, 6)
-                                
-
-class TestCorrLengthLaw(unittest.TestCase):
-    """
-    Unit tests for CorrLength Model function
-    """
-    def setUp(self):
-        from sans.models.CorrLengthModel import CorrLengthModel
-        self.model= CorrLengthModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 1010.08, 1)
-        self.assertAlmostEqual(self.model.run(0.150141), 0.274645, 5)
-        self.assertAlmostEqual(self.model.runXY(0.442528), 0.120396, 6)
-                                
-
-class TestBroadPeak(unittest.TestCase):
-    """
-    Unit tests for BroadPeak Model function
-    """
-    def setUp(self):
-        from sans.models.BroadPeakModel import BroadPeakModel
-        self.model= BroadPeakModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 10000.5, 1)
-        self.assertAlmostEqual(self.model.run(0.1501412), 1.47557, 5)
-        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.134093, 6)
-        
-class TestFractalCoreShell(unittest.TestCase):
-    """
-    Unit tests for FractalCoreShell Model function
-    """
-    def setUp(self):
-        from sans.models.FractalCoreShellModel import FractalCoreShellModel
-        self.model= FractalCoreShellModel()
-        
-    def test1D(self):        
-        #self.model.setParam('radius.width', 2.0)
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 273.742, 3)
-        self.assertAlmostEqual(self.model.run(0.1501412), 0.040079, 6)
-        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.00141167, 8)  
-         
-    def test1DSchulzDispersion(self):      
-        # Same test w/ test1D up there but w/ Schulzdispersion
-        from sans.models.dispersion_models import SchulzDispersion
-        disp = SchulzDispersion()
-        self.model.set_dispersion('radius', disp)
-        # 'width' is a ratio now for non-angular parameters
-        self.model.dispersion['radius']['width'] = 0.1
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 3.0
-        # the values are from Igor pro calculation
-        # the run does not neccessary to be exactly same with NIST 
-        # 'cause we used different method.
-        self.assertAlmostEqual(self.model.run(0.001), 287.851, -1)
-        self.assertAlmostEqual(self.model.run(0.1501412), 0.0500775, 3)
-        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.00390948, 3)         
-       
-
-class TestUnifiedPowerRg(unittest.TestCase):
-    """
-    Unit tests for FractalCoreShell Model function
-    """
-    def setUp(self):
-        from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel
-        self.model1= UnifiedPowerRgModel(1)
-        self.model4= UnifiedPowerRgModel(4)
-        
-    def test1DLabel1(self):        
-        # Label #1
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model1.run(0.001), 2.99956, 5)
-        self.assertAlmostEqual(self.model1.run(0.1501412), 0.126506, 6)
-        self.assertAlmostEqual(self.model1.runXY(0.4425284), 0.00306386, 8)                             
- 
-    def test1DLabel4(self):        
-        # Label #4
-        # Set params consistent w/NIST
-        # No. 4 already same
-        # No. 3
-        self.model4.setParam('Rg3', 200)
-        self.model4.setParam('B3', 5e-06)
-        self.model4.setParam('G3', 400)
-        # No. 2
-        self.model4.setParam('Rg2', 600)
-        self.model4.setParam('B2', 2e-07)
-        self.model4.setParam('G2', 4000)
-        # No. 1
-        self.model4.setParam('Rg1', 2000)
-        self.model4.setParam('B1', 1e-08)
-        self.model4.setParam('G1', 40000)
-        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model4.run(0.001), 14778.4, 1)
-        self.assertAlmostEqual(self.model4.run(0.0301614), 7.88115, 4)
-        self.assertAlmostEqual(self.model4.run(0.1501412), 0.126864, 6)
-        self.assertAlmostEqual(self.model4.runXY(0.4425284), 0.00306386, 8)  
-                                                                              
-
-class TestCSPP(unittest.TestCase):
-    """
-    Unit tests for CSParallelepiped Model function
-    """
-    def setUp(self):
-        from sans.models.CSParallelepipedModel import CSParallelepipedModel
-        self.model= CSParallelepipedModel()
-        
-    def test1D(self):        
-        # the values are from Igor pro calculation  
-        # the different digits are due to precision of q values  
-        self.assertAlmostEqual(self.model.run(0.001), 1383.96, 2)
-        self.assertAlmostEqual(self.model.run(0.1501412), 2.51932, 4)
-        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.0736735, 6)
-                                                                                                                                                          
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_model_calculate_ER.py
===================================================================
--- sansmodels/src/sans/models/test/utest_model_calculate_ER.py	(revision 15f52f88737738eb57d2a9d36d0679320ba36530)
+++ 	(revision )
@@ -1,249 +1,0 @@
-"""
-    Unit tests for calculate_ER of specific models
-    @author: JHJ Cho / UTK
-"""
-
-import unittest, time, math, numpy
-
-        
-class TestSphere(unittest.TestCase):
-    """ Unit tests for calculate_ER (sphere model) """
-    
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        self.comp = SphereModel()
-        
-    def test(self):
-        """ Test 1D model for a sphere """
-        self.comp.setParam("radius", 20)
-        self.assertAlmostEqual(self.comp.calculate_ER(), 20)
-        
-class TestCoreShell(unittest.TestCase):
-    """ Unit tests for calculate_ER (CoreShellModel) """
-    
-    def setUp(self):
-        from sans.models.CoreShellModel import CoreShellModel
-        self.comp = CoreShellModel()
-        
-    def test(self):
-        """ Test 1D model for a CoreShell """
-        self.comp.setParam("radius", 20)
-        self.comp.setParam("thickness", 20)
-        self.assertAlmostEqual(self.comp.calculate_ER(), 40)       
-         
-class TestMultiShell(unittest.TestCase):
-    """ Unit tests for calculate_ER (MultiShellModel) """
-    
-    def setUp(self):
-        from sans.models.MultiShellModel import MultiShellModel
-        self.comp = MultiShellModel()
-        
-    def test(self):
-        """ Test 1D model for a MultiShell """
-        self.comp.setParam("core_radius", 60)
-        self.comp.setParam("s_thickness", 10)
-        self.comp.setParam("w_thickness", 15)
-        self.comp.setParam("n_pairs", 2)
-        self.assertAlmostEqual(self.comp.calculate_ER(), 95)      
-
-class TestVesicle(unittest.TestCase):
-    """ Unit tests for calculate_ER (VesicleModel) """
-    
-    def setUp(self):
-        from sans.models.VesicleModel import VesicleModel
-        self.comp = VesicleModel()
-        
-    def test(self):
-        """ Test 1D model for a Vesicle """
-        self.comp.setParam("radius", 60)
-        self.comp.setParam("thickness", 30)
-        self.assertAlmostEqual(self.comp.calculate_ER(), 90)   
-
-class TestCylinder(unittest.TestCase):
-    """ Unit tests for calculate_ER (cylinder model) """
-    
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        from sans.models.DiamCylFunc import DiamCylFunc
-        self.comp = CylinderModel()
-        self.diam = DiamCylFunc()
-        
-    def test(self):
-        """ Test 1D model for a Cylinder """
-        self.comp.setParam("radius", 20)
-        self.comp.setParam("length",400)
-        self.diam.setParam("radius", 20)
-        self.diam.setParam("length",400)       
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)  
-         
-class TestCoreShellCylinder(unittest.TestCase):
-    """ Unit tests for calculate_ER (CoreShellcylinder model) """
-    
-    def setUp(self):
-        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
-        from sans.models.DiamCylFunc import DiamCylFunc
-        self.comp = CoreShellCylinderModel()
-        self.diam = DiamCylFunc()
-        
-    def test(self):
-        """ Test 1D model for a CoreShellCylinder """
-        self.comp.setParam("radius", 20)
-        self.comp.setParam("thickness", 10)
-        self.comp.setParam("length",400)
-        self.diam.setParam("radius", 30)
-        self.diam.setParam("length",420)       
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)   
-
-class TestHollowCylinder(unittest.TestCase):
-    """ Unit tests for calculate_ER (Hollowcylinder model) """
-    
-    def setUp(self):
-        from sans.models.HollowCylinderModel import HollowCylinderModel
-        from sans.models.DiamCylFunc import DiamCylFunc
-        self.comp = HollowCylinderModel()
-        self.diam = DiamCylFunc()
-        
-    def test(self):
-        """ Test 1D model for a Hollowcylinder """
-        self.comp.setParam("radius", 20)
-        self.comp.setParam("length",400)
-        self.diam.setParam("radius", 20)
-        self.diam.setParam("length",400)       
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)        
-
-class TestStackedDisksModel(unittest.TestCase):
-    """ Unit tests for calculate_ER (StackedDisks model) """
-    
-    def setUp(self):
-        from sans.models.StackedDisksModel import StackedDisksModel
-        from sans.models.DiamCylFunc import DiamCylFunc
-        self.comp = StackedDisksModel()
-        self.diam = DiamCylFunc()
-        
-    def test(self):
-        """ Test 1D model for a StackedDisks """
-        self.comp.setParam("radius", 3000)
-        self.comp.setParam("n_stacking", 2)
-        self.comp.setParam("core_thick",10)
-        self.comp.setParam("layer_thick", 15)
-        self.diam.setParam("radius", 3000)
-        self.diam.setParam("length",80)       
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)  
-             
-class TestEllipticalCylinder(unittest.TestCase):
-    """ Unit tests for calculate_ER (EllipticalCylindermodel) """
-    
-    def setUp(self):
-        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
-        from sans.models.DiamCylFunc import DiamCylFunc
-        self.comp = EllipticalCylinderModel()
-        self.diam = DiamCylFunc()
-        
-    def test(self):
-        """ Test 1D model for a EllipticalCylinder """
-        self.comp.setParam("r_minor", 20)
-        self.comp.setParam("r_ratio",1.5)  
-        self.comp.setParam("length",400)  
-        r_value = math.sqrt(20*20*1.5)    
-        self.diam.setParam("radius", r_value)
-        self.diam.setParam("length",400)       
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)  
-         
-class TestParallelepiped(unittest.TestCase):
-    """ Unit tests for calculate_ER (Parallelepipedmodel) """
-    
-    def setUp(self):
-        from sans.models.ParallelepipedModel import ParallelepipedModel
-        from sans.models.DiamCylFunc import DiamCylFunc
-        self.comp = ParallelepipedModel()
-        self.diam = DiamCylFunc()
-        
-    def test(self):
-        """ Test 1D model for a Parallelepiped """
-        self.comp.setParam("short_a", 35)
-        self.comp.setParam("short_b", 75)  
-        self.comp.setParam("long_c",400)  
-        r_value = math.sqrt(35*75/math.pi)    
-        self.diam.setParam("radius", r_value)
-        self.diam.setParam("length",400)   
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)   
-                                                  
-class TestEllipsoid(unittest.TestCase):
-    """ Unit tests for calculate_ER (Ellipsoid model) """
-    
-    def setUp(self):
-        from sans.models.EllipsoidModel import EllipsoidModel
-        from sans.models.DiamEllipFunc import DiamEllipFunc
-        self.comp = EllipsoidModel()
-        self.diam = DiamEllipFunc()
-        
-    def test(self):
-        """ Test 1D model for a Ellipsoid """
-        self.comp.setParam("radius_a", 20)
-        self.comp.setParam("radius_b",400)
-        self.diam.setParam("radius_a", 20)
-        self.diam.setParam("radius_b",400)       
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)   
-
-class TestCoreShellEllipsoid(unittest.TestCase):
-    """ Unit tests for calculate_ER (CoreShellEllipsoid model) """
-    
-    def setUp(self):
-        from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel
-        from sans.models.DiamEllipFunc import DiamEllipFunc
-        self.comp = CoreShellEllipsoidModel()
-        self.diam = DiamEllipFunc()
-        
-    def test(self):
-        """ Test 1D model for a CoreShellEllipsoid """
-        self.comp.setParam("polar_shell", 20)
-        self.comp.setParam("equat_shell",400)       
-        self.diam.setParam("radius_a", 20)
-        self.diam.setParam("radius_b",400)
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2) 
-
-class TestTriaxialEllipsoid(unittest.TestCase):
-    """ Unit tests for calculate_ER (TriaxialEllipsoid model) """
-    
-    def setUp(self):
-        from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
-        from sans.models.DiamEllipFunc import DiamEllipFunc
-        self.comp = TriaxialEllipsoidModel()
-        self.diam = DiamEllipFunc()
-        
-    def test(self):
-        """ Test 1D model for a TriaxialEllipsoid """
-        self.comp.setParam("semi_axisA", 35)
-        self.comp.setParam("semi_axisB", 100)
-        self.comp.setParam("semi_axisC", 400)  
-        r_value = math.sqrt(35*100)    
-        self.diam.setParam("radius_a", 400)
-        self.diam.setParam("radius_b",r_value)
-        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2) 
-                    
-class TestLamellar(unittest.TestCase):
-    """ Unit tests for calculate_ER (Lamellarmodel)"""
-    
-    def setUp(self):
-        from sans.models.LamellarModel import LamellarModel
-        self.comp = LamellarModel()
-        
-    def test(self):
-        """ Test 1D model for a Lamellar """
-        #No finite number should return from Lamellar models.
-        self.assertFalse(numpy.isfinite(self.comp.calculate_ER())) 
-         
-class TestGuinier(unittest.TestCase):
-    """ Unit tests for calculate_ER (Guinier model) """
-    
-    def setUp(self):
-        from sans.models.GuinierModel import GuinierModel
-        self.comp = GuinierModel()
-        
-    def test(self):
-        """ Test 1D model for Guinier """    
-        #calculate_ER() is not implemented for pure python model functions
-        self.assertEqual(self.comp.calculate_ER(), NotImplemented)  
-        
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_model_onionexpshell.py
===================================================================
--- sansmodels/src/sans/models/test/utest_model_onionexpshell.py	(revision 96d19c6bf56eec1e8d4620dff4ab8cebf354401f)
+++ 	(revision )
@@ -1,141 +1,0 @@
-"""
-    Unit tests for specific models
-    @author: JHJ Cho / UTK
-"""
-
-import unittest
-
-class TestOnionExpShell1(unittest.TestCase):
-    """ 
-        Unit tests for OnionExpShellModel
-    """
-    def setUp(self):
-
-        from sans.models.OnionExpShellModel import OnionExpShellModel
-        from sans.models.CoreMultiShellModel import CoreMultiShellModel
-        from sans.models.VesicleModel import VesicleModel 
-        
-        # intit models and the multifactor
-        self.model = OnionExpShellModel(1)
-        self.model2 = OnionExpShellModel(1).model
-        self.model3 = CoreMultiShellModel(1)
-        self.model4 = VesicleModel()
-        self.model5 = OnionExpShellModel(9)
-        
-    def test_compare_Exp0_flat(self):
-        """
-        Check if Exp function with A_shell=0 gives the same value as Flat function
-        """
-        print "\n*****Note: All tests (test_compare_Exp0_flat and test_compare_Expsmall_line) were passes since Sept. 18, 2010..."
-        # Exp: func_shell = 2, Line: func_shell =1 , Flat: func_shell = 0.
-        # A_shell = The coefficient of the exponential function: exp(A_shell*(r-ro)/thick_shell)
-        # exp function by default
-        # exp function crosses over to flat func at A_shell=0
-        self.model.setParam("A_shell1", 0)
-        # set A_shell=1
-        self.model2.setParam("A_shell1", 1)
-        # change the function to flat function
-        self.model2.setParam("func_shell1", 0)
-        #self.model2.setParam("sld_in_shell1", 1.7e-006)
-        #self.model2.setParam("sld_out_shell1", 1.7e-006)
-        
-        # model3: set param values as same as the model2
-        self.model3.setParam("background", 0.0)
-        self.model3.setParam("rad_core0", 200.0)
-        self.model3.setParam("scale", 1.0)
-        self.model3.setParam("sld_core0", 1.0e-006)
-        self.model3.setParam("sld_shell1", 1.7e-006)
-        self.model3.setParam("sld_solv", 6.4e-006)
-        self.model3.setParam("thick_shell1", 50.0)
-        
-        #Compare exp(A=0) to flat (where A_shell is null) function
-        self.assertEqual(self.model.run(0.1),self.model2.run(0.1))
-        self.assertAlmostEqual(self.model2.run(0.1),self.model3.run(0.1),10)
-        
-
-  
-    def test_compare_Expsmall_line(self):
-        """
-        Check if Exp function with A_shell-->0 gives the same value 
-        as a linear function
-        """
-        # exp function crosses over to line func as A_shell-->0
-        self.model.setParam("A_shell1", 0.000001)
-        self.model2.setParam("A_shell1", 1)
-        # change the function to a line function
-        self.model2.setParam("func_shell1", 1)
-        
-        #Compare exp(A=0.000001) to linear (where A_shell is null) function   
-        self.assertAlmostEqual(self.model.run(0.1),self.model2.run(0.1),4)
-        
-    def test_compare_time_linear_flat_functions(self):
-        """
-        Compare the calculation time between func=1(linear) , and 2 (step).
-        """
-        from time import time
-        # using linear func
-        self.model5.model.setParam("func_shell1", 1)
-        #input
-        input = [0.01,0.01]
-        st = time()
-        for iter in range(0,100000):
-            self.model5.model.run(0.01)
-        time_linear = time()-st
-        
-        # using flat function
-        self.model5.model.setParam("func_shell1", 0)
-        st = time()
-        for iter in range(0,100000):
-            self.model5.model.run(0.01)
-        time_flat = time()-st
-        
-        print "time (linear) = %s, \n time (flat) = %s"% (time_linear,time_flat)
-        
-        #Compare time of the calculation: time_linear takes a bit longer
-        # but they are not much different  
-        self.assertAlmostEqual(time_linear,time_flat,0)
-  
-    # this feature removed!!!
-    """
-    def test_compare_Exp0_flat_vesicle(self):
-    """
-    """
-        Check if Exp function with A_shell=0 gives the same value as Flat 
-        function of vesicle model when sld_solv=sld_core
-        """
-    """
-        print "\n*****Note: All tests (test_compare_Exp0_flat and \
-            test_compare_Expsmall_line) were passes since Sept. 18, 2010..."
-        # Exp: func_shell = 2, Line: func_shell =1 , Flat: func_shell = 0.
-        # A_shell = The coefficient of the exponential function: exp(A_shell*(r-ro)/thick_shell)
-        # exp function by default
-        # exp function crosses over to flat func at A_shell=0
-        self.model.setParam("A_shell1", 0)
-                # set A_shell=1
-        self.model2.setParam("A_shell1", 1)
-        # change the function to flat function
-        self.model2.setParam("func_shell1", 0)
-        
-        # model: set param values as same as the model2
-        self.model.setParam("background", 0.0)
-        self.model.setParam("rad_core0", 100.0)
-        self.model.setParam("scale", 1.0)
-        self.model.setParam("sld_core0", 6.36e-006)
-        self.model.setParam("sld_in_shell1", 5e-007)
-        self.model.setParam("sld_solv", 6.36e-006)
-        self.model.setParam("thick_shell1", 30.0)
-        # model2: set param values as same as the model2
-        self.model2.setParam("background", 0.0)
-        self.model2.setParam("rad_core0", 100.0)
-        self.model2.setParam("scale", 1.0)
-        self.model2.setParam("sld_core0", 6.36e-006)
-        self.model2.setParam("sld_in_shell1", 5e-007)
-        self.model2.setParam("sld_solv", 6.36e-006)
-        self.model2.setParam("thick_shell1", 30.0)
-        #Compare exp(A=0) to flat (where A_shell is null) function
-        self.assertEqual(self.model.run(0.1),self.model4.run(0.1))
-        self.assertEqual(self.model2.run(0.1),self.model4.run(0.1))
-        #self.assertAlmostEqual(self.model2.run(0.1),self.model3.run(0.1),10)
-    """               
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_model_pearlnecklace.py
===================================================================
--- sansmodels/src/sans/models/test/utest_model_pearlnecklace.py	(revision d17597f821540bb70455c5b0e79393d1eb551fcd)
+++ 	(revision )
@@ -1,57 +1,0 @@
-"""
-    Unit tests for specific models II
-"""
-
-import unittest, time, math
-     
-class TestPerlNecklace(unittest.TestCase):
-    """ Unit tests for PerlNecklace """
-    
-    def setUp(self):
-        from sans.models.PearlNecklaceModel import PearlNecklaceModel
-        self.pnl = PearlNecklaceModel()
-        from sans.models.SphereModel import SphereModel
-        self.sphere = SphereModel()
-        from sans.models.BarBellModel import BarBellModel
-        self.bar = BarBellModel()
-        
-    def testwithsphere(self):
-        """ Compare 1D model with sphere """
-        self.pnl.setParam("radius", 60)
-        self.pnl.setParam("num_pearls", 1)
-        self.pnl.setParam("sld_pearl", 2e-06)
-        self.pnl.setParam("sld_solv", 1e-06)
-        self.assertAlmostEqual(self.pnl.run(0.001), self.sphere.run(0.001), 5)
-        self.assertAlmostEqual(self.pnl.run(0.005), self.sphere.run(0.005), 5)
-        self.assertAlmostEqual(self.pnl.run(0.01), self.sphere.run(0.01), 5)
-        self.assertAlmostEqual(self.pnl.run(0.05), self.sphere.run(0.05), 5)
-        self.assertAlmostEqual(self.pnl.run(0.1), self.sphere.run(0.1), 5)
-        self.assertAlmostEqual(self.pnl.run(0.5), self.sphere.run(0.5), 5)
-        
-    def testwithbarbell(self):
-        """ 
-        Compare 1D model with barbell
-        
-        Note:  pearlnecklace assumes infinite thin rod
-        """
-        self.pnl.setParam("radius", 20)
-        self.pnl.setParam("num_pearls", 2)
-        self.pnl.setParam("sld_pearl", 1e-06)
-        self.pnl.setParam("sld_string", 1e-06)
-        self.pnl.setParam("sld_solv", 6.3e-06)
-        self.pnl.setParam("thick_string", 0.1)
-        self.pnl.setParam("edge_separation", 400)
-        self.bar.setParam("rad_bar", 0.1)
-        self.bar.setParam("rad_bell", 20)
-        
-        self.assertAlmostEqual(self.pnl.run(0.001), self.bar.run(0.001), 1)
-        self.assertAlmostEqual(self.pnl.run(0.005), self.bar.run(0.005), 1)
-        self.assertAlmostEqual(self.pnl.run(0.01), self.bar.run(0.01), 1)
-        self.assertAlmostEqual(self.pnl.run(0.05), self.bar.run(0.05), 1)
-        self.assertAlmostEqual(self.pnl.run(0.1), self.bar.run(0.1), 1)
-        self.assertAlmostEqual(self.pnl.run(0.5), self.bar.run(0.5), 1)
-        
-        
-
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_model_sphericalsldmodel.py
===================================================================
--- sansmodels/src/sans/models/test/utest_model_sphericalsldmodel.py	(revision 96d19c6bf56eec1e8d4620dff4ab8cebf354401f)
+++ 	(revision )
@@ -1,77 +1,0 @@
-"""
-    Unit tests for specific models
-    @author: JHJ Cho / UTK
-"""
-
-import unittest
-
-class TestSphericalSLDModel(unittest.TestCase):
-    """ 
-        Unit tests for OnionExpShellModel
-    """
-    def setUp(self):
-
-        from sans.models.SphericalSLDModel import SphericalSLDModel
-        from sans.models.OnionExpShellModel import OnionExpShellModel
-        
-        # intit models and the multifactor
-        # layer 
-        self.model = SphericalSLDModel(1)
-        self.model2 = OnionExpShellModel(3)
-        
-    def test_compare_SphericalSLD_OnionExpShell(self):
-        """
-        Check if SphericalSLD equals (up to 1%) to 
-        OnionExpShellModel with an equivalent SLD profile 
-        """
-        note = "\n*****Note: This test was passes since Nov. 1st, 2010..."
-        print note
-        # set params
-        self.model.setParam("npts_inter", 35)
-        self.model.setParam("rad_core0", 100)
-        self.model.setParam("thick_inter0", 200)
-        self.model.setParam("nu_inter0", 4)
-        # Rexp func
-        self.model.setParam("func_inter0", 3)
-        self.model.setParam("thick_inter1", 200)
-        self.model.setParam("nu_inter1", 4)
-        self.model.setParam("func_inter1", 3)
-        # set A_shell=1
-        self.model2.setParam("sld_core0", 2.07e-006)
-        # change the function to flat function
-        self.model2.setParam("rad_core0", 100)
-        self.model2.setParam("thick_shell1", 200)
-        self.model2.setParam("sld_out_shell1", 4e-006)
-        self.model2.setParam("sld_in_shell1", 2.07e-006)
-        self.model2.setParam("A_shell1", -4)
-        self.model2.setParam("thick_shell2", 100)
-        self.model2.setParam("sld_out_shell2", 4e-006)
-        self.model2.setParam("sld_in_shell2", 4e-006)
-        self.model2.setParam("A_shell2", 0)
-        self.model2.setParam("thick_shell3", 200)
-        self.model2.setParam("sld_out_shell3", 1e-006)
-        self.model2.setParam("sld_in_shell3", 4e-006)
-        self.model2.setParam("A_shell3", -4)
-        self.model2.setParam("sld_solv", 1e-006)
-        
-        #sphericalsld model runs
-        model_run_0_1 = self.model.run(0.1)
-        model_run_0_01 = self.model.run(0.01)
-        model_run_0_001 = self.model.run(0.001)
-        #onionexp model runs
-        model2_run_0_1 = self.model2.run(0.1)
-        model2_run_0_01 = self.model2.run(0.01)
-        model2_run_0_001 = self.model2.run(0.001)
-        import time
-        st = time.time()
-        qs = []
-        qs = [i/10000 for i in range(1,1000)]
-        out = map(self.model.run,qs)
-        print time.time()-st
-        #Compare exp(A=0) to flat (where A_shell is null) function
-        self.assertAlmostEqual(self.model.run(0.1),self.model2.run(0.1),4)
-        self.assertAlmostEqual(self.model.run(0.01),self.model2.run(0.01),0)
-        self.assertAlmostEqual(self.model.run(0.001),self.model2.run(0.001),-3)
-                        
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_modelmultiplication.py
===================================================================
--- sansmodels/src/sans/models/test/utest_modelmultiplication.py	(revision c52f66f31ac56768461f6de337f16537426fd3c0)
+++ 	(revision )
@@ -1,726 +1,0 @@
-"""
-    Unit tests for specific models
-    @author: JHJ Cho / UTK
-"""
-#This test replaces the older utests for multiplicationModel. Aug. 31, 2009. JC
-import unittest, numpy,math
-### P*S with sphere model    
-class TestsphereSuareW(unittest.TestCase):
-    """ 
-        Unit tests for SphereModel(Q) * SquareWellStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        from sans.models.SquareWellStructure import SquareWellStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = SphereModel()
-        self.model2 = SquareWellStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc() 
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        modelDrun = 60
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun )
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication  (check the setparameters and the run & runXY w/ array dispersion)"""
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            if not 'scale' in item: 
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)
-        
-        val_1d = self.model3.run(math.sqrt(0.0002))
-        val_2d = self.model3.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)
-      
-class TestsphereHardS(unittest.TestCase):
-    """ 
-        Unit tests for SphereModel(Q) * HardsphereStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        from sans.models.HardsphereStructure import HardsphereStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = SphereModel()
-        self.model2 = HardsphereStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc() 
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        modelDrun = 60
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun )
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication  (check the parameters)"""
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            if not 'scale' in item: 
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)
-        
-        val_1d = self.model3.run(math.sqrt(0.0002))
-        val_2d = self.model3.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)
-class TestsphereSHS(unittest.TestCase):
-    """ 
-        Unit tests for SphereModel(Q) * StickyHSStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        from sans.models.StickyHSStructure import StickyHSStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = SphereModel()
-        self.model2 = StickyHSStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc() 
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        modelDrun = 60
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun )
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication  (check the parameters)"""
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            if not 'scale' in item: 
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)
-        
-        val_1d = self.model3.run(math.sqrt(0.0002))
-        val_2d = self.model3.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)
-        
-class TestsphereHayterM(unittest.TestCase):
-    """ 
-        Unit tests for SphereModel(Q) * HayterMSAStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        from sans.models.HayterMSAStructure import HayterMSAStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = SphereModel()
-        self.model2 = HayterMSAStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc() 
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        modelDrun = 60
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun )
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication  (check the parameters)"""
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            if not 'scale' in item: 
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)
-        
-        val_1d = self.model3.run(math.sqrt(0.0002))
-        val_2d = self.model3.runXY([0.01,0.01]) 
-
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)      
-          
-### P*S with cylinder model
-class TestcylinderSuareW(unittest.TestCase):
-    """ 
-        Unit tests for CylinderModel(Q) * SquareWellStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        from sans.models.SquareWellStructure import SquareWellStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = CylinderModel()
-        self.model2 = SquareWellStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc() 
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        self.modelD.setParam("radius", 60)
-        modelDrun = self.modelD.run(0.1)/2
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun)
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication  (check the setparameters and the run & runXY w/ array dispersion)"""
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            if not 'scale' in item: 
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
-         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
-          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)
-        
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)
-      
-class TestcylinderHardS(unittest.TestCase):
-    """ 
-        Unit tests for CylinderModel(Q) * HardsphereStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        from sans.models.HardsphereStructure import HardsphereStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = CylinderModel()
-        self.model2 = HardsphereStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc() 
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        self.modelD.setParam("radius", 60)
-        modelDrun = self.modelD.run(0.1)/2
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun )
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication """
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            #model3 parameters should not include scale*
-            if not 'scale' in item: 
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        #self.model3.setParam("scale", 15)
-        #self.assertEqual(self.model3.getParam("scale"), 15)
-        self.model3.setParam("scale_factor", 0.1)
-        self.assertEqual(self.model3.getParam("scale_factor"), 0.1)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
-         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
-          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)
-        
-
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)
-class TestcylinderSHS(unittest.TestCase):
-    """ 
-        Unit tests for SphereModel(Q) * StickyHSStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        from sans.models.StickyHSStructure import StickyHSStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = CylinderModel()
-        self.model2 = StickyHSStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc()
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        self.modelD.setParam("radius", 60)
-        modelDrun = self.modelD.run(0.1)/2
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun )
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication  (check the parameters)"""
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            if not 'scale' in item: 
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
-         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
-          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)
-        
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)
-        
-class TestcylinderHayterM(unittest.TestCase):
-    """ 
-        Unit tests for CylinderModel(Q) * HayterMSAStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        from sans.models.HayterMSAStructure import HayterMSAStructure
-        from sans.models.DiamCylFunc import DiamCylFunc
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = CylinderModel()
-        self.model2 = HayterMSAStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-        self.modelD = DiamCylFunc()
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("radius", 60)
-        self.modelD.setParam("radius", 60)
-        modelDrun = self.modelD.run(0.1)/2
-        self.model2.setParam("volfraction", 0.2)
-        self.model2.setParam("effect_radius", modelDrun )
-        
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
-        self.assertEqual(self.model.calculate_ER(), modelDrun)
-        
-        
-    def testMultiplicationParam(self):
-        """ Test Multiplication  (check the parameters)"""
-        ## test details dictionary
-
-        ## test parameters list
-        list3= self.model3.getParamList()
-
-        for item in self.model.getParamList():
-            if not 'scale' in item:  
-                self.assert_(item in list3)
-        for item in self.model2.getParamList():
-            #model3 parameters should not include effect_radius*
-            if not 'effect_radius' in item:  
-                self.assert_(item in list3)
-            
-        ## test set value for parameters and get paramaters
-        #self.model3.setParam("scale", 15)
-        #self.assertEqual(self.model3.getParam("scale"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.model3.setParam("radius", 20)
-        self.assertEqual(self.model3.getParam("radius"), 20)
-        self.model3.setParam("radius.width", 15)
-        self.assertEqual(self.model3.getParam("radius.width"), 15)
-        self.model3.setParam("scale_factor", 15)
-        self.assertEqual(self.model3.getParam("scale_factor"), 15)
-        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
-        
-        ## Dispersity 
-        list3= self.model3.getDispParamList()
-        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
-         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
-          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
-        
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_th = ArrayDispersion()
-        
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_th[i]=(math.pi/99.0*i)
-            weights[i]=(1.0)
-    
-        disp_th.set_weights(values_th, weights)
-        
-        self.model3.set_dispersion('radius', disp_th)        
-
-        model4= self.model3.clone()
-        self.assertEqual(model4.getParam("radius"), 20)        
-        
-class TestGuinierHayterM(unittest.TestCase):
-    """ 
-        Unit tests for GuinierModel(Q) * HayterMSAStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.GuinierModel import GuinierModel
-        from sans.models.HayterMSAStructure import HayterMSAStructure
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = GuinierModel()
-        self.model2 = HayterMSAStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-
-    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        self.model.setParam("rg", 60)
-        self.model.setParam("scale", 1)
-        #Compare new method with old method         
-        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
-        
-        #effective radius calculation is not implemented for this model. 
-        self.assertEqual(self.model3.calculate_ER(), NotImplemented)       
-        
-class TestLamellarHayterM(unittest.TestCase):
-    """ 
-        Unit tests for LamellarModel(Q) * HayterMSAStructure(Q)
-    """
-    def setUp(self):
-        from sans.models.LamellarModel import LamellarModel
-        from sans.models.HayterMSAStructure import HayterMSAStructure
-        from sans.models.MultiplicationModel import MultiplicationModel
-
-        self.model = LamellarModel()
-        self.model2 = HayterMSAStructure()
-        self.model3 = MultiplicationModel(self.model, self.model2)  
-
-    #Radius of model1.calculate_ER should Not be finite.
-    def test_multplication_radius(self):
-        """
-            test multiplication model (check the effective radius & the output
-             of the multiplication)
-        """
-        #Check run       
-        self.assertFalse(numpy.isfinite(self.model3.run(0.1)))
-        #check effective radius . 
-        self.assertFalse(numpy.isfinite(self.model.calculate_ER()))      
-                
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_models.py
===================================================================
--- sansmodels/src/sans/models/test/utest_models.py	(revision e52eeea3ee0fcb41e0f8afc08b5b05c0da152582)
+++ 	(revision )
@@ -1,251 +1,0 @@
-"""
-    Unit tests for specific models
-    @author: Mathieu Doucet / UTK
-"""
-
-import unittest, time, math
-
-# Disable "missing docstring" complaint
-# pylint: disable-msg=C0111
-# Disable "too many methods" complaint 
-# pylint: disable-msg=R0904 
-# Disable "could be a function" complaint 
-# pylint: disable-msg=R0201
-
-class TestSpherew(unittest.TestCase):
-    """ Unit tests for sphere model """
-    
-    def setUp(self):
-        from sans.models.CoreFourShellModel import CoreFourShellModel
-        from sans.models.CoreMultiShellModel import CoreMultiShellModel
-        self.comp = CoreMultiShellModel(4)
-        
-    def test1D(self):
-        """ Test 1D model for a sphere """
-        self.comp._set_dispersion()
-        
-class TestSphere(unittest.TestCase):
-    """ Unit tests for sphere model """
-    
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        self.comp = SphereModel()
-        
-    def test1D(self):
-        """ Test 1D model for a sphere """
-        self.assertAlmostEqual(self.comp.run(1.0), 5.6387e-5, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a sphere """
-        self.assertAlmostEqual(self.comp.run([1.0, 1.3]), 5.6387e-5, 4)
-
-class TestCyl(unittest.TestCase):
-    """Unit tests for cylinder"""
-    
-    def setUp(self):
-
-        from sans.models.CylinderModel import CylinderModel
-        self.comp = CylinderModel()
-        
-    def test1D(self):
-        """ Test 1D model of a cylinder """ 
-        self.assertAlmostEqual(self.comp.run(0.2), 0.041761386790780453, 4)
-       
-    def testTime(self):
-        """ Time profiling """
-        self.comp.run(2.0)
-        t0 = time.clock()
-        self.assertTrue(time.clock()-t0<1e-5)
-     
-    def test2D(self):
-        """ Test 2D model of a cylinder """ 
-        self.comp.setParam('cyl_theta', 1*180/math.pi)
-        self.comp.setParam('cyl_phi', 1*180/math.pi)
-        self.assertAlmostEqual(self.comp.run([0.2, 2.5]), 
-                               0.038176446608393366, 4)
-       
-    def testIO(self):
-        from sans.models.ModelFactory import ModelFactory
-        from sans.models.ModelIO import ModelIO
-        factory = ModelFactory()
-        io = ModelIO(factory)
-        io.save(self.comp,"myModel.xml")
-        value = self.comp.run(1)
-        loaded = io.load("myModel.xml")
-        self.assertEqual(value, loaded.run(1))
-        
-    def testIO_add(self):
-        # version 0.5.0: No longer supported
-        return
-        from sans.models.ModelFactory import ModelFactory
-        from sans.models.ModelIO import ModelIO
-        factory = ModelFactory()
-        io = ModelIO(factory)
-        sph = factory.getModel("SphereModel")
-        cyl = factory.getModel("CylinderModel")
-        combo = sph - cyl
-        io.save(combo,"myModel.xml")
-        value = combo.run(1)
-        loaded = io.load("myModel.xml")
-        self.assertEqual(value, loaded.run(1))
-        
-    def testIO_add2(self):
-        # version 0.5.0: No longer supported
-        return
-        from sans.models.ModelFactory import ModelFactory
-        #from sans.models.ModelIO import ModelIO
-        factory = ModelFactory()
-        #io = ModelIO(factory)
-        sph = factory.getModel("SphereModel")
-        cyl = factory.getModel("CylinderModel")
-        sph2 = factory.getModel("SphereModel")
-        combo1 = cyl - sph
-        combo = combo1 / sph2
-        #combo1 = sph
-        #io.save(combo,"myModel.xml")
-        # Just check that we have some output
-        self.assertTrue(math.fabs(combo.run(1))>0)
-        #loaded = io.load("myModel.xml")
-        #self.assertEqual(value, loaded.run(1))
-        
-        
-      
-       
-class TestFactory(unittest.TestCase):
-    """Unit tests for Model Factory"""
-    
-    def setUp(self):
-        from sans.models.ModelFactory import ModelFactory
-        self.comp = ModelFactory().getModel('CylinderModel')
-        
-    def test1D(self):
-        """ Test 1D model of a cylinder """ 
-        self.assertAlmostEqual(self.comp.run(0.2), 0.041761386790780453, 4)
-        
- 
-class TestGaussian(unittest.TestCase):
-    """Unit tests for Gaussian function"""
-    
-    def setUp(self):
-        from sans.models.Gaussian import Gaussian
-        self.gauss= Gaussian()
-        
-    def test1D(self):
-        self.gauss.setParam('scale', 2.0)
-        self.gauss.setParam('center', 1.0)
-        self.gauss.setParam('sigma', 1.0)
-        self.assertEqual(self.gauss.run(1.0), 2.0)
-        value = math.exp(-0.5)
-        self.assertEqual(self.gauss.run(2.0), 2.0*value)
-        
-    def test2D(self):
-        self.gauss.setParam('scale', 2.0)
-        self.gauss.setParam('center', 1.0)
-        self.gauss.setParam('sigma', 1.0)
-        self.assertEqual(self.gauss.runXY([1.0,1.0]), 2.0*2.0)
-        value = math.exp(-0.5)
-        self.assertEqual(self.gauss.runXY([1.0,2.0]), 2.0*2.0*value)
-        self.assertEqual(self.gauss.runXY([2.0,2.0]), 2.0*2.0*value*value)
-        
-    def test2Dphi(self):
-        self.gauss.setParam('scale', 2.0)
-        self.gauss.setParam('center', 1.0)
-        self.gauss.setParam('sigma', 1.0)
-        value = math.exp(-0.5)
-        self.assertAlmostEqual(self.gauss.run([math.sqrt(8.0), math.pi/4.0]), 2.0*2.0*value*value, 5)
-        
-class TestLorentzian(unittest.TestCase):
-    """Unit tests for Lorentzian function"""
-    
-    def setUp(self):
-        from sans.models.Lorentzian import Lorentzian
-        self.lor= Lorentzian()
-        
-    def test1D(self):
-        self.lor.setParam('scale', 2.0)
-        self.lor.setParam('center', 1.0)
-        self.lor.setParam('gamma', 1.0)
-        self.assertEqual(self.lor.run(1.0), 4.0/math.pi)
-        value = 1/math.pi*0.5/(1+.25)
-        self.assertEqual(self.lor.run(2.0), 2.0*value)
-        
-    def test2D(self):
-        self.lor.setParam('scale', 0.5*math.pi)
-        self.lor.setParam('center', 1.0)
-        self.lor.setParam('gamma', 1.0)
-        self.assertEqual(self.lor.run(1.0), 1.0)
-        value = 0.25/(1+.25)
-        self.assertEqual(self.lor.runXY([1.0,2.0]), value)
-        self.assertEqual(self.lor.runXY([2.0,2.0]), value*value)
-        
-    def test2Dphi(self):
-        self.lor.setParam('scale', 0.5*math.pi)
-        self.lor.setParam('center', 1.0)
-        self.lor.setParam('gamma', 1.0)
-        self.assertEqual(self.lor.run(1.0), 1.0)
-        value = 0.25/(1+.25)
-        self.assertAlmostEqual(self.lor.run([math.sqrt(8.0), math.pi/4.0]), value*value, 5)
-        
-class TestSin(unittest.TestCase):
-    """Unit tests for Sin(x) function"""
-    
-    def setUp(self):
-        from sans.models.Sin import Sin
-        self.sin = Sin()
-
-    def test1D(self):
-        self.assertEqual(self.sin.run(1.13), math.sin(1.13))
-        
-    def test2D(self):
-        self.assertEqual(self.sin.run([1.13,0.56]), math.sin(1.13*math.cos(0.56))*math.sin(1.13*math.sin(0.56)))
-        self.assertEqual(self.sin.runXY([1.13,0.56]), math.sin(1.13)*math.sin(0.56))
-        
-class TestCos(unittest.TestCase):
-    """Unit tests for Cos(x) function"""
-    
-    def setUp(self):
-        from sans.models.Cos import Cos
-        self.cos = Cos()
-
-    def test1D(self):
-        self.assertEqual(self.cos.run(1.13), math.cos(1.13))
-        
-    def test2D(self):
-        self.assertEqual(self.cos.run([1.13,0.56]), math.cos(1.13*math.cos(0.56))*math.cos(1.13*math.sin(0.56)))
-        self.assertEqual(self.cos.runXY([1.13,0.56]), math.cos(1.13)*math.cos(0.56))
-        
-class TestConstant(unittest.TestCase):
-    """Unit tests for Cos(x) function"""
-    
-    def setUp(self):
-        from sans.models.Constant import Constant
-        self.const = Constant()
-        self.const.setParam('value',56.1)
-
-    def test1D(self):
-        self.assertEqual(self.const.run(1.13), 56.1)
-        
-    def test2D(self):
-        self.assertEqual(self.const.run([1.13,0.56]), 56.1)
-        self.assertEqual(self.const.runXY([1.13,0.56]), 56.1)
-        
-    def testFunction(self):
-        # version 0.5.0: No longer supported
-        return
-        from sans.models.Sin import Sin
-        s = Sin()
-        A = self.const
-        A.setParam('Value',1.5)
-        B = self.const.clone()
-        B.setParam('value',2.0)
-        C = self.const.clone()
-        C.setParam('value',3.0)
-        
-        f = A+B*s*s+C
-        answer = 1.5+2.0*math.sin(1.1)**2+3.0
-        self.assertEqual(f.run(1.1), answer)
-    
-        
-
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_models_array.py
===================================================================
--- sansmodels/src/sans/models/test/utest_models_array.py	(revision b461b8fed4aa97723eb398327713f1eea0660858)
+++ 	(revision )
@@ -1,86 +1,0 @@
-"""
-    Unit tests for specific models using numpy array input
-    @author: Gervaise B Alina/ UTK
-"""
-
-import unittest, time, math, numpy
-
-        
-class TestSphere(unittest.TestCase):
-    """ Unit tests for sphere model using evalDistribution function """
-    
-    def setUp(self):
-        from sans.models.SphereModel import SphereModel
-        self.comp = SphereModel()
-        self.x = numpy.array([1.0,2.0,3.0, 4.0])
-        self.y = self.x +1
-        
-    def test1D(self):
-        """ Test 1D model for a sphere  with vector as input"""
-        answer = numpy.array([5.63877831e-05,2.57231782e-06,2.73704050e-07,2.54229069e-08])
-       
-       
-        testvector= self.comp.evalDistribution(self.x)
-       
-        self.assertAlmostEqual(len(testvector),4)
-        for i in xrange(len(answer)):
-            self.assertAlmostEqual(testvector[i],answer[i])
-       
-    def test1D_1(self):
-        """ Test 2D model for a sphere  with scalar as input"""
-        self.assertAlmostEqual(self.comp.run(1.0),5.63877831e-05, 4)
-         
-    def test1D_2(self):
-        """ Test 2D model for a sphere for 2 scalar """
-        self.assertAlmostEqual(self.comp.run([1.0, 1.3]), 56.3878e-06, 4)
-        
-    def test1D_3(self):
-        """ Test 2D model for a Shpere for 2 vectors as input """
-        #x= numpy.reshape(self.x, [len(self.x),1])
-        #y= numpy.reshape(self.y, [1,len(self.y)])
-        vect = self.comp.evalDistribution([self.x,self.y])
-        self.assertAlmostEqual(vect[0],9.2985e-07, 4)
-        self.assertAlmostEqual(vect[len(self.x)-1],1.3871e-08, 4)
-        
-        
-class TestCylinder(unittest.TestCase):
-    """ Unit tests for Cylinder model using evalDistribution function """
-    
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        self.comp = CylinderModel()
-        self.x = numpy.array([1.0,2.0,3.0, 4.0])
-        self.y = self.x +1
-        
-    def test1D(self):
-        """ Test 1D model for a cylinder with vector as input"""
-        
-        answer = numpy.array([1.98860592e-04,7.03686335e-05,2.89144683e-06,2.04282827e-06])
-
-        testvector= self.comp.evalDistribution(self.x)
-        self.assertAlmostEqual(len(testvector),4)
-        for i in xrange(len(answer)):
-            self.assertAlmostEqual(testvector[i],answer[i])
-       
-    def test1D_1(self):
-        """ Test 2D model for a cylinder  with scalar as input"""
-        self.assertAlmostEqual(self.comp.run(0.2), 0.041761386790780453, 4)
-         
-    def test1D_2(self):
-        """ Test 2D model of a cylinder """ 
-        self.comp.setParam('cyl_theta', 1.0 * 180/3.1415)
-        self.comp.setParam('cyl_phi', 1.0 * 180/3.1415)
-        self.assertAlmostEqual(self.comp.run([0.2, 2.5]), 
-                               0.038176446608393366, 3)
-        
-    def test1D_3(self):
-        """ Test 2D model for a cylinder for 2 vectors as input """
-        vect = self.comp.evalDistribution([self.x,self.y])
-      
-        self.assertAlmostEqual(vect[0],5.06121018e-08,4)
-        self.assertAlmostEqual(vect[len(self.x)-1],2.5978e-11, 4)
-        
-        
-
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_models_new1_3.py
===================================================================
--- sansmodels/src/sans/models/test/utest_models_new1_3.py	(revision ec658c856bb1b403622acc98b5528f12702b6f5b)
+++ 	(revision )
@@ -1,86 +1,0 @@
-"""
-    Unit tests for specific models II
-"""
-
-import unittest, time, math
-     
-class TestFuzzySphere(unittest.TestCase):
-    """ Unit tests for fuzzysphere model """
-    
-    def setUp(self):
-        from sans.models.FuzzySphereModel import FuzzySphereModel
-        self.comp = FuzzySphereModel()
-        
-    def test1D(self):
-        """ Test 1D model for a fuzzysphere """
-        self.assertAlmostEqual(self.comp.run(1), 0.001, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a fuzzysphere """
-        self.assertAlmostEqual(self.comp.run([1, 1.3]), 0.001, 3)
-        
-class TestPolyGaussCoil(unittest.TestCase):
-    """ Unit tests for PolyGaussCoil """
-    
-    def setUp(self):
-        from sans.models.Poly_GaussCoil import Poly_GaussCoil
-        self.comp = Poly_GaussCoil()
-        
-    def test1D(self):
-        """ Test 1D model for a PolyGaussCoil """
-        self.assertAlmostEqual(self.comp.run(0.107000453), 0.0688476, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a PolyGaussCoil """
-        self.assertAlmostEqual(self.comp.run([0.107000453, 0.2]), 0.0688476, 4)
-                
-class TestCoreFourShellModel(unittest.TestCase):
-    """ Unit tests for CoreFourShellModel """
-    
-    def setUp(self):
-        from sans.models.CoreFourShellModel import CoreFourShellModel
-        self.comp = CoreFourShellModel()
-        
-    def test1D(self):
-        """ Test 1D model for a CoreFourShellModel """
-        print "sldsolv",self.comp.getParam("sld_solv")
-        self.assertAlmostEqual(self.comp.run(0.001), 3318.19548, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a CoreFourShellModel """
-        self.assertAlmostEqual(self.comp.run([0.001, 0.2]), 3318.19548, 4)
-
-class TestFractal(unittest.TestCase):
-    """ Unit tests for Fractal model """
-    
-    def setUp(self):
-        from sans.models.FractalModel import FractalModel
-        self.comp = FractalModel()
-        
-    def test1D(self):
-        """ Test 1D model for a Fractal """
-        self.assertAlmostEqual(self.comp.run(0.001), 39.288146, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Fractal """
-        self.assertAlmostEqual(self.comp.run([0.001, 1]), 39.288146, 4)
-                                
-class TestLamella(unittest.TestCase):
-    """ Unit tests for Lamella model """
-    
-    def setUp(self):
-        from sans.models.LamellarModel import LamellarModel
-        self.comp = LamellarModel()
-        
-    def test1D(self):
-        """ Test 1D model for a Lamellar """
-        self.assertAlmostEqual(self.comp.run(1.0), 5.6387e-5, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Lamellar """
-        self.assertAlmostEqual(self.comp.run([1.0, 1.3]), 5.6387e-5, 4)
-                
-        
-
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_newstylemodels.py
===================================================================
--- sansmodels/src/sans/models/test/utest_newstylemodels.py	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ 	(revision )
@@ -1,93 +1,0 @@
-"""
-    Unit tests for dispersion functionality of 
-    C++ model classes
-"""
-print "New style models are still under development"
-import unittest, math, numpy
-
-class TestModel(object):
-    """
-        An old-style model
-    """
-    def __init__(self):
-        ## Parameter dictionary
-        self.params = {}
-        self.params['scale']       = 0.05
-        
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale']       = ['',     None, None]
-
-    def run(self, x):
-        return self.params['scale']*x
-
-from sans.models.BaseModel import BaseModel, Parameter, ParameterProperty
-class NewTestModel(BaseModel):
-    scale = ParameterProperty('scale')
-    
-    def __init__(self):  
-        BaseModel.__init__(self)  
-        self.parameters = {}
-        self.parameters['scale'] = Parameter('scale', 4.0) 
-        
-        
-    def runXY(self, x):
-        return self.scale*x
-        
-class TestBogusModel(unittest.TestCase):
-    def setUp(self):
-        self.model = NewTestModel()
-        
-    def test_call(self):
-        self.assertEqual(self.model(1), 4.0)
-        self.model.scale = 1.0
-        self.assertEqual(self.model(1), 1.0)
-        self.model.setParam('scale',2.0)
-        self.assertEqual(self.model(1), 2.0)
-        self.assertEqual(self.model.getParam('scale'), 2.0)
-        
-class TestBaseModel(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.BaseModel import BaseModel
-        self.model = BaseModel()
-        
-        
-    def test_removed_attrs(self):
-        def setop():
-            print self.model.operateOn
-        self.assertRaises(AttributeError, setop)
-        def setother():
-            print self.model.other
-        self.assertRaises(AttributeError, setother)
-        
-class TestAdaptor(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.NewCylinderModel import CylinderModel
-        self.model = CylinderModel()
-        
-        
-    def test_setparam(self):
-        self.model.setParam("length", 151.0)
-        self.assertEquals(self.model.getParam("length"), 151.0)
-        
-        
-        
-        print self.model(0.001)
-        print self.model.parameters['length']
-        self.model.setParam("length", 250.0)
-        self.assertEquals(self.model.getParam("length"), 250.0)
-        
-        print self.model.parameters['length']
-        print self.model(0.001)
-        
-    
-  
-if __name__ == '__main__':
-    unittest.main()
-   
Index: nsmodels/src/sans/models/test/utest_nonshape.py
===================================================================
--- sansmodels/src/sans/models/test/utest_nonshape.py	(revision a07161bc821b453da5ecc5a80ee4cd222cbf0404)
+++ 	(revision )
@@ -1,522 +1,0 @@
-"""
-    Unit tests for non shape based model (Task 8.2.1)
-    These tests are part of the requirements
-"""
-
-import unittest, time, math
-from scipy.special import erf,gammaln
-
-# Disable "missing docstring" complaint
-# pylint: disable-msg=C0111
-# Disable "too many methods" complaint 
-# pylint: disable-msg=R0904 
-# Disable "could be a function" complaint 
-# pylint: disable-msg=R0201
-
-import scipy 
-class TestGuinier(unittest.TestCase):
-    """
-        Unit tests for Guinier function
-        
-        F(x) = exp[ [A] + [B]*Q**2 ]
-        
-        The model has two parameters: A and B
-    """
-    def _func(self, a, b, x):
-        return a*math.exp(-(b*x)**2/3.0)
-    
-    def setUp(self):
-        from sans.models.GuinierModel import GuinierModel
-        self.model= GuinierModel()
-        
-    def test1D(self):
-        self.model.setParam('scale', 2.0)
-        self.model.setParam('rg', 1.0)
-        
-        self.assertEqual(self.model.run(0.0), 2.0)
-        self.assertEqual(self.model.run(2.0), 2.0*math.exp(-(1.0*2.0)**2/3.0))
-        self.assertEqual(self.model.runXY(2.0), 2.0*math.exp(-(1.0*2.0)**2/3.0))
-        
-    def test2D(self):
-        self.model.setParam('scale', 2.0)
-        self.model.setParam('rg', 1.0)
-        
-        #value = self._func(2.0, 1.0, 1.0)*self._func(2.0, 1.0, 2.0)
-        value = self._func(2.0, 1.0, math.sqrt(5.0))
-        #self.assertEqual(self.model.runXY([0.0,0.0]), 2.0*2.0)
-        self.assertEqual(self.model.runXY([0.0,0.0]), 2.0)
-        self.assertEqual(self.model.runXY([1.0,2.0]), value)
-        
-    def test2Dphi(self):
-        self.model.setParam('scale', 2.0)
-        self.model.setParam('rg', 1.0)
-        
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        #value = self._func(2.0, 1.0, x)*self._func(2.0, 1.0, y)
-        value = self._func(2.0, 1.0, r)
-        
-        #self.assertEqual(self.model.run([r, phi]), value)
-        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
-        
-        
-class TestPorod(unittest.TestCase):
-    """
-        Unit tests for Porod function
-        
-        F(x) = C/Q**4 
-        
-        The model has one parameter: C
-    """
-    def _func(self, c, x):
-        return c/(x**4)
-    
-    def setUp(self):
-        from sans.models.PorodModel import PorodModel
-        self.model= PorodModel()
-        self.model.setParam('scale', 2.0)        
-        
-    def test1D(self):
-        value = self._func(2.0, 3.0)
-        self.assertEqual(self.model.run(3.0), value)
-        self.assertEqual(self.model.runXY(3.0), value)
-        
-    def test2D(self):
-        #value = self._func(2.0, 1.0)*self._func(2.0, 2.0)
-        value = self._func(2.0, math.sqrt(5.0))
-        self.assertEqual(self.model.runXY([1.0,2.0]), value)
-        
-    def test2Dphi(self):
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        #value = self._func(2.0, 1.0)*self._func(2.0, 2.0)
-        value = self._func(2.0, r)
-        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
-        
-class TestDebye(unittest.TestCase):
-    """
-        Unit tests for Debye function
-        
-        F(x) = 2( exp(-x)+x -1 )/x**2
-        
-        The model has three parameters: 
-            Rg     =  radius of gyration
-            scale  =  scale factor
-            bkd    =  Constant background
-    """
-    def _func(self, Rg, scale, bkg, x):
-        y = (Rg * x)**2
-        return scale * (2*(math.exp(-y) + y -1)/y**2) + bkg
-    
-    def setUp(self):
-        from sans.models.DebyeModel import DebyeModel
-        self.model= DebyeModel()
-        self.model.setParam('rg', 50.0)    
-        self.model.setParam('scale',1.0) 
-        self.model.setParam('background',0.001)   
-        
-    def test1D(self):
-        value = self._func(50.0, 1.0, 0.001, 2.0)
-        self.assertEqual(self.model.run(2.0), value)
-        self.assertEqual(self.model.runXY(2.0), value)
-
-        # User enter zero as a value of x, y= 1
-        self.assertAlmostEqual(self.model.run(0.0), 1.00, 2)
-        
-    def test1D_clone(self):
-        value = self._func(50.0, 1.0, 10.0, 2.0)
-        self.model.setParam('background', 10.0)
-        clone = self.model.clone()
-        self.assertEqual(clone.run(2.0), value)
-        self.assertEqual(clone.runXY(2.0), value)
-        
-        # User enter zero as a value of x
-        # An exceptio is raised: No more exception
-        #self.assertRaises(ZeroDivisionError, clone.run, 0.0)
-        
-    def test2D(self):
-        #value = self._func(50.0, 1.0, 0.001, 1.0)*self._func(50.0, 1.0, 0.001, 2.0)
-        value = self._func(50.0, 1.0, 0.001, math.sqrt(5.0))
-        self.assertEqual(self.model.runXY([1.0,2.0]), value)
-        
-    def test2Dphi(self):
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        value = self._func(50.0, 1.0, 0.001, 1.0)*self._func(50.0, 1.0, 0.001, 2.0)
-        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
-        
-        
-class TestLorentz(unittest.TestCase):
-    """
-        Unit tests for Lorentz function
-        
-         F(x) = scale/( 1 + (x*L)^2 ) + bkd
-        
-        The model has three parameters: 
-            L     =  screen Length
-            scale  =  scale factor
-            bkd    =  incoherent background
-    """
-    def _func(self, I0 , L, bgd, qval):
-        return I0/(1.0 + (qval*L)*(qval*L)) + bgd
-    
-    def setUp(self):
-        from sans.models.LorentzModel import LorentzModel
-        self.model= LorentzModel()
-        
-    def test1D(self):
-        self.model.setParam('scale', 100.0)
-        self.model.setParam('Length', 50.0)
-        self.model.setParam('background', 1.0)
-        
-        self.assertEqual(self.model.run(0.0), 101.0)
-        self.assertEqual(self.model.run(2.0), self._func(100.0, 50.0, 1.0, 2.0))
-        self.assertEqual(self.model.runXY(2.0), self._func(100.0, 50.0, 1.0, 2.0))
-        
-    def test2D(self):
-        self.model.setParam('scale', 100.0)
-        self.model.setParam('Length', 50.0)
-        self.model.setParam('background', 1.0)
-        
-        #value = self._func(100.0, 50.0, 1.0, 1.0)*self._func(100.0, 50.0, 1.0, 2.0)    
-        value = self._func(100.0, 50.0, 1.0, math.sqrt(5.0))  
-        self.assertEqual(self.model.runXY([1.0,2.0]), value)
-        
-    def test2Dphi(self):
-        self.model.setParam('scale', 100.0)
-        self.model.setParam('Length', 50.0)
-        self.model.setParam('background', 1.0)
-        
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        value = self._func(100.0, 50.0, 1.0, x)*self._func(100.0, 50.0, 1.0, y)
-        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
-        
-class TestDAB(unittest.TestCase):
-    """
-        Unit tests for DAB function
-        
-         F(x) = scale/( 1 + (x*L)^2 )^(2) + bkd
-        
-        The model has three parameters: 
-            L      =  Correlation Length
-            scale  =  scale factor
-            bkd    =  incoherent background
-    """
-    def _func(self, Izero, range, incoh, qval):
-        return Izero* pow(range,3)/pow((1.0 + (qval*range)*(qval*range)),2) + incoh
-    
-    def setUp(self):
-        from sans.models.DABModel import DABModel
-        self.model= DABModel()
-        self.scale = 10.0
-        self.length = 40.0
-        self.back = 1.0
-        
-        self.model.setParam('scale', self.scale)
-        self.model.setParam('length', self.length)
-        self.model.setParam('background', self.back)
-        
-    def test1D(self):
-
-        self.assertEqual(self.model.run(2.0), self._func(self.scale, self.length, self.back, 2.0))
-        self.assertEqual(self.model.runXY(2.0), self._func(self.scale, self.length, self.back, 2.0))
-        
-    def test2D(self):
-        #value = self._func(self.scale, self.length, self.back, 1.0)*self._func(self.scale, self.length, self.back, 2.0)    
-        value = self._func(self.scale, self.length, self.back, math.sqrt(5.0))
-        self.assertEqual(self.model.runXY([1.0,2.0]), value)
-        
-    def test2Dphi(self):
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        value = self._func(self.scale, self.length, self.back, x)*self._func(self.scale, self.length, self.back, y)
-        self.assertAlmostEquals(self.model.run([x, y]), value,1)
-        
-class TestPowerLaw(unittest.TestCase):
-    """
-        Unit tests for PowerLaw function
-
-        F(x) = scale* (x)^(m) + bkd
-        
-        The model has three parameters: 
-            m     =  power
-            scale  =  scale factor
-            bkd    =  incoherent background
-    """
-    def _func(self, a, m, bgd, qval):
-        return a*math.pow(qval,-m) + bgd
-    
-    
-    def setUp(self):
-        from sans.models.PowerLawModel import PowerLawModel
-        self.model= PowerLawModel()
-        
-    def test1D(self):
-        self.model.setParam('scale', math.exp(-6))
-        self.model.setParam('m', 4.0)
-        self.model.setParam('background', 1.0)
-        
-        #self.assertEqual(self.model.run(0.0), 1.0)
-        self.assertEqual(self.model.run(2.0), self._func(math.exp(-6), 4.0, 1.0, 2.0))
-        self.assertEqual(self.model.runXY(2.0), self._func(math.exp(-6), 4.0, 1.0, 2.0))
-    
-    def testlimit(self):
-        self.model.setParam('scale', math.exp(-6))
-        self.model.setParam('m', -4.0)
-        self.model.setParam('background', 1.0)
-        
-        self.assertEqual(self.model.run(0.0), 1.0)
-        
-    def test2D(self):
-        self.model.setParam('scale', math.exp(-6))
-        self.model.setParam('m', 4.0)
-        self.model.setParam('background', 1.0)
-        
-        #value = self._func(math.exp(-6), 4.0, 1.0, 1.0)\
-        #*self._func(math.exp(-6), 4.0, 1.0, 2.0)    
-        value = self._func(math.exp(-6), 4.0, 1.0, math.sqrt(5.0))
-        
-        self.assertEqual(self.model.runXY([1.0,2.0]), value)
-        
-    def test2Dphi(self):
-        self.model.setParam('scale', math.exp(-6))
-        self.model.setParam('m', 4.0)
-        self.model.setParam('background', 1.0)
-        
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        value = self._func(math.exp(-6), 4.0, 1.0, x)\
-        *self._func(math.exp(-6), 4.0, 1.0, y)
-        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
-                
-class TestTeubnerStrey(unittest.TestCase):
-    """
-        Unit tests for PowerLaw function
-
-        F(x) = 1/( scale + c1*(x)^(2)+  c2*(x)^(4)) + bkd
-        
-        The model has Four parameters: 
-            scale  =  scale factor
-            c1     =  constant
-            c2     =  constant
-            bkd    =  incoherent background
-    """
-    def _func(self, scale, c1, c2, bck, q):
-        
-        q2 = q*q;
-        q4 = q2*q2;
-    
-        return 1.0/(scale + c1*q2+c2*q4) + bck
-    
-    def setUp(self):
-        from sans.models.TeubnerStreyModel import TeubnerStreyModel
-        self.model= TeubnerStreyModel()
-        
-    def test1D(self):
-        
-        self.model.setParam('c1', -30.0) 
-        self.model.setParam('c2', 5000.0) 
-        self.model.setParam('scale', 0.1)
-        self.model.setParam('background', 0.1)
-        #self.assertEqual(1/(math.sqrt(4)), math.pow(4,-1/2))
-        #self.assertEqual(self.model.TeubnerStreyLengths(),False )
-        
-        self.assertEqual(self.model.run(0.0), 10.1)
-        self.assertEqual(self.model.run(2.0), self._func(0.1,-30.0,5000.0,0.1,2.0))
-        self.assertEqual(self.model.runXY(2.0), self._func(0.1,-30.0,5000.0,0.1,2.0))
-        
-    def test2D(self):
-        self.model.setParam('c1', -30.0) 
-        self.model.setParam('c2', 5000.0) 
-        self.model.setParam('scale', 0.1)
-        self.model.setParam('background', 0.1)
-        #value = self._func(0.1,-30.0,5000.0,0.1, 1.0)\
-        #*self._func(0.1,-30.0,5000.0,0.1, 2.0)    
-        value = self._func(0.1,-30.0,5000.0,0.1, math.sqrt(5.0))
-        
-        self.assertEqual(self.model.runXY([1.0,2.0]), value)
-        
-    def test2Dphi(self):
-        self.model.setParam('c1', -30.0) 
-        self.model.setParam('c2', 5000.0) 
-        self.model.setParam('scale', 0.1)
-        self.model.setParam('background', 0.1)
-        
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        #value = self._func(0.1,-30.0,5000.0,0.1, x)\
-        #*self._func(0.1,-30.0,5000.0,0.1, y)
-        value = self._func(0.1,-30.0,5000.0,0.1, r)
-        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
-        
-class TestBEPolyelectrolyte(unittest.TestCase):
-    """
-        Unit tests for  BEPolyelectrolyte function
-        
-        F(x) = K*1/(4*pi()*Lb*(alpha)^(2)*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\
-                       *(q^(2)-(12*h*C/b^(2)))
-        
-        The model has Eight parameters: 
-            K        =  Constrast factor of the polymer
-            Lb       =  Bjerrum length
-            H        =  virial parameter
-            B        =  monomer length
-            Cs       =  Concentration of monovalent salt 
-            alpha    =  ionazation degree 
-            C        = polymer molar concentration
-            bkd      = background
-    """
-    def _func(self, K, Lb, H, B, Cs, alpha, C, bkd, r02, k2,  x):
-        return (K /( (4*math.pi *Lb*(alpha**2)*(x**2 +k2)) *( (1 +(r02**2))  \
-                    *((x**2) + k2)*((x**2) -(12 * H * C/(B**2))) )))+ bkd
-    
-    def setUp(self):
-        from sans.models.BEPolyelectrolyte import BEPolyelectrolyte
-        self.model= BEPolyelectrolyte()
-        
-        self.K = 10.0
-        self.Lb = 6.5
-        self.h = 11
-        self.b = 13
-        self.Cs = 0.1
-        self.alpha = 0.05
-        self.C  = .7
-        self.Bkd =0.01
-       
-        self.model.setParam('K', self.K) 
-        self.model.setParam('Lb', self.Lb) 
-        self.model.setParam('H', self.h)
-        self.model.setParam('B', self.b)
-        self.model.setParam('Cs',self.Cs) 
-        self.model.setParam('alpha', self.alpha) 
-        self.model.setParam('C', self.C)
-        self.model.setParam('background', self.Bkd)
-        
-    def _func(self, q):
-        
-        Ca = self.C *6.022136e-4          
-        Csa = self.Cs * 6.022136e-4        
-        k2= 4*math.pi*self.Lb*(2*self.Cs+self.alpha*Ca)   
-
-        r02 = 1./self.alpha / Ca**0.5*( self.b / (48*math.pi*self.Lb)**0.5 )
-        q2 = q**2    
-        Sq = self.K*1./(4*math.pi*self.Lb*self.alpha**2) * (q2 + k2)  /  (1+(r02**2) * (q2+k2) * (q2- (12*self.h*Ca/self.b**2)) ) + self.Bkd
-        return Sq
-       
-    def test1D(self):
-        
-       
-        q = 0.001
-   
-        self.assertEqual(self.model.run(q), self._func(q))
-        self.assertEqual(self.model.runXY(q), self._func(q))
-         
-    def test2D(self):
-        #self.assertAlmostEquals(self.model.runXY([1.0,2.0]), self._func(1.0)*self._func(2.0), 8)
-        self.assertAlmostEquals(self.model.runXY([1.0,2.0]), self._func(math.sqrt(1.0+2.0**2)), 8)
-        
-    def test2Dphi(self):
-
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        
-        self.assertAlmostEquals(self.model.run([r, phi]), self._func(r), 8)
-        
-class TestFractalModel(unittest.TestCase):
-    """
-        Unit tests for  Number Density Fractal function   
-        F(x)= P(x)*S(x) + bkd
-        The model has Seven parameters: 
-            scale   =  Volume fraction
-            Radius  =  Block radius
-            Fdim    =  Fractal dimension
-            L       =  correlation Length
-            SDLB    =  SDL block
-            SDLS    =  SDL solvent
-            bkd     =  background
-    """
-    def setUp(self):
-        from sans.models.FractalModel import FractalModel
-        self.model= FractalModel()
-        self.r0 = 5.0
-        self.sldp = 2.0e-6
-        self.sldm = 6.35e-6
-        self.phi = 0.05
-        self.Df = 2
-        self.corr = 100.0
-        self.bck = 1.0
-        
-        self.model.setParam('scale', self.phi) 
-        self.model.setParam('radius', self.r0) 
-        self.model.setParam('fractal_dim',self.Df)
-        self.model.setParam('cor_length', self.corr)
-        self.model.setParam('sldBlock', self.sldp) 
-        self.model.setParam('sldSolv', self.sldm) 
-        self.model.setParam('background', self.bck)
-        
-    def _func(self, x):
-        r0 = self.r0
-        sldp = self.sldp
-        sldm = self.sldm
-        phi = self.phi
-        Df = self.Df
-        corr = self.corr
-        bck = self.bck
-        
-        pq = 1.0e8*phi*4.0/3.0*math.pi*r0*r0*r0*(sldp-sldm)*(sldp-sldm)*math.pow((3*(math.sin(x*r0) - x*r0*math.cos(x*r0))/math.pow((x*r0),3)),2);
-        
-        sq = Df*math.exp(gammaln(Df-1.0))*math.sin((Df-1.0)*math.atan(x*corr));
-        sq /= math.pow((x*r0),Df) * math.pow((1.0 + 1.0/(x*corr)/(x*corr)),((Df-1.0)/2.0));
-        sq += 1.0;
-        
-        #self.assertAlmostEqual(self.model._scatterRanDom(x), pq, 8 )
-        #self.assertEqual(self.model._Block(x),sq )
-        
-        return sq*pq+bck
-    
-    def test1D(self):        
-        x = 0.001
-        
-        iq = self._func(x)
-        self.assertEqual(self.model.run(x), iq)
-        self.assertEqual(self.model.runXY(x), iq)
-    
-    def test2D(self):
-        x = 1.0
-        y = 2.0
-        r = math.sqrt(x**2 + y**2)
-        phi = math.atan2(y, x)
-        iq_x = self._func(x)
-        iq_y = self._func(y)
-        
-        #self.assertEqual(self.model.run([r, phi]), iq_x*iq_y)
-        self.assertEqual(self.model.run([r, phi]), self.model.run(r))
-        #self.assertEqual(self.model.runXY([x,y]), iq_x*iq_y)
-        self.assertEqual(self.model.runXY([x,y]), self.model.run(r))
-        
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_other_dispersity.py
===================================================================
--- sansmodels/src/sans/models/test/utest_other_dispersity.py	(revision 876192b2223a223fe789d5537906b264f5297f5f)
+++ 	(revision )
@@ -1,139 +1,0 @@
-"""
-    Unit tests for dispersion functionality of 
-    C++ model classes
-"""
-
-import unittest, math, numpy
-
-class TestCylinder(unittest.TestCase):
-    """
-        Testing C++ Cylinder model
-    """
-    def setUp(self):
-        from sans.models.CylinderModel import CylinderModel
-        self.model= CylinderModel()
-        
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('radius', 20.0)
-        self.model.setParam('length', 400.0)
-        self.model.setParam('sldCyl', 4.e-6)
-        self.model.setParam('sldSolv', 1.e-6)
-        self.model.setParam('background', 0.0)
-        self.model.setParam('cyl_theta', 0.0)
-        self.model.setParam('cyl_phi', 0.0)
-        
-    def test_simple(self):
-        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
-        
-    def test_constant(self):
-        from sans.models.dispersion_models import DispersionModel
-        disp = DispersionModel()
-        self.model.setParam('scale', 10.0)
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 5.0/20.0
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.0
-        print "constant",self.model.run(0.001), self.model.dispersion
-        self.assertAlmostEqual(self.model.run(0.001), 1.021051*4527.47250339, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001, 0.001]), 1.021048*4546.997777604715, 2)
-        
-    def test_gaussian(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp = GaussianDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 5.0/20.0
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.0
-        self.model.setParam('scale', 10.0)
-        
-        self.assertAlmostEqual(self.model.run(0.001), 1.1804794*4723.32213339, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 1.180454*4743.56, 2)
-        
-    def test_clone(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp = GaussianDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 5.0/20.0
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.0
-        self.model.setParam('scale', 10.0)
-        
-        new_model = self.model.clone()
-        print "gaussian",self.model.run(0.001)
-        self.assertAlmostEqual(new_model.run(0.001), 1.1804794*4723.32213339, 3)
-        self.assertAlmostEqual(new_model.runXY([0.001,0.001]), 1.180454*4743.56, 2)
-        
-    def test_schulz_zero(self):
-        from sans.models.dispersion_models import SchulzDispersion
-        disp = SchulzDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 5.0/20.0
-        #self.model.dispersion['radius']['width'] = 0.0
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.0
-        self.model.setParam('scale', 1.0)
-        #self.model.setParam('scale', 10.0)
-        print "schulz",self.model.run(0.001), self.model.dispersion
-        self.assertAlmostEqual(self.model.run(0.001), 542.23568, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 544.54864, 3)
-        
-    def test_lognormal_zero(self):
-        from sans.models.dispersion_models import LogNormalDispersion
-        disp = LogNormalDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 5.0/20.0
-        #self.model.dispersion['radius']['width'] = 0.0
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.0
-        self.model.setParam('scale', 1.0)
-        #self.model.setParam('scale', 10.0)
-        print "model dispersion",self.model.dispersion
-        print "lognormal",self.model.run(0.001)
-        self.assertAlmostEqual(self.model.run(0.001), 450.64237, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.58733, 3)
-        
-    def test_gaussian_zero(self):
-        from sans.models.dispersion_models import GaussianDispersion
-        disp = GaussianDispersion()
-        self.model.set_dispersion('radius', disp)
-        self.model.dispersion['radius']['width'] = 0.0
-        self.model.dispersion['radius']['npts'] = 100
-        self.model.dispersion['radius']['nsigmas'] = 2.0
-        self.model.setParam('scale', 1.0)
-        
-        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
-        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
-        
-    def test_array(self):
-        """
-            Perform complete rotational average and
-            compare to 1D
-        """
-        from sans.models.dispersion_models import ArrayDispersion
-        disp_ph = ArrayDispersion()
-        disp_th = ArrayDispersion()
-        
-        values_ph = numpy.zeros(100)
-        values_th = numpy.zeros(100)
-        weights   = numpy.zeros(100)
-        for i in range(100):
-            values_ph[i]=(360/99.0*i)
-            values_th[i]=(180/99.0*i)
-            weights[i]=(1.0)
-        
-        disp_ph.set_weights(values_ph, weights)
-        disp_th.set_weights(values_th, weights)
-        
-        self.model.set_dispersion('cyl_theta', disp_th)
-        self.model.set_dispersion('cyl_phi', disp_ph)
-        
-        val_1d = self.model.run(math.sqrt(0.0002))
-        val_2d = self.model.runXY([0.01,0.01]) 
-        
-        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
-        
-
-if __name__ == '__main__':
-    unittest.main()
-   
Index: nsmodels/src/sans/models/test/utest_other_models.py
===================================================================
--- sansmodels/src/sans/models/test/utest_other_models.py	(revision 867760730e073d19d4c319880aa99ac9375e4dc5)
+++ 	(revision )
@@ -1,1731 +1,0 @@
-"""
-    Unit tests for specific models.
-    @since: 08/25/2009 
-    @note:  The models are running also with numpy array as input.
-            Some models return limit of the function at critical point .
-            So the user should expect finite value for some critical points.
-            Only critical q=0 will be tested. 
-            
-            Critical points tests that fail. the user is responsible of changing
-            the model tested or document the failure.
-            
-            Initial values for models are given as the one of Igo software.
-    @author: Gervaise Alina / UTK
-    @summary: Run by G. Alina 10/21/2009
-            Most of the lamellar tests are not passing. Check lamellar im
-            plementation.
-            critial points tested not passing for:
-            - Flexible Cylinder
-            - PeakLorenzt
-            - Squarewell Structure
-            - StickyHstructure
-            - hardSphereStructure
-            
-    @ Note: We don't use matrix for 2D anymore so testEval2D can be ignored (JC)     
-            
-"""
-
-import unittest
-import numpy 
-import math
-
-class TestCoreShell(unittest.TestCase):
-    """ Unit tests for coreshell model """
-    
-    def setUp(self):
-        from sans.models.CoreShellModel import CoreShellModel
-        self.comp = CoreShellModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("radius", 60.0)
-        self.comp.setParam("thickness", 10.0)
-        self.comp.setParam("core_sld", 1.0e-6)
-        self.comp.setParam("shell_sld",2.0e-6)
-        self.comp.setParam("solvent_sld",3.0e-6)
-        self.comp.setParam("Background", 0.001)
-   
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a coreshell """
-        self.assertAlmostEquals(self.comp.run(0.4),0.00169, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a coreshell """
-        self.assertAlmostEquals(self.comp.run([0.4, 1.3]),0.00169, 4)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a coreshell  with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a coreshell  with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point    
-    #def testCriticalPoint(self):
-    #    """ Test coreshell at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-  
-class TestMultiShellModel(unittest.TestCase):
-    """ Unit tests for MultiShell Model """
-    
-    def setUp(self):
-        from sans.models.MultiShellModel import MultiShellModel
-        self.comp = MultiShellModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("core_radius", 60.0)
-        self.comp.setParam("s_thickness", 10.0)
-        self.comp.setParam("w_thickness",10.0 )
-        self.comp.setParam("core_sld",6.4e-6)
-        self.comp.setParam("shell_sld",4e-7)
-        self.comp.setParam("n_pairs", 2)
-        self.comp.setParam("Background", 0.001)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a MultiShell Model """
-        self.assertAlmostEquals(self.comp.run(0.001), 2442.81, 2)
-        
-    def test1D_2(self):
-        """ Test 2D model for a MultiShell Model"""
-        self.assertAlmostEquals(self.comp.run([0.001, 0.30903]), 2442.81, 2)
-      
-    def testEval_1D(self):
-        """ Test 1D model for a MultiShell  with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a MultiShell  with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test multishell at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-    
-class TestVesicleModel(unittest.TestCase):
-    """ Unit tests for Vesicle Model """
-    
-    def setUp(self):
-        from sans.models.VesicleModel import VesicleModel
-        self.comp = VesicleModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("radius", 100.0)
-        self.comp.setParam("core_sld", 6.36e-6)
-        self.comp.setParam("shell_sld",5e-7)
-        self.comp.setParam("thickness",30.0 )
-        self.comp.setParam("Background", 0.001)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        #qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        #qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a Vesicle Model """
-        self.assertAlmostEquals(self.comp.run(0.001), 1.71399e4,1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Vesicle Model"""
-        self.assertAlmostEquals(self.comp.run([0.001, 1.3]), 1.71399e4,1)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a Vesicle with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Vesicle with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test vesicle at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
-        
-        
-class TestBinaryHSModel(unittest.TestCase):
-    """ Unit tests for BinaryHS Model"""
-    
-    def setUp(self):
-        from sans.models.BinaryHSModel import BinaryHSModel
-        self.comp = BinaryHSModel()
-        #Give initial value to model
-        self.comp.setParam("l_radius", 100.0)
-        self.comp.setParam("ls_sld", 3.5e-6)
-        self.comp.setParam("s_radius",25)
-        self.comp.setParam("solvent_sld",6.36e-6 )
-        self.comp.setParam("ss_sld", 5e-7)
-        self.comp.setParam("vol_frac_ss", 0.1)
-        self.comp.setParam("vol_frac_ls", 0.2)
-        self.comp.setParam("Background", 0.001)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        #qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        #qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a BinaryHS Model"""
-        self.assertAlmostEquals(self.comp.run(0.001),60.6785, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a BinaryHS Model"""
-        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),60.6785, 4)
-      
-    def testEval_1D(self):
-        """ Test 1D model for a BinaryHS with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a BinaryHS with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point    
-    #def testCriticalPoint(self):
-    #    """ Test BinaryHS at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-       
-     
-class TestCoreShellCylinderModel(unittest.TestCase):
-    """ Unit tests for CoreShellCylinder Model"""
-    
-    def setUp(self):
-        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
-        self.comp = CoreShellCylinderModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("core_sld", 1e-6)
-        self.comp.setParam("length", 400)
-        self.comp.setParam("radius",20)
-        self.comp.setParam("solvent_sld",1e-6 )
-        self.comp.setParam("shell_sld", 4e-6)
-        self.comp.setParam("thickness", 10.0)
-        self.comp.setParam("Background", 0.01)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for a CoreShellCylinder Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 353.56,1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a CoreShellCylinder Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a CoreShellCylinder with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a CoreShellCylinder with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test CoreShellCylinder at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
- 
- 
-class TestHollowCylinderModel(unittest.TestCase):
-    """ Unit tests for HollowCylinder Model"""
-    
-    def setUp(self):
-        from sans.models.HollowCylinderModel import HollowCylinderModel
-        self.comp = HollowCylinderModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("core_radius",20.0)
-        self.comp.setParam("radius",30)
-        self.comp.setParam("length", 400)
-        self.comp.setParam("sldCyl",6.3e-6 )
-        self.comp.setParam("sldSolv",1e-6 )
-        self.comp.setParam("Background", 0.01)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for a HollowCylinder Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 1756.76, 1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a HollowCylinder Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1) 
-  
-    def testEval_1D(self):
-        """ Test 1D model for a HollowCylinder with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a HollowCylinder with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point    
-    #def testCriticalPoint(self):
-    #    """ Test HollowCylinder at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-        
-        
-class TestFlexibleCylinderModel(unittest.TestCase):
-    """ Unit tests for FlexibleCylinder Model"""
-    
-    def setUp(self):
-        from sans.models.FlexibleCylinderModel import FlexibleCylinderModel
-        self.comp = FlexibleCylinderModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("sldSolv",6.3e-6 )
-        self.comp.setParam("sldCyl",1e-6 )
-        self.comp.setParam("kuhn_length",100)
-        self.comp.setParam("length", 1000)
-        self.comp.setParam("radius",20)
-        self.comp.setParam("Background", 0.0001)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for a FlexibleCylinder Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 3509.22, 1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a FlexibleCylinder Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1) 
-    def testEval_1D(self):
-        """ Test 1D model for a FlexibleCylinder Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a FlexibleCylinder Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test FlexibleCylinder at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-  
-class TestFlexCylEllipXModel(unittest.TestCase):
-    """ Unit tests for FlexCylEllipXModel"""
-    
-    def setUp(self):
-        from sans.models.FlexCylEllipXModel import FlexCylEllipXModel
-        self.comp = FlexCylEllipXModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("sldSolv",6.3e-6 )
-        self.comp.setParam("sldCyl",1e-6 )
-        self.comp.setParam("kuhn_length",100)
-        self.comp.setParam("length", 1000)
-        self.comp.setParam("radius",20)
-        self.comp.setParam("background", 0.0001)
-        self.comp.setParam("axis_ratio", 1.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for FlexCylEllipXModel"""
-        self.assertAlmostEqual(self.comp.run(0.001), 3509.22, 1)
-        
-    def test1D_2(self):
-        """ Test 2D model for FlexCylEllipXModel"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1) 
-    def testEval_1D(self):
-        """ Test 1D model for FlexCylEllipXModel with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for FlexCylEllipXModel with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-              
-              
-class TestStackedDisksModel(unittest.TestCase):
-    """ Unit tests for StackedDisks Model"""
-    
-    def setUp(self):
-        from sans.models.StackedDisksModel import StackedDisksModel
-        self.comp = StackedDisksModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 0.01 )
-        self.comp.setParam("radius",3000.0 )
-        self.comp.setParam("core_thick", 10.0)
-        self.comp.setParam("layer_thick",15.0 )
-        self.comp.setParam("core_sld",4e-006 )
-        self.comp.setParam("layer_sld",-4e-007 )
-        self.comp.setParam("solvent_sld", 5e-006 )
-        self.comp.setParam("n_stacking",1.0 )
-        self.comp.setParam("sigma_d", 0.0)
-        self.comp.setParam("background",0.001)
-        self.comp.setParam("axis_theta", 0.0 )
-        self.comp.setParam("axis_phi",0.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for a StackedDisks Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 5075.12, 1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a StackedDisks Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a StackedDisks Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a StackedDisks Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test StackedDisks at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0))) 
-   
-  
-class TestParallelepipedModel(unittest.TestCase):
-    """ Unit tests for Parallelepiped Model"""
-    
-    def setUp(self):
-        from sans.models.ParallelepipedModel import ParallelepipedModel
-        self.comp = ParallelepipedModel()
-        #Give initial value to model
-        self.comp.setParam("background", 0.0 )
-        self.comp.setParam("short_a",35)
-        self.comp.setParam("short_b", 75)
-        self.comp.setParam("long_c",400 )
-        self.comp.setParam("sldPipe", 6.3e-006 )
-        self.comp.setParam("sldSolv", 1e-006 )
-        self.comp.setParam("scale",1.0 )
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    
-    def test1D(self):
-        """ Test 1D model for a Parallelepiped Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 2935.82, 2)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Parallelepiped Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a Parallelepiped Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Parallelepiped Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-   
-    def testCriticalPoint(self):
-        """ Test Parallelepiped at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
-  
-class TestEllipticalCylinderModel(unittest.TestCase):
-    """ Unit tests for EllipticalCylinder Model"""
-    
-    def setUp(self):
-        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
-        self.comp = EllipticalCylinderModel()
-        self.comp.setParam("scale",1.0) 
-        self.comp.setParam("r_minor",20.0)
-        self.comp.setParam("r_ratio",1.5) 
-        self.comp.setParam("length",400.0)
-        self.comp.setParam("sldCyl",4e-006)
-        self.comp.setParam("sldSolv",1e-006)
-        self.comp.setParam("background",0.0)
-        self.comp.setParam("cyl_theta",0.0)
-        self.comp.setParam("cyl_phi",0.0)
-        self.comp.setParam("cyl_psi",0.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for a EllipticalCylinder Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 675.504402, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a EllipticalCylinder Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a EllipticalCylinder with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a EllipticalCylinder with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test EllipticalCylinder at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
-  
-        
-class TestEllipsoidModel(unittest.TestCase):
-    """ Unit tests for Ellipsoid Model"""
-    
-    def setUp(self):
-        from sans.models.EllipsoidModel import EllipsoidModel
-        self.comp = EllipsoidModel()
-        self.comp.setParam("scale",1.0) 
-        self.comp.setParam("radius_a",20.0)
-        self.comp.setParam("radius_b",400.0)
-        self.comp.setParam("sldEll",4e-006)
-        self.comp.setParam("sldSolv",1e-006)
-        self.comp.setParam("background",0.0)
-        self.comp.setParam("axis_theta",1.57)
-        self.comp.setParam("axis_phi",0.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for a Ellipsoid Model"""
-        self.assertAlmostEqual(self.comp.run(1.0), 0.000733968, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Ellipsoid Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1)
-    def testEval_1D(self):
-        """ Test 1D model for a Ellipsoid Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Ellipsoid Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test Ellipsoid at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
-        
-class TestCoreShellEllipsoidModel(unittest.TestCase):
-    """ Unit tests for CoreShellEllipsoid Model"""
-    
-    def setUp(self):
-        from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel
-        self.comp = CoreShellEllipsoidModel()
-        #Give initial value to model
-        self.comp.setParam("scale", 1.0)
-        self.comp.setParam("equat_core", 200.0)
-        self.comp.setParam("polar_core", 20.0)
-        self.comp.setParam("equat_shell",250.0)
-        self.comp.setParam("polar_shell", 30.0)
-        self.comp.setParam("sld_shell",1e-006)
-        self.comp.setParam("sld_core",2e-006)
-        self.comp.setParam("sld_solvent",6.3e-006)
-        self.comp.setParam("background",0.001)
-        self.comp.setParam("axis_theta", 0.0)
-        self.comp.setParam("axis_phi",0.0)
-         
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-    def test1D(self):
-        """ Test 1D model for a CoreShellEllipsoid Model"""
-        self.assertAlmostEqual(self.comp.run(1.0), 0.001894, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a CoreShellEllipsoid Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a CoreShellEllipsoid with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a CoreShellEllipsoid with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test CoreShellEllipsoid at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
-    
-class TestTriaxialEllipsoidModel(unittest.TestCase):
-    """ Unit tests for TriaxialEllipsoid Model"""
-    
-    def setUp(self):
-        from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
-        self.comp = TriaxialEllipsoidModel()
-        self.comp.setParam("scale",1.0)
-        self.comp.setParam("semi_axisA",35.0)
-        self.comp.setParam("semi_axisB", 100.0)
-        self.comp.setParam("semi_axisC",400.0 )
-        self.comp.setParam("sldSolv",6.3e-6)
-        self.comp.setParam("sldEll",1e-6)
-        self.comp.setParam("background",0.0)
-        self.comp.setParam("axis_theta", 1.0)
-        self.comp.setParam("axis_phi",0.0 )
-        self.comp.setParam("axis_psi",0.0 )
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        self.q = 0.001
-        self.phi= math.pi/2
-        self.qx= self.q*math.cos(self.phi)
-        self.qy= self.q*math.sin(self.phi)
-        
-        
-    def test1D(self):
-        """ Test 1D model for a TriaxialEllipsoid Model"""
-        self.assertAlmostEquals(self.comp.run(0.001),16285.6, 1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a TriaxialEllipsoid Model"""
-        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
-                              self.comp.runXY([self.qx, self.qy]),1)
-     
-    def testEval_1D(self):
-        """ Test 1D model for a TriaxialEllipsoid Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a TriaxialEllipsoid Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test TriaxialEllipsoid at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))            
-   
-class TestLamellarModel(unittest.TestCase):
-    """ Unit tests for Lamellar Model"""
-    
-    def setUp(self):
-        from sans.models.LamellarModel import LamellarModel
-        self.comp = LamellarModel()
-        self.comp.setParam("scale",1.0) 
-        self.comp.setParam("bi_thick",50.0)
-        self.comp.setParam("sld_bi",1e-006)
-        self.comp.setParam("sld_sol",6.3e-006)
-        self.comp.setParam("background",0.0)
-
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a Lamellar Model"""
-        self.assertAlmostEquals(self.comp.run(0.001), 882289.54309, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Lamellar Model"""
-        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),882289.54309, 3)     
-    
-    def testEval_1D(self):
-        """ Test 1D model for a Lamellar Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Lamellar Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-       
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test Lamellar at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-     
-class TestLamellarFFHGModel(unittest.TestCase):
-    """ Unit tests for LamellarFFHG Model"""
-    
-    def setUp(self):
-        from sans.models.LamellarFFHGModel import LamellarFFHGModel
-        self.comp = LamellarFFHGModel()
-        self.comp.setParam("scale",1.0) 
-        self.comp.setParam("t_length",15.0)
-        self.comp.setParam("h_thickness",10.0)
-        self.comp.setParam("sld_tail",4e-007)
-        self.comp.setParam("sld_head",3e-006)
-        self.comp.setParam("sld_solvent",6e-006)
-        self.comp.setParam("background",0.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        
-    def test1D(self):
-        """ Test 1D model for a LamellarFFHG Model"""
-        self.assertAlmostEquals(self.comp.run(0.001),653143.9209, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a LamellarFFHG Model"""
-        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),653143.9209, 3)
-    
-    def testEval_1D(self):
-        """ Test 1D model for a LamellarFFHG Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a LamellarFFHG Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-      
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test LamellarFFHG at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))              
-    
-class TestLamellarPSModel(unittest.TestCase):
-    """ Unit tests for LamellarPS Model"""
-    
-    def setUp(self):
-        from sans.models.LamellarPSModel import LamellarPSModel
-        self.comp = LamellarPSModel()
-        self.comp.setParam("scale",1.0) 
-        self.comp.setParam("spacing",400.0)
-        self.comp.setParam("delta",30.0)
-        self.comp.setParam("sld_bi",6.3e-006)
-        self.comp.setParam("sld_sol",1e-006)
-        self.comp.setParam("n_plates",20.0) 
-        self.comp.setParam("caille", 0.1)
-        self.comp.setParam("background",0.0)
-
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        
-    def test1D(self):
-        """ Test 1D model for a LamellarPS Model"""
-        self.assertAlmostEquals(self.comp.run(0.001), 27899.30836, 1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a LamellarPS Model"""
-        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),27899.30836, 1) 
-    
-    def testEval_1D(self):
-        """ Test 1D model for a LamellarPS Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a LamellarPS Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-      
-    # No more singular point        
-    #def testCriticalPoint(self):
-    #    """ Test LamellarPS at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-     
-class TestLamellarPSHGModel(unittest.TestCase):
-    """ Unit tests for LamellarPSHG Model"""
-    
-    def setUp(self):
-        from sans.models.LamellarPSHGModel import LamellarPSHGModel
-        self.comp = LamellarPSHGModel()
-        self.comp.setParam("scale",1.0)
-        self.comp.setParam("spacing",40.0)
-        self.comp.setParam("deltaT",10.0)
-        self.comp.setParam("deltaH",2.0)
-        self.comp.setParam("sld_tail",4e-7)
-        self.comp.setParam("sld_head",2e-6)
-        self.comp.setParam("sld_solvent",6e-6)
-        self.comp.setParam("n_plates",30)
-        self.comp.setParam("caille",0.001)
-        self.comp.setParam("background",0.001)
-
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a LamellarPSHG Model"""
-        self.assertAlmostEquals(self.comp.run(0.001),6831387.29466, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a LamellarPSHG Model"""
-        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),6831387.29466,3)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a LamellarPSHG Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a LamellarPSHG Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-       
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test LamellarPSHG at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-     
-class TestSquareWellStructure(unittest.TestCase):
-    """ Unit tests for SquareWellStructure """
-    
-    def setUp(self):
-        from sans.models.SquareWellStructure import SquareWellStructure
-        self.comp = SquareWellStructure()
-        self.comp.setParam("effect_radius",50.0)
-        self.comp.setParam("volfraction",0.04)
-        self.comp.setParam("welldepth",1.5 )
-        self.comp.setParam("wellwidth",1.2)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        
-    def test1D(self):
-        """ Test 1D model for a SquareWellStructure"""
-        self.assertAlmostEqual(self.comp.run(0.001), 0.976657, 2)
-        
-    def test1D_2(self):
-        """ Test 2D model for a SquareWellStructure"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.9776657,2)     
-    
-    def testEval_1D(self):
-        """ Test 1D model for a SquareWellStructure with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a SquareWellStructure with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test SquareWellStructure at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))                     
-     
-class TestHardsphereStructure(unittest.TestCase):
-    """ Unit tests for HardsphereStructure"""
-    
-    def setUp(self):
-        from sans.models.HardsphereStructure import HardsphereStructure
-        self.comp = HardsphereStructure()
-        self.comp.setParam("effect_radius",50.0)
-        self.comp.setParam("volfraction", 0.2)
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-        
-    def test1D(self):
-        """ Test 1D model for a HardsphereStructure"""
-        self.assertAlmostEqual(self.comp.run(0.001),0.209128, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a HardsphereStructure"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.209128, 4)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a HardsphereStructure with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a HardsphereStructure with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test HardsphereStructure at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))                  
-    
-class TestStickyHSStructure(unittest.TestCase):
-    """ Unit tests for StickyHSStructure"""
-    
-    def setUp(self):
-        from sans.models.StickyHSStructure import StickyHSStructure
-        self.comp = StickyHSStructure()
-        self.comp.setParam("effect_radius",50.0)
-        self.comp.setParam("volfraction",0.1)
-        self.comp.setParam("perturb",0.05)
-        self.comp.setParam("stickiness",0.2)
-
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a StickyHSStructure"""
-        self.assertAlmostEqual(self.comp.run(0.001),1.09718, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a StickyHSStructure"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),1.09718, 4)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a StickyHSStructure with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a StickyHSStructure with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point           
-    #def testCriticalPoint(self):
-    #    """ Test StickyHSStructure at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0))) 
-        
-class TestHayterMSAStructure(unittest.TestCase):
-    """ Unit tests for HayterMSAStructure"""
-    
-    def setUp(self):
-        from sans.models.HayterMSAStructure import HayterMSAStructure
-        self.comp = HayterMSAStructure()
-        self.comp.setParam("effect_radius",20.75)
-        self.comp.setParam("charge",19.0)
-        self.comp.setParam("volfraction",0.0192 )
-        self.comp.setParam("temperature",298)
-        self.comp.setParam("saltconc",0.0)
-        self.comp.setParam("dielectconst",78)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-
-    def test1D(self):
-        """ Test 1D model for a HayterMSAStructure"""
-        self.assertAlmostEqual(self.comp.run(0.001),0.0712928, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a HayterMSAStructure"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.0712928, 4) 
-        
-    def testEval_1D(self):
-        """ Test 1D model for a HayterMSAStructure with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a HayterMSAStructure with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test HayterMSAStructure at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))                   
-     
-     
-class TestBEPolyelectrolyte(unittest.TestCase):
-    """ Unit tests for BEPolyelectrolyte"""
-    
-    def setUp(self):
-        from sans.models.BEPolyelectrolyte import BEPolyelectrolyte
-        self.comp = BEPolyelectrolyte()
-       
-        self.comp.setParam('k',10)
-        self.comp.setParam('lb',7.1)
-        self.comp.setParam('h',12)
-        self.comp.setParam('b',10)
-        self.comp.setParam('cs', 0.0)
-        self.comp.setParam('alpha',0.05)
-        self.comp.setParam('c', 0.7)
-        self.comp.setParam('background',0.001)
-         
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-
-    def test1D(self):
-        """ Test 1D model for a BEPolyelectrolyte"""
-        self.assertAlmostEqual(self.comp.run(0.001),0.0948, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a BEPolyelectrolyte"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.0948, 3)
-      
-    def testEval_1D(self):
-        """ Test 1D model for a BEPolyelectrolyte with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a BEPolyelectrolyte with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-   
-    def testCriticalPoint(self):
-        """ Test BEPolyelectrolyte at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))            
-             
-             
-class TestDABModel(unittest.TestCase):
-    """ Unit tests for DABModel"""
-    
-    def setUp(self):
-        from sans.models.DABModel import DABModel
-        self.comp = DABModel()
-        self.comp.setParam('length',40.0)
-        self.comp.setParam('scale',10.0)
-        self.comp.setParam('background',1.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-    
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a DABModel"""
-        self.assertAlmostEqual(self.comp.run(0.001),637957.9047, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a DABModel"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),637957.90473, 3)
-         
-    def testEval_1D(self):
-        """ Test 1D model for a DABModel with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a DABModel with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test DABModel at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))           
-             
-    
-class TestGuinierModel(unittest.TestCase):
-    """ Unit tests for Guinier Model"""
-    
-    def setUp(self):
-        from sans.models.GuinierModel import GuinierModel
-        self.comp = GuinierModel()
-        self.comp.setParam('scale',1.0)
-        self.comp.setParam('rg', 1)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a GuinierModel"""
-        self.assertAlmostEqual(self.comp.run(1.0),0.716531, 4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a GuinierModel"""
-        self.assertAlmostEqual(self.comp.run([1.0, 1.3]),0.716531, 4)
-     
-    def testEval_1D(self):
-        """ Test 1D model for a GuinierModel with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a GuinierModel with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test GuinierModel at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
-        
-        
-class TestDebyeModel(unittest.TestCase):
-    """ Unit tests for Debye Model"""
-    
-    def setUp(self):
-        from sans.models.DebyeModel import DebyeModel
-        self.comp = DebyeModel()
-        self.comp.setParam('rg', 50.0)
-        self.comp.setParam('scale',1.0)
-        self.comp.setParam('background',0.001)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a DebyeModel"""
-        self.assertAlmostEqual(self.comp.run(0.001),1.00017,4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a DebyeModel"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),1.00017,4)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a DebyeModel with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a DebyeModel with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test DebyeModel at the critical point"""
-        self.assertEquals(self.comp.run(0.0),1.001)
-        
-       
-class TestPorodModel(unittest.TestCase):
-    """ Unit tests for PorodModel"""
-    
-    def setUp(self):
-        from sans.models.PorodModel import PorodModel
-        self.comp = PorodModel()
-        self.comp.setParam('scale', 1.0)
-        self.comp.setParam('background', 0.0)
-         
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a PorodModel"""
-        self.assertEquals(self.comp.run(0.5), 16)
-        
-    def test1D_2(self):
-        """ Test 2D model for a PorodModel"""
-        self.assertEquals(self.comp.run([0.5, 1.3]),16)  
-        
-    def testEval_1D(self):
-        """ Test 1D model for a PorodModel with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a PorodModel with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCreaticalPoint(self):
-        """ Test for critical point for PorodModel run"""
-        self.assertRaises(ZeroDivisionError, self.comp.run, 0.0)
-        
-        
-class TestPeakGaussModel(unittest.TestCase):
-    """ Unit tests for PeakGaussModel"""
-    
-    def setUp(self):
-        from sans.models.PeakGaussModel import PeakGaussModel
-        self.comp = PeakGaussModel()
-        self.comp.setParam('scale', 100)
-        self.comp.setParam('B', 0.005)
-        self.comp.setParam('q0',0.05)
-        self.comp.setParam('background',1.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a PeakGauss Model"""
-        self.assertEquals(self.comp.run(0.001),1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a PeakGauss Model"""
-        self.assertEquals(self.comp.run([0.001, 1.3]),1)  
-        
-    def testEval_1D(self):
-        """ Test 1D model for a PeakGauss Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a PeakGauss Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-    
-    def testCriticalPoint(self):
-        """ Test PeakGauss at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))    
-        
-class TestPeakLorentzModel(unittest.TestCase):
-    """ Unit tests for PeakLorentzModel"""
-    
-    def setUp(self):
-        from sans.models.PeakLorentzModel import PeakLorentzModel
-        self.comp = PeakLorentzModel()
-        self.comp.setParam('scale', 100)
-        self.comp.setParam('B', 0.005)
-        self.comp.setParam('q0',0.05)
-        self.comp.setParam('background',1.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a PeakLorentz Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 2.0305, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a PeakLorentz Model"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]), 2.0305, 3)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a PeakLorentz Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a PeakLorentz Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-        
-    def testCriticalPoint(self):
-        """ Test PeakLorentz at the critical point"""
-        self.comp.setParam('B', 0.0)
-        self.assertRaises(ZeroDivisionError, self.comp.run, 10)
-        #self.assert_(numpy.isfinite(self.comp.run(0.0)))  
-        
-       
-class TestFractalAbsModel(unittest.TestCase):
-    """ Unit tests for FractalAbsModel"""
-    
-    def setUp(self):
-        from sans.models.FractalAbsModel import FractalAbsModel
-        self.comp = FractalAbsModel()
-        self.comp.setParam('scale', 0.05)
-        self.comp.setParam('radius', 5.0)
-        self.comp.setParam('fractal_dim', 2.0)
-        self.comp.setParam('cor_length',100.0)
-        self.comp.setParam('sldBlock', 2.0e-6)
-        self.comp.setParam('sldSolv', 6.35e-6)
-        self.comp.setParam('background',0.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a Fractal Abs Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 39.2881, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Fractal Abs Model"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]), 39.2881, 3)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a Fractal Abs Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Fractal Abs Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point
-    #def testCriticalPoint(self):
-    #    """ Test Fractal Abs at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))    
-   
-class TestFractalModel(unittest.TestCase):
-    """ Unit tests for FractalModel"""
-    
-    def setUp(self):
-        from sans.models.FractalModel import FractalModel
-        self.comp = FractalModel()
-        self.comp.setParam('scale', 0.05)
-        self.comp.setParam('radius', 5.0)
-        self.comp.setParam('fractal_dim', 2.0)
-        self.comp.setParam('cor_length',100.0)
-        self.comp.setParam('sldBlock', 2.0e-6)
-        self.comp.setParam('sldSolv', 6.35e-6)
-        self.comp.setParam('background',0.0)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a Fractal Model"""
-        self.assertAlmostEqual(self.comp.run(0.001), 39.2881, 3)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Fractal Model"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]), 39.2881, 3)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a Fractal Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Fractal Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    # No more singular point    
-    #def testCriticalPoint(self):
-    #    """ Test Fractal at the critical point"""
-    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
-    
-class TestLorentzModel(unittest.TestCase):
-    """ Unit tests for LorentzModel"""
-    
-    def setUp(self):
-        from sans.models.LorentzModel import LorentzModel
-        self.comp = LorentzModel()
-        self.comp.setParam("background",1)
-        self.comp.setParam("length",50)
-        self.comp.setParam("scale",100)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a Lorentz Model"""
-        self.assertAlmostEqual(self.comp.run(0.001),100.751, 2)
-        
-    def test1D_2(self):
-        """ Test 2D model for a Lorentz Model"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),100.751, 2)
-    
-    def testEval_1D(self):
-        """ Test 1D model for a Lorentz Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Lorentz Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-          
-    def testCriticalPoint(self):
-        """ Test Lorentz at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
-        
-          
-class TestPowerLawAbsModel(unittest.TestCase):
-    """ Unit tests for PowerLawAbsModel"""
-    
-    def setUp(self):
-        from sans.models.PowerLawAbsModel import PowerLawAbsModel
-        self.comp = PowerLawAbsModel()
-        self.comp.setParam("background",1)
-        self.comp.setParam("m",4)
-        self.comp.setParam("scale",1e-6)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a PowerLawAbs Model"""
-        self.assertAlmostEqual(self.comp.run(0.19189), 1.00074,4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a PowerLawAbs Model"""
-        self.assertAlmostEqual(self.comp.run([0.19189,1.3]), 1.00074,4)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a PowerLawAbs Model with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a PowerLawAbs Model with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test PowerLawAbs at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
-        
-        
-class TestPowerLawModel(unittest.TestCase):
-    """ Unit tests for PowerLawModel"""
-    
-    def setUp(self):
-        from sans.models.PowerLawModel import PowerLawModel
-        self.comp = PowerLawModel()
-        self.comp.setParam("background",1)
-        self.comp.setParam("m",4)
-        self.comp.setParam("scale",1e-6)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a PowerLaw Model"""
-        self.assertAlmostEquals(self.comp.run(0.19189), 1.00074,4)
-        
-    def test1D_2(self):
-        """ Test 2D model for a PowerLawModel"""
-        self.assertAlmostEquals(self.comp.run([0.19189,1.3]), 1.00074,4)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a PowerLawModel with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a PowerLawModel with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test PowerLawModel at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
-      
-      
-class TestTeubnerStreyModel(unittest.TestCase):
-    """ Unit tests for TeubnerStreyModel"""
-    
-    def setUp(self):
-        from sans.models.TeubnerStreyModel import TeubnerStreyModel
-        self.comp = TeubnerStreyModel()
-        self.comp.setParam("background",0.1)
-        self.comp.setParam("c1",-30)
-        self.comp.setParam("c2",5000)
-        self.comp.setParam("scale",0.1)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a TeubnerStrey Model"""
-        self.assertAlmostEqual(self.comp.run(0.001),10.103, 1)
-        
-    def test1D_2(self):
-        """ Test 2D model for a TeubnerStrey Model"""
-        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),10.103, 1)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a TeubnerStrey  with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a TeubnerStrey  with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test TeubnerStrey at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))    
-      
-      
-class TestLineModel(unittest.TestCase):
-    """ Unit tests for LineModel"""
-    
-    def setUp(self):
-        from sans.models.LineModel import LineModel
-        self.comp = LineModel()
-        self.comp.setParam("A",1)
-        self.comp.setParam("B",1)
-        
-        self.x = numpy.array([0.4, 1.3])
-        self.y = numpy.array([0.5, 1.57])
-        self.x_array = self.comp.evalDistribution(self.x)
-        self.y_array = self.comp.evalDistribution(self.y)
-        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
-        qy_prime = numpy.reshape(self.y, [len(self.y),1])
-        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
-        
-    def test1D(self):
-        """ Test 1D model for a Line Model"""
-        self.assertEquals(self.comp.run(1.0),2)
-        
-    def testEval_1D(self):
-        """ Test 1D model for a Line  with evalDistribution"""
-        self.assertEquals(self.comp.run(0.4),self.x_array[0])
-        self.assertEquals(self.comp.run(1.3),self.x_array[1])
-        
-    def testEval_2D(self):
-        """ Test 2D model for a Line  with evalDistribution"""
-        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0], 8)
-        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
-
-    
-    def testCriticalPoint(self):
-        """ Test line at the critical point"""
-        self.assert_(numpy.isfinite(self.comp.run(0.0)))
- 
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/utest_smearing.py
===================================================================
--- sansmodels/src/sans/models/test/utest_smearing.py	(revision 96726274f72d26a72b756636015c6b6e63c05fb5)
+++ 	(revision )
@@ -1,150 +1,0 @@
-"""
-    Unit tests for data manipulations
-"""
-
-
-import unittest
-import numpy, math
-from sans.dataloader.loader import  Loader
-from sans.dataloader.data_info import Data1D, Data2D
-#from DataLoader.qsmearing import SlitSmearer, QSmearer, smear_selection
-from sans.models.qsmearing import SlitSmearer, QSmearer, smear_selection
-from sans.models.SphereModel import SphereModel
-import os.path
-from time import time
-class smear_tests(unittest.TestCase):
-    
-    def setUp(self):
-        self.data = Loader().load("cansas1d_slit.xml")
-        
-        x = 0.001*numpy.arange(1,11)
-        y = 12.0-numpy.arange(1,11)
-        dxl = 0.00*numpy.ones(10)
-        dxw = 0.00*numpy.ones(10)
-        dx = 0.00*numpy.ones(10)
-        
-        self.data.dx = dx
-        self.data.x = x
-        self.data.y = y
-        self.data.dxl = dxl
-        self.data.dxw = dxw
-        
-    def test_slit(self):
-        """
-            Test identity smearing
-        """
-        # Create smearer for our data
-        s = SlitSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        for i in range(len(input)):
-            self.assertEquals(input[i], output[i])
-
-    def test_slit2(self):
-        """
-            Test basic smearing
-        """
-        dxl = 0.005*numpy.ones(10)
-        dxw = 0.0*numpy.ones(10)
-        self.data.dxl = dxl
-        self.data.dxw = dxw
-        # Create smearer for our data
-        s = SlitSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        # The following commented line was the correct output for even bins [see smearer.cpp for details] 
-        #answer = [ 9.666,  9.056,  8.329,  7.494,  6.642,  5.721,  4.774,  3.824,  2.871, 2.   ]
-        answer = [ 9.0618,  8.6401,  8.1186,  7.1391,  6.1528,  5.5555,     4.5584,  3.5606,  2.5623, 2.    ]
-        for i in range(len(input)):
-            self.assertAlmostEqual(answer[i], output[i], 3)
-        
-    def test_q(self):
-        """
-            Test identity resolution smearing
-        """
-        # Create smearer for our data
-        s = QSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        for i in range(len(input)):
-            self.assertAlmostEquals(input[i], output[i], 5)
-
-    def test_q2(self):
-        """
-            Test basic smearing
-        """
-        dx = 0.001*numpy.ones(10)
-        self.data.dx = dx
-
-        # Create smearer for our data
-        s = QSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        
-        answer = [ 10.44785079,   9.84991299,   8.98101708,   
-                  7.99906585,   6.99998311,   6.00001689,
-                  5.00093415,   4.01898292,   3.15008701,   2.55214921]
-        for i in range(len(input)):
-            self.assertAlmostEqual(answer[i], output[i], 2)
-      
-class smear_test_1Dpinhole(unittest.TestCase):
-    
-    def setUp(self):
-        # NIST sample data
-        self.data = Loader().load("CMSphere5.txt")
-        # NIST smeared sphere w/ param values below
-        self.answer = Loader().load("CMSphere5smearsphere.txt")
-        # call spheremodel
-        self.model = SphereModel()
-        # setparams consistent with Igor default
-        self.model.setParam('scale', 1.0)
-        self.model.setParam('background', 0.01)
-        self.model.setParam('radius', 60.0)
-        self.model.setParam('sldSolv', 6.3e-06)
-        self.model.setParam('sldSph', 1.0e-06)
-        
-    def test_q(self):
-        """
-        Compare Pinhole resolution smearing with NIST
-        """
-        # x values
-        input = numpy.zeros(len(self.data.x))
-        # set time
-        st1 = time()
-        # cal I w/o smear
-        input = self.model.evalDistribution(self.data.x)
-        # Cal_smear (first call)
-        for i in range(1000):
-            s = QSmearer(self.data, self.model)
-        # stop and record time taken
-        first_call_time = time()-st1
-        # set new time
-        st = time()
-        # cal I w/o smear (this is not neccessary to call but just to be fare
-        input = self.model.evalDistribution(self.data.x)
-        # smear cal (after first call done above)
-        for i in range(1000):
-            output = s(input)
-
-        # record time taken
-        last_call_time = time()-st
-        # compare the ratio of ((NIST_answer-SsanView_answer)/NIST_answer)
-        # If the ratio less than 1%, pass the test 
-        for i in range(len(self.data.x)):
-            ratio  = math.fabs((self.answer.y[i]-output[i])/self.answer.y[i])
-            if ratio > 0.006:
-                ratio = 0.006
-            self.assertEqual(math.fabs((self.answer.y[i]-output[i])/ \
-                                       self.answer.y[i]), ratio) 
-        # print
-        print "\n NIST_time = 10sec:"
-        print "Cal_time(1000 times of first_calls; ) = ",  first_call_time  
-        print "Cal_time(1000 times of calls) = ",  last_call_time 
-        
-if __name__ == '__main__':
-    unittest.main()
-   
Index: nsmodels/src/sans/models/test/utest_state.py
===================================================================
--- sansmodels/src/sans/models/test/utest_state.py	(revision 5f43ff9563cb01f72a92d4da0d4e3ede009bec6b)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Test for setstate and reduce_ex operations for models
-"""
-import unittest
-
-from sans.models.SphereModel import SphereModel
-
-class TestSphere(unittest.TestCase):
-    def setUp(self):
-        self.sphere = SphereModel()
-        
-    def test_state_IO(self):
-        """
-            Check that a state oject is independent from the model object it
-            was generated with
-        """
-        self.sphere.setParam('radius', 44.0)
-        _, _, state, _, _ = self.sphere.__reduce_ex__(0)
-        
-        sphere_copy = SphereModel()
-        sphere_copy.__setstate__(state)
-        sphere_clone = sphere_copy.clone()
-        self.assertEqual(sphere_copy.getParam('radius'), 44)
-        
-        self.sphere.setParam('radius', 33.0)
-        
-        self.assertEqual(sphere_clone.getParam('radius'), 44)
-        
-    
-if __name__ == '__main__':
-    unittest.main()
Index: nsmodels/src/sans/models/test/validate_1D_model.py
===================================================================
--- sansmodels/src/sans/models/test/validate_1D_model.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,109 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Class to validate a given model by reading a test data set
-    generated from the IGOR SANS analysis tool from the NCNR
-"""
-import sys, math
-
-
-class Validate1D:
-    """ 
-        Class to validate a given model by reading a test data set
-        generated from the IGOR SANS analysis tool from the NCNR
-    """
-    
-    def __init__(self):
-        """ Initialization """
-        # Precision for the result comparison
-        self.precision = 0.0001
-        # Flag for end result
-        self.passed = True
-                
-    def __call__(self, filename):
-        """ 
-            Perform test on a data file
-            @param filename: name of the test data set
-        """
-        from sans.models.ModelFactory import ModelFactory
-        
-        # Read the data file
-        file_obj = open(filename,'r')
-        content = file_obj.read()
-        
-        # Flag to determine whether we are in the DATA section
-        started_data = False
-        # Model to test
-        model_object = None
-        
-        # Process each line of the file
-        for line in content.split('\n'):
-            if len(line)==0:
-                continue
-            try:
-                # Catch class name
-                if line.count("pythonclass")>0 and model_object==None:
-                    toks = line.split('=')
-                    print "Found class", toks[1]
-                    classname = toks[1].lstrip().rstrip()
-                    model_object = ModelFactory().getModel(classname)
-                
-                    # Output file for plotting
-                    file_out = open("%s_out.txt" % classname, 'w')
-                    file_out.write("<q>  <I_danse>  <I_igor>\n")
-                
-                # Process data
-                elif started_data:
-                    toks = line.split()
-                    q = float(toks[0])
-                    iq = float(toks[1])
-                    
-                    value = model_object.run(q)
-                    
-                    file_out.write("%g %g %g\n" % (q, value, iq))
-                    
-                    if math.fabs( (value - iq)/iq )>self.precision:
-                        self.passed = False
-                        print "ERROR q=%g: %g <> %g" % (q, model_object.run(q), iq)
-                        
-                # Catch DATA tag
-                elif line.count("DATA")>0:
-                    started_data = True
-                                
-                # Process parameters
-                elif started_data == False and not model_object==None:
-                    toks = line.split('=')
-                    if len(toks)==2:
-                        print "Setting parameter", line
-                        model_object.setParam(toks[0].lstrip().rstrip(), 
-                                              float(toks[1]))
-            except:
-                print "Could not parse line:\n %s" % line
-                print sys.exc_value
-            
-        file_obj.close()
-        file_out.close()
-        
-        print "Test passed = ", self.passed
-        return self.passed
-            
-if __name__ == '__main__':
-    validator = Validate1D()
-    all_pass = True
-    all_pass = all_pass and validator("sphere_testdata.txt")
-    print '\n'
-    all_pass = all_pass and validator("cylinder_testdata.txt")
-    print '\n'
-    all_pass = all_pass and validator("core_shell_cyl_testdata.txt")
-    print '\n'
-    all_pass = all_pass and validator("core_shell_testdata.txt")
-    print '\n'
-    all_pass = all_pass and validator("ellipsoid_testdata.txt")
-    print '\n'
-    all_pass = all_pass and validator("elliptical_cylinder_testdata.txt")
-
-    print '\nOverall result:', all_pass
-        
-        
-        
-  
-    
Index: nsmodels/src/sans/models/test/validate_2D_3axes_shape_model.py
===================================================================
--- sansmodels/src/sans/models/test/validate_2D_3axes_shape_model.py	(revision ff18c583ceba7337d7366925c724ad9d9195c6a0)
+++ 	(revision )
@@ -1,138 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Class to validate a given 2D model w/ 3 axes by averaging it
-    and comparing to 1D prediction.
-    
-    The equation used for averaging is:
-    
-        (integral dphi from 0 to 2pi)(integral dtheta from 0 to pi)
-             p(theta, phi) I(q) sin(theta) dtheta
-             
-        = (1/N_phi) (1/N_theta) (pi/2) (sum over N_phi) (sum over N_theta)
-             p(theta_i, phi_i) I(q) sin(theta_i)
-             
-    where p(theta, phi) is the probability distribution normalized to 4pi.
-    In the current case, we put p(theta, phi) = 1.
-    
-    The normalization factor results from:
-          2pi/N_phi      for the phi sum
-        x pi/N_theta     for the theta sum
-        x 1/(4pi)        because p is normalized to 4pi
-        --------------
-        = (1/N_phi) (1/N_theta) (pi/2)
-    
-    Note: 
-        Averaging the 3-axes 2D scattering intensity give a slightly
-        different output than the 1D function  
-        at hight Q (Q>~0.2). This is due to the way the IGOR library 
-        averages(?), taking only 76 points in alpha, the angle between
-        the axis of the ellipsoid and the q vector.
-        
-    Note: Core-shell and sphere models are symmetric around
-        all axes and don't need to be tested in the following way.
-"""
-import sys, math
-from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
-from sans.models.ParallelepipedModel import ParallelepipedModel
-from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
-
-class Validate2D:
-    """ 
-        Class to validate a given 2D model by averaging it
-        and comparing to 1D prediction.
-    """
-    
-    def __init__(self):
-        """ Initialization """
-        # Precision for the result comparison
-        self.precision = 0.000001
-        # Flag for end result
-        self.passed = True
-                
-    def __call__(self, model_class=EllipticalCylinderModel, points = 101):
-        """ 
-            Perform test and produce output file
-            @param model_class: python class of the model to test
-        """
-        print "Averaging %s: Note; takes loooong time." % model_class.__name__
-        passed = True
-        
-        npts =points
-        #The average values are very sensitive to npts of phi so npts_alpha should be large enough.
-        npts_alpha =180 #npts of phi
-        model = model_class()
-        #model.setParam('scale', 1.0)
-        #model.setParam('contrast', 1.0)
-        
-        theta_label = 'cyl_theta'
-        if not model.params.has_key(theta_label):
-            theta_label = 'parallel_theta'
-        if not model.params.has_key(theta_label):
-            theta_label = 'axis_theta'
-            
-        phi_label = 'cyl_phi'
-        if not model.params.has_key(phi_label):
-            phi_label = 'parallel_phi'
-        if not model.params.has_key(phi_label):
-            phi_label = 'axis_phi'
-            
-        psi_label = 'cyl_psi'
-        if not model.params.has_key(psi_label):
-            psi_label = 'parallel_psi'
-        if not model.params.has_key(psi_label):
-            psi_label = 'axis_psi'
-            
-        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')
-        output_f.write("<q_average> <2d_average> <1d_average>\n")
-            
-        for i_q in range(1, 23):
-            q = 0.01*i_q
-            sum = 0.0
-            weight = 0.0
-            for i_theta in range(npts):
-                theta = 180.0/npts*(i_theta+1)
-                
-                model.setParam(theta_label, theta)
-                
-                for j in range(npts_alpha):
-                    model.setParam(phi_label, 180.0 * 2.0 / npts_alpha * j)
-                    for k in range(npts):
-                        model.setParam(psi_label, 180.0 * 2.0 / npts * k)
-                        if str(model.run([q, 0])).count("INF")>0:                        
-                            print "ERROR", q, theta, 180.0 * 2.0 / npts * k
-                            
-                        # sin() is due to having not uniform bin number density wrt the q plane.
-                        sum += model.run([q, 0])*math.sin(theta*math.pi/180.0)
-                        weight += math.sin(theta*math.pi/180.0) 
-
-            value = sum/weight #*math.pi/2.0
-            ana = model.run(q)
-            if q<0.3 and (value-ana)/ana>0.05:
-                passed = False
-            output_f.write("%10g %10g %10g\n" % (q, value, ana))
-            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
-        
-        output_f.close()
-        return passed
-    
-        
-        
-if __name__ == '__main__':
-    validator = Validate2D()
-    
-    #Note: Test one model by one model, otherwise it could crash depending on the memory.
-    
-    te_passed =validator(TriaxialEllipsoidModel, points=76)
-    #pp_passed = validator(ParallelepipedModel, points=76)
-    #ell_passed = validator(EllipticalCylinderModel, points=76)
-        
-    print ""
-    print "Model             Passed"
-    print "TriaxialEllipsoid         %s" % te_passed
-    #print "ParallelepipedModel    %s" % pp_passed
-    #print "EllipticalCylinder        %s" % ell_passed
- 
-        
-        
-  
-    
Index: nsmodels/src/sans/models/test/validate_2D_elliptical_cyl.py
===================================================================
--- sansmodels/src/sans/models/test/validate_2D_elliptical_cyl.py	(revision b5a0509624bfee190d8ccb0d7d77c05353ae5e15)
+++ 	(revision )
@@ -1,234 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Test for Elliptical Cylinder model.
-    Class to validate a given 2D model by averaging it
-    and comparing to 1D prediction.
-    
-"""
-import sys, math
-from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
-
-
-class Validate2D:
-    """ 
-        Class to validate a given 2D model by averaging it
-        and comparing to 1D prediction.
-    """
-    
-    def __init__(self):
-        """ Initialization """
-        # Precision for the result comparison
-        self.precision = 0.000001
-        # Flag for end result
-        self.passed = True
-        # Verbose flag
-        self.verbose = True
-                
-    def __call__(self, npts = 101):
-        """ 
-            Perform test and produce output file
-            @param npts: number of points to average over
-            @return: True if the test passed, otherwise False
-        """
-        passed = True
-        
-        model = EllipticalCylinderModel()
-        
-        theta_label = 'cyl_theta'
-        if not model.params.has_key(theta_label):
-            theta_label = 'axis_theta'
-            
-        phi_label = 'cyl_phi'
-        if not model.params.has_key(phi_label):
-            phi_label = 'axis_phi'
-        
-        output_f = open("average_func.txt",'w')    
-        output_f.write("<q_average> <2d_average> <1d_average>\n")
-            
-        for i_q in range(1, 15):
-            q = 0.3/15.0*i_q
-            value = self.average_point_3D(model, q, npts)
-            ana = model.run(q)
-            if q<0.3 and (value-ana)/ana>0.05:
-                passed = False
-            output_f.write("%10g %10g %10g\n" % (q, value, ana))
-            if self.verbose:
-                print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
-        
-        output_f.close()
-        return passed
-    
-    def average_point_3D(self, model, q, npts):
-        """
-            Average intensity over all orientations
-            of the main cylinder axis and the 
-            rotation around that axis
-            
-            @param model: model to test
-            @param q: q-value
-            @param npts: number of points to average over
-            @return: average intensity
-        """
-        sum = 0.0
-        for i_theta in range(npts):
-            theta = math.pi/npts*i_theta
-            
-            model.setParam('cyl_theta', theta)
-            
-            for j in range(npts):
-                model.setParam('cyl_phi', math.pi * 2.0 / npts * j)
-                     
-                for k in range(npts):
-                    model.setParam("cyl_psi", math.pi * 2.0 / npts * k)
-                    
-                    if str(model.run([q, 0])).count("IN")>0:                        
-                        if self.verbose:
-                            #print "ERROR", q, theta, math.pi * 2.0 / npts * j
-                            pass
-                    else:
-                        sum += math.sin(theta)*model.run([q, 0])
-         
-        value = sum/npts/npts/npts
-        return value
-
-    def checkCylinder2D(self, phi):
-        """ 
-            Check that the 2D scattering intensity reduces
-            to a cylinder when r_ratio = 1.0
-            @param phi: angle of the vector q on the detector
-            @return: True if the test passed, otherwise False
-        """
-        from sans.models.CylinderModel import CylinderModel
-        
-        cyl = CylinderModel()
-        cyl.setParam("cyl_theta", 90)
-        cyl.setParam("cyl_phi", 0.0)
-        cyl.setParam("radius", 20)
-        cyl.setParam("length", 400)
-        cyl.setParam("sldCyl", 2.0e-6)
-        cyl.setParam("sldSolv", 1.0e-6)
-
-        ell = EllipticalCylinderModel()
-        ell.setParam("r_ratio", 1.0)
-        ell.setParam("r_minor", 20)
-        ell.setParam("cyl_theta", 90)
-        ell.setParam("cyl_phi", 0.0)
-        ell.setParam("length", 400)
-        ell.setParam("sldCyl", 2.0e-6)
-        ell.setParam("sldSolv", 1.0e-6)
-        
-        passed = True
-        for i_q in range(1, 30):
-            q = 0.025*i_q
-            ell_val = ell.run([q, phi])
-            cyl_val = cyl.run([q, phi])
-            if self.verbose:
-                print "Q=%g    Ell=%g    Cyl=%g   R=%g" %(q, ell_val, cyl_val, ell_val/cyl_val)
-            if math.fabs(ell_val-cyl_val)/cyl_val>0.05:
-                passed= False
-                
-        return passed
-
-        
-    def checkCylinder(self, points):
-        """
-            Compare the average over all orientations
-            of the main cylinder axis for a cylinder
-            and the elliptical cylinder with r_ratio = 1
-            
-            @param points: number of points to average over
-            @return: True if the test passed, otherwise False
-        """
-        from sans.models.CylinderModel import CylinderModel
-        
-        passed = True
-        
-        npts =points
-        model = EllipticalCylinderModel()
-        model.setParam('r_ratio', 1.0)
-        model.setParam("r_minor", 20)
-        model.setParam("cyl_theta", 90)
-        model.setParam("cyl_phi", 0.0)
-        model.setParam("length", 400)
-        model.setParam("sldEll", 2.0e-6)
-        model.setParam("sldSolv", 1.0e-6)
-        
-        cyl = CylinderModel()
-        cyl.setParam("cyl_theta", 90)
-        cyl.setParam("cyl_phi", 0.0)
-        cyl.setParam("radius", 20)
-        cyl.setParam("length", 400)
-        cyl.setParam("sldCyl", 2.0e-6)
-        cyl.setParam("sldSolv", 1.0e-6)
-
-        
-        output_f = open("average_func.txt",'w')    
-        output_f.write("<q_average> <2d_average> <1d_average>\n")
-            
-        for i_q in range(1, 15):
-            q = 0.3/15.0*i_q
-            value = self.average_point_2D(model, q, npts)
-            
-            ana = cyl.run(q)
-            if q<0.3 and math.fabs(value-ana)/ana>0.05:
-                passed = False
-            output_f.write("%10g %10g %10g\n" % (q, value, ana))
-            if self.verbose:
-                print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
-        
-        output_f.close()
-        return passed
-        
-        
-
-    def average_point_2D(self, model, q, npts):
-        """
-            Average intensity over all orientations
-            of the main cylinder axis
-            
-            @param model: model to test
-            @param q: q-value
-            @param npts: number of points to average over
-            @return: average intensity
-        """
-        sum = 0.0
-        
-        for i_theta in range(npts):
-            theta = math.pi/npts*i_theta            
-            model.setParam('cyl_theta', theta * 180 / math.pi)
-            
-            for j in range(npts):
-                model.setParam('cyl_phi', 180 * 2.0 / npts * j)
-                     
-                if str(model.run([q, 0])).count("IN")>0:                        
-                    if self.verbose:
-                        print "ERROR", q, theta, 180 * 2.0 / npts * j
-                else:
-                    sum += math.sin(theta)*model.run([q, 0])
-        
-        value = sum/npts/npts*math.pi/2.0
-        return value
-
-    
-if __name__ == '__main__':
-    select = 0
-
-    validator = Validate2D()
-    validator.verbose = True
-    
-    print "Testing Elliptical cylinder to 5%\n"
-    
-    if select == 0 or select == 1:
-        # Check that the scat intensity reduces to a cylinder
-        # for r_ratio = 1
-        print "Comparing to Cyl I(q,theta):", validator.checkCylinder2D(1.5)
-    elif select == 0 or select == 2:
-        print "Comparing average to Cyl I(q):", validator.checkCylinder(100)
-    elif select == 0 or select == 3:
-        ellcyl_passed = validator(100)
-    
-        
-        
-        
-  
-    
Index: nsmodels/src/sans/models/test/validate_2D_model.py
===================================================================
--- sansmodels/src/sans/models/test/validate_2D_model.py	(revision da987e10ef00f90c617dd56131f42c0974b3afe5)
+++ 	(revision )
@@ -1,206 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Class to validate a given 2D model by averaging it
-    and comparing to 1D prediction.
-    
-    The equation used for averaging is:
-    
-        (integral dphi from 0 to 2pi)(integral dtheta from 0 to pi)
-             p(theta, phi) I(q) sin(theta) dtheta
-             
-        = (1/N_phi) (1/N_theta) (pi/2) (sum over N_phi) (sum over N_theta)
-             p(theta_i, phi_i) I(q) sin(theta_i)
-             
-    where p(theta, phi) is the probability distribution normalized to 4pi.
-    In the current case, we put p(theta, phi) = 1.
-    
-    The normalization factor results from:
-          2pi/N_phi      for the phi sum
-        x pi/N_theta     for the theta sum
-        x 1/(4pi)        because p is normalized to 4pi
-        --------------
-        = (1/N_phi) (1/N_theta) (pi/2)
-    
-    Note: Ellipsoid
-        Averaging the 2D ellipsoid scattering intensity give a slightly
-        different output than the 1D function from the IGOR library 
-        at hight Q (Q>0.3). This is due to the way the IGOR library 
-        averages, taking only 76 points in alpha, the angle between
-        the axis of the ellipsoid and the q vector.
-        
-    Note: Core-shell and sphere models are symmetric around
-        all axes and don't need to be tested in the following way.
-"""
-import sys, math
-from sans.models.SphereModel import SphereModel
-from sans.models.CylinderModel import CylinderModel
-from sans.models.EllipsoidModel import EllipsoidModel
-from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
-
-
-class Validate2D:
-    """ 
-        Class to validate a given 2D model by averaging it
-        and comparing to 1D prediction.
-    """
-    
-    def __init__(self):
-        """ Initialization """
-        # Precision for the result comparison
-        self.precision = 0.000001
-        # Flag for end result
-        self.passed = True
-                
-    def __call__(self, model_class=CylinderModel, points = 101):
-        """ 
-            Perform test and produce output file
-            @param model_class: python class of the model to test
-        """
-        print "Averaging %s" % model_class.__name__
-        passed = True
-        
-        npts =points
-        model = model_class()
-        #model.setParam('scale', 1.0)
-        #model.setParam('contrast', 1.0)
-        
-        theta_label = 'cyl_theta'
-        if not model.params.has_key(theta_label):
-            theta_label = 'axis_theta'
-            
-        phi_label = 'cyl_phi'
-        if not model.params.has_key(phi_label):
-            phi_label = 'axis_phi'
-        
-        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')    
-        output_f.write("<q_average> <2d_average> <1d_average>\n")
-            
-        for i_q in range(1, 30):
-            q = 0.025 *i_q
-            sum = 0.0
-            for i_theta in range(npts):
-                theta = 180.0 / npts * i_theta
-                
-                model.setParam(theta_label, theta)
-                
-                for j in range(npts):
-                    model.setParam(phi_label, 180.0 * 2.0 / npts * j)
-                    if str(model.run([q, 0])).count("INF")>0:                        
-                        print "ERROR", q, theta, 180.0 * 2.0 / npts * j
-                    sum += math.sin(theta*math.pi/180.0)*model.run([q, 0])
-                    #sum += model.run([q, 0])
-            
-            value = sum/npts/npts*math.pi/2.0
-            ana = model.run(q)
-            if q<0.25 and (value-ana)/ana>0.05:
-                passed = False
-            output_f.write("%10g %10g %10g\n" % (q, value, ana))
-            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
-        
-        output_f.close()
-        return passed
-    
-    def average(self, model_class=CylinderModel, points = 101):
-        """ 
-            Perform test and produce output file
-            @param model_class: python class of the model to test
-        """
-        print "Averaging %s" % model_class.__name__
-        passed = True
-        
-        npts =points
-        model = model_class()
-        model.setParam('scale', 1.0)
-        model.setParam('contrast', 1.0)
-        
-        theta_label = 'cyl_theta'
-        if not model.params.has_key(theta_label):
-            theta_label = 'axis_theta'
-            
-        phi_label = 'cyl_phi'
-        if not model.params.has_key(phi_label):
-            phi_label = 'axis_phi'
-        
-        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')    
-        output_f.write("<q_average> <2d_average> <1d_average>\n")
-            
-        for i_q in range(1, 30):
-            q = 0.025*i_q
-            sum = 0.0
-            theta = 90.0
-            
-            model.setParam(theta_label, theta)
-            
-            for j in range(npts):
-                model.setParam(phi_label, 180.0 / 2.0 / npts * j)
-                if str(model.run([q, 0])).count("INF")>0:                        
-                    print "ERROR", q, theta, 180.0 * 2.0 / npts * j
-                #sum += math.sin(theta*math.pi/180.0)*model.run([q, 0])
-                sum += math.sin(math.pi / 2.0 / npts * j)*model.run([q, 0])
-                #sum += model.run([q, 0])
-            
-            value = sum/npts
-            ana = model.run(q)
-            if q<0.25 and (value-ana)/ana>0.05:
-                passed = False
-            output_f.write("%10g %10g %10g\n" % (q, value, ana))
-            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
-        
-        output_f.close()
-        return passed
-        
-    def test_non_oriented(self, model_class=SphereModel, points = 101):
-        """ 
-            Perform test and produce output file
-            @param model_class: python class of the model to test
-        """
-        print "Averaging %s" % model_class.__name__
-        passed = True
-        
-        npts =points
-        model = model_class()
-        #model.setParam('scale', 1.0)
-        #model.setParam('contrast', 1.0)
-        
-        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')    
-        output_f.write("<q_average> <2d_average> <1d_average>\n")
-            
-        for i_q in range(1, 30):
-            q = 0.025*i_q
-            sum = 0.0
-            for i_theta in range(npts):
-                theta = 180.0/npts*i_theta
-                
-                for j in range(npts):
-                    if str(model.run([q, 0])).count("INF")>0:                        
-                        print "ERROR", q, theta, 180.0 * 2.0 / npts * j
-                    sum += math.sin(theta*math.pi/180.0)*model.run([q, 0])
-            
-            value = sum/npts/npts*math.pi/2.0
-            ana = model.run(q)
-            if q<0.25 and (value-ana)/ana>0.05:
-                passed = False
-            output_f.write("%10g %10g %10g\n" % (q, value, ana))
-            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
-        
-        output_f.close()
-        return passed
-            
-        
-if __name__ == '__main__':
-    validator = Validate2D()
-    cyl_passed = validator(CylinderModel, points=201)
-    ell_passed = validator(EllipsoidModel, points=501)
-    cylcorehsell_passed = validator(CoreShellCylinderModel, points=201) 
-    sph_passed = validator.test_non_oriented(SphereModel, points=211) 
-        
-    print ""
-    print "Model             Passed"
-    print "Cylinder          %s" % cyl_passed
-    print "Ellipsoid         %s" % ell_passed
-    print "Core-shell cyl    %s" % cylcorehsell_passed
-    print "Sphere            %s" % sph_passed
-        
-        
-  
-    
Index: sansmodels/test/CMSphere5.txt
===================================================================
--- sansmodels/test/CMSphere5.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/CMSphere5.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,100 @@
+0.001278	54.9380924003798	37.0601175120843	0.0002847	0.001309	0.9969
+0.001562	55.9867418157196	18.7060721785266	0.0002905	0.001586	1
+0.001846	53.560827622232	12.1975438809796	0.0002956	0.001866	1
+0.00213	56.0611368219615	9.35924816875345	0.0003017	0.002147	1
+0.002414	54.9105450986387	7.41016498457617	0.0003087	0.002429	1
+0.002698	52.6206676026623	6.045008707986	0.0003165	0.002712	1
+0.002982	54.3487185926871	5.26582738584293	0.0003249	0.002994	1
+0.003266	53.1519252869778	4.55658543376789	0.000334	0.003277	1
+0.00355	50.3956985471045	3.94388487999297	0.0003437	0.00356	1
+0.003834	52.3077243923509	3.61620396245673	0.0003539	0.003843	1
+0.004118	48.9775315111468	3.18108860178174	0.0003646	0.004127	1
+0.004402	47.851863958769	2.88229340467268	0.0003757	0.00441	1
+0.004686	48.120403795601	2.66803353208751	0.0003872	0.004694	1
+0.00497	46.6358007278057	2.43894320769947	0.000399	0.004977	1
+0.005253	46.7096327873935	2.27814819504774	0.0004112	0.005261	1
+0.005537	44.7668346304486	2.0908757003657	0.0004237	0.005544	1
+0.005821	44.5102618760759	1.9622356317224	0.0004365	0.005828	1
+0.006105	43.8317929116779	1.83904398707451	0.0004495	0.006111	1
+0.006389	42.8115820491762	1.7218568467313	0.0004628	0.006395	1
+0.006673	40.6287017456067	1.59351619354822	0.0004762	0.006679	1
+0.006957	38.9273825772724	1.48551934346209	0.0004899	0.006963	1
+0.007241	39.4347686851588	1.42720701725474	0.0005037	0.007246	1
+0.007525	37.3896037689509	1.32928345624222	0.0005177	0.00753	1
+0.007809	35.6306787321893	1.24357164292396	0.0005318	0.007814	1
+0.008093	35.530501695638	1.19214934795332	0.0005461	0.008098	1
+0.008377	34.0993161167952	1.12297345606099	0.0005605	0.008381	1
+0.008661	32.9897133648153	1.06364208149705	0.000575	0.008665	1
+0.008945	32.1518950821748	1.01254716257906	0.0005896	0.008949	1
+0.009229	29.8897142444819	0.942611834366517	0.0006044	0.009233	1
+0.009513	28.9877911868164	0.897338521326267	0.0006192	0.009517	1
+0.009797	28.8671346812142	0.866582969308467	0.0006341	0.0098	1
+0.01008	26.9433496519676	0.811046621571466	0.0006491	0.01008	1
+0.01036	26.6574283650013	0.782285336779699	0.0006641	0.01037	1
+0.01065	24.3082221946571	0.725049547803642	0.0006793	0.01065	1
+0.01093	23.8126250954449	0.697116877376645	0.0006945	0.01094	1
+0.01122	23.1785075655241	0.668667535089826	0.0007097	0.01122	1
+0.0115	21.9740009615986	0.633465328879644	0.0007251	0.0115	1
+0.01178	20.6925854394778	0.59854083649735	0.0007404	0.01179	1
+0.01207	19.7807301988479	0.570199138755696	0.0007558	0.01207	1
+0.01235	18.3816218241588	0.535922420693967	0.0007713	0.01235	1
+0.01264	18.3908707649353	0.522982665113434	0.0007868	0.01264	1
+0.01292	16.6161700838934	0.485273055949626	0.0008024	0.01292	1
+0.0132	16.0777395370208	0.466244845015208	0.000818	0.01321	1
+0.01349	15.263459197006	0.443959969486881	0.0008336	0.01349	1
+0.01377	14.1821386233677	0.418435336883356	0.0008493	0.01377	1
+0.01406	13.502938686688	0.399416793154326	0.000865	0.01406	1
+0.01434	12.7120240406905	0.379297079863246	0.0008807	0.01434	1
+0.01462	12.3555872971682	0.366151201613803	0.0008965	0.01463	1
+0.01491	11.2547046019901	0.342326858530752	0.0009123	0.01491	1
+0.01519	10.9244250567462	0.330521180210077	0.0009281	0.01519	1
+0.01547	10.035672955121	0.310579708660702	0.000944	0.01548	1
+0.01576	9.54857095265672	0.297122712018445	0.0009598	0.01576	1
+0.01604	9.13262277183969	0.285096505677118	0.0009757	0.01604	1
+0.01633	8.08125471450095	0.263218034782734	0.0009916	0.01633	1
+0.01661	7.81396931095573	0.25412252707745	0.001008	0.01661	1
+0.01689	7.15622633154717	0.238849321076674	0.001024	0.0169	1
+0.01718	6.58315875573461	0.225067254333071	0.001039	0.01718	1
+0.01746	6.43230960958337	0.218637916921313	0.001055	0.01746	1
+0.01774	5.90542211293399	0.205941307480525	0.001071	0.01775	1
+0.01803	5.4581186471037	0.194688473505747	0.001088	0.01803	1
+0.01831	5.22827912984443	0.187421561660762	0.001104	0.01831	1
+0.0186	4.88437306640718	0.178230788618277	0.00112	0.0186	1
+0.01888	4.42899966633438	0.167025306994807	0.001136	0.01888	1
+0.01916	4.17549684846924	0.159640879027805	0.001152	0.01917	1
+0.01945	3.78069785571845	0.149569359258851	0.001168	0.01945	1
+0.01973	3.57736677843592	0.143287334425684	0.001184	0.01973	1
+0.02002	3.32715311708635	0.136123026207964	0.0012	0.02002	1
+0.0203	3.0976943461779	0.129413735491718	0.001216	0.0203	1
+0.02058	2.8778429506358	0.122929031089926	0.001232	0.02058	1
+0.02087	2.59549794256613	0.115075351147255	0.001249	0.02087	1
+0.02115	2.34203393868523	0.107772572065675	0.001265	0.02115	1
+0.02143	2.23234126433142	0.103757094440139	0.001281	0.02144	1
+0.02172	2.06670267290386	0.0984659657480468	0.001297	0.02172	1
+0.022	1.96040951516539	0.0946044762011819	0.001313	0.022	1
+0.02228	1.77196064410215	0.088743341386574	0.001329	0.02229	1
+0.02257	1.63708077448337	0.0841766166945712	0.001346	0.02257	1
+0.02285	1.53159863781081	0.0803621902602349	0.001362	0.02285	1
+0.02314	1.42479800116411	0.0765159633096708	0.001378	0.02314	1
+0.02342	1.34419916363248	0.073379495822172	0.001394	0.02342	1
+0.0237	1.28950309519543	0.0709726811217327	0.001411	0.0237	1
+0.02399	1.18575259309099	0.0672174491013361	0.001427	0.02399	1
+0.02427	1.11661367746353	0.0644328918452755	0.001443	0.02427	1
+0.02455	1.03725820906637	0.0613529362624028	0.001459	0.02456	1
+0.02484	0.963936666624243	0.0584406406908292	0.001476	0.02484	1
+0.02512	0.946666784713813	0.0572334134481483	0.001492	0.02512	1
+0.02541	0.85517174555837	0.0537648235548803	0.001508	0.02541	1
+0.02569	0.837653826942447	0.0525996725094271	0.001524	0.02569	1
+0.02597	0.779716006334579	0.0501713234228845	0.001541	0.02597	1
+0.02626	0.758831276438753	0.0489387203301556	0.001557	0.02626	1
+0.02654	0.737853170893451	0.0477213222943686	0.001573	0.02654	1
+0.02682	0.683436680838241	0.0454232028983561	0.00159	0.02682	1
+0.02711	0.687265505181365	0.0450551510778741	0.001606	0.02711	1
+0.02739	0.655078310492671	0.0435144667607471	0.001622	0.02739	1
+0.02767	0.638970027703769	0.0425189366016694	0.001639	0.02767	1
+0.02796	0.60633272894638	0.0409828262439632	0.001655	0.02796	1
+0.02824	0.604236153070516	0.0404857440009898	0.001671	0.02824	1
+0.02852	0.56286255473902	0.0386722507332448	0.001688	0.02853	1
+0.02881	0.568578929096012	0.0384715167864823	0.001704	0.02881	1
+0.02909	0.55573597175355	0.0376503540172005	0.00172	0.02909	1
+0.02937	0.534835145987317	0.0365662120675398	0.001737	0.02938	1
Index: sansmodels/test/CMSphere5smearsphere.txt
===================================================================
--- sansmodels/test/CMSphere5smearsphere.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/CMSphere5smearsphere.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,100 @@
+0.001278 2538.41176383
+0.001562 2536.91820405
+0.001846 2535.13182479
+0.00213 2533.06217813
+0.002414 2530.70378586
+0.002698 2528.05024192
+0.002982 2525.10408349
+0.003266 2521.86667499
+0.00355 2518.3390775
+0.003834 2514.52246995
+0.004118 2510.41798319
+0.004402 2506.02690988
+0.004686 2501.35067884
+0.00497 2496.38678318
+0.005253 2491.16237596
+0.005537 2485.63911673
+0.005821 2479.83657083
+0.006105 2473.75676948
+0.006389 2467.4014599
+0.006673 2460.77293372
+0.006957 2453.86724627
+0.007241 2446.69623838
+0.007525 2439.25775219
+0.007809 2431.55421398
+0.008093 2423.58785521
+0.008377 2415.36158137
+0.008661 2406.87009473
+0.008945 2398.12841186
+0.009229 2389.13360806
+0.009513 2379.88958042
+0.009797 2370.39776774
+0.01008 2360.69528793
+0.01036 2350.85169027
+0.01065 2340.42023633
+0.01093 2330.11206013
+0.01122 2319.20109972
+0.0115 2308.43503981
+0.01178 2297.44820179
+0.01207 2285.83853677
+0.01235 2274.41290746
+0.01264 2262.36219581
+0.01292 2250.51169731
+0.0132 2238.45596231
+0.01349 2225.76495666
+0.01377 2213.29618391
+0.01406 2200.19110751
+0.01434 2187.34050325
+0.01462 2174.30529864
+0.01491 2160.61632548
+0.01519 2147.21038112
+0.01547 2133.6202358
+0.01576 2119.37907426
+0.01604 2105.45234903
+0.01633 2090.86319102
+0.01661 2076.60576032
+0.01689 2062.19214565
+0.01718 2047.10550219
+0.01746 2032.38715621
+0.01774 2017.52560123
+0.01803 2001.99124318
+0.01831 1986.8466206
+0.0186 1971.03389745
+0.01888 1955.61395119
+0.01916 1940.08291563
+0.01945 1923.87672225
+0.01973 1908.10656374
+0.02002 1891.66297192
+0.0203 1875.66789021
+0.02058 1859.56357196
+0.02087 1842.7946829
+0.02115 1826.50064489
+0.02143 1810.11533702
+0.02172 1793.06840882
+0.022 1776.5115358
+0.02228 1759.87201249
+0.02257 1742.57354412
+0.02285 1725.79397319
+0.02314 1708.3583155
+0.02342 1691.45256069
+0.0237 1674.48561783
+0.02399 1656.86525366
+0.02427 1639.79847285
+0.02455 1622.68887088
+0.02484 1604.964211
+0.02512 1587.85768129
+0.02541 1569.99297335
+0.02569 1552.84580279
+0.02597 1535.54074115
+0.02626 1517.75249337
+0.02654 1500.40115023
+0.02682 1483.03632237
+0.02711 1465.05942429
+0.02739 1447.67682181
+0.02767 1430.46495191
+0.02796 1412.49232282
+0.02824 1395.13182318
+0.02852 1377.93439837
+0.02881 1359.99528971
+0.02909 1342.67274512
+0.02937 1325.55375609
Index: sansmodels/test/EllipticalCylinderModel_avg.txt
===================================================================
--- sansmodels/test/EllipticalCylinderModel_avg.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/EllipticalCylinderModel_avg.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,40 @@
+<q_average> <2d_average> <1d_average>
+      0.01    450.507    450.538
+      0.02    228.525    228.583
+      0.03    146.842    146.905
+      0.04    99.4289    99.4891
+      0.05    68.9421    68.9963
+      0.06    48.1995    48.2457
+      0.07    33.0792    33.1168
+      0.08    22.2588    22.2879
+      0.09    14.5974     14.619
+       0.1     9.1764    9.19152
+      0.11    5.56643    5.57647
+      0.12    3.24083    3.24712
+      0.13     1.7993    1.80306
+      0.14    1.00787    1.01007
+      0.15   0.594417   0.595781
+      0.16   0.402388   0.403396
+      0.17    0.34266   0.343579
+      0.18   0.317975   0.318926
+      0.19   0.306544   0.307546
+       0.2   0.296341   0.297366
+      0.21   0.269339   0.270346
+      0.22    0.24207   0.243026
+      0.23    0.21435   0.215236
+      0.24   0.183616   0.184429
+      0.25   0.160746   0.161486
+      0.26   0.138993   0.139665
+      0.27   0.117419   0.118023
+      0.28   0.100312   0.100842
+      0.29  0.0813972  0.0818505
+       0.3  0.0637594  0.0641323
+      0.31  0.0498591  0.0501547
+      0.32  0.0365552   0.036785
+      0.33  0.0280352  0.0282178
+      0.34  0.0237687  0.0239272
+      0.35  0.0212566  0.0214156
+      0.36  0.0225586  0.0227386
+      0.37  0.0246106  0.0248264
+      0.38  0.0258744   0.026131
+      0.39  0.0274088   0.027696
Index: sansmodels/test/ParallelepipedModel_avg.txt
===================================================================
--- sansmodels/test/ParallelepipedModel_avg.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/ParallelepipedModel_avg.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,23 @@
+<q_average> <2d_average> <1d_average>
+      0.01    1726.15    1726.27
+      0.02    844.977     845.19
+      0.03    512.608    512.824
+      0.04    320.271    320.463
+      0.05    200.963    201.119
+      0.06    126.024    126.142
+      0.07    77.5119    77.5985
+      0.08    47.8721    47.9338
+      0.09    30.4693    30.5136
+       0.1    19.9932     20.026
+      0.11    13.8137    13.8388
+      0.12    9.73278     9.7521
+      0.13    6.59619    6.61053
+      0.14    4.24385    4.25362
+      0.15    2.42973    2.43556
+      0.16    1.17877    1.18168
+      0.17   0.547226    0.54844
+      0.18   0.307981   0.308673
+      0.19   0.338138    0.33912
+       0.2   0.488894     0.4905
+      0.21    0.58072   0.582884
+      0.22   0.611786   0.614215
Index: sansmodels/test/SmearList.py
===================================================================
--- sansmodels/test/SmearList.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/SmearList.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,197 @@
+
+from sans.models.ModelFactory import ModelFactory
+from sans.models.BaseComponent import BaseComponent
+import math
+
+class Smear:
+    
+    def __init__(self, model, param, sigma):
+        """
+            @param model: model to smear
+            @param param: parameter to smear
+            @param sigma: std deviations for parameter
+        """
+
+        
+        ## Model to smear
+        #self.model = factory.getModel(model_name)
+        self.model = model
+        ## Standard deviation of the smearing
+        self.sigmas = sigma
+        ## Parameter to smear
+        self.params = param
+        ## Nominal value of the smeared parameter
+        self.centers = []
+        ## Error on last evaluation
+        self.error = 0.0
+        ## Error flag
+        self.doErrors = False
+        for par in self.params:
+            self.centers.append(self.model.getParam(par))
+        
+    def smearParam(self, id, x):
+        """
+            @param x: input value
+        """
+        # from random import random
+        # If we exhausted the parameter array, simply evaluate
+        # the model
+        if id < len(self.params):
+            #print "smearing", self.params[id]
+            
+            # Average over Gaussian distribution (2 sigmas)
+            value_sum = 0.0
+            gauss_sum = 0.0
+            
+            min_value = self.centers[id] - 2*self.sigmas[id]
+            max_value = self.centers[id] + 2*self.sigmas[id]
+            n_pts = 25
+            step = (max_value - min_value)/(n_pts-1)
+            #print min_value, max_value, step, max_value-min_value
+            if step == 0.0:
+                return self.smearParam(id+1,x)
+            
+            # Gaussian function used to weigh points
+            #gaussian = ModelFactory().getModel("Gaussian")
+            gaussian = Gaussian()
+            gaussian.setParam('sigma', self.sigmas[id])
+            gaussian.setParam('mean', self.centers[id])
+                    
+            # Compute average
+            prev_value = None
+            error_sys = 0.0
+            for i in range(n_pts):
+                # Set the parameter value           
+                value = min_value + i*step
+                # value = random()*4.0*self.sigmas[id] + min_value
+                # print value
+                self.model.setParam(self.params[id], value)
+                gauss_value = gaussian.run(value)
+                #gauss_value = 1.0
+                #if id==0: print value, gauss_value
+                func_value, error_1 = self.smearParam(id+1, x)
+                if self.doErrors:
+                    if not prev_value == None:
+                        error_sys += (func_value-prev_value)*(func_value-prev_value)/4.0
+                    prev_value = func_value
+
+                value_sum += gauss_value * func_value
+                gauss_sum += gauss_value
+                
+            #print "Error", math.sqrt(error)
+            return value_sum/gauss_sum, math.sqrt(error_sys)
+        
+        else:
+            return self.model.run(x), 0.0
+        
+    def run(self, x):
+        """
+            @param x: input
+        """
+        
+        # Go through the list of parameters
+        n_par = len(self.params)
+        
+        # Check array lengths
+        if not len(self.centers) == n_par or\
+            not len(self.sigmas) == n_par:
+            raise ValueError, "Incompatible array lengths"
+        
+        # Smear first parameters
+        if n_par > 0:
+            value, error = self.smearParam(0, x)
+            self.error = error
+            
+            # Put back original values
+            for i in range(len(self.centers)):
+                self.model.setParam(self.params[i], self.centers[i])
+            
+            
+            return value
+        
+class Gaussian(BaseComponent):
+    """ Gaussian function """
+    
+    def __init__(self):
+        """ Initialization """
+        BaseComponent.__init__(self)
+        
+        ## Name of the model
+        self.name = "Gaussian"
+        ## Scale factor
+        self.params['scale']  = 1.0
+        ## Mean value
+        self.params['mean']   = 0.0
+        ## Standard deviation
+        self.params['sigma']  = 1.0
+        ## Internal log
+        self.log = {}
+        return
+    
+    def run(self, x=0):
+        """ Evaluate the function 
+            @param x: input q or [q,phi]
+            @return: scattering function
+        """
+        if(type(x)==type([])):
+            # vector input
+            if(len(x)==2):
+                return self.analytical_2D(x)
+            else:
+                raise ValueError, "Gaussian takes a scalar or a 2D point"
+        else:
+            return self.analytical_1D(x)
+
+    def analytical_2D(self, x):
+        """ Evaluate 2D model 
+            @param x: input [q,phi]
+            @return: scattering function
+        """
+        
+        # 2D sphere is the same as 1D sphere
+        return self.analytical_1D(x[0])
+
+    def analytical_1D(self, x):
+        """ Evaluate 1D model
+            @param x: input q
+            @return: scattering function
+        """
+        vary = x-self.params['mean']
+        expo_value = -vary*vary/(2*self.params['sigma']*self.params['sigma'])
+        value = self.params['scale'] *  math.exp(expo_value)
+        
+        return value
+        
+# main
+if __name__ == '__main__':
+    import math
+    if True:
+        cyl = ModelFactory().getModel("CylinderModel")
+        cyl.setParam('length', 2000.0)
+        cyl.setParam('cyl_phi', .45)
+        cyl.setParam('cyl_theta', 2.)
+        #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [.01, .01])
+        #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [2.0, 2.0])
+        #app = Smear(cyl,['cyl_theta'], [2.5])
+        app = Smear(cyl, ['cyl_phi', 'cyl_theta'], [math.pi, math.pi])
+        #app = Smear(cyl,['scale', 'scale'],[.5,1.0])
+        val_no = cyl.run([.001, 1.0])
+        print "Cylinder (no smear) f(.1):", val_no
+        val_sm =  app.run([.001, 1.0])
+        print "Cylinder (smear)    f(.1):", val_sm, app.error, app.error/val_sm
+        print "Cylinder (1D)    f(.1):", cyl.run(.001), cyl.run(.001)/val_sm
+      
+      
+    print "--------------"
+    sinsin = ModelFactory().getModel("SinSin")
+    sinsin.setParam('a', -1.7)
+    sinsin.setParam('b', 5.45)
+    #app = Smear(sinsin, ['A'], [3.1])
+    #app = Smear(sinsin, ['A', 'b'], [math.pi/2.0, .0])
+    app = Smear(sinsin, ['A'], [math.pi/2.0])
+    #app = Smear(cyl,['scale', 'scale'],[.5,1.0])
+    val_no = sinsin.run(1.0)
+    print "SinSin (no smear) :", val_no
+    val_sm =  app.run(1.0)
+    print "SinSin (smear)    : %g +- %g" % (val_sm, app.error)
+      
Index: sansmodels/test/TriaxialEllipsoidModel_avg.txt
===================================================================
--- sansmodels/test/TriaxialEllipsoidModel_avg.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/TriaxialEllipsoidModel_avg.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,23 @@
+<q_average> <2d_average> <1d_average>
+      0.01    6165.45    6166.44
+      0.02    2194.74    2195.78
+      0.03    874.216    874.921
+      0.04    373.155    373.577
+      0.05    180.257    180.513
+      0.06    92.2976    92.4552
+      0.07    45.6908    45.7821
+      0.08    22.4177     22.466
+      0.09    11.5738    11.5978
+       0.1    6.33202    6.34288
+      0.11    4.00772    4.01228
+      0.12    3.12529    3.12787
+      0.13    2.61889    2.62135
+      0.14    2.17612     2.1788
+      0.15    1.77645    1.77924
+      0.16    1.36894    1.37152
+      0.17   0.993054    0.99509
+      0.18   0.717117   0.718548
+      0.19   0.530954   0.531899
+       0.2   0.412607   0.412982
+      0.21   0.352447    0.35239
+      0.22   0.318321   0.319034
Index: sansmodels/test/cansas1d_slit.xml
===================================================================
--- sansmodels/test/cansas1d_slit.xml	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/cansas1d_slit.xml	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,141 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="example.xsl" ?>
+<SASroot version="1.0"
+    xmlns="cansas1d/1.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="cansas1d/1.0 http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd"
+    >
+	<SASentry>
+		<Title>Test title</Title>
+		<Run name='run name'>1234</Run>
+		<SASdata>
+			<Idata>
+				<Q unit="1/A">0.02</Q>
+				<I unit="1/cm">1000</I>
+				<Idev unit="1/cm">3</Idev>
+				<dQl unit="1/A">0.005</dQl>
+				<dQw unit="1/A">0.001</dQw>
+				<Shadowfactor><!-- Shadowfactor is optional --></Shadowfactor>
+			</Idata>
+			<Idata>
+				<Q unit="1/A">0.03</Q>
+				<I unit="1/cm">1001</I>
+				<Idev unit="1/cm">4</Idev>
+				<dQl unit="1/A">0.005</dQl>
+				<dQw unit="1/A">0.001</dQw>
+				<Shadowfactor><!-- Shadowfactor is optional --></Shadowfactor>
+			</Idata>
+		</SASdata>
+		<SASsample name='my sample'>
+			<ID>SI600-new-long</ID>
+			<thickness unit="mm">1.03</thickness>
+			<transmission>0.327</transmission>
+			<temperature unit="C">0.0000</temperature>
+			<position>
+				<x unit="mm">10.00</x>
+				<y unit="mm">0.00</y>
+			</position>
+			<orientation>
+				<roll unit="degree">22.5<!-- was: sample_orientation --></roll>
+				<pitch unit="degree">0.020<!-- was: sample_offset_angle --></pitch>
+			</orientation>
+			<details>
+				<!-- was: sample_prep -->
+				http://chemtools.chem.soton.ac.uk/projects/blog/blogs.php/bit_id/2720
+			</details>
+			<details>
+				Some text here
+			</details>
+			
+		</SASsample>
+		<SASinstrument name="TEST instrument">
+			<name>canSAS instrument</name>
+			<SASsource name="source name">
+				<radiation>neutron</radiation>
+				<beam_size name='bm'>
+					<x unit="mm">12.00</x>
+					<y unit="mm">13.00</y>
+				</beam_size>
+				<beam_shape>disc</beam_shape>
+				<wavelength unit="A">6.00</wavelength>
+				<wavelength_min unit="nm">0.22</wavelength_min>
+				<wavelength_max unit="nm">1.00</wavelength_max>
+				<wavelength_spread unit="percent">
+					14.3
+				</wavelength_spread>
+			</SASsource>
+			<SAScollimation name="test coll name">
+				<length unit='mm'> 123.0</length>
+				<aperture name="source" type="radius">
+					<size>
+						<x unit="mm">50</x>
+					</size>
+					<distance unit="m">11.000<!-- was: distance_coll --></distance>
+				</aperture>
+				<aperture name="sample" type="radius">
+					<size name='size name'>
+						<x unit="mm">1</x>
+					</size>
+				</aperture>
+			</SAScollimation>
+			<SASdetector>
+				<name>fictional hybrid</name>
+				<SDD unit="m">
+					<!-- sample-to-detector distance -->
+					4.150
+				</SDD>
+				<orientation>
+					<roll unit="degree">1.00</roll>
+					<pitch unit="degree">0.00</pitch>
+					<yaw unit="degree">0.00</yaw>
+				</orientation>
+				<offset>
+					<x unit="mm">1</x>
+					<y unit="mm">2</y>
+				</offset>
+				<beam_center>
+					<x unit="mm">322.64</x>
+					<y unit="mm">327.68</y>
+				</beam_center>
+				<pixel_size>
+					<x unit="mm">5.00</x>
+					<y unit="mm">5.00</y>
+				</pixel_size>
+			</SASdetector>
+		</SASinstrument>
+		<SASprocess>
+			<name>spol</name>
+			<date>04-Sep-2007 18:35:02</date>
+			<term name="radialstep" unit="mm">10.000</term>
+			<term name="sector_width" unit="degree">180.0</term>
+			<term name="sector_orient" unit="degree">0.0</term>
+			<term name="MASK_file">USER:MASK.COM</term>
+			<SASprocessnote>
+				AvA1 0.0000E+00 AsA2 1.0000E+00 XvA3 1.0526E+03 XsA4
+				5.2200E-02 XfA5 0.0000E+00
+			</SASprocessnote>
+			<SASprocessnote>
+				S... 13597 0 2.26E+02 2A 5mM 0%D2O Sbak 13594 0 1.13E+02
+				H2O Buffer
+			</SASprocessnote>
+			<SASprocessnote>V... 13552 3 1.00E+00 H2O5m</SASprocessnote>
+		</SASprocess>
+		<SASprocess>
+			<name>NCNR-IGOR</name>
+			<date>03-SEP-2006 11:42:47</date>
+			<description />
+			<term name="average_type">Circular</term>
+			<term name="SAM_file">SEP06064.SA3_AJJ_L205</term>
+			<term name="BKD_file">SEP06064.SA3_AJJ_L205</term>
+			<term name="EMP_file">SEP06064.SA3_AJJ_L205</term>
+			<term name="DIV_file">SEP06064.SA3_AJJ_L205</term>
+			<term name="MASK_file">SEP06064.SA3_AJJ_L205</term>
+			<term name="ABS:TSTAND">1</term>
+			<term name="ABS:DSTAND" unit="mm">1</term>
+			<term name="ABS:IZERO">230.09</term>
+			<term name="ABS:XSECT" unit="mm">1</term>
+			<SASprocessnote/>
+		</SASprocess>
+		<SASnote />
+	</SASentry>
+</SASroot>
Index: sansmodels/test/core_shell_cyl_testdata.txt
===================================================================
--- sansmodels/test/core_shell_cyl_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/core_shell_cyl_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,139 @@
+pythonclass = CoreShellCylinderModel
+scale = 1
+radius = 20
+thickness = 10
+length = 400
+core_sld = 1e-6
+shell_sld = 4e-6
+solvent_sld = 1e-6
+background = 0.01
+
+DATA
+0.001	353.560132167546
+0.00105251266011778	353.353125068201
+0.00110778289970821	353.124000569665
+0.00116595552660488	352.87041875967
+0.00122718295288593	352.58979743803
+0.00129162559419317	352.279288228264
+0.00135945229002046	351.935750610798
+0.00143084074607265	351.555723763133
+0.00150597799985384	351.13539610369
+0.00158506091070502	350.67057245352
+0.00166829667557485	350.156638755392
+0.00175590337187494	349.588524324878
+0.00184811052884188	348.96066165541
+0.00194515972890305	348.2669438617
+0.00204730524062173	347.50067992682
+0.00215481468487986	346.654548021734
+0.00226796973604376	345.720547296668
+0.00238706685995004	344.689948707106
+0.00251241809064502	343.553245639307
+0.00264435184791283	342.300105348302
+0.00278321379773411	340.919322522823
+0.00292936775792964	339.398776654985
+0.00308319665136179	337.725395326242
+0.00324510350919104	335.885126033787
+0.00341551252681621	333.862919780817
+0.00359487017526494	331.642730345873
+0.00378364637094618	329.207533933654
+0.00398233570682956	326.539374789731
+0.00419145874827721	323.619443324298
+0.0044115633969232	320.42819431362
+0.00464322632617388	316.945513794367
+0.00488705449209019	313.150944275563
+0.0051436867236104	309.023978776314
+0.0054137953962797	304.544434827648
+0.00569808819387176	299.692919778901
+0.00599730996251769	294.451398290194
+0.00631224466220038	288.803871471549
+0.00664371742072679	282.737174369416
+0.00699259669556001	276.241893948161
+0.00735979654917468	269.313402842951
+0.00774627904389752	261.952994401996
+0.00815305676250721	254.169091326557
+0.00858119546119774	245.978483087029
+0.00903181686185589	237.40752600812
+0.00950610159096858	228.493214681787
+0.0100052922728602	219.284005115922
+0.010530696785364	209.840240785234
+0.0110836916864573	200.234006071171
+0.0116657258208385	190.548212990096
+0.0122783241158954	180.874724485493
+0.0129230915770094	171.311341206724
+0.0136017174926639	161.957540886819
+0.0143159798603742	152.908972976731
+0.0150677500450351	144.250886565509
+0.0158589976818897	136.05091014724
+0.0166917958369675	128.351896721801
+0.0175683264385096	121.165863476228
+0.0184908859936133	114.4703267421
+0.0194618916050726	108.208458104453
+0.0204838873041789	102.294332218686
+0.0215595507160742	96.6239575011789
+0.0226917000751195	91.0916748532794
+0.0238833016086589	85.6098975590415
+0.0251374773085249	80.1282952267494
+0.0264575131106459	74.6469601970146
+0.027846867504187	69.2177167568136
+0.0293091805927793	63.9295437880283
+0.0308482836315787	58.8787182407255
+0.0324682090651407	54.1312654799973
+0.0341732010924115	49.69226426132
+0.035967726786514	45.4991807718727
+0.0378564877984635	41.4499135076893
+0.0398444326754772	37.4589544254216
+0.0419367698261504	33.5130282576843
+0.0441389811664687	29.686116638358
+0.0464568364824087	26.0906695351733
+0.0488964085467568	22.7896027400326
+0.0514640890297529	19.7418575728741
+0.0541666052452436	16.8470027329151
+0.0570110377762212	14.0641733834676
+0.0600048390259259	11.4767624934243
+0.0631558527431166	9.2013416146032
+0.0664723345726646	7.23621720450609
+0.0699629736853145	5.47667717868581
+0.0736369155432808	3.90694235857881
+0.0775037858613269	2.64520254302911
+0.0815737158261042	1.71888244584613
+0.085857368639825	1.00616951922904
+0.0903659674578153	0.505746479270218
+0.0951113247931421	0.309316869918116
+0.100105873465356	0.308828468967212
+0.105362699174436	0.429865649540495
+0.110895574785276	0.739968811735628
+0.116718996412541	1.09493668549302
+0.122848221400442	1.46082520272542
+0.129299308296917	1.82653039088647
+0.136089158926978	2.05737723523194
+0.143235562675425	2.20629099045896
+0.150757243094979	2.15813904059397
+0.158673906961919	1.99386071154923
+0.167006295907771	1.66050707894721
+0.175776240762306	1.26841056680328
+0.185006718750238	0.836447930777851
+0.194721913691476	0.449693930627265
+0.20494727936264	0.185700967900882
+0.215709606185875	0.0512394957384413
+0.227037091419654	0.0559048063587326
+0.238959413035505	0.168095485620378
+0.251507807474183	0.311108248903106
+0.264715151485044	0.406870878371388
+0.278616048263005	0.408344224667358
+0.2932469181088	0.316510838067329
+0.308646093850034	0.178888365548314
+0.324853921273063	0.0632726105995981
+0.341912864828804	0.0166666303781699
+0.359867618889456	0.0363079940206598
+0.378765224847594	0.0772563511682604
+0.398655194364451	0.0908219781360385
+0.4195896390903	0.0626486424147243
+0.441623407196792	0.0256750929944015
+0.464814227078974	0.0110636566475161
+0.489222858603482	0.0167465728125504
+0.514913252299177	0.0199946004105147
+0.541952716907305	0.0145028620055464
+0.570412095730168	0.0104003959468734
+0.600365952240318	0.0104967016337968
+0.631892765436603	0.0102949185411522
+0.665075135458861	0.0106147900550481
Index: sansmodels/test/core_shell_testdata.txt
===================================================================
--- sansmodels/test/core_shell_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/core_shell_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,138 @@
+pythonclass = CoreShellModel
+scale = 1
+radius = 60
+thickness = 10
+core_sld = 1e-6
+shell_sld = 2e-6
+solvent_sld = 3e-6
+background = 0.001
+
+DATA
+0.001	381.274046971472
+0.00105251266011778	381.237899910898
+0.00110778289970821	381.19786027418
+0.00116595552660488	381.153509293754
+0.00122718295288593	381.104383244174
+0.00129162559419317	381.049968637346
+0.00135945229002046	380.989696908168
+0.00143084074607265	380.922938539463
+0.00150597799985384	380.848996566762
+0.00158506091070502	380.767099400611
+0.00166829667557485	380.676392895334
+0.00175590337187494	380.575931589119
+0.00184811052884188	380.464669030575
+0.00194515972890305	380.341447101163
+0.00204730524062173	380.204984233923
+0.00215481468487986	380.053862419402
+0.00226796973604376	379.886512882077
+0.00238706685995004	379.701200298987
+0.00251241809064502	379.49600542349
+0.00264435184791283	379.268805965744
+0.00278321379773411	379.017255571336
+0.00292936775792964	378.738760728792
+0.00308319665136179	378.430455426155
+0.00324510350919104	378.08917336769
+0.00341551252681621	377.711417552685
+0.00359487017526494	377.293327011804
+0.00378364637094618	376.830640491906
+0.00398233570682956	376.318656879007
+0.00419145874827721	375.752192152612
+0.0044115633969232	375.125532673916
+0.00464322632617388	374.432384627427
+0.00488705449209019	373.665819462742
+0.0051436867236104	372.818215222885
+0.0054137953962797	371.881193701371
+0.00569808819387176	370.845553445896
+0.00599730996251769	369.701198727091
+0.00631224466220038	368.437064721844
+0.00664371742072679	367.041039329271
+0.00699259669556001	365.499882251454
+0.00735979654917468	363.799142240043
+0.00774627904389752	361.923073744821
+0.00815305676250721	359.854554613775
+0.00858119546119774	357.575007000233
+0.00903181686185589	355.064324247026
+0.00950610159096858	352.300807257296
+0.0100052922728602	349.261114744241
+0.010530696785364	345.920232795758
+0.0110836916864573	342.251470410986
+0.0116657258208385	338.226489077737
+0.0122783241158954	333.81537607021
+0.0129230915770094	328.986772953036
+0.0136017174926639	323.708072763327
+0.0143159798603742	317.945701467637
+0.0150677500450351	311.665501484756
+0.0158589976818897	304.833237213943
+0.0166917958369675	297.415244439261
+0.0175683264385096	289.379246945833
+0.0184908859936133	280.695364337768
+0.0194618916050726	271.337334425244
+0.0204838873041789	261.283971041376
+0.0215595507160742	250.520872986184
+0.0226917000751195	239.042391027563
+0.0238833016086589	226.853846399068
+0.0251374773085249	213.973974766497
+0.0264575131106459	200.437542879074
+0.027846867504187	186.298049862679
+0.0293091805927793	171.630380485316
+0.0308482836315787	156.533223593014
+0.0324682090651407	141.131006418686
+0.0341732010924115	125.57502775677
+0.035967726786514	110.043406138698
+0.0378564877984635	94.7394031434915
+0.0398444326754772	79.8876517594616
+0.0419367698261504	65.7278357602731
+0.0441389811664687	52.5054542084486
+0.0464568364824087	40.4594948569723
+0.0488964085467568	29.8071600221693
+0.0514640890297529	20.726258352271
+0.0541666052452436	13.336494524359
+0.0570110377762212	7.68161679902745
+0.0600048390259259	3.71512224140784
+0.0631558527431166	1.29279888095064
+0.0664723345726646	0.175550519014221
+0.0699629736853145	0.0453924538681532
+0.0736369155432808	0.535923418986669
+0.0775037858613269	1.27580609656724
+0.0815737158261042	1.93998544566538
+0.085857368639825	2.29923118349953
+0.0903659674578153	2.25545560606361
+0.0951113247931421	1.85001590113763
+0.100105873465356	1.23672780785815
+0.105362699174436	0.621355016508782
+0.110895574785276	0.183149542475723
+0.116718996412541	0.00639177282429009
+0.122848221400442	0.0529088860080835
+0.129299308296917	0.193331375536727
+0.136089158926978	0.285780213218503
+0.143235562675425	0.258850751719227
+0.150757243094979	0.144682310792552
+0.158673906961919	0.0362122531752963
+0.167006295907771	0.00113663058210361
+0.175776240762306	0.0277097331697254
+0.185006718750238	0.0531103329757048
+0.194721913691476	0.0401179463806756
+0.20494727936264	0.010881272301514
+0.215709606185875	0.0011822843814875
+0.227037091419654	0.00839678281024765
+0.238959413035505	0.00914771323458895
+0.251507807474183	0.00271488007246614
+0.264715151485044	0.00119017076116013
+0.278616048263005	0.00209189028269908
+0.2932469181088	0.00118078317349688
+0.308646093850034	0.00108286779061982
+0.324853921273063	0.00100867939845478
+0.341912864828804	0.00130885256583451
+0.359867618889456	0.00111691184987341
+0.378765224847594	0.00155107403368663
+0.398655194364451	0.00179962321843482
+0.4195896390903	0.00131961072539651
+0.441623407196792	0.00251915473759882
+0.464814227078974	0.00118345764149102
+0.489222858603482	0.0026873874933769
+0.514913252299177	0.00137597045735508
+0.541952716907305	0.00210439596198283
+0.570412095730168	0.00207013597449065
+0.600365952240318	0.00107370624743048
+0.631892765436603	0.00208956797079987
+0.665075135458861	0.00152395959676715
Index: sansmodels/test/cylinder_testdata.txt
===================================================================
--- sansmodels/test/cylinder_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/cylinder_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,136 @@
+pythonclass = CylinderModel
+scale = 1
+radius = 20
+length = 400
+contrast = 3e-6
+background = 0.01
+
+DATA
+0.001	450.365065779858
+0.00105251266011778	450.146580159158
+0.00110778289970821	449.904721058613
+0.00116595552660488	449.637008936793
+0.00122718295288593	449.340705967062
+0.00129162559419317	449.012790215663
+0.00135945229002046	448.649927487565
+0.00143084074607265	448.248440688541
+0.00150597799985384	447.804276557381
+0.00158506091070502	447.312969632777
+0.00166829667557485	446.769603336734
+0.00175590337187494	446.16876808224
+0.00184811052884188	445.504516349513
+0.00194515972890305	444.770314725176
+0.00204730524062173	443.958992965425
+0.00215481468487986	443.06269023145
+0.00226796973604376	442.072798757619
+0.00238706685995004	440.979905355641
+0.00251241809064502	439.773731337189
+0.00264435184791283	438.443071660573
+0.00278321379773411	436.975734382002
+0.00292936775792964	435.358481827868
+0.00308319665136179	433.576975311161
+0.00324510350919104	431.615725703122
+0.00341551252681621	429.45805275105
+0.00359487017526494	427.086056715235
+0.00378364637094618	424.480606690776
+0.00398233570682956	421.621350889575
+0.00419145874827721	418.48675518485
+0.0044115633969232	415.054177358106
+0.00464322632617388	411.299985718283
+0.00488705449209019	407.199732049438
+0.0051436867236104	402.728390128864
+0.0054137953962797	397.860672252773
+0.00569808819387176	392.571437181701
+0.00599730996251769	386.836203490749
+0.00631224466220038	380.631782234131
+0.00664371742072679	373.937041785537
+0.00699259669556001	366.733815283289
+0.00735979654917468	359.007956784618
+0.00774627904389752	350.750545416413
+0.00815305676250721	341.959226825518
+0.00858119546119774	332.639667374524
+0.00903181686185589	322.807078144569
+0.00950610159096858	312.487742427288
+0.0100052922728602	301.720451940157
+0.010530696785364	290.557724098633
+0.0110836916864573	279.066637024047
+0.0116657258208385	267.329083828761
+0.0122783241158954	255.441218487576
+0.0129230915770094	243.511850295617
+0.0136017174926639	231.659553491498
+0.0143159798603742	220.008306831172
+0.0150677500450351	208.681580188645
+0.0158589976818897	197.79495631257
+0.0166917958369675	187.447625061693
+0.0175683264385096	177.713411852586
+0.0184908859936133	168.632377005123
+0.0194618916050726	160.204390996683
+0.0204838873041789	152.38635368558
+0.0215595507160742	145.094741759756
+0.0226917000751195	138.214768436832
+0.0238833016086589	131.616467303681
+0.0251374773085249	125.176404569476
+0.0264575131106459	118.801620763363
+0.027846867504187	112.450266533729
+0.0293091805927793	106.142075700885
+0.0308482836315787	99.9524453550689
+0.0324682090651407	93.9874997719109
+0.0341732010924115	88.3443041234747
+0.035967726786514	83.0688232388444
+0.0378564877984635	78.1304426729725
+0.0398444326754772	73.4304494970684
+0.0419367698261504	68.8486707842003
+0.0441389811664687	64.3094541736059
+0.0464568364824087	59.8273466085108
+0.0488964085467568	55.4936826961488
+0.0514640890297529	51.4009604588362
+0.0541666052452436	47.5581111282103
+0.0570110377762212	43.8774155688553
+0.0600048390259259	40.2624605003613
+0.0631558527431166	36.7152777493163
+0.0664723345726646	33.3300934619011
+0.0699629736853145	30.1616336003056
+0.0736369155432808	27.1450621666718
+0.0775037858613269	24.2065619286448
+0.0815737158261042	21.3959787911772
+0.085857368639825	18.7909944516912
+0.0903659674578153	16.3453512004984
+0.0951113247931421	14.0105824738489
+0.100105873465356	11.8613539021756
+0.105362699174436	9.91011586652733
+0.110895574785276	8.09924233046156
+0.116718996412541	6.48721642322365
+0.122848221400442	5.07262211522658
+0.129299308296917	3.8241007701892
+0.136089158926978	2.7902311341927
+0.143235562675425	1.92376715107624
+0.150757243094979	1.25195840473638
+0.158673906961919	0.739247462316389
+0.167006295907771	0.39034943849544
+0.175776240762306	0.166847976328158
+0.185006718750238	0.0638252857300758
+0.194721913691476	0.0371817504957719
+0.20494727936264	0.0700301931370014
+0.215709606185875	0.132358655755811
+0.227037091419654	0.193912768174811
+0.238959413035505	0.239497654621447
+0.251507807474183	0.257679805850731
+0.264715151485044	0.243166233829726
+0.278616048263005	0.200630401151877
+0.2932469181088	0.142354013759544
+0.308646093850034	0.083781005054643
+0.324853921273063	0.0388578776547404
+0.341912864828804	0.0157446742258134
+0.359867618889456	0.0142232167943077
+0.378765224847594	0.0263426031970756
+0.398655194364451	0.0404298608524238
+0.4195896390903	0.0459660214615077
+0.441623407196792	0.0387976446053645
+0.464814227078974	0.0251520976537578
+0.489222858603482	0.0133956386353553
+0.514913252299177	0.0108065514382524
+0.541952716907305	0.0152710060258391
+0.570412095730168	0.0196514304875119
+0.600365952240318	0.0182845678719795
+0.631892765436603	0.0130198222806718
+0.665075135458861	0.0101535864652661
Index: sansmodels/test/ellipsoid_testdata.txt
===================================================================
--- sansmodels/test/ellipsoid_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/ellipsoid_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,136 @@
+pythonclass = EllipsoidModel
+scale = 1
+radius_a = 20
+radius_b = 400
+contrast = 3e-6
+background = 0.01
+
+DATA
+0.001	11808.8528968632
+0.00105251266011778	11781.7147338649
+0.00110778289970821	11751.726514487
+0.00116595552660488	11718.5978599118
+0.00122718295288593	11682.01083219
+0.00129162559419317	11641.6177848645
+0.00135945229002046	11597.0391584392
+0.00143084074607265	11547.8612513417
+0.00150597799985384	11493.6340074247
+0.00158506091070502	11433.8688737723
+0.00166829667557485	11368.0367979944
+0.00175590337187494	11295.5664527249
+0.00184811052884188	11215.8427971077
+0.00194515972890305	11128.2061110769
+0.00204730524062173	11031.951668581
+0.00215481468487986	10926.3302508532
+0.00226796973604376	10810.5497404861
+0.00238706685995004	10683.7780812871
+0.00251241809064502	10545.1479370896
+0.00264435184791283	10393.7634337298
+0.00278321379773411	10228.7094202917
+0.00292936775792964	10049.0637353733
+0.00308319665136179	9853.91300696029
+0.00324510350919104	9642.37254402161
+0.00341551252681621	9413.61088528121
+0.00359487017526494	9166.879543996
+0.00378364637094618	8901.54841182498
+0.00398233570682956	8617.14714114096
+0.00419145874827721	8313.41259076583
+0.0044115633969232	7990.34206915047
+0.00464322632617388	7648.25161351986
+0.00488705449209019	7287.83787614165
+0.0051436867236104	6910.24132742693
+0.0054137953962797	6517.10741990347
+0.00569808819387176	6110.64109931719
+0.00599730996251769	5693.64864736002
+0.00631224466220038	5269.55939642207
+0.00664371742072679	4842.41854557534
+0.00699259669556001	4416.8413977311
+0.00735979654917468	3997.91920819247
+0.00774627904389752	3591.06797139074
+0.00815305676250721	3201.81444399825
+0.00858119546119774	2835.51908599765
+0.00903181686185589	2497.04384279986
+0.00950610159096858	2190.38388293401
+0.0100052922728602	1918.29597467291
+0.010530696785364	1681.97052793915
+0.0110836916864573	1480.80647627844
+0.0116657258208385	1312.35366329635
+0.0122783241158954	1172.4806119466
+0.0129230915770094	1055.80087419096
+0.0136017174926639	956.345199427954
+0.0143159798603742	868.401686020703
+0.0150677500450351	787.373295795928
+0.0158589976818897	710.444579006174
+0.0166917958369675	636.839691442685
+0.0175683264385096	567.524137445761
+0.0184908859936133	504.366315112346
+0.0194618916050726	449.001613576719
+0.0204838873041789	401.841966414852
+0.0215595507160742	361.713843354515
+0.0226917000751195	326.376840678275
+0.0238833016086589	293.695004896232
+0.0251374773085249	262.744038847928
+0.0264575131106459	234.039847131565
+0.027846867504187	208.639158819275
+0.0293091805927793	186.837277235271
+0.0308482836315787	167.70997478874
+0.0324682090651407	150.021720507628
+0.0341732010924115	133.469048132347
+0.035967726786514	118.660929907549
+0.0378564877984635	105.851355256071
+0.0398444326754772	94.3663066816175
+0.0419367698261504	83.6578396413674
+0.0441389811664687	74.0303846471908
+0.0464568364824087	65.6488966587392
+0.0488964085467568	58.0126389704112
+0.0514640890297529	51.0164068972012
+0.0541666052452436	44.9003014032841
+0.0570110377762212	39.3721336546038
+0.0600048390259259	34.3529627586149
+0.0631558527431166	29.958497372189
+0.0664723345726646	25.9550620560306
+0.0699629736853145	22.4261198409402
+0.0736369155432808	19.2679866604944
+0.0775037858613269	16.4682212334822
+0.0815737158261042	13.9888621639924
+0.085857368639825	11.805997960264
+0.0903659674578153	9.88077806606173
+0.0951113247931421	8.21127352905187
+0.100105873465356	6.74958811344309
+0.105362699174436	5.49602638898874
+0.110895574785276	4.42590111015658
+0.116718996412541	3.51634335501236
+0.122848221400442	2.7564115317264
+0.129299308296917	2.13145505928053
+0.136089158926978	1.62491960968472
+0.143235562675425	1.22192025374086
+0.150757243094979	0.908755828531692
+0.158673906961919	0.672118368226188
+0.167006295907771	0.499015180776053
+0.175776240762306	0.376993265291224
+0.185006718750238	0.294475487249178
+0.194721913691476	0.240999006101438
+0.20494727936264	0.206976804274189
+0.215709606185875	0.184084804995347
+0.227037091419654	0.166799187053838
+0.238959413035505	0.150583285805888
+0.251507807474183	0.133330958053468
+0.264715151485044	0.113698351753489
+0.278616048263005	0.0866638841974435
+0.2932469181088	0.0612447728443078
+0.308646093850034	0.07146333544507
+0.324853921273063	0.0642081900887752
+0.341912864828804	0.0396251834721476
+0.359867618889456	0.0210274910924806
+0.378765224847594	0.0199010559646776
+0.398655194364451	0.0279754666458064
+0.4195896390903	0.0319472487548983
+0.441623407196792	0.0268350754071031
+0.464814227078974	0.0181555013515734
+0.489222858603482	0.0134732506169512
+0.514913252299177	0.0143447123658664
+0.541952716907305	0.0163992637354073
+0.570412095730168	0.0156477366167964
+0.600365952240318	0.012898427036931
+0.631892765436603	0.0114950061180364
+0.665075135458861	0.0126814563174163
Index: sansmodels/test/elliptical_cylinder_testdata.txt
===================================================================
--- sansmodels/test/elliptical_cylinder_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/elliptical_cylinder_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,51 @@
+pythonclass = EllipticalCylinderModel
+scale = 1
+r_minor = 20
+r_ratio = 1.5
+length = 400
+contrast = 3e-6
+background = 0.00
+
+DATA
+0.001	675.50440232505
+0.00113999241252094	674.585621554061
+0.00129958270060531	673.394210762832
+0.00148151441813353	671.850289410856
+0.00168891519571259	669.851269662357
+0.00192535050850367	667.265881328373
+0.00219488497113752	663.926958947588
+0.00250215221345301	659.622979404263
+0.00285243453830891	654.088557911805
+0.00325175373088482	646.99452081442
+0.00370697458059535	637.938887875081
+0.00422592289528669	626.441265201386
+0.00481752003652534	611.944943469895
+0.00549193628880649	593.833534033594
+0.0062607656992878	571.472138550979
+0.00713722539375944	544.286072836033
+0.00813638279533754	511.890903244197
+0.0092754146520507	474.281385973753
+0.0105739023263233	432.06585649542
+0.0120541684227461	386.686741391944
+0.0137416605411801	340.493801750454
+0.0156653887523837	296.461181585324
+0.0178584243169082	257.357995056469
+0.0203584682208548	224.472404683279
+0.0232084993023232	196.656975592684
+0.0264575131106459	171.051533112635
+0.0301613642003096	145.892282588722
+0.0343837263396336	122.492775456219
+0.0391971871413787	102.387787023423
+0.044684495933335	83.9644239362009
+0.0509399863213247	66.6884221063028
+0.0580711979002305	51.7673903991309
+0.0662007249922647	38.2008300068913
+0.0754683241945671	26.8220307031804
+0.0860333169674769	17.3310728335251
+0.0980773285669326	10.0671608021353
+0.111807410406626	5.06032753961084
+0.127459599527169	2.09807907940937
+0.14530297636393	0.74349155534215
+0.165644290571589	0.362431309457757
+0.188833234429025	0.310054845776307
+
Index: sansmodels/test/load_test_model.xml
===================================================================
--- sansmodels/test/load_test_model.xml	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/load_test_model.xml	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,10 @@
+<Component class='AddComponent' name='AddComponent'>
+  <operateOn>
+    <Component class='SphereModel' name='SphereModel'>
+</Component>
+  </operateOn>
+  <toAdd>
+    <Component class='SphereModel' name='SphereModel'>
+</Component>
+  </toAdd>
+</Component>
Index: sansmodels/test/polyexclvol_default_igor.txt
===================================================================
--- sansmodels/test/polyexclvol_default_igor.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/polyexclvol_default_igor.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,131 @@
+#PolymerExclVolume model 
+#Data was calculated from Igor/NIST 
+#package using SansView default values
+0.001	0.998801
+0.00105251	0.998672
+0.00110778	0.998529
+0.00116596	0.99837
+0.00122718	0.998195
+0.00129163	0.998001
+0.00135945	0.997785
+0.00143084	0.997547
+0.00150598	0.997283
+0.00158506	0.996991
+0.0016683	0.996667
+0.0017559	0.996309
+0.00184811	0.995912
+0.00194516	0.995473
+0.00204731	0.994986
+0.00215481	0.994448
+0.00226797	0.993852
+0.00238707	0.993192
+0.00251242	0.992462
+0.00264435	0.991653
+0.00278321	0.990759
+0.00292937	0.98977
+0.0030832	0.988675
+0.0032451	0.987464
+0.00341551	0.986125
+0.00359487	0.984644
+0.00378365	0.983007
+0.00398234	0.981197
+0.00419146	0.979197
+0.00441156	0.976988
+0.00464323	0.974548
+0.00488705	0.971854
+0.00514369	0.968881
+0.0054138	0.965601
+0.00569809	0.961984
+0.00599731	0.957997
+0.00631224	0.953605
+0.00664372	0.94877
+0.0069926	0.94345
+0.0073598	0.937601
+0.00774628	0.931175
+0.00815306	0.924123
+0.0085812	0.91639
+0.00903182	0.90792
+0.0095061	0.898654
+0.0100053	0.888531
+0.0105307	0.877486
+0.0110837	0.865457
+0.0116657	0.852378
+0.0122783	0.838186
+0.0129231	0.822819
+0.0136017	0.806219
+0.014316	0.788334
+0.0150678	0.769119
+0.015859	0.74854
+0.0166918	0.726576
+0.0175683	0.703223
+0.0184909	0.678493
+0.0194619	0.652424
+0.0204839	0.625076
+0.0215596	0.596538
+0.0226917	0.566929
+0.0238833	0.5364
+0.0251375	0.505131
+0.0264575	0.473333
+0.0278469	0.441243
+0.0293092	0.409122
+0.0308483	0.377244
+0.0324682	0.345891
+0.0341732	0.315341
+0.0359677	0.285861
+0.0378565	0.257691
+0.0398444	0.23104
+0.0419368	0.206075
+0.044139	0.182913
+0.0464568	0.161625
+0.0488964	0.142232
+0.0514641	0.124708
+0.0541666	0.108991
+0.057011	0.0949896
+0.0600048	0.0825877
+0.0631559	0.0716579
+0.0664723	0.0620666
+0.069963	0.0536799
+0.0736369	0.0463687
+0.0775038	0.0400111
+0.0815737	0.0344944
+0.0858574	0.0297157
+0.090366	0.0255826
+0.0951113	0.0220122
+0.100106	0.0189313
+0.105363	0.0162751
+0.110896	0.0139869
+0.116719	0.0120168
+0.122848	0.0103217
+0.129299	0.00886379
+0.136089	0.00761043
+0.143236	0.00653329
+0.150757	0.00560785
+0.158674	0.00481295
+0.167006	0.00413032
+0.175776	0.00354422
+0.185007	0.00304106
+0.194722	0.00260918
+0.204947	0.00223851
+0.21571	0.00192041
+0.227037	0.00164746
+0.238959	0.00141325
+0.251508	0.0012123
+0.264715	0.0010399
+0.278616	0.000892001
+0.293247	0.000765121
+0.308646	0.000656279
+0.324854	0.000562913
+0.341913	0.000482824
+0.359868	0.000414126
+0.378765	0.000355199
+0.398655	0.000304655
+0.41959	0.000261302
+0.441623	0.000224117
+0.464814	0.000192222
+0.489223	0.000164866
+0.514913	0.000141403
+0.541953	0.000121279
+0.570412	0.000104018
+0.600366	8.92138e-05
+0.631893	7.65164e-05
+0.665075	6.56261e-05
Index: sansmodels/test/prototypes/test_2dsim.py
===================================================================
--- sansmodels/test/prototypes/test_2dsim.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/prototypes/test_2dsim.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,82 @@
+from sans_extension.prototypes.c_models import CCanvas
+from sans.models.SphereModel import SphereModel
+from sans.models.CoreShellModel import CoreShellModel
+
+import math
+
+# Sphere ###############################
+sphere = SphereModel()
+sphere.setParam('radius',40.0)
+sphere.setParam('contrast',1.0)
+sphere.setParam('scale',1.0)
+sphere.setParam('background',0.0)
+
+can = CCanvas()
+
+print "ID", can.add()
+can.setParam(0,1,40.0)
+ 
+
+for q in [1,0.1,0.05,0.02,0.01,0.001,0.0001]:
+    ana = sphere.run([q,1.0])
+    sim = can.evaluate([q,1.0])
+
+    print "Sphere: ANA = %g   SIM = %g   (%g)" %(ana, sim, sim/ana)
+
+
+
+
+# Core-shell ###########################
+# This is a core shell model where the weight-average
+# of the SLDs is zero. The I(q) should go to zero as q->0.
+
+import time
+t_0 = time.time()
+
+sphere = CoreShellModel()
+# Core radius
+radius = 10.0
+thickness = 5.0
+sphere.setParam('radius', radius)
+# Shell thickness
+sphere.setParam('thickness', thickness)
+sphere.setParam('core_sld', 1.0)
+
+core_vol = 4.0/3.0*math.pi*radius*radius*radius
+outer_radius = radius+thickness
+shell_vol = 4.0/3.0*math.pi*outer_radius*outer_radius*outer_radius - core_vol
+shell_sld = -1.0*core_vol/shell_vol
+print "Shell SLD", shell_sld
+
+sphere.setParam('shell_sld', shell_sld)
+sphere.setParam('solvent_sld',0.0)
+sphere.setParam('background',0.0)
+sphere.setParam('scale',1.0)
+
+can = CCanvas()
+
+print "ID", can.add()
+can.setParam(0,1, outer_radius)
+can.setParam(0,2, shell_sld)
+
+
+print "ID", can.add()
+can.setParam(1,1, radius)
+can.setParam(1,2, 1.0)
+
+print "VOLS inner = %g, outer = %g, shell = %g" % (core_vol, shell_vol+core_vol, shell_vol)
+
+f = open('core-shell.txt','w')
+f.write("<q_cs>   <ans_cs>   <sim_cs>\n")
+for q in [1,0.1,0.05,0.04,0.03,0.02,0.01,0.005,0.001,0.0001]:
+#for i in range(400):
+    #q = 0.0001+i*0.005
+    ana = sphere.run([q,1.0])
+    sim = can.evaluate([q,1.0])
+    f.write("%g  %g  %g\n" %(q, ana, sim))
+    print "Core-shell: q=%g  ANA = %g   SIM = %g   (%g)" %(q, ana, sim, sim/ana)
+
+f.close()
+
+
+print "Time: ", time.time()-t_0
Index: sansmodels/test/prototypes/test_cyl_err2.py
===================================================================
--- sansmodels/test/prototypes/test_cyl_err2.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/prototypes/test_cyl_err2.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,164 @@
+try:
+    from sans.models.prototypes.SimCylinderF import SimCylinderF
+except:
+    print "This test uses the prototypes module."
+from sans.models.CylinderModel import CylinderModel
+import time, math, random
+
+def reset(seed=0):
+    sim = SimCylinderF()
+    sim.setParam('radius', 20)
+    sim.setParam('length', 200)
+    sim.setParam('phi', 1)
+    sim.setParam('theta', 1)
+    sim.setParam('seed', math.fmod(time.time()*100+seed,10000))
+    return sim
+
+# number of times to repeat each point
+N_q = 50
+# Relative error on the simulation
+sig_val = 0.20
+
+
+counter = 0
+
+sim = reset()
+sph = CylinderModel()
+
+
+sph.setParam('radius', 20)
+sph.setParam('length', 200)
+sph.setParam('scale', 1)
+sph.setParam('contrast',1)
+sph.setParam('length', 200)
+sph.setParam('cyl_phi', 1)
+sph.setParam('cyl_theta', 1)
+
+vol = math.pi*20*20*200
+
+f = open('sim_err_cyl.txt', 'w')
+f.write("<q>  <npts>  <sigma>\n")
+
+
+
+
+for i_npts in range(1):
+
+    # Find which q has an error of sig_val
+    #print err    
+    q_sigma = 0
+    i_min = 0
+    i_max = 0
+    i_last_max = 0
+    val_min = 0
+    val_max = 0
+    last_error = 0
+    last_val = 0
+    error_vec = []
+    
+    found_it = False
+    i_vec = 0
+        
+    
+    t_0 = time.time()
+    npts = 50000
+    #npts = 50000*i_npts+1000
+    #npts = 1000 * math.pow(2.0,(i_npts+1))
+    
+    sim = reset()
+    #sim.setParam('npoints', npts)
+    
+    # Vectors of errors
+    err = []
+    for i in range(80):
+        q = 0.40*(i) /50
+        
+        
+        # For each Q, repeat the simulation N_q times
+        sum_q_ana = 0
+        sum_q_sim = 0
+        sum = 0
+        vec = []
+        for i_q in range(N_q):
+            counter += 1
+            sim = reset(counter)
+            #sim.setParam('npoints', npts)
+                    
+            simval = sim.run([q, 0])
+            sum_q_ana += sph.run([q, 0])
+            sum_q_sim += simval
+            
+            vec.append(simval)
+            
+        mean = sum_q_sim/N_q
+        for val in range(N_q):
+            diff = vec[val] - mean
+            sum += diff * diff
+        sum /= (N_q-1)
+
+        ana_value = sum_q_ana/N_q
+        sim_value = sum_q_sim/N_q
+        
+         
+        try:    
+            err_i = [q, (sim_value-ana_value)/ana_value, ana_value, math.sqrt(sum)/ana_value]
+        except:
+            err_i = [q,0,0,0]
+        
+        err.append(err_i)
+                    
+        print err_i
+    
+        
+        # update extrema
+        if val_min > err_i[2]:
+            val_min = err_i[2]
+            
+        if val_max < err_i[2]:
+            val_max = err_i[2]
+        
+        # Find a minimum, where the error changes sign
+        if last_val==val_min and err_i[2] > val_min:
+            
+            
+            #print "  min", err_i[0]
+            if i_min > 0:
+                i_plateau = i_last_max
+      
+                # check error for plateau
+                #if math.fabs(err[i_plateau][1])>sig_val:
+                if math.fabs(err[i_max][3])>sig_val:
+                    error_vec.append(err[i_plateau])
+                    t_f = time.time()
+                    pred = sph.run([err[i_plateau][0],0])
+                    print '[',t_f-t_0,']',math.pow((vol/npts),-.6666), 'n=',npts, 'q=',err[i_plateau][0], \
+                        'err=',math.fabs(err[i_plateau][1]), i_min, 'sig=',err[i_plateau][3]
+                        
+                    f.write("%10g %10g %10g\n" % (err[i_plateau][0], npts, err[i_plateau][3]))
+                    found_it = True
+                    break
+                
+            i_min = i_vec
+            # Get ready for next maximum
+            val_max = val_min
+            
+        # check if we are at max
+        elif last_val==val_max and err_i[2]<val_max:
+            #print "   max", err[i_vec-1][0], err[i_vec-1][1]
+            i_last_max = i_max
+            i_max = i_vec-1
+            # get ready for next minimum
+            val_min = val_max
+
+        last_error = err_i[1]
+        last_val = err_i[2]
+        i_vec += 1
+
+        
+    if found_it == False:
+        print "Could not complete", npts
+    #print "Npts = %g; %s" %(npts, str(len(error_vec)))
+        
+
+f.close()
+
Index: sansmodels/test/prototypes/test_cyl_iq.py
===================================================================
--- sansmodels/test/prototypes/test_cyl_iq.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/prototypes/test_cyl_iq.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,77 @@
+try:
+    from sans.models.prototypes.TestSphere2 import TestSphere2
+    from sans.models.prototypes.SimCylinderF import SimCylinderF
+    from sans.models.prototypes.SimCylinder import SimCylinder
+except:
+    print "This test uses the prototypes module."
+from sans.models.SphereModel import SphereModel
+from sans.models.CylinderModel import CylinderModel
+import math, time
+
+
+def test_lores():
+
+    lores = open('lores.iq', 'r')
+    f = open('lores_check.txt', 'w')
+    content = lores.read()
+    lines = content.split('\n')
+    inum = 0
+    norma = 0.
+    for line in lines:
+        toks = line.split()
+        if len(toks)==2:
+            inum += 1
+            q = float(toks[0])
+            ana = sph.run(q)
+            if inum==1:
+                continue
+            elif inum==2:
+                norma = ana/float(toks[1])
+            lor = float(toks[1])*norma
+            f.write("%g %g %g\n" % (q, ana, lor))
+    f.close()
+            
+
+#sim = TestSphere2()
+#sph = SphereModel()
+sim = SimCylinderF()
+sph = CylinderModel()
+
+sim.setParam('radius', 20)
+sim.setParam('length', 200)
+sim.setParam('phi', 1)
+sim.setParam('theta', 1)
+sim.setParam('npoints',2500)
+#print sph.params
+
+sph.setParam('radius', 20)
+sph.setParam('scale', 1)
+sph.setParam('contrast',1)
+sph.setParam('length', 200)
+sph.setParam('cyl_phi', 1)
+sph.setParam('cyl_theta', 1)
+
+#print "ANA", sph.run(0.1)
+#print "SIM", sim.run(0.1)
+
+f = open('sim_iq.txt', 'w')
+f.write("<q>  <ana>  <sim>\n")
+
+t_0 = time.time()
+
+for i in range(60):
+    q = 0.01 * (i+1) /3.0
+    #ana_value = sph.run([q,0])
+    #sim_value = sim.run([q,0])
+    ana_value = sph.run(q)
+    sim_value = sim.run(q)
+    ratio = 0
+    if sim_value>0:
+        ratio = sim_value/ana_value
+    print q, ana_value, sim_value, ratio
+    f.write("%10g %10g %10g\n" % (q, ana_value, sim_value))
+
+t_f = time.time()
+print "Time = ", t_f-t_0
+f.close()
+
Index: sansmodels/test/prototypes/test_simulation.py
===================================================================
--- sansmodels/test/prototypes/test_simulation.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/prototypes/test_simulation.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,275 @@
+try:
+    from sans.models.prototypes.SimCylinder import SimCylinder
+except:
+    print "This test uses the prototypes module."
+    
+from sans.models.CylinderModel import CylinderModel
+
+import os, sys
+
+def simulate(filename="simul.txt", npts=500):
+    output_file = open(filename, 'w')
+    #output_file = open("simul_phi=0_theta=1_57_l=400_r=20_9.txt", 'w')
+    
+    sim = SimCylinder()
+    sim.setParam('scale', 1.0)
+    #sim.setParam('length', 100.0)
+    #sim.setParam('radius', 40.0)
+    sim.setParam('length', 400.0)
+    sim.setParam('radius', 20.0)
+    sim.setParam('theta', 1.57)
+    sim.setParam('phi', 0.0)
+    sim.setParam('qmax', 0.2)
+    
+    output_file.write("<q_value>  <ana_value>  <sim_value>\n")
+    norma = 0
+    for i in range(npts):
+        q = 1.0/npts*(i+1)
+        
+        cyl_val = sim.run(q)
+        sim_val = sim.run([q, 0.0])
+        if i==0:
+            norma = cyl_val/sim_val
+        
+        #print q, cyl_val, sim_val, sim_val/cyl_val
+        output_file.write("%10g %10g %10g\n" % (q, cyl_val, sim_val*norma))
+        
+    output_file.close()
+     
+def create_model():
+    sim = SimCylinder()
+    sim.setParam('scale', 1.0)
+    sim.setParam('length', 100.0)
+    sim.setParam('radius', 40.0)
+    # simul and simul_2
+    #sim.setParam('theta', 1.57)
+    #sim.setParam('phi', 0.0)
+    sim.setParam('theta', 0.0)
+    sim.setParam('phi', 1.0)
+    sim.setParam('qmax', 0.2)
+    return sim
+    
+def comp(): 
+    """
+        Simple test that should give 1 for the ratio
+        of simulated and analytical
+    """
+    sim = create_model()
+    
+    ana_val = sim.run(.05)
+    sim_val = sim.run([0.05, 0])
+    print ana_val, sim_val, ana_val/sim_val
+    
+    
+#    ana_val = sim.run(.05)
+#    sim_val = sim.run([0.05, 1])
+#    print ana_val, sim_val, ana_val/sim_val
+    
+#    sim = create_model()
+#    sim.setParam('theta', 1.0)
+#    sim.setParam('phi', 1.0)   
+#    ana_val = sim.run(.05)
+#    sim_val = sim.run([0.05, 1])
+#    print ana_val, sim_val, ana_val/sim_val
+    
+#    sim = create_model()
+#    sim.setParam('theta', 1.0)
+#    sim.setParam('phi', 2.0)
+#    ana_val = sim.run(.05)
+#    sim_val = sim.run([0.05, 1])
+#    print ana_val, sim_val, ana_val/sim_val
+    
+    sim = create_model()
+    sim.setParam('theta', 1.0)
+    sim.setParam('phi', -2.0)
+    ana_val = sim.run(.05)
+    sim_val = sim.run([0.15, 1])
+    print ana_val, sim_val, ana_val/sim_val
+    
+def add_error_to_file(prefix = "", dir = "output"):
+    import os, math
+    
+    # Open standard deviation file
+    std_file = open("%s/std_simul.txt" % dir, 'r')
+    std_content = std_file.read()
+    std_lines = std_content.split('\n')
+    
+    std_values = {}
+    for line in std_lines:
+        if line == std_lines[0]:
+            continue
+        
+        toks = line.split()
+        if not len(toks) > 3:
+            continue
+
+        std_values[toks[0]] = float(toks[2])
+    
+    std_file.close()
+    
+    # Read the files
+    
+    file_list = os.listdir(dir)
+    
+    for file in file_list:
+        if file.count(prefix)>0:
+            print "Reading", file
+    
+            file_obj = open("%s/%s" % (dir, file), 'r')
+            
+            # open new file
+            file_new = open("%s/error-%s" % (dir, file), 'w')
+            file_content = file_obj.read()
+            lines = file_content.split('\n')
+            for line in lines:
+                if line == lines[0]:
+                    file_new.write(line+'\n')
+                    continue
+                    
+                toks = line.split()
+                
+                if not len(toks) == 3:
+                    file_new.write(line+'\n')
+                    continue
+            
+                error = 0
+                if toks[0].lower() in std_values:
+                    error = float(toks[2]) * std_values[toks[0].lower()]
+                    
+                file_new.write(line+" %10g\n" % error)
+                
+            file_obj.close()
+            file_new.close()
+    
+    
+    
+def std_estimate(prefix = "", dir="output"):
+    import os, math
+    
+    file_list = os.listdir(dir)
+    output_file = open("%s/std_simul.txt" % dir, 'w')
+    output_file.write("<q_value>   <std>  <frac>\n")
+    values = {}
+    
+    for file in file_list:
+        if file.count(prefix)>0:
+            print "Reading", file
+            file_obj = open("%s/%s" % (dir, file), 'r')
+            file_content = file_obj.read()
+            lines = file_content.split('\n')
+            for line in lines:
+                if line == lines[0]:
+                    continue
+                toks = line.split()
+                
+                if not len(toks) == 3:
+                    continue
+                
+                if toks[0] not in values:
+                    values[toks[0]] = []
+                    
+                values[toks[0]].append(float(toks[2]))
+                                       
+    q_list = values.keys()
+    q_list.sort()                 
+    for q in q_list:
+        num = len(values[q])
+        sum = 0
+        mean = 0
+        for val in range(num):
+            mean += values[q][val] 
+        mean /= num
+            
+        for val in range(num):
+            diff = values[q][val] - mean
+            sum += diff * diff
+        sum /= (num-1)
+        #print q, math.sqrt(sum)
+    
+        output_file.write("%10s %10g %10g %10g\n" % (q, math.sqrt(sum), math.sqrt(sum)/mean, math.sqrt(sum)/mean*100.0))
+        
+    output_file.close()
+    
+    
+    # sqrt( 1/(N-1) sum[ (x-mean)**2 ] )
+    
+def test_volume_pts():
+    import random, math, time
+    
+    print "Generating points"
+    pt_list = []
+    for i in range(50000):
+        x = random.random()
+        y = random.random()
+        z = random.random()
+        pt_list.append([x, y, z])
+        
+    # Compute list of closest distance for each point
+    print "Computing distances"
+    closest_list = []
+    t_init = time.time()
+    
+    for i in range(len(pt_list)):
+        if math.fmod(i,100)==0:
+            print i, time.time()-t_init
+            t_init = time.time()
+        pt = pt_list[i]
+        
+        min_dist = -1.0
+        for j in range(i+1, len(pt_list)):
+            pt_2 = pt_list[j]
+            #print pt_2
+            dx = pt[0]-pt_2[0]
+            dy = pt[1]-pt_2[1]
+            dz = pt[2]-pt_2[2]
+            dist = math.sqrt( dx*dx + dy*dy + dz*dz ) 
+            if min_dist<0 or dist < min_dist:
+                min_dist = dist
+             
+        closest_list.append(min_dist)        
+        
+    # Analyze list of distances
+    print "Analyzing"
+    sum = 0
+    for d in closest_list:
+        sum += d
+    average = sum/len(closest_list)
+    
+    sum = 0
+    for d in closest_list:
+        diff = d - average
+        sum += diff*diff
+    sum /= len(closest_list)
+    
+    print "%5g +/- %5g)" % (average, math.sqrt(sum))
+    
+                              
+            
+    
+if __name__ == '__main__':
+    #test_volume_pts()
+    #simulate("simul_phi=0_theta=1_57_l=400_r=20_test.txt")
+    #std_estimate("simul_phi=0_theta=1_57_l=400_r=20")
+    #add_error_to_file("l=400_r=20.txt")
+    
+    option = "error"
+    
+    #if len(sys.argv)>1:
+    if len(option)>0:
+        if option=="gen":
+            ifile = 0
+            for i in range(100):
+                ifile += 1
+                #print "simul_qmax=1_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile
+                #simulate("simul_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile)
+                print "simul_qmax=1_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile
+                simulate("output/pt5000/simul_phi=0_theta=1_57_l=400_r=20_%g.txt" % ifile)
+        elif option=="comp":
+            comp()
+        elif option=="std":
+            #std_estimate("simul_phi=0_theta=1_57_l=400_r=20")
+            std_estimate("simul_phi=0_theta=1_57_l=400_r=20", "output/pt5000")
+        elif option=="error":
+            #add_error_to_file("l=400_r=20.txt")
+            add_error_to_file("l=400_r=20_1.txt", "output/pt5000")
+            
Index: sansmodels/test/prototypes/test_sphere_err2.py
===================================================================
--- sansmodels/test/prototypes/test_sphere_err2.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/prototypes/test_sphere_err2.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,156 @@
+try:
+    from sans.models.prototypes.SimSphereF import SimSphereF
+except:
+    print "This test uses the prototypes module."
+from sans.models.SphereModel import SphereModel
+import time, math, random
+
+def reset(seed=0):
+    sim = SimSphereF()
+    sim.setParam('radius', 60)
+    sim.setParam('seed', math.fmod(time.time()*100+seed,10000))
+    return sim
+
+# number of times to repeat each point
+N_q = 50
+# Relative error on the simulation
+sig_val = 0.10
+
+
+counter = 0
+
+sim = reset()
+sph = SphereModel()
+
+
+sph.setParam('radius', 60)
+sph.setParam('scale', 1)
+
+vol = 4/3*math.pi*60*60*60
+
+f = open('sim_err_4.txt', 'w')
+f.write("<q>  <npts>  <sigma>\n")
+
+
+
+
+for i_npts in range(15):
+
+    # Find which q has an error of sig_val
+    #print err    
+    q_sigma = 0
+    i_min = 0
+    i_max = 0
+    i_last_max = 0
+    val_min = 0
+    val_max = 0
+    last_error = 0
+    last_val = 0
+    error_vec = []
+    
+    found_it = False
+    i_vec = 0
+        
+    
+    t_0 = time.time()
+    npts = 50000*i_npts+1000
+    #npts = 1000 * math.pow(2.0,(i_npts+1))
+    
+    sim = reset()
+    sim.setParam('npoints', npts)
+    
+    # Vectors of errors
+    err = []
+    for i in range(80):
+        q = 0.40*(i) /50
+        
+        
+        # For each Q, repeat the simulation N_q times
+        sum_q_ana = 0
+        sum_q_sim = 0
+        sum = 0
+        vec = []
+        for i_q in range(N_q):
+            counter += 1
+            sim = reset(counter)
+            sim.setParam('npoints', npts)
+                    
+            simval = sim.run([q, 0])
+            sum_q_ana += sph.run([q, 0])
+            sum_q_sim += simval
+            
+            vec.append(simval)
+            
+        mean = sum_q_sim/N_q
+        for val in range(N_q):
+            diff = vec[val] - mean
+            sum += diff * diff
+        sum /= (N_q-1)
+
+        ana_value = sum_q_ana/N_q
+        sim_value = sum_q_sim/N_q
+        
+        
+        
+        try:    
+            err_i = [q, (sim_value-ana_value)/ana_value, ana_value, math.sqrt(sum)/ana_value]
+        except:
+            err_i = [q,0,0,0]
+        
+        err.append(err_i)
+                    
+         
+    
+        
+        # update extrema
+        if val_min > err_i[2]:
+            val_min = err_i[2]
+            
+        if val_max < err_i[2]:
+            val_max = err_i[2]
+        
+        # Find a minimum, where the error changes sign
+        if last_val==val_min and err_i[2] > val_min:
+            
+            
+            #print "  min", err_i[0]
+            if i_min > 0:
+                i_plateau = i_last_max
+      
+                # check error for plateau
+                #if math.fabs(err[i_plateau][1])>sig_val:
+                if math.fabs(err[i_max][3])>sig_val:
+                    error_vec.append(err[i_plateau])
+                    t_f = time.time()
+                    pred = sph.run([err[i_plateau][0],0])
+                    print '[',t_f-t_0,']',math.pow((vol/npts),-.6666), 'n=',npts, 'q=',err[i_plateau][0], \
+                        'err=',math.fabs(err[i_plateau][1]), i_min, 'sig=',err[i_plateau][3]
+                        
+                    f.write("%10g %10g %10g\n" % (err[i_plateau][0], npts, err[i_plateau][3]))
+                    found_it = True
+                    break
+                
+            i_min = i_vec
+            # Get ready for next maximum
+            val_max = val_min
+            
+        # check if we are at max
+        elif last_val==val_max and err_i[2]<val_max:
+            #print "   max", err[i_vec-1][0], err[i_vec-1][1]
+            i_last_max = i_max
+            i_max = i_vec-1
+            # get ready for next minimum
+            val_min = val_max
+
+        last_error = err_i[1]
+        last_val = err_i[2]
+        i_vec += 1
+
+        
+    if found_it == False:
+        print "Could not complete", npts
+    #print "Npts = %g; %s" %(npts, str(len(error_vec)))
+        
+
+f.close()
+
Index: sansmodels/test/prototypes/test_sphere_iq.py
===================================================================
--- sansmodels/test/prototypes/test_sphere_iq.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/prototypes/test_sphere_iq.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,43 @@
+try:
+    from sans.models.prototypes.SimSphereF import SimSphereF
+except:
+    print "This test uses the prototypes module."
+from sans.models.SphereModel import SphereModel
+import math, time
+
+
+
+sim = SimSphereF()
+sph = SphereModel()
+
+sim.setParam('radius', 60)
+sim.setParam('npoints', 50000)
+
+sph.setParam('radius', 60)
+sph.setParam('scale', 1)
+
+
+f = open('sim_iq.txt', 'w')
+f.write("<q>  <ana>  <sim> <err>\n")
+
+t_0 = time.time()
+
+#for i in range(60):
+for i in range(100):
+    #q = 0.01 * (i+1) /3.0
+    q = 0.05 + 0.20*(i+1) /100
+    
+    ana_value = sph.run([q,0])
+    sim_value = sim.run([q,0])
+#    ana_value = sph.run(q)
+#    sim_value = sim.run(q)
+    ratio = 0
+    if sim_value>0:
+        ratio = sim_value/ana_value
+    print q, ana_value, sim_value, ratio
+    f.write("%10g %10g %10g %10g\n" % (q, ana_value, sim_value, (sim_value-ana_value)/ana_value))
+
+t_f = time.time()
+print "Time = ", t_f-t_0
+f.close()
+
Index: sansmodels/test/sphere_testdata.txt
===================================================================
--- sansmodels/test/sphere_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/sphere_testdata.txt	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,135 @@
+pythonclass = SphereModel
+scale = 1
+radius = 60
+contrast = 1e-6
+background = 0.01
+
+DATA
+0.001	90.4227444561307
+0.00105251266011778	90.4157276053359
+0.00110778289970821	90.4079550029624
+0.00116595552660488	90.3993453156916
+0.00122718295288593	90.3898084718774
+0.00129162559419317	90.3792447263187
+0.00135945229002046	90.3675436251717
+0.00143084074607265	90.3545828615347
+0.00150597799985384	90.3402270095186
+0.00158506091070502	90.3243261248614
+0.00166829667557485	90.3067141976634
+0.00175590337187494	90.287207442629
+0.00184811052884188	90.2656024098205
+0.00194515972890305	90.2416738978344
+0.00204730524062173	90.2151726495366
+0.00215481468487986	90.185822808414
+0.00226796973604376	90.1533191119972
+0.00238706685995004	90.1173237963576
+0.00251241809064502	90.0774631837544
+0.00264435184791283	90.0333239229256
+0.00278321379773411	89.9844488493339
+0.00292936775792964	89.9303324299529
+0.00308319665136179	89.8704157547851
+0.00324510350919104	89.8040810347349
+0.00341551252681621	89.7306455629486
+0.00359487017526494	89.6493550944954
+0.00378364637094618	89.5593765971608
+0.00398233570682956	89.4597903244572
+0.00419145874827721	89.3495811609297
+0.0044115633969232	89.2276291894534
+0.00464322632617388	89.0926994310602
+0.00488705449209019	88.9434307099749
+0.0051436867236104	88.7783236005616
+0.0054137953962797	88.5957274193056
+0.00569808819387176	88.393826234303
+0.00599730996251769	88.1706238779775
+0.00631224466220038	87.9239279666488
+0.00664371742072679	87.6513329544612
+0.00699259669556001	87.3502022802804
+0.00735979654917468	87.0176497061855
+0.00774627904389752	86.6505199970915
+0.00815305676250721	86.2453691549684
+0.00858119546119774	85.7984445008535
+0.00903181686185589	85.3056649962709
+0.00950610159096858	84.7626023162297
+0.0100052922728602	84.1644633324426
+0.010530696785364	83.5060748418634
+0.0110836916864573	82.7818715864011
+0.0116657258208385	81.9858888591154
+0.0122783241158954	81.1117612843166
+0.0129230915770094	80.1527296972877
+0.0136017174926639	79.1016584357033
+0.0143159798603742	77.9510657891023
+0.0150677500450351	76.6931708311579
+0.0158589976818897	75.3199603730699
+0.0166917958369675	73.8232803087866
+0.0175683264385096	72.1949561473611
+0.0184908859936133	70.4269480041077
+0.0194618916050726	68.5115456917836
+0.0204838873041789	66.4416097339716
+0.0215595507160742	64.2108640045017
+0.0226917000751195	61.8142451337187
+0.0238833016086589	59.248312629239
+0.0251374773085249	56.5117216066172
+0.0264575131106459	53.605756841905
+0.027846867504187	50.5349222351867
+0.0293091805927793	47.3075733855052
+0.0308482836315787	43.9365725134711
+0.0324682090651407	40.4399341936915
+0.0341732010924115	36.8414172059712
+0.035967726786514	33.1710025095031
+0.0378564877984635	29.4651805895993
+0.0398444326754772	25.7669546222864
+0.0419367698261504	22.1254514069004
+0.0441389811664687	18.5950234076791
+0.0464568364824087	15.2337275099316
+0.0488964085467568	12.1010856393634
+0.0514640890297529	9.2550766770957
+0.0541666052452436	6.74838567895613
+0.0570110377762212	4.62405104866114
+0.0600048390259259	2.9108039900483
+0.0631558527431166	1.61857916581746
+0.0664723345726646	0.734868643264245
+0.0699629736853145	0.222751268886955
+0.0736369155432808	0.021493170785741
+0.0775037858613269	0.0505007176184419
+0.0815737158261042	0.217030561955665
+0.085857368639825	0.427366151211124
+0.0903659674578153	0.600177099372201
+0.0951113247931421	0.679643993347096
+0.100105873465356	0.644995876938007
+0.105362699174436	0.512882672304445
+0.110895574785276	0.330050926618079
+0.116718996412541	0.156436599531048
+0.122848221400442	0.0427161530728255
+0.129299308296917	0.0102364291202494
+0.136089158926978	0.0427676396140632
+0.143235562675425	0.0962906936732686
+0.150757243094979	0.124412512424065
+0.158673906961919	0.106245316452041
+0.167006295907771	0.0581157186256502
+0.175776240762306	0.0180003127669836
+0.185006718750238	0.0120232942917672
+0.194721913691476	0.0314717764737715
+0.20494727936264	0.0445914093009115
+0.215709606185875	0.0335942223501167
+0.227037091419654	0.0143439512133508
+0.238959413035505	0.0113779690004859
+0.251507807474183	0.0214441689681625
+0.264715151485044	0.0221334416546839
+0.278616048263005	0.012423248413131
+0.2932469181088	0.0111309676391173
+0.308646093850034	0.0164251291976273
+0.324853921273063	0.0133484308747301
+0.341912864828804	0.0100937607456987
+0.359867618889456	0.0133061305111565
+0.378765224847594	0.0115497267629865
+0.398655194364451	0.0103763850351245
+0.4195896390903	0.0120165913778557
+0.441623407196792	0.0100464754133085
+0.464814227078974	0.0111896261669603
+0.489222858603482	0.0102144295433158
+0.514913252299177	0.0106974772728633
+0.541952716907305	0.0101315993523187
+0.570412095730168	0.0105409279971524
+0.600365952240318	0.0100029843668479
+0.631892765436603	0.0103719406877445
+0.665075135458861	0.0101206894788735
Index: sansmodels/test/testModel.xml
===================================================================
--- sansmodels/test/testModel.xml	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/testModel.xml	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,2 @@
+<Component class='EllipticalCylinderModel' name='EllipticalCylinderModel'>
+</Component>
Index: sansmodels/test/test_pickle_cyl.py
===================================================================
--- sansmodels/test/test_pickle_cyl.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/test_pickle_cyl.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,9 @@
+import pickle
+from sans.models.CylinderModel import CylinderModel
+import copy
+
+model = CylinderModel()
+model.setParam('cyl_theta', 1.234)
+p = copy.deepcopy(model)
+
+assert p.getParam('cyl_theta') == model.getParam('cyl_theta')
Index: sansmodels/test/testcase_generator.py
===================================================================
--- sansmodels/test/testcase_generator.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/testcase_generator.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,770 @@
+"""
+    Random test-case generator for BaseComponents
+    
+"""
+import time
+
+def randomModel():
+    """ Return a random model name """
+    from sans.models.ModelFactory import ModelFactory
+    from random import random
+    from math import floor
+    
+    model_list = ModelFactory().getAllModels()
+    ready = False
+    while not ready:
+        rnd_id = int(floor(random()*len(model_list)))
+        if model_list[rnd_id] not in ["TestSphere2", "DataModel"]:
+            ready = True
+    return model_list[rnd_id]
+
+class ReportCard: # pylint: disable-msg=R0902
+    """ Class to hold test-case results """
+    
+    def __init__(self):
+        """ Initialization """
+        ## Number of test cases
+        self.n_cases = 0
+        ## Number of passed test cases
+        self.n_cases_pass = 0
+        ## Number of Evaluation calls
+        self.n_eval = 0
+        ## Number of passed Evaluation calls
+        self.n_eval_pass = 0
+        ## Number of SetParam calls
+        self.n_set = 0
+        ## Number of passed Set calls
+        self.n_set_pass = 0
+        ## Number of GetParam calls
+        self.n_get = 0
+        ## Number of passed Get calls
+        self.n_get_pass = 0
+        ## Number of load calls
+        self.n_load = 0
+        ## Number of passed Load calls
+        self.n_load_pass = 0
+        ## Number of save calls
+        self.n_save = 0
+        ## Number of passed Save calls
+        self.n_save_pass = 0
+        ## Number of Add calls
+        self.n_add = 0
+        ## Number of passed Add calls
+        self.n_add_pass = 0
+        ## Number of Sub calls
+        self.n_sub = 0
+        ## Number of passed Sub calls
+        self.n_sub_pass = 0
+        ## Number of Div calls
+        self.n_div = 0
+        ## Number of passed Div calls
+        self.n_div_pass = 0
+        ## Number of mul calls
+        self.n_mul = 0
+        ## Number of passed Mul calls
+        self.n_mul_pass = 0
+        ## Test log
+        self.log = ""
+        ## Trace
+        self.trace = ""
+        ## Model tested
+        self.model = ""
+        ## List of all models tested
+        self.modelList = []
+        
+        
+    def __add__(self, other):
+        """ Add two report cards
+            @param other: other report to add
+            @return: updated self
+        """
+        
+        self.n_cases += other.n_cases
+        self.n_cases_pass += other.n_cases_pass
+        self.n_eval += other.n_eval
+        self.n_eval_pass += other.n_eval_pass
+        self.n_set += other.n_set
+        self.n_set_pass += other.n_set_pass
+        self.n_get += other.n_get
+        self.n_get_pass += other.n_get_pass
+        self.n_load += other.n_load
+        self.n_load_pass += other.n_load_pass
+        self.n_save += other.n_save
+        self.n_save_pass += other.n_save_pass
+        self.n_add += other.n_add
+        self.n_add_pass += other.n_add_pass
+        self.n_sub += other.n_sub
+        self.n_sub_pass += other.n_sub_pass
+        self.n_mul += other.n_mul
+        self.n_mul_pass += other.n_mul_pass
+        self.n_div += other.n_div
+        self.n_div_pass += other.n_div_pass
+        if len(other.log)>0:
+            self.log += other.log
+        if len(other.trace)>0:
+            self.trace += other.trace
+            
+        if not other.model in self.modelList:
+            self.modelList.append(other.model)
+            
+        return self
+        
+    def isPassed(self):
+        """ Returns true if no error was found """
+        if self.n_cases_pass < self.n_cases \
+            or self.n_save_pass < self.n_save \
+            or self.n_load_pass < self.n_load \
+            or self.n_set_pass < self.n_set \
+            or self.n_get_pass < self.n_get \
+            or self.n_eval_pass < self.n_eval \
+            or self.n_add_pass < self.n_add \
+            or self.n_sub_pass < self.n_sub \
+            or self.n_mul_pass < self.n_mul \
+            or self.n_div_pass < self.n_div:
+            return False
+        return True
+        
+    def __str__(self):
+        """ String representation of the report card """
+        from sans.models.ModelFactory import ModelFactory
+        
+        rep = "Detailed output:\n"
+        rep += self.log
+        rep += "\n"
+        rep += "Total number of cases: %g\n" % self.n_cases
+        rep += "   Passed:             %g\n" % self.n_cases_pass
+        rep += "\n"
+        self.modelList.sort()
+        rep += "Models tested: %s\n" % self.modelList
+        all_models = ModelFactory().getAllModels()
+        all_models.sort()
+        rep += "\n"
+        rep += "Available models: %s\n" % all_models
+        rep += "\n"
+        rep += "Breakdown:\n"
+        rep += "   Eval:          %g / %g\n" % (self.n_eval_pass, self.n_eval)
+        rep += "   Set:           %g / %g\n" % (self.n_set_pass, self.n_set)
+        rep += "   Get:           %g / %g\n" % (self.n_get_pass, self.n_get)
+        rep += "   Load:          %g / %g\n" % (self.n_load_pass, self.n_load)
+        rep += "   Save:          %g / %g\n" % (self.n_save_pass, self.n_save)
+        rep += "   Add:           %g / %g\n" % (self.n_add_pass, self.n_add)
+        rep += "   Sub:           %g / %g\n" % (self.n_sub_pass, self.n_sub)
+        rep += "   Mul:           %g / %g\n" % (self.n_mul_pass, self.n_mul)
+        rep += "   Div:           %g / %g\n" % (self.n_div_pass, self.n_div)
+        return rep
+    
+        
+
+class TestCaseGenerator:
+    """ Generator for suite of test-cases
+    """
+    
+    def __init__(self):
+        """ Initialization
+        """
+        
+        self.n_tests = 0
+        self.n_passed = 0
+        self.time = 0
+        self.reportCard = ReportCard()
+    
+    def generateFiles(self, number, file_prefix):
+        """ Generate test-case files
+            @param number: number of files to generate
+            @param file_prefix: prefix for the file names
+        """
+        
+        for i in range(number):
+            filename = "%s_%d.xml" % (file_prefix, i)
+            self.generateFileTest(filename)
+            self.n_tests += 1
+            
+    def generateAndRun(self, number):
+        """ Generate test-cases and run them
+            @param number: number of test-cases to generate
+        """
+        start_time = time.time()
+        for i in range(number):
+            textcase = self.generateTest()
+            t = TestCase(text = textcase)
+            passed = t.run()
+            self.reportCard += t.reportCard
+            if not passed:
+                t = time.localtime()
+                xmloutput = open("error_%i-%i-%i-%i-%i-%i_%i.xml" % \
+                 (t[0],t[1],t[2],t[3],t[4],t[5],self.reportCard.n_cases),'w')
+                xmloutput.write(textcase)
+                xmloutput.close()
+
+                
+        self.time += time.time()-start_time
+        print self.reportCard        
+        
+    def generateFileTest(self, filename = "tmp.xml"):
+        """
+            Write a random test-case in an XML file
+            @param filename: name of file to write to
+        """
+        text = self.generateTest()
+        # Write test case in file
+        xmlfile = open(filename,'w')
+        xmlfile.write(text)
+        xmlfile.close()
+    
+    
+    def generateTest(self):
+        """
+            Generate an XML representation of a random test-case
+        """
+        import random
+        
+        #t = TestCase()
+        text = "<?xml version=\"1.0\"?>\n"
+        text  += "<TestCase>\n"
+        stimulus = "eval"
+    
+        loop = True
+        while loop:
+            rnd = random.random()
+            
+            # run 50%
+            if rnd <= 0.5:
+                stimulus = "eval"
+            elif rnd>0.5 and rnd<=0.7:
+                stimulus = "set"
+            elif rnd>0.7 and rnd<=0.72:
+                stimulus = "save"
+            elif rnd>0.72 and rnd<=0.74:
+                stimulus = "load"
+            elif rnd>0.74 and rnd<=0.8:
+                stimulus = "get"
+            elif rnd>0.8 and rnd<=0.81:
+                stimulus = "add"
+            elif rnd>0.81 and rnd<=0.82:
+                stimulus = "div"
+            elif rnd>0.82 and rnd<=0.83:
+                stimulus = "mul"
+            elif rnd>0.83 and rnd<=0.84:
+                stimulus = "sub"
+            else:
+                # just run and quit
+                stimulus = "eval"
+                loop = False
+                
+            text += "  <Stimulus id=\"%s\"/>\n" % stimulus
+        text += "</TestCase>"
+        
+        return text
+    
+        
+class TestCase:
+    """ Test-case class """
+    
+    def __init__(self, filename = None, text = None):
+        """ Initialization
+            @param filename: name of file containing the test case
+        """
+        #from sans.models.ModelFactory import ModelFactory
+        self.filename = filename
+        self.text = text
+        #self.model = ModelFactory().getModel(randomModel())
+        self.model = getRandomModelObject()
+        #self.model = ModelFactory().getModel("SphereModel")
+        self.passed = True
+        self.reportCard = ReportCard()
+        
+    
+    def run(self):
+        """ Read the test case and execute it """
+        from xml.dom.minidom import parse
+        from xml.dom.minidom import parseString
+        
+        # Initialize report
+        self.reportCard = ReportCard()
+        self.reportCard.model = self.model.name
+        self.reportCard.n_cases = 1
+        
+        if not self.text == None:
+            dom = parseString(self.text)
+        elif not self.filename == None:
+            dom = parse(self.filename)
+        else:
+            print "No input to parse"
+            return False
+        
+        if dom.hasChildNodes():
+            for n in dom.childNodes:
+                if n.nodeName == "TestCase":
+                    self.processStimuli(n)
+            
+        # Update report card        
+        if self.passed:
+            self.reportCard.n_cases_pass = 1
+            
+        return self.passed
+                          
+    def processStimuli(self, node):
+        """ Process the stimuli list in the TestCase node 
+            of an XML test-case file
+            @param node: test-case node
+        """
+        import testcase_generator as generator
+        report = ReportCard()
+        report.trace = "%s\n" % self.model.name
+        
+        self.passed = True
+        if node.hasChildNodes():
+            for n in node.childNodes:
+                if n.nodeName == "Stimulus":
+                    
+                    s_type = None
+                    if n.hasAttributes():
+                        # Get stilumus ID
+                        for i in range(len(n.attributes)):
+                            attr_name = n.attributes.item(i).name
+                            if attr_name == "id":
+                                s_type = n.attributes.item(i).nodeValue
+                    if hasattr(generator,"%sStimulus" % s_type):
+                        stimulus = getattr(generator,"%sStimulus" % s_type)
+                        #print s_type, self.model.name
+                        m, res = stimulus(self.model)
+                        #print "     ", m.name
+                        self.model = m
+                        if not res.isPassed():
+                            self.passed = False
+                        
+                        report += res
+                        
+                    else:
+                        print "Stimulus %s not found" % s_type
+                        
+        self.reportCard += report
+        
+        if not self.passed:
+            print "\nFailure:"
+            print report.trace
+        return self.passed
+        
+    
+def evalStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwise
+    """
+    minval = 0.001
+    maxval = 1.0
+    # Call run with random input
+    import random, math
+    input_value = random.random()*(maxval-minval)+minval
+    
+    # Catch division by zero, which can happen
+    # when creating random models
+    try:
+        # Choose whether we want 1D or 2D
+        if random.random()>0.5:
+            output = model.run(input_value)
+        else:
+            output = model.run([input_value, 2*math.pi*random.random()])            
+    except ZeroDivisionError:
+        print "Error evaluating model %s: %g" % (model.name, input_value)
+        output = None
+        
+    #print "Eval: %g" % output
+    
+    # Oracle bit - just check that we have a number...
+    passed = False
+    try:
+        if output != None and math.fabs(output) >= 0: 
+            passed = True
+    except:
+        print "---> Could not compute abs val", output, model.name
+        
+    
+    report = ReportCard()
+    report.n_eval = 1
+    if passed:
+        report.n_eval_pass = 1
+    else:
+        report.log = "Eval: bad output value %s\n" % str(output)
+        
+    report.trace = "Eval(%g) = %s %i\n" % (input_value, str(output), passed)    
+    return model, report
+
+def setStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwize
+    """
+    # Call run with random input
+    import random, math
+    minval = 1
+    maxval = 5
+    
+    # Choose a parameter to change
+    keys = model.getParamList()
+    if len(keys)==0:
+        #print model.name+" has no params"
+        return model, ReportCard()
+    
+    p_len = len(keys)
+    i_param = int(math.floor(random.random()*p_len))
+    p_name  = keys[i_param]
+    
+    # Choose a value
+    # Check for min/max
+    if hasattr(model, "details"):
+        if model.details.has_key(p_name):
+            if model.details[p_name][1] != None:
+                minval = model.details[p_name][1]
+            if model.details[p_name][2] != None:
+                maxval = model.details[p_name][2]
+        elif model.other.details.has_key(p_name):
+            if model.other.details[p_name][1] != None:
+                minval = model.other.details[p_name][1]
+            if model.other.details[p_name][2] != None:
+                maxval = model.other.details[p_name][2]
+        elif model.operateOn.details.has_key(p_name):
+            if model.operateOn.details[p_name][1] != None:
+                minval = model.operateOn.details[p_name][1]
+            if model.operateOn.details[p_name][2] != None:
+                maxval = model.operateOn.details[p_name][2]
+            
+    input_val = random.random()*(maxval-minval)+minval
+    model.setParam(p_name, input_val)
+    
+    # Read back
+    check_val = model.getParam(p_name)
+    #print "Set: %s = %g" % (p_name, check_val)
+    
+    # Oracle bit
+    passed = False
+    if check_val == input_val: 
+        passed = True
+    
+    report = ReportCard()
+    report.n_set = 1
+    if passed:
+        report.n_set_pass = 1
+    else:
+        report.log = "Set: parameter %s not set properly %g <> %g\n" % \
+            (p_name, input_val, check_val)
+        
+    report.trace = "Set %s = %g %i\n" % (p_name, input_val, passed)    
+    return model, report
+
+def getStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwise
+    """
+    import random, math
+    # Choose a parameter to change
+    keys = model.getParamList()
+    if len(keys)==0:
+        #print model.name+" has no params"
+        return model, ReportCard()    
+    
+    p_len = len(keys)
+    i_param = int(math.floor(random.random()*p_len))
+    p_name  = keys[i_param]
+    
+    # Read back
+    check_val = model.getParam(p_name)
+    #print "Get: %s = %g" % (p_name, check_val)
+    
+    # Oracle bit
+    passed = False
+    if math.fabs(check_val) >= 0: 
+        passed = True
+        
+    report = ReportCard()
+    report.n_get = 1
+    if passed:
+        report.n_get_pass = 1
+    else:
+        report.log = "Get: bad value for parameter %s: %g\n" % \
+            (p_name, check_val)
+        
+    report.trace = "Get %s = %g %i\n" % (p_name, check_val, passed)    
+    return model, report
+
+def loadStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwize
+    """
+    from sans.models.ModelIO import ModelIO
+    from sans.models.ModelFactory import ModelFactory
+    factory = ModelFactory()
+    io = ModelIO(factory)
+    
+    # testModel.xml should be in the directory
+    loaded = io.load("load_test_model.xml")
+    value2 = loaded.run(1)
+    
+    # Oracle bit
+    passed = False
+    if not value2 == 0: 
+        passed = True
+        
+    report = ReportCard()
+    report.n_load = 1
+    if passed:
+        report.n_load_pass = 1
+    else:
+        report.log = "Load: bad loaded model\n"
+        
+    report.trace = "Load = %s %i\n" % (loaded.name, passed)    
+    return model, report
+
+def saveStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwize
+    """
+    from sans.models.ModelIO import ModelIO
+    from sans.models.ModelFactory import ModelFactory
+    factory = ModelFactory()
+    io = ModelIO(factory)
+    io.save(model,"testModel.xml")
+    #value = model.run(1)
+
+    # Check it 
+    loaded = io.load("testModel.xml")
+    try:
+        value2 = loaded.run(1)
+    except ZeroDivisionError:
+        value2 = -1
+    
+    # Oracle bit
+    passed = False
+    
+    # The two outputs do not need to be the same
+    # since we do not save the parameters!
+    # If it's the subtraction of two identical models, 
+    # we will also get zero!
+    #if value2 == value: 
+    #    passed = True
+    
+    passed = True
+
+        
+    report = ReportCard()
+    report.n_save = 1
+    if passed:
+        report.n_save_pass = 1
+    else:
+        report.log = "Save: bad output from saved model %g\n" % value2
+        
+    report.trace = "Save %s %i\n" % (model.name, passed)    
+    return model, report
+
+def getRandomModelObject():
+    """
+        Return a random model object
+    """
+    from sans.models.ModelFactory import ModelFactory
+    while True:
+        try:
+            modelname = randomModel()
+            add_model = ModelFactory().getModel(modelname)
+            return add_model
+        except:
+            # Don't complain when a model can't be loaded.
+            # A list of tested models will appear in the 
+            # file report, which can be compared with the 
+            # list of available models, also printed.
+            pass
+            #print "Could not load ", modelname
+    
+
+def addStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwize
+    """
+    #from sans.models.ModelFactory import ModelFactory
+    #factory = ModelFactory()
+    #add_model = factory.getModel("SphereModel")
+    add_model = getRandomModelObject()
+            
+    tmp = model + add_model
+    model = tmp
+    
+    # Oracle bit
+    passed = False
+    
+    try:
+        value2 = model.run(1)
+        value2 = float(value2)
+    except:
+        passed = False
+    
+    # If we made it this far, we have a float
+    passed = True 
+        
+    report = ReportCard()
+    report.n_add = 1
+    if passed:
+        report.n_add_pass = 1
+    else:
+        report.log = "Add: bad output from composite model\n"
+        
+    report.trace = "Div %s %i\n" % (model.name, passed)    
+    return model, report
+
+def subStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwize
+    """
+    from sans.models.ModelFactory import ModelFactory
+    from random import random
+    
+    #factory = ModelFactory()
+    #sub_model = factory.getModel("CylinderModel")
+    #sub_model = factory.getModel(randomModel())
+    sub_model = getRandomModelObject()
+
+    
+    sub_model.params["scale"] = 1.1*random()
+    tmp = model - sub_model
+    
+    # Oracle bit
+    passed = False
+    
+    try:
+        value2 = tmp.run(1.1 * (1.0 + random()))
+        value2 = float(value2)
+    except:
+        value2 = None
+        passed = False
+    
+    # If we made it this far, we have a float
+    passed = True 
+        
+    report = ReportCard()
+    report.n_sub = 1
+    if passed:
+        report.n_sub_pass = 1
+    else:
+        report.log = "Sub: bad output from composite model\n"
+
+    report.trace = "Sub %s (%g - %g = %s) %i\n" % \
+        (model.name, model.run(1), \
+         sub_model.run(1), str(value2), passed)                
+    return tmp, report
+
+def mulStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwize
+    """
+    #from sans.models.ModelFactory import ModelFactory
+    #factory = ModelFactory()
+    #mul_model = factory.getModel("SphereModel")
+    #mul_model = factory.getModel(randomModel())
+    mul_model = getRandomModelObject()
+    tmp = model * mul_model
+    
+    # Oracle bit
+    passed = False
+    
+    from random import random
+    input_val = 1.1 * (1.0 + random())
+    v1 = None
+    v2 = None
+    try:
+        v1 = mul_model.run(input_val)
+        v2 = model.run(input_val)
+        value2 = tmp.run(input_val)
+        value2 = float(value2)
+    except ZeroDivisionError:
+        value2 = None
+    
+    # If we made it this far, we have a float
+    passed = True 
+        
+    report = ReportCard()
+    report.n_mul = 1
+    if passed:
+        report.n_mul_pass = 1
+    else:
+        report.log = "Mul: bad output from composite model\n"
+        
+    report.trace = "Mul %s (%s * %s = %s) %i\n" % \
+      (model.name, str(v1), str(v2), str(value2), passed)                
+    return tmp, report
+
+def divStimulus(model):
+    """ Apply the stimulus to the supplied model object
+        @param model: model to apply the stimulus to
+        @return: True if passed, False otherwise
+    """
+    #from sans.models.ModelFactory import ModelFactory
+    #factory = ModelFactory()
+    #div_model = factory.getModel("SphereModel")
+    #div_model = factory.getModel(randomModel())
+
+    from random import random
+    input_val = 1.5 * random()
+    
+    # Find a model that will not evaluate to zero
+    # at the input value
+    try_again = True
+    while try_again:
+        div_model = getRandomModelObject()
+        try:
+            v2 = div_model.run(input_val)
+            try_again = False
+        except:
+            pass
+        
+    tmp = model / div_model
+    
+    # Oracle bit
+    passed = False
+    
+    v1 = None
+    v2 = None
+    try:
+        
+        # Check individual models against bad combinations,
+        # which happen from time to time given that all 
+        # parameters are random
+        try:
+            v2 = div_model.run(input_val)
+            v1 = model.run(input_val)
+            value2 = tmp.run(input_val)
+            value2 = float(value2)
+        except ZeroDivisionError:
+            value2 = None
+    except:
+        passed = False
+    
+    # If we made it this far, we have a float
+    passed = True 
+        
+    report = ReportCard()
+    report.n_div = 1
+    if passed:
+        report.n_div_pass = 1
+    else:
+        report.log = "Div: bad output from composite model\n"
+        
+    report.trace = "Div %s/%s (%g) = %s / %s = %s %i\n" % \
+      (model.name, div_model.name, input_val, str(v1), str(v2), str(value2), passed)                
+    return tmp, report
+
+if __name__ == '__main__':
+    print "Model operations are no longer supported."
+    print "The TestCase generator for model operation can't be used with this version of sansmodels." 
+    
+    
+    #print randomModel()
+    #g = TestCaseGenerator()
+    #g.generateAndRun(20000)
+    
+    #t = TestCase(filename = "error_1.17721e+009.xml")
+    #print t.run()
+    
Index: sansmodels/test/utest_disperser.py
===================================================================
--- sansmodels/test/utest_disperser.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_disperser.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,106 @@
+"""
+    Unit tests for specific models
+    @author: Mathieu Doucet / UTK
+"""
+
+import unittest
+from SmearList import Smear
+
+# Disable "missing docstring" complaint
+# pylint: disable-msg=C0111
+# Disable "too many methods" complaint 
+# pylint: disable-msg=R0904 
+# Disable "could be a function" complaint 
+# pylint: disable-msg=R0201
+
+from sans_extension.c_models import Disperser
+from sans.models.ModelFactory import ModelFactory
+from sans.models.DisperseModel import DisperseModel
+      
+class TestDisperser(unittest.TestCase):
+    """ Unit tests for sphere model """
+    
+    def setUp(self):
+        self.model = ModelFactory().getModel("CylinderModel")
+        self.model.setParam("cyl_theta", 1.57)
+        self.model.setParam("cyl_phi", 0.1)
+        
+        
+
+    def testNoDisp(self):
+        """ Test 1D model for a sphere """
+        q = 0.005
+        d = Disperser(self.model, [], [])
+        value = d.run([q, 0])
+        self.assertEqual(value, self.model.run([q, 0]))
+
+    def testComp(self):
+        q = 0.005
+        phi = 0.10
+        sigma = 0.3
+        value_0 = self.model.run([q, phi])
+        app = Smear(self.model, ['cyl_phi'], [sigma])
+        val_py = app.run([q, phi])
+        
+        # Check that the parameters were returned to original values
+        self.assertEqual(value_0, self.model.run([q, phi]))
+        d = Disperser(self.model, ["cyl_phi"], [sigma])
+        val_c = d.run([q, phi])
+        self.assertEqual(val_py, val_c)
+        
+    def test2Disp(self):
+        q = 0.005
+        phi = 0.10
+        sigma = 0.3
+        value_0 = self.model.run([q, phi])
+        app = Smear(self.model, ['cyl_phi', 'cyl_theta'], [sigma, sigma])
+        val_py = app.run([q, phi])
+        
+        # Check that the parameters were returned to original values
+        self.assertEqual(value_0, self.model.run([q, phi]))
+        d = Disperser(self.model, ["cyl_phi", "cyl_theta"], [sigma, sigma])
+        val_c = d.run([q, phi])
+        self.assertEqual(val_py, val_c)
+        
+    def test3Disp(self):
+        q = 0.005
+        phi = 0.10
+        sigma = 0.3
+        value_0 = self.model.run([q, phi])
+        app = Smear(self.model, 
+                    ['cyl_phi', 'cyl_theta', 'radius'], [sigma, sigma, 1.0])
+        val_py = app.run([q, phi])
+        
+        # Check that the parameters were returned to original values
+        self.assertEqual(value_0, self.model.run([q, phi]))
+        d = Disperser(self.model, 
+                      ["cyl_phi", "cyl_theta", 'radius'], [sigma, sigma, 1.0])
+        val_c = d.run([q, phi])
+        self.assertEqual(val_py, val_c)
+        
+        
+class TestDisperserModel(unittest.TestCase):
+    """ Unit tests for sphere model """
+    
+    def setUp(self):
+        self.model = ModelFactory().getModel("CylinderModel")
+        self.model.setParam("cyl_theta", 1.57)
+        self.model.setParam("cyl_phi", 0.1)
+        
+    def test2Disp(self):
+        q = 0.005
+        phi = 0.10
+        sigma = 0.3
+        value_0 = self.model.run([q, phi])
+        app = Smear(self.model, ['cyl_phi', 'cyl_theta'], [sigma, sigma])
+        val_py = app.run([q, phi])
+        
+        # Check that the parameters were returned to original values
+        self.assertEqual(value_0, self.model.run([q, phi]))
+        d = DisperseModel(self.model, ["cyl_phi", "cyl_theta"], [sigma, sigma])
+        val_c = d.run([q, phi])
+        self.assertEqual(val_py, val_c)
+
+
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_dispersity.py
===================================================================
--- sansmodels/test/utest_dispersity.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_dispersity.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,523 @@
+"""
+    Unit tests for dispersion functionality of 
+    C++ model classes
+"""
+
+#Note: The 'sans.models.DisperseModel' is for only the test. We use 
+#'sans.models.dispersion_models', instead in the application.
+#The first uses width = sigma, while the second uses width = ratio (=sigma/mean)
+#for length parameters and width = sigma for angle parameters.
+#In Feb. 2011, we found and fixed the some precision problems in the C, so that
+#this test was updated too.
+
+
+import unittest, math, numpy
+
+class TestCylinder(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        self.model= CylinderModel()
+        
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('radius', 20.0)
+        self.model.setParam('length', 400.0)
+        self.model.setParam('sldCyl', 4.e-6)
+        self.model.setParam('sldSolv', 1.e-6)
+        self.model.setParam('background', 0.0)
+        self.model.setParam('cyl_theta', 0.0)
+        self.model.setParam('cyl_phi', 0.0)
+        
+    def test_simple(self):
+        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
+        
+    def test_constant(self):
+        from sans.models.dispersion_models import DispersionModel
+        disp = DispersionModel()
+        self.model.setParam('scale', 10.0)
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 0.25
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.5
+        
+        self.assertAlmostEqual(self.model.run(0.001), 1.021051*4527.47250339, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001, 0.001]), 
+                               1.021048*4546.997777604715, 2)
+        
+    def test_gaussian(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp = GaussianDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 0.25
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2
+        self.model.setParam('scale', 10.0)
+        
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               1.1804794*4723.32213339, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               1.180454*4743.56, 2)
+        
+    def test_clone(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp = GaussianDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 0.25
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2
+        self.model.setParam('scale', 10.0)
+        
+        new_model = self.model.clone()
+        self.assertAlmostEqual(new_model.run(0.001), 
+                               1.1804794*4723.32213339, 3)
+        self.assertAlmostEqual(new_model.runXY([0.001,0.001]), 
+                               1.180454*4743.56, 2)
+        
+    def test_gaussian_zero(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp = GaussianDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 0.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.5
+        self.model.setParam('scale', 1.0)
+        
+        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
+        
+    def test_array(self):
+        """
+            Perform complete rotational average and
+            compare to 1D
+        """
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_ph = ArrayDispersion()
+        disp_th = ArrayDispersion()
+        
+        values_ph = numpy.zeros(100)
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_ph[i]=(360/99.0*i)
+            values_th[i]=(180/99.0*i)
+            weights[i]=(1.0)
+        
+        disp_ph.set_weights(values_ph, weights)
+        disp_th.set_weights(values_th, weights)
+        
+        self.model.set_dispersion('cyl_theta', disp_th)
+        self.model.set_dispersion('cyl_phi', disp_ph)
+        
+        val_1d = self.model.run(math.sqrt(0.0002))
+        val_2d = self.model.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        
+class TestCoreShellCylinder(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
+        self.model= CoreShellCylinderModel()
+        
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('radius', 20.0)
+        self.model.setParam('thickness', 10.0)
+        self.model.setParam('length', 400.0)
+        self.model.setParam('core_sld', 1.e-6)
+        self.model.setParam('shell_sld', 4.e-6)
+        self.model.setParam('solvent_sld', 1.e-6)
+        self.model.setParam('background', 0.0)
+        self.model.setParam('axis_theta', 0.0)
+        self.model.setParam('axis_phi', 0.0)
+        
+    def test_simple(self):
+        """
+            Test simple 1D and 2D values
+            Numbers taken from model that passed validation, before
+            the update to C++ underlying class.
+        """
+        self.assertAlmostEqual(self.model.run(0.001), 353.55013216754583, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               355.25355270620543, 3)
+        
+    def test_dispersion(self):
+        """
+            Test with dispersion
+        """
+        from sans.models.DisperseModel import DisperseModel
+        disp = DisperseModel(self.model, ['radius', 
+                                          'thickness', 
+                                          'length'], [5, 2, 50])
+        disp.setParam('n_pts', 10)
+        self.assertAlmostEqual(disp.run(0.001), 358.44062724936009, 3)
+        self.assertAlmostEqual(disp.runXY([0.001,0.001]), 360.22673635224584, 3)
+
+    def test_new_disp(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp_rm = GaussianDispersion()
+        self.model.set_dispersion('radius', disp_rm)
+        self.model.dispersion['radius']['width'] = 0.25
+        self.model.dispersion['radius']['npts'] = 10
+        self.model.dispersion['radius']['nsigmas'] = 2
+
+        disp_rr = GaussianDispersion()
+        self.model.set_dispersion('thickness', disp_rr)
+        self.model.dispersion['thickness']['width'] = 0.2
+        self.model.dispersion['thickness']['npts'] = 10
+        self.model.dispersion['thickness']['nsigmas'] = 2
+
+        disp_len = GaussianDispersion()
+        self.model.set_dispersion('length', disp_len)
+        self.model.dispersion['length']['width'] = 1.0/8.0
+        self.model.dispersion['length']['npts'] = 10
+        self.model.dispersion['length']['nsigmas'] = 2
+
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               1.07832610*358.44062724936009, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               1.07844010*360.22673635224584, 3)
+        
+
+    def test_array(self):
+        """
+            Perform complete rotational average and
+            compare to 1D
+        """
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_ph = ArrayDispersion()
+        disp_th = ArrayDispersion()
+        
+        values_ph = numpy.zeros(100)
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_ph[i]=(360/99.0*i)
+            values_th[i]=(180/99.0*i)
+            weights[i]=(1.0)
+        
+        disp_ph.set_weights(values_ph, weights)
+        disp_th.set_weights(values_th, weights)
+        
+        self.model.set_dispersion('axis_theta', disp_th)
+        self.model.set_dispersion('axis_phi', disp_ph)
+        
+        val_1d = self.model.run(math.sqrt(0.0002))
+        val_2d = self.model.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        
+        
+        
+class TestCoreShell(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.CoreShellModel import CoreShellModel
+        self.model= CoreShellModel()
+        
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('radius', 60.0)
+        self.model.setParam('thickness', 10.0)
+        self.model.setParam('core_sld', 1.e-6)
+        self.model.setParam('shell_sld', 2.e-6)
+        self.model.setParam('solvent_sld', 3.e-6)
+        self.model.setParam('background', 0.0)
+        
+    def test_simple(self):
+        """
+            Test simple 1D and 2D values
+            Numbers taken from model that passed validation, before
+            the update to C++ underlying class.
+        """
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               381.27304697150055, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               380.93779156218682, 3)
+        
+    def test_dispersion(self):
+        """
+            Test with dispersion
+        """
+        from sans.models.DisperseModel import DisperseModel
+        disp = DisperseModel(self.model, ['radius', 'thickness'], [10, 2])
+        disp.setParam('n_pts', 10)
+        self.assertAlmostEqual(disp.run(0.001), 407.344127907553, 3)
+    
+    def test_new_disp(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp_rm = GaussianDispersion()
+        self.model.set_dispersion('radius', disp_rm)
+        self.model.dispersion['radius']['width'] = 0.1666666667
+        self.model.dispersion['radius']['npts'] = 10
+        self.model.dispersion['radius']['nsigmas'] = 2
+
+        disp_rr = GaussianDispersion()
+        self.model.set_dispersion('thickness', disp_rr)
+        self.model.dispersion['thickness']['width'] = 0.2
+        self.model.dispersion['thickness']['npts'] = 10
+        self.model.dispersion['thickness']['nsigmas'] = 2
+
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               1.16747510*407.344127907553, 3)
+
+        
+class TestEllipsoid(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.EllipsoidModel import EllipsoidModel
+        self.model= EllipsoidModel()
+        
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('radius_a', 20.0)
+        self.model.setParam('radius_b', 400.0)
+        self.model.setParam('sldEll', 4.e-6)
+        self.model.setParam('sldSolv', 1.e-6)
+        self.model.setParam('background', 0.0)
+        self.model.setParam('axis_theta', 89.95445)
+        self.model.setParam('axis_phi', 0.0)
+        
+    def test_simple(self):
+        """
+            Test simple 1D and 2D values
+            Numbers taken from model that passed validation, before
+            the update to C++ underlying class.
+        """
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               11808.842896863147, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               11681.990374929677, 3)
+
+    def test_dispersion(self):
+        """
+            Test with dispersion
+        """
+        from sans.models.DisperseModel import DisperseModel
+        disp = DisperseModel(self.model, ['radius_a', 'radius_b'], [5, 50])
+        disp.setParam('n_pts', 10)
+
+        self.assertAlmostEqual(disp.run(0.001), 11948.72581312305, 3)
+        self.assertAlmostEqual(disp.runXY([0.001,0.001]), 11811.972359807551, 3)
+        
+    def test_new_disp(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp_rm = GaussianDispersion()
+        self.model.set_dispersion('radius_a', disp_rm)
+        self.model.dispersion['radius_a']['width'] = 0.25
+        self.model.dispersion['radius_a']['npts'] = 10
+        self.model.dispersion['radius_a']['nsigmas'] = 2
+
+        disp_rr = GaussianDispersion()
+        self.model.set_dispersion('radius_b', disp_rr)
+        self.model.dispersion['radius_b']['width'] = 0.125
+        self.model.dispersion['radius_b']['npts'] = 10
+        self.model.dispersion['radius_b']['nsigmas'] = 2
+
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               1.10650710*11948.72581312305, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               1.105898*11811.972359807551, 2)
+
+    def test_array(self):
+        """
+            Perform complete rotational average and
+            compare to 1D
+        """
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_ph = ArrayDispersion()
+        disp_th = ArrayDispersion()
+        
+        values_ph = numpy.zeros(100)
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_ph[i]=(360/99.0*i)
+            values_th[i]=(180/99.0*i)
+            weights[i]=(1.0)
+        
+        disp_ph.set_weights(values_ph, weights)
+        disp_th.set_weights(values_th, weights)
+        
+        self.model.set_dispersion('axis_theta', disp_th)
+        self.model.set_dispersion('axis_phi', disp_ph)
+        
+        val_1d = self.model.run(math.sqrt(0.0002))
+        val_2d = self.model.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        
+        
+        
+class TestSphere(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        self.model= SphereModel()
+        
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('radius', 60.0)
+        self.model.setParam('sldSph', 2.0)
+        self.model.setParam('sldSolv', 1.0)
+        self.model.setParam('background', 0.0)
+        
+    def test_simple(self):
+        """
+            Test simple 1D and 2D values
+            Numbers taken from model that passed validation, before
+            the update to C++ underlying class.
+        """
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               90412744456130.672, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               90347660670656.391, 1)
+
+    def test_dispersion(self):
+        """
+            Test with dispersion
+        """
+        from sans.models.DisperseModel import DisperseModel
+        disp = DisperseModel(self.model, ['radius'], [10])
+        disp.setParam('n_pts', 10)
+        disp.setParam('radius.npts', 10)
+        disp.setParam('radius.nsigmas', 2.5)
+        self.assertAlmostEqual(disp.run(0.001), 96795008379480.859, 1)
+        
+    def test_new_disp(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp_rm = GaussianDispersion()
+        self.model.set_dispersion('radius', disp_rm)
+        self.model.dispersion['radius']['width'] = 0.1666666667
+        self.model.dispersion['radius']['npts'] = 10
+        self.model.dispersion['radius']['nsigmas'] = 2
+
+        #self.assertAlmostEqual(self.model.run(0.001), 96795008379475.25,3)
+        
+        
+        
+class TestEllipticalCylinder(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
+        self.model= EllipticalCylinderModel()
+        
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('r_minor', 20.0)
+        self.model.setParam('r_ratio', 1.5)
+        self.model.setParam('length', 400.0)
+        self.model.setParam('sldCyl', 4.0e-6)
+        self.model.setParam('sldSolv', 1.0e-6)
+        self.model.setParam('background', 0.0)
+        self.model.setParam('cyl_theta', 90)
+        self.model.setParam('cyl_phi', 0.0)
+        self.model.setParam('cyl_psi', 0.0)
+        
+    def test_simple(self):
+        """
+            Test simple 1D and 2D values
+            Numbers taken from model that passed validation, before
+            the update to C++ underlying class.
+        """
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               675.50440232504991, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               669.5173937622792, 0)
+        
+    def test_dispersion(self):
+        """
+            Test with dispersion
+        """
+        from sans.models.DisperseModel import DisperseModel
+        disp = DisperseModel(self.model, ['r_minor', 'r_ratio', 'length'], 
+                             [5, 0.25, 50])
+        disp.setParam('n_pts', 10)
+        self.assertAlmostEqual(disp.run(0.001), 711.18048194151925, 3)
+        self.assertAlmostEqual(disp.runXY([0.001,0.001]), 704.63525988095705, 0)
+
+    def test_new_disp(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp_rm = GaussianDispersion()
+        self.model.set_dispersion('r_minor', disp_rm)
+        self.model.dispersion['r_minor']['width'] = 0.25
+        self.model.dispersion['r_minor']['npts'] = 10
+        self.model.dispersion['r_minor']['nsigmas'] = 2
+
+        disp_rr = GaussianDispersion()
+        self.model.set_dispersion('r_ratio', disp_rr)
+        self.model.dispersion['r_ratio']['width'] = 0.25/1.5
+        self.model.dispersion['r_ratio']['npts'] = 10
+        self.model.dispersion['r_ratio']['nsigmas'] = 2
+
+        disp_len = GaussianDispersion()
+        self.model.set_dispersion('length', disp_len)
+        self.model.dispersion['length']['width'] = 50.0/400
+        self.model.dispersion['length']['npts'] = 10
+        self.model.dispersion['length']['nsigmas'] = 2
+
+        self.assertAlmostEqual(self.model.run(0.001), 
+                               1.23925910*711.18048194151925, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 
+                               1.238955*704.63525988095705, 0)
+        
+
+    def test_array(self):
+        """
+            Perform complete rotational average and
+            compare to 1D
+        """
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_ph = ArrayDispersion()
+        disp_th = ArrayDispersion()
+        disp_ps = ArrayDispersion()
+        
+        values_ph = numpy.zeros(100)
+        values_th = numpy.zeros(100)
+        values_ps = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_ps[i]=(360/99.0*i)
+            values_ph[i]=(360/99.0*i)
+            values_th[i]=(180/99.0*i)
+            weights[i]=(1.0)
+        
+        disp_ph.set_weights(values_ph, weights)
+        disp_th.set_weights(values_th, weights)
+        disp_ps.set_weights(values_ps, weights)
+        
+        self.model.set_dispersion('cyl_theta', disp_th)
+        self.model.set_dispersion('cyl_phi', disp_ph)
+        self.model.set_dispersion('cyl_psi', disp_ps)
+        
+        val_1d = self.model.run(math.sqrt(0.0002))
+        val_2d = self.model.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        
+class TestDispModel(unittest.TestCase):
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        self.model = CylinderModel()
+        
+        
+    def test_disp_params(self):
+        
+        self.assertEqual(self.model.dispersion['radius']['width'], 0.0)
+        self.model.setParam('radius.width', 0.25)
+        self.assertEqual(self.model.dispersion['radius']['width'], 0.25)
+        self.assertEqual(self.model.getParam('radius.width'), 0.25)
+        self.assertEqual(self.model.dispersion['radius']['type'], 'gaussian')
+        
+  
+if __name__ == '__main__':
+    unittest.main()
+   
Index: sansmodels/test/utest_evaldist.py
===================================================================
--- sansmodels/test/utest_evaldist.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_evaldist.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,184 @@
+"""
+    Test for the BaseComponent.evalDistribution
+    See method documentation for more details
+"""
+import unittest
+import numpy, math
+from sans.models.SphereModel import SphereModel
+from sans.models.Cos import Cos
+
+
+class TestEvalPythonMethods(unittest.TestCase):
+    """ Testing evalDistribution for pure python models """
+
+    def setUp(self):
+        self.model= Cos()
+        
+    def test_scalar_methods(self):
+        """
+            Simple test comparing the run(), runXY() and
+            evalDistribution methods
+        """
+        q1 = self.model.run(0.001)
+        q2 = self.model.runXY(0.001)
+        qlist3 = numpy.asarray([0.001, 0.002])
+        q3 = self.model.evalDistribution(qlist3)
+        q4 = self.model.run(0.002)
+
+        self.assertEqual(q1, q2)
+        self.assertEqual(q1, q3[0])
+        self.assertEqual(q4, q3[1])
+        
+    def test_XY_methods(self):
+        """
+            Compare to the runXY() method for 2D models.
+            
+                      +--------+--------+--------+
+            qy=0.009  |        |        |        | 
+                      +--------+--------+--------+
+            qy-0.006  |        |        |        |
+                      +--------+--------+--------+            
+            qy=0.003  |        |        |        | 
+                      +--------+--------+--------+
+                      qx=0.001   0.002   0.003
+            
+        """
+        # These are the expected values for all bins
+        expected = numpy.zeros([3,3])
+        for i in range(3):
+            for j in range(3):
+                q_length = math.sqrt( (0.001*(i+1.0))*(0.001*(i+1.0)) + (0.003*(j+1.0))*(0.003*(j+1.0)) )
+                expected[i][j] = self.model.run(q_length)
+        
+        qx_values = [0.001, 0.002, 0.003]
+        qy_values = [0.003, 0.006, 0.009]
+        
+        qx = numpy.asarray(qx_values)
+        qy = numpy.asarray(qy_values)
+                     
+        new_x = numpy.tile(qx, (len(qy),1))
+        new_y = numpy.tile(qy, (len(qx),1))
+        new_y = new_y.swapaxes(0,1)
+    
+        #iq is 1d array now (since 03-12-2010)
+        qx_prime = new_x.flatten()
+        qy_prime = new_y.flatten()
+        
+        iq = self.model.evalDistribution([qx_prime, qy_prime])
+
+        for i in range(3):
+            for j in range(3):
+                k = i+len(qx)*j
+                self.assertAlmostEquals(iq[k], expected[i][j])
+
+    def test_rectangle_methods(self):
+        """
+            Compare to the runXY() method for 2D models
+            with a non-square matrix.
+            TODO: Doesn't work for C models apparently
+        
+                      +--------+--------+--------+
+            qy-0.006  |        |        |        |
+                      +--------+--------+--------+            
+            qy=0.003  |        |        |        | 
+                      +--------+--------+--------+
+                      qx=0.001   0.002   0.003
+            
+        """
+        # These are the expected values for all bins
+        expected = numpy.zeros([3,3])
+        for i in range(3):
+            for j in range(2):
+                q_length = math.sqrt( (0.001*(i+1.0))*(0.001*(i+1.0)) + (0.003*(j+1.0))*(0.003*(j+1.0)) )
+                expected[i][j] = self.model.run(q_length)
+        
+        qx_values = [0.001, 0.002, 0.003]
+        qy_values = [0.003, 0.006]
+        
+        qx = numpy.asarray(qx_values)
+        qy = numpy.asarray(qy_values)
+                     
+        new_x = numpy.tile(qx, (len(qy),1))
+        new_y = numpy.tile(qy, (len(qx),1))
+        new_y = new_y.swapaxes(0,1)
+    
+        #iq is 1d array now (since 03-12-2010)
+        qx_prime = new_x.flatten()
+        qy_prime = new_y.flatten()
+        
+        iq = self.model.evalDistribution([qx_prime, qy_prime])
+        
+        for i in range(3):
+            for j in range(2):
+                k = i+len(qx)*j
+                self.assertAlmostEquals(iq[k], expected[i][j])
+
+
+                
+class TestEvalMethods(unittest.TestCase):
+    """ Testing evalDistribution for C models """
+
+    def setUp(self):
+        self.model= SphereModel()
+        
+    def test_scalar_methods(self):
+        """
+            Simple test comparing the run(), runXY() and
+            evalDistribution methods
+        """
+        q1 = self.model.run(0.001)
+        q2 = self.model.runXY(0.001)
+        q4 = self.model.run(0.002)
+        qlist3 = numpy.asarray([0.001, 0.002])
+        q3 = self.model.evalDistribution(qlist3)
+
+        self.assertEqual(q1, q2)
+        self.assertEqual(q1, q3[0])
+        self.assertEqual(q4, q3[1])
+        
+    def test_XY_methods(self):
+        """
+            Compare to the runXY() method for 2D models.
+            
+                      +--------+--------+--------+
+            qy=0.009  |        |        |        | 
+                      +--------+--------+--------+
+            qy-0.006  |        |        |        |
+                      +--------+--------+--------+            
+            qy=0.003  |        |        |        | 
+                      +--------+--------+--------+
+                      qx=0.001   0.002   0.003
+            
+        """
+        # These are the expected values for all bins
+        expected = numpy.zeros([3,3])
+        for i in range(3):
+            for j in range(3):
+                q_length = math.sqrt( (0.001*(i+1.0))*(0.001*(i+1.0)) + (0.003*(j+1.0))*(0.003*(j+1.0)) )
+                expected[i][j] = self.model.run(q_length)
+        
+        qx_values = [0.001, 0.002, 0.003]
+        qy_values = [0.003, 0.006, 0.009]
+        
+        qx = numpy.asarray(qx_values)
+        qy = numpy.asarray(qy_values)
+              
+        new_x = numpy.tile(qx, (len(qy),1))
+        new_y = numpy.tile(qy, (len(qx),1))
+        new_y = new_y.swapaxes(0,1)
+    
+        #iq is 1d array now (since 03-12-2010)
+        qx_prime = new_x.flatten()
+        qy_prime = new_y.flatten()
+        
+        iq = self.model.evalDistribution([qx_prime, qy_prime])
+        
+        for i in range(3):
+            for j in range(3):
+                # convert index into 1d array
+                k = i+len(qx)*j
+                self.assertAlmostEquals(iq[k], expected[i][j])
+                
+
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_extra_models.py
===================================================================
--- sansmodels/test/utest_extra_models.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_extra_models.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,366 @@
+"""
+Unit tests for extra models,PolymerexclVolume, RPA10Model
+The reference values are calculated on IGOR/NIST package(Oct.,2010)
+@author: JHJ Cho / UTK
+"""
+import unittest
+class TestPolymerExclVolume(unittest.TestCase):
+    """
+    Unit tests for PolymerexclVolume (non-shape) function
+    """
+    def setUp(self):
+        from sans.models.PolymerExclVolume import PolymerExclVolume
+        self.model= PolymerExclVolume()
+        
+    def test1D(self):          
+        # the values are from Igor pro calculation    
+        self.assertAlmostEqual(self.model.run(0.001), 0.998801, 6)
+        self.assertAlmostEqual(self.model.run(0.21571), 0.00192041, 6)
+        self.assertAlmostEqual(self.model.runXY(0.41959), 0.000261302, 6)
+        
+class TestRPA10Case(unittest.TestCase):
+    """
+    Unit tests for RPA10Model (non-shape) function
+    """
+    def setUp(self):
+        from sans.models.RPA10Model import RPA10Model
+        self.model0= RPA10Model(0)
+        self.model1= RPA10Model(1)
+        self.model2= RPA10Model(2)
+        self.model3= RPA10Model(3)
+        self.model4= RPA10Model(4)
+        self.model5= RPA10Model(5)
+        self.model6= RPA10Model(6)
+        self.model7= RPA10Model(7)
+        self.model8= RPA10Model(8)
+        self.model9= RPA10Model(9)
+        
+    def test1D(self):          
+        # the test values are from Igor pro calculation   
+        # case 0 
+        # set default of vol fration consistent with IGor
+        self.model0.setParam('Phic',0.5)
+        self.model0.setParam('Phid',0.5)
+        self.assertAlmostEqual(self.model0.run(0.001), 0.0716863, 6)
+        self.assertAlmostEqual(self.model0.runXY(0.414955), 0.00396997, 6)
+        # case 1
+        # set default of vol fration consistent with IGor
+        self.model1.setParam('Phic',0.5)
+        self.model1.setParam('Phid',0.5)
+        self.assertAlmostEqual(self.model1.run(0.001), 0.00395016, 6)
+        self.assertAlmostEqual(self.model1.runXY(0.414955), 0.00396735, 6)
+        # case 2 
+        # set default of vol fration consistent with IGor
+        self.model2.setParam('Phib',0.33)
+        self.model2.setParam('Phic',0.33)
+        self.model2.setParam('Phid',0.33)
+        self.assertAlmostEqual(self.model2.run(0.001), 0.0932902, 6)
+        self.assertAlmostEqual(self.model2.runXY(0.414955), 0.00355736, 6)
+        # case 3
+        # set default of vol fration consistent with IGor
+        self.model3.setParam('Phib',0.33)
+        self.model3.setParam('Phic',0.33)
+        self.model3.setParam('Phid',0.33)
+        self.assertAlmostEqual(self.model3.run(0.001), 0.026254, 6)
+        self.assertAlmostEqual(self.model3.runXY(0.414955), 0.00355577, 6)
+        # case 4
+        # set default of vol fration consistent with IGor
+        self.model4.setParam('Phib',0.33)
+        self.model4.setParam('Phic',0.33)
+        self.model4.setParam('Phid',0.33)
+        self.assertAlmostEqual(self.model4.run(0.001), 0.0067433, 6)
+        self.assertAlmostEqual(self.model4.runXY(0.414955), 0.00355656, 6)
+        # case 5
+        self.assertAlmostEqual(self.model5.run(0.001), 0.102636, 6)
+        self.assertAlmostEqual(self.model5.runXY(0.414955), 0.00305812, 6)
+        # case 6
+        self.assertAlmostEqual(self.model6.run(0.001), 0.0370357, 6)
+        self.assertAlmostEqual(self.model6.runXY(0.414955), 0.00305708, 6)
+        # case 7
+        self.assertAlmostEqual(self.model7.run(0.001), 0.0167775, 6)
+        self.assertAlmostEqual(self.model7.runXY(0.414955), 0.00305743, 6)
+        # case 8
+        self.assertAlmostEqual(self.model8.run(0.001), 0.0378691, 6)
+        self.assertAlmostEqual(self.model8.runXY(0.414955), 0.00305743, 6)
+        # case 9
+        self.assertAlmostEqual(self.model9.run(0.001), 0.00839376, 6)
+        self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6)  
+              
+class TestBarBell(unittest.TestCase):
+    """
+    Unit tests for BarBell function
+    """
+    def setUp(self):
+        from sans.models.BarBellModel import BarBellModel
+        self.model= BarBellModel()
+        
+    def test1D(self):          
+        # the values are from Igor pro calculation    
+        self.assertAlmostEqual(self.model.run(0.001), 2864.7, 1)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.526351, 4)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.0685892, 6)
+
+class TestCappedCylinder(unittest.TestCase):
+    """
+    Unit tests for CappedCylinder function
+    """
+    def setUp(self):
+        from sans.models.CappedCylinderModel import CappedCylinderModel
+        self.model= CappedCylinderModel()
+        
+    def test1D(self):          
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 1424.72, 2)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.360736, 4)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.110283, 5)
+
+class TestLamellarParaCrystal(unittest.TestCase):
+    """
+    Unit tests for LamellarParaCystal function
+    """
+    def setUp(self):
+        from sans.models.LamellarPCrystalModel import LamellarPCrystalModel
+        self.model= LamellarPCrystalModel()
+        
+    def test1D(self):    
+        self.model.setParam("pd_spacing", 0.2)      
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 21829.3, 1)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.00487686, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.00062029, 6)
+
+
+class TestSCParaCrystal(unittest.TestCase):
+    """
+    Unit tests for Simple Cubic ParaCrystal Model function
+    """
+    def setUp(self):
+        from sans.models.SCCrystalModel import SCCrystalModel
+        self.model= SCCrystalModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 10.3038, 4)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.00714905, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000313289, 6)
+
+class TestFCParaCrystal(unittest.TestCase):
+    """
+    Unit tests for Face Centered Cubic ParaCrystal Model function
+    """
+    def setUp(self):
+        from sans.models.FCCrystalModel import FCCrystalModel
+        self.model= FCCrystalModel()
+        
+    def test1D(self):       
+        self.model.setParam("d_factor", 0.05)  
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 0.121017, 6)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.0107218, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000443282, 6)
+
+class TestBCParaCrystal(unittest.TestCase):
+    """
+    Unit tests for Body Centered Cubic ParaCrystal Model function
+    """
+    def setUp(self):
+        from sans.models.BCCrystalModel import BCCrystalModel
+        self.model= BCCrystalModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 1.77267, 4)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.00927739, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000406973, 6)
+                               
+
+class TestGuinierPorod(unittest.TestCase):
+    """
+    Unit tests for GuinierPorod Model function
+    """
+    def setUp(self):
+        from sans.models.GuinierPorodModel import GuinierPorodModel 
+        self.model= GuinierPorodModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 995.112, 3)
+        self.assertAlmostEqual(self.model.run(0.105363), 0.162904, 5)
+        self.assertAlmostEqual(self.model.runXY(0.441623), 0.100854, 6)
+
+class TestGaussLorentzGel(unittest.TestCase):
+    """
+    Unit tests for GuinierPorod Model function
+    """
+    def setUp(self):
+        from sans.models.GaussLorentzGelModel import GaussLorentzGelModel
+        self.model= GaussLorentzGelModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 149.481, 3)
+        self.assertAlmostEqual(self.model.run(0.105363), 9.1903, 4)
+        self.assertAlmostEqual(self.model.runXY(0.441623), 0.632811, 5)
+                                
+
+class TestTwoPowerLaw(unittest.TestCase):
+    """
+    Unit tests for TwoPowerLaw Model function
+    """
+    def setUp(self):
+        from sans.models.TwoPowerLawModel import TwoPowerLawModel
+        self.model= TwoPowerLawModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertEqual(self.model.run(0.001), 1000)
+        self.assertAlmostEqual(self.model.run(0.150141), 0.125945, 5)
+        self.assertAlmostEqual(self.model.runXY(0.442528), 0.00166884, 7)
+                                
+class TestTwoLorentzian(unittest.TestCase):
+    """
+    Unit tests for TwoLorentzian Model function
+    """
+    def setUp(self):
+        from sans.models.TwoLorentzianModel import TwoLorentzianModel
+        self.model= TwoLorentzianModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 11.0899, 3)
+        self.assertAlmostEqual(self.model.run(0.150141), 0.410245, 5)
+        self.assertAlmostEqual(self.model.runXY(0.442528), 0.148699, 6)
+                                
+
+class TestCorrLengthLaw(unittest.TestCase):
+    """
+    Unit tests for CorrLength Model function
+    """
+    def setUp(self):
+        from sans.models.CorrLengthModel import CorrLengthModel
+        self.model= CorrLengthModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 1010.08, 1)
+        self.assertAlmostEqual(self.model.run(0.150141), 0.274645, 5)
+        self.assertAlmostEqual(self.model.runXY(0.442528), 0.120396, 6)
+                                
+
+class TestBroadPeak(unittest.TestCase):
+    """
+    Unit tests for BroadPeak Model function
+    """
+    def setUp(self):
+        from sans.models.BroadPeakModel import BroadPeakModel
+        self.model= BroadPeakModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 10000.5, 1)
+        self.assertAlmostEqual(self.model.run(0.1501412), 1.47557, 5)
+        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.134093, 6)
+        
+class TestFractalCoreShell(unittest.TestCase):
+    """
+    Unit tests for FractalCoreShell Model function
+    """
+    def setUp(self):
+        from sans.models.FractalCoreShellModel import FractalCoreShellModel
+        self.model= FractalCoreShellModel()
+        
+    def test1D(self):        
+        #self.model.setParam('radius.width', 2.0)
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 273.742, 3)
+        self.assertAlmostEqual(self.model.run(0.1501412), 0.040079, 6)
+        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.00141167, 8)  
+         
+    def test1DSchulzDispersion(self):      
+        # Same test w/ test1D up there but w/ Schulzdispersion
+        from sans.models.dispersion_models import SchulzDispersion
+        disp = SchulzDispersion()
+        self.model.set_dispersion('radius', disp)
+        # 'width' is a ratio now for non-angular parameters
+        self.model.dispersion['radius']['width'] = 0.1
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 3.0
+        # the values are from Igor pro calculation
+        # the run does not neccessary to be exactly same with NIST 
+        # 'cause we used different method.
+        self.assertAlmostEqual(self.model.run(0.001), 287.851, -1)
+        self.assertAlmostEqual(self.model.run(0.1501412), 0.0500775, 3)
+        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.00390948, 3)         
+       
+
+class TestUnifiedPowerRg(unittest.TestCase):
+    """
+    Unit tests for FractalCoreShell Model function
+    """
+    def setUp(self):
+        from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel
+        self.model1= UnifiedPowerRgModel(1)
+        self.model4= UnifiedPowerRgModel(4)
+        
+    def test1DLabel1(self):        
+        # Label #1
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model1.run(0.001), 2.99956, 5)
+        self.assertAlmostEqual(self.model1.run(0.1501412), 0.126506, 6)
+        self.assertAlmostEqual(self.model1.runXY(0.4425284), 0.00306386, 8)                             
+ 
+    def test1DLabel4(self):        
+        # Label #4
+        # Set params consistent w/NIST
+        # No. 4 already same
+        # No. 3
+        self.model4.setParam('Rg3', 200)
+        self.model4.setParam('B3', 5e-06)
+        self.model4.setParam('G3', 400)
+        # No. 2
+        self.model4.setParam('Rg2', 600)
+        self.model4.setParam('B2', 2e-07)
+        self.model4.setParam('G2', 4000)
+        # No. 1
+        self.model4.setParam('Rg1', 2000)
+        self.model4.setParam('B1', 1e-08)
+        self.model4.setParam('G1', 40000)
+        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model4.run(0.001), 14778.4, 1)
+        self.assertAlmostEqual(self.model4.run(0.0301614), 7.88115, 4)
+        self.assertAlmostEqual(self.model4.run(0.1501412), 0.126864, 6)
+        self.assertAlmostEqual(self.model4.runXY(0.4425284), 0.00306386, 8)  
+                                                                              
+
+class TestCSPP(unittest.TestCase):
+    """
+    Unit tests for CSParallelepiped Model function
+    """
+    def setUp(self):
+        from sans.models.CSParallelepipedModel import CSParallelepipedModel
+        self.model= CSParallelepipedModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 1383.96, 2)
+        self.assertAlmostEqual(self.model.run(0.1501412), 2.51932, 4)
+        self.assertAlmostEqual(self.model.runXY(0.4425284), 0.0736735, 6)
+                                                                                                                                                          
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_model_calculate_ER.py
===================================================================
--- sansmodels/test/utest_model_calculate_ER.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_model_calculate_ER.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,249 @@
+"""
+    Unit tests for calculate_ER of specific models
+    @author: JHJ Cho / UTK
+"""
+
+import unittest, time, math, numpy
+
+        
+class TestSphere(unittest.TestCase):
+    """ Unit tests for calculate_ER (sphere model) """
+    
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        self.comp = SphereModel()
+        
+    def test(self):
+        """ Test 1D model for a sphere """
+        self.comp.setParam("radius", 20)
+        self.assertAlmostEqual(self.comp.calculate_ER(), 20)
+        
+class TestCoreShell(unittest.TestCase):
+    """ Unit tests for calculate_ER (CoreShellModel) """
+    
+    def setUp(self):
+        from sans.models.CoreShellModel import CoreShellModel
+        self.comp = CoreShellModel()
+        
+    def test(self):
+        """ Test 1D model for a CoreShell """
+        self.comp.setParam("radius", 20)
+        self.comp.setParam("thickness", 20)
+        self.assertAlmostEqual(self.comp.calculate_ER(), 40)       
+         
+class TestMultiShell(unittest.TestCase):
+    """ Unit tests for calculate_ER (MultiShellModel) """
+    
+    def setUp(self):
+        from sans.models.MultiShellModel import MultiShellModel
+        self.comp = MultiShellModel()
+        
+    def test(self):
+        """ Test 1D model for a MultiShell """
+        self.comp.setParam("core_radius", 60)
+        self.comp.setParam("s_thickness", 10)
+        self.comp.setParam("w_thickness", 15)
+        self.comp.setParam("n_pairs", 2)
+        self.assertAlmostEqual(self.comp.calculate_ER(), 95)      
+
+class TestVesicle(unittest.TestCase):
+    """ Unit tests for calculate_ER (VesicleModel) """
+    
+    def setUp(self):
+        from sans.models.VesicleModel import VesicleModel
+        self.comp = VesicleModel()
+        
+    def test(self):
+        """ Test 1D model for a Vesicle """
+        self.comp.setParam("radius", 60)
+        self.comp.setParam("thickness", 30)
+        self.assertAlmostEqual(self.comp.calculate_ER(), 90)   
+
+class TestCylinder(unittest.TestCase):
+    """ Unit tests for calculate_ER (cylinder model) """
+    
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        from sans.models.DiamCylFunc import DiamCylFunc
+        self.comp = CylinderModel()
+        self.diam = DiamCylFunc()
+        
+    def test(self):
+        """ Test 1D model for a Cylinder """
+        self.comp.setParam("radius", 20)
+        self.comp.setParam("length",400)
+        self.diam.setParam("radius", 20)
+        self.diam.setParam("length",400)       
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)  
+         
+class TestCoreShellCylinder(unittest.TestCase):
+    """ Unit tests for calculate_ER (CoreShellcylinder model) """
+    
+    def setUp(self):
+        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
+        from sans.models.DiamCylFunc import DiamCylFunc
+        self.comp = CoreShellCylinderModel()
+        self.diam = DiamCylFunc()
+        
+    def test(self):
+        """ Test 1D model for a CoreShellCylinder """
+        self.comp.setParam("radius", 20)
+        self.comp.setParam("thickness", 10)
+        self.comp.setParam("length",400)
+        self.diam.setParam("radius", 30)
+        self.diam.setParam("length",420)       
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)   
+
+class TestHollowCylinder(unittest.TestCase):
+    """ Unit tests for calculate_ER (Hollowcylinder model) """
+    
+    def setUp(self):
+        from sans.models.HollowCylinderModel import HollowCylinderModel
+        from sans.models.DiamCylFunc import DiamCylFunc
+        self.comp = HollowCylinderModel()
+        self.diam = DiamCylFunc()
+        
+    def test(self):
+        """ Test 1D model for a Hollowcylinder """
+        self.comp.setParam("radius", 20)
+        self.comp.setParam("length",400)
+        self.diam.setParam("radius", 20)
+        self.diam.setParam("length",400)       
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)        
+
+class TestStackedDisksModel(unittest.TestCase):
+    """ Unit tests for calculate_ER (StackedDisks model) """
+    
+    def setUp(self):
+        from sans.models.StackedDisksModel import StackedDisksModel
+        from sans.models.DiamCylFunc import DiamCylFunc
+        self.comp = StackedDisksModel()
+        self.diam = DiamCylFunc()
+        
+    def test(self):
+        """ Test 1D model for a StackedDisks """
+        self.comp.setParam("radius", 3000)
+        self.comp.setParam("n_stacking", 2)
+        self.comp.setParam("core_thick",10)
+        self.comp.setParam("layer_thick", 15)
+        self.diam.setParam("radius", 3000)
+        self.diam.setParam("length",80)       
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)  
+             
+class TestEllipticalCylinder(unittest.TestCase):
+    """ Unit tests for calculate_ER (EllipticalCylindermodel) """
+    
+    def setUp(self):
+        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
+        from sans.models.DiamCylFunc import DiamCylFunc
+        self.comp = EllipticalCylinderModel()
+        self.diam = DiamCylFunc()
+        
+    def test(self):
+        """ Test 1D model for a EllipticalCylinder """
+        self.comp.setParam("r_minor", 20)
+        self.comp.setParam("r_ratio",1.5)  
+        self.comp.setParam("length",400)  
+        r_value = math.sqrt(20*20*1.5)    
+        self.diam.setParam("radius", r_value)
+        self.diam.setParam("length",400)       
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)  
+         
+class TestParallelepiped(unittest.TestCase):
+    """ Unit tests for calculate_ER (Parallelepipedmodel) """
+    
+    def setUp(self):
+        from sans.models.ParallelepipedModel import ParallelepipedModel
+        from sans.models.DiamCylFunc import DiamCylFunc
+        self.comp = ParallelepipedModel()
+        self.diam = DiamCylFunc()
+        
+    def test(self):
+        """ Test 1D model for a Parallelepiped """
+        self.comp.setParam("short_a", 35)
+        self.comp.setParam("short_b", 75)  
+        self.comp.setParam("long_c",400)  
+        r_value = math.sqrt(35*75/math.pi)    
+        self.diam.setParam("radius", r_value)
+        self.diam.setParam("length",400)   
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)   
+                                                  
+class TestEllipsoid(unittest.TestCase):
+    """ Unit tests for calculate_ER (Ellipsoid model) """
+    
+    def setUp(self):
+        from sans.models.EllipsoidModel import EllipsoidModel
+        from sans.models.DiamEllipFunc import DiamEllipFunc
+        self.comp = EllipsoidModel()
+        self.diam = DiamEllipFunc()
+        
+    def test(self):
+        """ Test 1D model for a Ellipsoid """
+        self.comp.setParam("radius_a", 20)
+        self.comp.setParam("radius_b",400)
+        self.diam.setParam("radius_a", 20)
+        self.diam.setParam("radius_b",400)       
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2)   
+
+class TestCoreShellEllipsoid(unittest.TestCase):
+    """ Unit tests for calculate_ER (CoreShellEllipsoid model) """
+    
+    def setUp(self):
+        from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel
+        from sans.models.DiamEllipFunc import DiamEllipFunc
+        self.comp = CoreShellEllipsoidModel()
+        self.diam = DiamEllipFunc()
+        
+    def test(self):
+        """ Test 1D model for a CoreShellEllipsoid """
+        self.comp.setParam("polar_shell", 20)
+        self.comp.setParam("equat_shell",400)       
+        self.diam.setParam("radius_a", 20)
+        self.diam.setParam("radius_b",400)
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2) 
+
+class TestTriaxialEllipsoid(unittest.TestCase):
+    """ Unit tests for calculate_ER (TriaxialEllipsoid model) """
+    
+    def setUp(self):
+        from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
+        from sans.models.DiamEllipFunc import DiamEllipFunc
+        self.comp = TriaxialEllipsoidModel()
+        self.diam = DiamEllipFunc()
+        
+    def test(self):
+        """ Test 1D model for a TriaxialEllipsoid """
+        self.comp.setParam("semi_axisA", 35)
+        self.comp.setParam("semi_axisB", 100)
+        self.comp.setParam("semi_axisC", 400)  
+        r_value = math.sqrt(35*100)    
+        self.diam.setParam("radius_a", 400)
+        self.diam.setParam("radius_b",r_value)
+        self.assertAlmostEqual(self.comp.calculate_ER(), self.diam.run(0.1)/2) 
+                    
+class TestLamellar(unittest.TestCase):
+    """ Unit tests for calculate_ER (Lamellarmodel)"""
+    
+    def setUp(self):
+        from sans.models.LamellarModel import LamellarModel
+        self.comp = LamellarModel()
+        
+    def test(self):
+        """ Test 1D model for a Lamellar """
+        #No finite number should return from Lamellar models.
+        self.assertFalse(numpy.isfinite(self.comp.calculate_ER())) 
+         
+class TestGuinier(unittest.TestCase):
+    """ Unit tests for calculate_ER (Guinier model) """
+    
+    def setUp(self):
+        from sans.models.GuinierModel import GuinierModel
+        self.comp = GuinierModel()
+        
+    def test(self):
+        """ Test 1D model for Guinier """    
+        #calculate_ER() is not implemented for pure python model functions
+        self.assertEqual(self.comp.calculate_ER(), NotImplemented)  
+        
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_model_onionexpshell.py
===================================================================
--- sansmodels/test/utest_model_onionexpshell.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_model_onionexpshell.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,141 @@
+"""
+    Unit tests for specific models
+    @author: JHJ Cho / UTK
+"""
+
+import unittest
+
+class TestOnionExpShell1(unittest.TestCase):
+    """ 
+        Unit tests for OnionExpShellModel
+    """
+    def setUp(self):
+
+        from sans.models.OnionExpShellModel import OnionExpShellModel
+        from sans.models.CoreMultiShellModel import CoreMultiShellModel
+        from sans.models.VesicleModel import VesicleModel 
+        
+        # intit models and the multifactor
+        self.model = OnionExpShellModel(1)
+        self.model2 = OnionExpShellModel(1).model
+        self.model3 = CoreMultiShellModel(1)
+        self.model4 = VesicleModel()
+        self.model5 = OnionExpShellModel(9)
+        
+    def test_compare_Exp0_flat(self):
+        """
+        Check if Exp function with A_shell=0 gives the same value as Flat function
+        """
+        print "\n*****Note: All tests (test_compare_Exp0_flat and test_compare_Expsmall_line) were passes since Sept. 18, 2010..."
+        # Exp: func_shell = 2, Line: func_shell =1 , Flat: func_shell = 0.
+        # A_shell = The coefficient of the exponential function: exp(A_shell*(r-ro)/thick_shell)
+        # exp function by default
+        # exp function crosses over to flat func at A_shell=0
+        self.model.setParam("A_shell1", 0)
+        # set A_shell=1
+        self.model2.setParam("A_shell1", 1)
+        # change the function to flat function
+        self.model2.setParam("func_shell1", 0)
+        #self.model2.setParam("sld_in_shell1", 1.7e-006)
+        #self.model2.setParam("sld_out_shell1", 1.7e-006)
+        
+        # model3: set param values as same as the model2
+        self.model3.setParam("background", 0.0)
+        self.model3.setParam("rad_core0", 200.0)
+        self.model3.setParam("scale", 1.0)
+        self.model3.setParam("sld_core0", 1.0e-006)
+        self.model3.setParam("sld_shell1", 1.7e-006)
+        self.model3.setParam("sld_solv", 6.4e-006)
+        self.model3.setParam("thick_shell1", 50.0)
+        
+        #Compare exp(A=0) to flat (where A_shell is null) function
+        self.assertEqual(self.model.run(0.1),self.model2.run(0.1))
+        self.assertAlmostEqual(self.model2.run(0.1),self.model3.run(0.1),10)
+        
+
+  
+    def test_compare_Expsmall_line(self):
+        """
+        Check if Exp function with A_shell-->0 gives the same value 
+        as a linear function
+        """
+        # exp function crosses over to line func as A_shell-->0
+        self.model.setParam("A_shell1", 0.000001)
+        self.model2.setParam("A_shell1", 1)
+        # change the function to a line function
+        self.model2.setParam("func_shell1", 1)
+        
+        #Compare exp(A=0.000001) to linear (where A_shell is null) function   
+        self.assertAlmostEqual(self.model.run(0.1),self.model2.run(0.1),4)
+        
+    def test_compare_time_linear_flat_functions(self):
+        """
+        Compare the calculation time between func=1(linear) , and 2 (step).
+        """
+        from time import time
+        # using linear func
+        self.model5.model.setParam("func_shell1", 1)
+        #input
+        input = [0.01,0.01]
+        st = time()
+        for iter in range(0,100000):
+            self.model5.model.run(0.01)
+        time_linear = time()-st
+        
+        # using flat function
+        self.model5.model.setParam("func_shell1", 0)
+        st = time()
+        for iter in range(0,100000):
+            self.model5.model.run(0.01)
+        time_flat = time()-st
+        
+        print "time (linear) = %s, \n time (flat) = %s"% (time_linear,time_flat)
+        
+        #Compare time of the calculation: time_linear takes a bit longer
+        # but they are not much different  
+        self.assertAlmostEqual(time_linear,time_flat,0)
+  
+    # this feature removed!!!
+    """
+    def test_compare_Exp0_flat_vesicle(self):
+    """
+    """
+        Check if Exp function with A_shell=0 gives the same value as Flat 
+        function of vesicle model when sld_solv=sld_core
+        """
+    """
+        print "\n*****Note: All tests (test_compare_Exp0_flat and \
+            test_compare_Expsmall_line) were passes since Sept. 18, 2010..."
+        # Exp: func_shell = 2, Line: func_shell =1 , Flat: func_shell = 0.
+        # A_shell = The coefficient of the exponential function: exp(A_shell*(r-ro)/thick_shell)
+        # exp function by default
+        # exp function crosses over to flat func at A_shell=0
+        self.model.setParam("A_shell1", 0)
+                # set A_shell=1
+        self.model2.setParam("A_shell1", 1)
+        # change the function to flat function
+        self.model2.setParam("func_shell1", 0)
+        
+        # model: set param values as same as the model2
+        self.model.setParam("background", 0.0)
+        self.model.setParam("rad_core0", 100.0)
+        self.model.setParam("scale", 1.0)
+        self.model.setParam("sld_core0", 6.36e-006)
+        self.model.setParam("sld_in_shell1", 5e-007)
+        self.model.setParam("sld_solv", 6.36e-006)
+        self.model.setParam("thick_shell1", 30.0)
+        # model2: set param values as same as the model2
+        self.model2.setParam("background", 0.0)
+        self.model2.setParam("rad_core0", 100.0)
+        self.model2.setParam("scale", 1.0)
+        self.model2.setParam("sld_core0", 6.36e-006)
+        self.model2.setParam("sld_in_shell1", 5e-007)
+        self.model2.setParam("sld_solv", 6.36e-006)
+        self.model2.setParam("thick_shell1", 30.0)
+        #Compare exp(A=0) to flat (where A_shell is null) function
+        self.assertEqual(self.model.run(0.1),self.model4.run(0.1))
+        self.assertEqual(self.model2.run(0.1),self.model4.run(0.1))
+        #self.assertAlmostEqual(self.model2.run(0.1),self.model3.run(0.1),10)
+    """               
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_model_pearlnecklace.py
===================================================================
--- sansmodels/test/utest_model_pearlnecklace.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_model_pearlnecklace.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,57 @@
+"""
+    Unit tests for specific models II
+"""
+
+import unittest, time, math
+     
+class TestPerlNecklace(unittest.TestCase):
+    """ Unit tests for PerlNecklace """
+    
+    def setUp(self):
+        from sans.models.PearlNecklaceModel import PearlNecklaceModel
+        self.pnl = PearlNecklaceModel()
+        from sans.models.SphereModel import SphereModel
+        self.sphere = SphereModel()
+        from sans.models.BarBellModel import BarBellModel
+        self.bar = BarBellModel()
+        
+    def testwithsphere(self):
+        """ Compare 1D model with sphere """
+        self.pnl.setParam("radius", 60)
+        self.pnl.setParam("num_pearls", 1)
+        self.pnl.setParam("sld_pearl", 2e-06)
+        self.pnl.setParam("sld_solv", 1e-06)
+        self.assertAlmostEqual(self.pnl.run(0.001), self.sphere.run(0.001), 5)
+        self.assertAlmostEqual(self.pnl.run(0.005), self.sphere.run(0.005), 5)
+        self.assertAlmostEqual(self.pnl.run(0.01), self.sphere.run(0.01), 5)
+        self.assertAlmostEqual(self.pnl.run(0.05), self.sphere.run(0.05), 5)
+        self.assertAlmostEqual(self.pnl.run(0.1), self.sphere.run(0.1), 5)
+        self.assertAlmostEqual(self.pnl.run(0.5), self.sphere.run(0.5), 5)
+        
+    def testwithbarbell(self):
+        """ 
+        Compare 1D model with barbell
+        
+        Note:  pearlnecklace assumes infinite thin rod
+        """
+        self.pnl.setParam("radius", 20)
+        self.pnl.setParam("num_pearls", 2)
+        self.pnl.setParam("sld_pearl", 1e-06)
+        self.pnl.setParam("sld_string", 1e-06)
+        self.pnl.setParam("sld_solv", 6.3e-06)
+        self.pnl.setParam("thick_string", 0.1)
+        self.pnl.setParam("edge_separation", 400)
+        self.bar.setParam("rad_bar", 0.1)
+        self.bar.setParam("rad_bell", 20)
+        
+        self.assertAlmostEqual(self.pnl.run(0.001), self.bar.run(0.001), 1)
+        self.assertAlmostEqual(self.pnl.run(0.005), self.bar.run(0.005), 1)
+        self.assertAlmostEqual(self.pnl.run(0.01), self.bar.run(0.01), 1)
+        self.assertAlmostEqual(self.pnl.run(0.05), self.bar.run(0.05), 1)
+        self.assertAlmostEqual(self.pnl.run(0.1), self.bar.run(0.1), 1)
+        self.assertAlmostEqual(self.pnl.run(0.5), self.bar.run(0.5), 1)
+        
+        
+
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_model_sphericalsldmodel.py
===================================================================
--- sansmodels/test/utest_model_sphericalsldmodel.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_model_sphericalsldmodel.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,77 @@
+"""
+    Unit tests for specific models
+    @author: JHJ Cho / UTK
+"""
+
+import unittest
+
+class TestSphericalSLDModel(unittest.TestCase):
+    """ 
+        Unit tests for OnionExpShellModel
+    """
+    def setUp(self):
+
+        from sans.models.SphericalSLDModel import SphericalSLDModel
+        from sans.models.OnionExpShellModel import OnionExpShellModel
+        
+        # intit models and the multifactor
+        # layer 
+        self.model = SphericalSLDModel(1)
+        self.model2 = OnionExpShellModel(3)
+        
+    def test_compare_SphericalSLD_OnionExpShell(self):
+        """
+        Check if SphericalSLD equals (up to 1%) to 
+        OnionExpShellModel with an equivalent SLD profile 
+        """
+        note = "\n*****Note: This test was passes since Nov. 1st, 2010..."
+        print note
+        # set params
+        self.model.setParam("npts_inter", 35)
+        self.model.setParam("rad_core0", 100)
+        self.model.setParam("thick_inter0", 200)
+        self.model.setParam("nu_inter0", 4)
+        # Rexp func
+        self.model.setParam("func_inter0", 3)
+        self.model.setParam("thick_inter1", 200)
+        self.model.setParam("nu_inter1", 4)
+        self.model.setParam("func_inter1", 3)
+        # set A_shell=1
+        self.model2.setParam("sld_core0", 2.07e-006)
+        # change the function to flat function
+        self.model2.setParam("rad_core0", 100)
+        self.model2.setParam("thick_shell1", 200)
+        self.model2.setParam("sld_out_shell1", 4e-006)
+        self.model2.setParam("sld_in_shell1", 2.07e-006)
+        self.model2.setParam("A_shell1", -4)
+        self.model2.setParam("thick_shell2", 100)
+        self.model2.setParam("sld_out_shell2", 4e-006)
+        self.model2.setParam("sld_in_shell2", 4e-006)
+        self.model2.setParam("A_shell2", 0)
+        self.model2.setParam("thick_shell3", 200)
+        self.model2.setParam("sld_out_shell3", 1e-006)
+        self.model2.setParam("sld_in_shell3", 4e-006)
+        self.model2.setParam("A_shell3", -4)
+        self.model2.setParam("sld_solv", 1e-006)
+        
+        #sphericalsld model runs
+        model_run_0_1 = self.model.run(0.1)
+        model_run_0_01 = self.model.run(0.01)
+        model_run_0_001 = self.model.run(0.001)
+        #onionexp model runs
+        model2_run_0_1 = self.model2.run(0.1)
+        model2_run_0_01 = self.model2.run(0.01)
+        model2_run_0_001 = self.model2.run(0.001)
+        import time
+        st = time.time()
+        qs = []
+        qs = [i/10000 for i in range(1,1000)]
+        out = map(self.model.run,qs)
+        print time.time()-st
+        #Compare exp(A=0) to flat (where A_shell is null) function
+        self.assertAlmostEqual(self.model.run(0.1),self.model2.run(0.1),4)
+        self.assertAlmostEqual(self.model.run(0.01),self.model2.run(0.01),0)
+        self.assertAlmostEqual(self.model.run(0.001),self.model2.run(0.001),-3)
+                        
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_modelmultiplication.py
===================================================================
--- sansmodels/test/utest_modelmultiplication.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_modelmultiplication.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,726 @@
+"""
+    Unit tests for specific models
+    @author: JHJ Cho / UTK
+"""
+#This test replaces the older utests for multiplicationModel. Aug. 31, 2009. JC
+import unittest, numpy,math
+### P*S with sphere model    
+class TestsphereSuareW(unittest.TestCase):
+    """ 
+        Unit tests for SphereModel(Q) * SquareWellStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        from sans.models.SquareWellStructure import SquareWellStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = SphereModel()
+        self.model2 = SquareWellStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc() 
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        modelDrun = 60
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun )
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication  (check the setparameters and the run & runXY w/ array dispersion)"""
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            if not 'scale' in item: 
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)
+        
+        val_1d = self.model3.run(math.sqrt(0.0002))
+        val_2d = self.model3.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)
+      
+class TestsphereHardS(unittest.TestCase):
+    """ 
+        Unit tests for SphereModel(Q) * HardsphereStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        from sans.models.HardsphereStructure import HardsphereStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = SphereModel()
+        self.model2 = HardsphereStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc() 
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        modelDrun = 60
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun )
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication  (check the parameters)"""
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            if not 'scale' in item: 
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)
+        
+        val_1d = self.model3.run(math.sqrt(0.0002))
+        val_2d = self.model3.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)
+class TestsphereSHS(unittest.TestCase):
+    """ 
+        Unit tests for SphereModel(Q) * StickyHSStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        from sans.models.StickyHSStructure import StickyHSStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = SphereModel()
+        self.model2 = StickyHSStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc() 
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        modelDrun = 60
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun )
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication  (check the parameters)"""
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            if not 'scale' in item: 
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)
+        
+        val_1d = self.model3.run(math.sqrt(0.0002))
+        val_2d = self.model3.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)
+        
+class TestsphereHayterM(unittest.TestCase):
+    """ 
+        Unit tests for SphereModel(Q) * HayterMSAStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        from sans.models.HayterMSAStructure import HayterMSAStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = SphereModel()
+        self.model2 = HayterMSAStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc() 
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        modelDrun = 60
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun )
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication  (check the parameters)"""
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            if not 'scale' in item: 
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)
+        
+        val_1d = self.model3.run(math.sqrt(0.0002))
+        val_2d = self.model3.runXY([0.01,0.01]) 
+
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)      
+          
+### P*S with cylinder model
+class TestcylinderSuareW(unittest.TestCase):
+    """ 
+        Unit tests for CylinderModel(Q) * SquareWellStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        from sans.models.SquareWellStructure import SquareWellStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = CylinderModel()
+        self.model2 = SquareWellStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc() 
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        self.modelD.setParam("radius", 60)
+        modelDrun = self.modelD.run(0.1)/2
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun)
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication  (check the setparameters and the run & runXY w/ array dispersion)"""
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            if not 'scale' in item: 
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
+         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
+          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)
+        
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)
+      
+class TestcylinderHardS(unittest.TestCase):
+    """ 
+        Unit tests for CylinderModel(Q) * HardsphereStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        from sans.models.HardsphereStructure import HardsphereStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = CylinderModel()
+        self.model2 = HardsphereStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc() 
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        self.modelD.setParam("radius", 60)
+        modelDrun = self.modelD.run(0.1)/2
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun )
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication """
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            #model3 parameters should not include scale*
+            if not 'scale' in item: 
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        #self.model3.setParam("scale", 15)
+        #self.assertEqual(self.model3.getParam("scale"), 15)
+        self.model3.setParam("scale_factor", 0.1)
+        self.assertEqual(self.model3.getParam("scale_factor"), 0.1)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
+         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
+          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)
+        
+
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)
+class TestcylinderSHS(unittest.TestCase):
+    """ 
+        Unit tests for SphereModel(Q) * StickyHSStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        from sans.models.StickyHSStructure import StickyHSStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = CylinderModel()
+        self.model2 = StickyHSStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc()
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        self.modelD.setParam("radius", 60)
+        modelDrun = self.modelD.run(0.1)/2
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun )
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication  (check the parameters)"""
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            if not 'scale' in item: 
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
+         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
+          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)
+        
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)
+        
+class TestcylinderHayterM(unittest.TestCase):
+    """ 
+        Unit tests for CylinderModel(Q) * HayterMSAStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        from sans.models.HayterMSAStructure import HayterMSAStructure
+        from sans.models.DiamCylFunc import DiamCylFunc
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = CylinderModel()
+        self.model2 = HayterMSAStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+        self.modelD = DiamCylFunc()
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("radius", 60)
+        self.modelD.setParam("radius", 60)
+        modelDrun = self.modelD.run(0.1)/2
+        self.model2.setParam("volfraction", 0.2)
+        self.model2.setParam("effect_radius", modelDrun )
+        
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #Compare radius from two different calculations. Note: modelD.run(0.0) is DIAMETER
+        self.assertEqual(self.model.calculate_ER(), modelDrun)
+        
+        
+    def testMultiplicationParam(self):
+        """ Test Multiplication  (check the parameters)"""
+        ## test details dictionary
+
+        ## test parameters list
+        list3= self.model3.getParamList()
+
+        for item in self.model.getParamList():
+            if not 'scale' in item:  
+                self.assert_(item in list3)
+        for item in self.model2.getParamList():
+            #model3 parameters should not include effect_radius*
+            if not 'effect_radius' in item:  
+                self.assert_(item in list3)
+            
+        ## test set value for parameters and get paramaters
+        #self.model3.setParam("scale", 15)
+        #self.assertEqual(self.model3.getParam("scale"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.model3.setParam("radius", 20)
+        self.assertEqual(self.model3.getParam("radius"), 20)
+        self.model3.setParam("radius.width", 15)
+        self.assertEqual(self.model3.getParam("radius.width"), 15)
+        self.model3.setParam("scale_factor", 15)
+        self.assertEqual(self.model3.getParam("scale_factor"), 15)
+        self.assertEqual(self.model3.getParam("volfraction"), self.model.getParam("scale"))
+        
+        ## Dispersity 
+        list3= self.model3.getDispParamList()
+        self.assertEqual(list3, ['radius.npts', 'radius.nsigmas', 'radius.width', 'length.npts', \
+         'length.nsigmas', 'length.width', 'cyl_theta.npts', 'cyl_theta.nsigmas', 'cyl_theta.width',\
+          'cyl_phi.npts', 'cyl_phi.nsigmas', 'cyl_phi.width'])
+        
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_th = ArrayDispersion()
+        
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_th[i]=(math.pi/99.0*i)
+            weights[i]=(1.0)
+    
+        disp_th.set_weights(values_th, weights)
+        
+        self.model3.set_dispersion('radius', disp_th)        
+
+        model4= self.model3.clone()
+        self.assertEqual(model4.getParam("radius"), 20)        
+        
+class TestGuinierHayterM(unittest.TestCase):
+    """ 
+        Unit tests for GuinierModel(Q) * HayterMSAStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.GuinierModel import GuinierModel
+        from sans.models.HayterMSAStructure import HayterMSAStructure
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = GuinierModel()
+        self.model2 = HayterMSAStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+
+    #Radius of model1.calculate_ER should be equal to the output/2 of DiamFunctions
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        self.model.setParam("rg", 60)
+        self.model.setParam("scale", 1)
+        #Compare new method with old method         
+        self.assertEqual(self.model3.run(0.1), self.model.run(0.1)*self.model2.run(0.1))
+        
+        #effective radius calculation is not implemented for this model. 
+        self.assertEqual(self.model3.calculate_ER(), NotImplemented)       
+        
+class TestLamellarHayterM(unittest.TestCase):
+    """ 
+        Unit tests for LamellarModel(Q) * HayterMSAStructure(Q)
+    """
+    def setUp(self):
+        from sans.models.LamellarModel import LamellarModel
+        from sans.models.HayterMSAStructure import HayterMSAStructure
+        from sans.models.MultiplicationModel import MultiplicationModel
+
+        self.model = LamellarModel()
+        self.model2 = HayterMSAStructure()
+        self.model3 = MultiplicationModel(self.model, self.model2)  
+
+    #Radius of model1.calculate_ER should Not be finite.
+    def test_multplication_radius(self):
+        """
+            test multiplication model (check the effective radius & the output
+             of the multiplication)
+        """
+        #Check run       
+        self.assertFalse(numpy.isfinite(self.model3.run(0.1)))
+        #check effective radius . 
+        self.assertFalse(numpy.isfinite(self.model.calculate_ER()))      
+                
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_models.py
===================================================================
--- sansmodels/test/utest_models.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_models.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,251 @@
+"""
+    Unit tests for specific models
+    @author: Mathieu Doucet / UTK
+"""
+
+import unittest, time, math
+
+# Disable "missing docstring" complaint
+# pylint: disable-msg=C0111
+# Disable "too many methods" complaint 
+# pylint: disable-msg=R0904 
+# Disable "could be a function" complaint 
+# pylint: disable-msg=R0201
+
+class TestSpherew(unittest.TestCase):
+    """ Unit tests for sphere model """
+    
+    def setUp(self):
+        from sans.models.CoreFourShellModel import CoreFourShellModel
+        from sans.models.CoreMultiShellModel import CoreMultiShellModel
+        self.comp = CoreMultiShellModel(4)
+        
+    def test1D(self):
+        """ Test 1D model for a sphere """
+        self.comp._set_dispersion()
+        
+class TestSphere(unittest.TestCase):
+    """ Unit tests for sphere model """
+    
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        self.comp = SphereModel()
+        
+    def test1D(self):
+        """ Test 1D model for a sphere """
+        self.assertAlmostEqual(self.comp.run(1.0), 5.6387e-5, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a sphere """
+        self.assertAlmostEqual(self.comp.run([1.0, 1.3]), 5.6387e-5, 4)
+
+class TestCyl(unittest.TestCase):
+    """Unit tests for cylinder"""
+    
+    def setUp(self):
+
+        from sans.models.CylinderModel import CylinderModel
+        self.comp = CylinderModel()
+        
+    def test1D(self):
+        """ Test 1D model of a cylinder """ 
+        self.assertAlmostEqual(self.comp.run(0.2), 0.041761386790780453, 4)
+       
+    def testTime(self):
+        """ Time profiling """
+        self.comp.run(2.0)
+        t0 = time.clock()
+        self.assertTrue(time.clock()-t0<1e-5)
+     
+    def test2D(self):
+        """ Test 2D model of a cylinder """ 
+        self.comp.setParam('cyl_theta', 1*180/math.pi)
+        self.comp.setParam('cyl_phi', 1*180/math.pi)
+        self.assertAlmostEqual(self.comp.run([0.2, 2.5]), 
+                               0.038176446608393366, 4)
+       
+    def testIO(self):
+        from sans.models.ModelFactory import ModelFactory
+        from sans.models.ModelIO import ModelIO
+        factory = ModelFactory()
+        io = ModelIO(factory)
+        io.save(self.comp,"myModel.xml")
+        value = self.comp.run(1)
+        loaded = io.load("myModel.xml")
+        self.assertEqual(value, loaded.run(1))
+        
+    def testIO_add(self):
+        # version 0.5.0: No longer supported
+        return
+        from sans.models.ModelFactory import ModelFactory
+        from sans.models.ModelIO import ModelIO
+        factory = ModelFactory()
+        io = ModelIO(factory)
+        sph = factory.getModel("SphereModel")
+        cyl = factory.getModel("CylinderModel")
+        combo = sph - cyl
+        io.save(combo,"myModel.xml")
+        value = combo.run(1)
+        loaded = io.load("myModel.xml")
+        self.assertEqual(value, loaded.run(1))
+        
+    def testIO_add2(self):
+        # version 0.5.0: No longer supported
+        return
+        from sans.models.ModelFactory import ModelFactory
+        #from sans.models.ModelIO import ModelIO
+        factory = ModelFactory()
+        #io = ModelIO(factory)
+        sph = factory.getModel("SphereModel")
+        cyl = factory.getModel("CylinderModel")
+        sph2 = factory.getModel("SphereModel")
+        combo1 = cyl - sph
+        combo = combo1 / sph2
+        #combo1 = sph
+        #io.save(combo,"myModel.xml")
+        # Just check that we have some output
+        self.assertTrue(math.fabs(combo.run(1))>0)
+        #loaded = io.load("myModel.xml")
+        #self.assertEqual(value, loaded.run(1))
+        
+        
+      
+       
+class TestFactory(unittest.TestCase):
+    """Unit tests for Model Factory"""
+    
+    def setUp(self):
+        from sans.models.ModelFactory import ModelFactory
+        self.comp = ModelFactory().getModel('CylinderModel')
+        
+    def test1D(self):
+        """ Test 1D model of a cylinder """ 
+        self.assertAlmostEqual(self.comp.run(0.2), 0.041761386790780453, 4)
+        
+ 
+class TestGaussian(unittest.TestCase):
+    """Unit tests for Gaussian function"""
+    
+    def setUp(self):
+        from sans.models.Gaussian import Gaussian
+        self.gauss= Gaussian()
+        
+    def test1D(self):
+        self.gauss.setParam('scale', 2.0)
+        self.gauss.setParam('center', 1.0)
+        self.gauss.setParam('sigma', 1.0)
+        self.assertEqual(self.gauss.run(1.0), 2.0)
+        value = math.exp(-0.5)
+        self.assertEqual(self.gauss.run(2.0), 2.0*value)
+        
+    def test2D(self):
+        self.gauss.setParam('scale', 2.0)
+        self.gauss.setParam('center', 1.0)
+        self.gauss.setParam('sigma', 1.0)
+        self.assertEqual(self.gauss.runXY([1.0,1.0]), 2.0*2.0)
+        value = math.exp(-0.5)
+        self.assertEqual(self.gauss.runXY([1.0,2.0]), 2.0*2.0*value)
+        self.assertEqual(self.gauss.runXY([2.0,2.0]), 2.0*2.0*value*value)
+        
+    def test2Dphi(self):
+        self.gauss.setParam('scale', 2.0)
+        self.gauss.setParam('center', 1.0)
+        self.gauss.setParam('sigma', 1.0)
+        value = math.exp(-0.5)
+        self.assertAlmostEqual(self.gauss.run([math.sqrt(8.0), math.pi/4.0]), 2.0*2.0*value*value, 5)
+        
+class TestLorentzian(unittest.TestCase):
+    """Unit tests for Lorentzian function"""
+    
+    def setUp(self):
+        from sans.models.Lorentzian import Lorentzian
+        self.lor= Lorentzian()
+        
+    def test1D(self):
+        self.lor.setParam('scale', 2.0)
+        self.lor.setParam('center', 1.0)
+        self.lor.setParam('gamma', 1.0)
+        self.assertEqual(self.lor.run(1.0), 4.0/math.pi)
+        value = 1/math.pi*0.5/(1+.25)
+        self.assertEqual(self.lor.run(2.0), 2.0*value)
+        
+    def test2D(self):
+        self.lor.setParam('scale', 0.5*math.pi)
+        self.lor.setParam('center', 1.0)
+        self.lor.setParam('gamma', 1.0)
+        self.assertEqual(self.lor.run(1.0), 1.0)
+        value = 0.25/(1+.25)
+        self.assertEqual(self.lor.runXY([1.0,2.0]), value)
+        self.assertEqual(self.lor.runXY([2.0,2.0]), value*value)
+        
+    def test2Dphi(self):
+        self.lor.setParam('scale', 0.5*math.pi)
+        self.lor.setParam('center', 1.0)
+        self.lor.setParam('gamma', 1.0)
+        self.assertEqual(self.lor.run(1.0), 1.0)
+        value = 0.25/(1+.25)
+        self.assertAlmostEqual(self.lor.run([math.sqrt(8.0), math.pi/4.0]), value*value, 5)
+        
+class TestSin(unittest.TestCase):
+    """Unit tests for Sin(x) function"""
+    
+    def setUp(self):
+        from sans.models.Sin import Sin
+        self.sin = Sin()
+
+    def test1D(self):
+        self.assertEqual(self.sin.run(1.13), math.sin(1.13))
+        
+    def test2D(self):
+        self.assertEqual(self.sin.run([1.13,0.56]), math.sin(1.13*math.cos(0.56))*math.sin(1.13*math.sin(0.56)))
+        self.assertEqual(self.sin.runXY([1.13,0.56]), math.sin(1.13)*math.sin(0.56))
+        
+class TestCos(unittest.TestCase):
+    """Unit tests for Cos(x) function"""
+    
+    def setUp(self):
+        from sans.models.Cos import Cos
+        self.cos = Cos()
+
+    def test1D(self):
+        self.assertEqual(self.cos.run(1.13), math.cos(1.13))
+        
+    def test2D(self):
+        self.assertEqual(self.cos.run([1.13,0.56]), math.cos(1.13*math.cos(0.56))*math.cos(1.13*math.sin(0.56)))
+        self.assertEqual(self.cos.runXY([1.13,0.56]), math.cos(1.13)*math.cos(0.56))
+        
+class TestConstant(unittest.TestCase):
+    """Unit tests for Cos(x) function"""
+    
+    def setUp(self):
+        from sans.models.Constant import Constant
+        self.const = Constant()
+        self.const.setParam('value',56.1)
+
+    def test1D(self):
+        self.assertEqual(self.const.run(1.13), 56.1)
+        
+    def test2D(self):
+        self.assertEqual(self.const.run([1.13,0.56]), 56.1)
+        self.assertEqual(self.const.runXY([1.13,0.56]), 56.1)
+        
+    def testFunction(self):
+        # version 0.5.0: No longer supported
+        return
+        from sans.models.Sin import Sin
+        s = Sin()
+        A = self.const
+        A.setParam('Value',1.5)
+        B = self.const.clone()
+        B.setParam('value',2.0)
+        C = self.const.clone()
+        C.setParam('value',3.0)
+        
+        f = A+B*s*s+C
+        answer = 1.5+2.0*math.sin(1.1)**2+3.0
+        self.assertEqual(f.run(1.1), answer)
+    
+        
+
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_models_array.py
===================================================================
--- sansmodels/test/utest_models_array.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_models_array.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,86 @@
+"""
+    Unit tests for specific models using numpy array input
+    @author: Gervaise B Alina/ UTK
+"""
+
+import unittest, time, math, numpy
+
+        
+class TestSphere(unittest.TestCase):
+    """ Unit tests for sphere model using evalDistribution function """
+    
+    def setUp(self):
+        from sans.models.SphereModel import SphereModel
+        self.comp = SphereModel()
+        self.x = numpy.array([1.0,2.0,3.0, 4.0])
+        self.y = self.x +1
+        
+    def test1D(self):
+        """ Test 1D model for a sphere  with vector as input"""
+        answer = numpy.array([5.63877831e-05,2.57231782e-06,2.73704050e-07,2.54229069e-08])
+       
+       
+        testvector= self.comp.evalDistribution(self.x)
+       
+        self.assertAlmostEqual(len(testvector),4)
+        for i in xrange(len(answer)):
+            self.assertAlmostEqual(testvector[i],answer[i])
+       
+    def test1D_1(self):
+        """ Test 2D model for a sphere  with scalar as input"""
+        self.assertAlmostEqual(self.comp.run(1.0),5.63877831e-05, 4)
+         
+    def test1D_2(self):
+        """ Test 2D model for a sphere for 2 scalar """
+        self.assertAlmostEqual(self.comp.run([1.0, 1.3]), 56.3878e-06, 4)
+        
+    def test1D_3(self):
+        """ Test 2D model for a Shpere for 2 vectors as input """
+        #x= numpy.reshape(self.x, [len(self.x),1])
+        #y= numpy.reshape(self.y, [1,len(self.y)])
+        vect = self.comp.evalDistribution([self.x,self.y])
+        self.assertAlmostEqual(vect[0],9.2985e-07, 4)
+        self.assertAlmostEqual(vect[len(self.x)-1],1.3871e-08, 4)
+        
+        
+class TestCylinder(unittest.TestCase):
+    """ Unit tests for Cylinder model using evalDistribution function """
+    
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        self.comp = CylinderModel()
+        self.x = numpy.array([1.0,2.0,3.0, 4.0])
+        self.y = self.x +1
+        
+    def test1D(self):
+        """ Test 1D model for a cylinder with vector as input"""
+        
+        answer = numpy.array([1.98860592e-04,7.03686335e-05,2.89144683e-06,2.04282827e-06])
+
+        testvector= self.comp.evalDistribution(self.x)
+        self.assertAlmostEqual(len(testvector),4)
+        for i in xrange(len(answer)):
+            self.assertAlmostEqual(testvector[i],answer[i])
+       
+    def test1D_1(self):
+        """ Test 2D model for a cylinder  with scalar as input"""
+        self.assertAlmostEqual(self.comp.run(0.2), 0.041761386790780453, 4)
+         
+    def test1D_2(self):
+        """ Test 2D model of a cylinder """ 
+        self.comp.setParam('cyl_theta', 1.0 * 180/3.1415)
+        self.comp.setParam('cyl_phi', 1.0 * 180/3.1415)
+        self.assertAlmostEqual(self.comp.run([0.2, 2.5]), 
+                               0.038176446608393366, 3)
+        
+    def test1D_3(self):
+        """ Test 2D model for a cylinder for 2 vectors as input """
+        vect = self.comp.evalDistribution([self.x,self.y])
+      
+        self.assertAlmostEqual(vect[0],5.06121018e-08,4)
+        self.assertAlmostEqual(vect[len(self.x)-1],2.5978e-11, 4)
+        
+        
+
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_models_new1_3.py
===================================================================
--- sansmodels/test/utest_models_new1_3.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_models_new1_3.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,86 @@
+"""
+    Unit tests for specific models II
+"""
+
+import unittest, time, math
+     
+class TestFuzzySphere(unittest.TestCase):
+    """ Unit tests for fuzzysphere model """
+    
+    def setUp(self):
+        from sans.models.FuzzySphereModel import FuzzySphereModel
+        self.comp = FuzzySphereModel()
+        
+    def test1D(self):
+        """ Test 1D model for a fuzzysphere """
+        self.assertAlmostEqual(self.comp.run(1), 0.001, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a fuzzysphere """
+        self.assertAlmostEqual(self.comp.run([1, 1.3]), 0.001, 3)
+        
+class TestPolyGaussCoil(unittest.TestCase):
+    """ Unit tests for PolyGaussCoil """
+    
+    def setUp(self):
+        from sans.models.Poly_GaussCoil import Poly_GaussCoil
+        self.comp = Poly_GaussCoil()
+        
+    def test1D(self):
+        """ Test 1D model for a PolyGaussCoil """
+        self.assertAlmostEqual(self.comp.run(0.107000453), 0.0688476, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a PolyGaussCoil """
+        self.assertAlmostEqual(self.comp.run([0.107000453, 0.2]), 0.0688476, 4)
+                
+class TestCoreFourShellModel(unittest.TestCase):
+    """ Unit tests for CoreFourShellModel """
+    
+    def setUp(self):
+        from sans.models.CoreFourShellModel import CoreFourShellModel
+        self.comp = CoreFourShellModel()
+        
+    def test1D(self):
+        """ Test 1D model for a CoreFourShellModel """
+        print "sldsolv",self.comp.getParam("sld_solv")
+        self.assertAlmostEqual(self.comp.run(0.001), 3318.19548, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a CoreFourShellModel """
+        self.assertAlmostEqual(self.comp.run([0.001, 0.2]), 3318.19548, 4)
+
+class TestFractal(unittest.TestCase):
+    """ Unit tests for Fractal model """
+    
+    def setUp(self):
+        from sans.models.FractalModel import FractalModel
+        self.comp = FractalModel()
+        
+    def test1D(self):
+        """ Test 1D model for a Fractal """
+        self.assertAlmostEqual(self.comp.run(0.001), 39.288146, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Fractal """
+        self.assertAlmostEqual(self.comp.run([0.001, 1]), 39.288146, 4)
+                                
+class TestLamella(unittest.TestCase):
+    """ Unit tests for Lamella model """
+    
+    def setUp(self):
+        from sans.models.LamellarModel import LamellarModel
+        self.comp = LamellarModel()
+        
+    def test1D(self):
+        """ Test 1D model for a Lamellar """
+        self.assertAlmostEqual(self.comp.run(1.0), 5.6387e-5, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Lamellar """
+        self.assertAlmostEqual(self.comp.run([1.0, 1.3]), 5.6387e-5, 4)
+                
+        
+
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_newstylemodels.py
===================================================================
--- sansmodels/test/utest_newstylemodels.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_newstylemodels.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,93 @@
+"""
+    Unit tests for dispersion functionality of 
+    C++ model classes
+"""
+print "New style models are still under development"
+import unittest, math, numpy
+
+class TestModel(object):
+    """
+        An old-style model
+    """
+    def __init__(self):
+        ## Parameter dictionary
+        self.params = {}
+        self.params['scale']       = 0.05
+        
+        ## Parameter details [units, min, max]
+        self.details = {}
+        self.details['scale']       = ['',     None, None]
+
+    def run(self, x):
+        return self.params['scale']*x
+
+from sans.models.BaseModel import BaseModel, Parameter, ParameterProperty
+class NewTestModel(BaseModel):
+    scale = ParameterProperty('scale')
+    
+    def __init__(self):  
+        BaseModel.__init__(self)  
+        self.parameters = {}
+        self.parameters['scale'] = Parameter('scale', 4.0) 
+        
+        
+    def runXY(self, x):
+        return self.scale*x
+        
+class TestBogusModel(unittest.TestCase):
+    def setUp(self):
+        self.model = NewTestModel()
+        
+    def test_call(self):
+        self.assertEqual(self.model(1), 4.0)
+        self.model.scale = 1.0
+        self.assertEqual(self.model(1), 1.0)
+        self.model.setParam('scale',2.0)
+        self.assertEqual(self.model(1), 2.0)
+        self.assertEqual(self.model.getParam('scale'), 2.0)
+        
+class TestBaseModel(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.BaseModel import BaseModel
+        self.model = BaseModel()
+        
+        
+    def test_removed_attrs(self):
+        def setop():
+            print self.model.operateOn
+        self.assertRaises(AttributeError, setop)
+        def setother():
+            print self.model.other
+        self.assertRaises(AttributeError, setother)
+        
+class TestAdaptor(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.NewCylinderModel import CylinderModel
+        self.model = CylinderModel()
+        
+        
+    def test_setparam(self):
+        self.model.setParam("length", 151.0)
+        self.assertEquals(self.model.getParam("length"), 151.0)
+        
+        
+        
+        print self.model(0.001)
+        print self.model.parameters['length']
+        self.model.setParam("length", 250.0)
+        self.assertEquals(self.model.getParam("length"), 250.0)
+        
+        print self.model.parameters['length']
+        print self.model(0.001)
+        
+    
+  
+if __name__ == '__main__':
+    unittest.main()
+   
Index: sansmodels/test/utest_nonshape.py
===================================================================
--- sansmodels/test/utest_nonshape.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_nonshape.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,522 @@
+"""
+    Unit tests for non shape based model (Task 8.2.1)
+    These tests are part of the requirements
+"""
+
+import unittest, time, math
+from scipy.special import erf,gammaln
+
+# Disable "missing docstring" complaint
+# pylint: disable-msg=C0111
+# Disable "too many methods" complaint 
+# pylint: disable-msg=R0904 
+# Disable "could be a function" complaint 
+# pylint: disable-msg=R0201
+
+import scipy 
+class TestGuinier(unittest.TestCase):
+    """
+        Unit tests for Guinier function
+        
+        F(x) = exp[ [A] + [B]*Q**2 ]
+        
+        The model has two parameters: A and B
+    """
+    def _func(self, a, b, x):
+        return a*math.exp(-(b*x)**2/3.0)
+    
+    def setUp(self):
+        from sans.models.GuinierModel import GuinierModel
+        self.model= GuinierModel()
+        
+    def test1D(self):
+        self.model.setParam('scale', 2.0)
+        self.model.setParam('rg', 1.0)
+        
+        self.assertEqual(self.model.run(0.0), 2.0)
+        self.assertEqual(self.model.run(2.0), 2.0*math.exp(-(1.0*2.0)**2/3.0))
+        self.assertEqual(self.model.runXY(2.0), 2.0*math.exp(-(1.0*2.0)**2/3.0))
+        
+    def test2D(self):
+        self.model.setParam('scale', 2.0)
+        self.model.setParam('rg', 1.0)
+        
+        #value = self._func(2.0, 1.0, 1.0)*self._func(2.0, 1.0, 2.0)
+        value = self._func(2.0, 1.0, math.sqrt(5.0))
+        #self.assertEqual(self.model.runXY([0.0,0.0]), 2.0*2.0)
+        self.assertEqual(self.model.runXY([0.0,0.0]), 2.0)
+        self.assertEqual(self.model.runXY([1.0,2.0]), value)
+        
+    def test2Dphi(self):
+        self.model.setParam('scale', 2.0)
+        self.model.setParam('rg', 1.0)
+        
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        #value = self._func(2.0, 1.0, x)*self._func(2.0, 1.0, y)
+        value = self._func(2.0, 1.0, r)
+        
+        #self.assertEqual(self.model.run([r, phi]), value)
+        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
+        
+        
+class TestPorod(unittest.TestCase):
+    """
+        Unit tests for Porod function
+        
+        F(x) = C/Q**4 
+        
+        The model has one parameter: C
+    """
+    def _func(self, c, x):
+        return c/(x**4)
+    
+    def setUp(self):
+        from sans.models.PorodModel import PorodModel
+        self.model= PorodModel()
+        self.model.setParam('scale', 2.0)        
+        
+    def test1D(self):
+        value = self._func(2.0, 3.0)
+        self.assertEqual(self.model.run(3.0), value)
+        self.assertEqual(self.model.runXY(3.0), value)
+        
+    def test2D(self):
+        #value = self._func(2.0, 1.0)*self._func(2.0, 2.0)
+        value = self._func(2.0, math.sqrt(5.0))
+        self.assertEqual(self.model.runXY([1.0,2.0]), value)
+        
+    def test2Dphi(self):
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        #value = self._func(2.0, 1.0)*self._func(2.0, 2.0)
+        value = self._func(2.0, r)
+        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
+        
+class TestDebye(unittest.TestCase):
+    """
+        Unit tests for Debye function
+        
+        F(x) = 2( exp(-x)+x -1 )/x**2
+        
+        The model has three parameters: 
+            Rg     =  radius of gyration
+            scale  =  scale factor
+            bkd    =  Constant background
+    """
+    def _func(self, Rg, scale, bkg, x):
+        y = (Rg * x)**2
+        return scale * (2*(math.exp(-y) + y -1)/y**2) + bkg
+    
+    def setUp(self):
+        from sans.models.DebyeModel import DebyeModel
+        self.model= DebyeModel()
+        self.model.setParam('rg', 50.0)    
+        self.model.setParam('scale',1.0) 
+        self.model.setParam('background',0.001)   
+        
+    def test1D(self):
+        value = self._func(50.0, 1.0, 0.001, 2.0)
+        self.assertEqual(self.model.run(2.0), value)
+        self.assertEqual(self.model.runXY(2.0), value)
+
+        # User enter zero as a value of x, y= 1
+        self.assertAlmostEqual(self.model.run(0.0), 1.00, 2)
+        
+    def test1D_clone(self):
+        value = self._func(50.0, 1.0, 10.0, 2.0)
+        self.model.setParam('background', 10.0)
+        clone = self.model.clone()
+        self.assertEqual(clone.run(2.0), value)
+        self.assertEqual(clone.runXY(2.0), value)
+        
+        # User enter zero as a value of x
+        # An exceptio is raised: No more exception
+        #self.assertRaises(ZeroDivisionError, clone.run, 0.0)
+        
+    def test2D(self):
+        #value = self._func(50.0, 1.0, 0.001, 1.0)*self._func(50.0, 1.0, 0.001, 2.0)
+        value = self._func(50.0, 1.0, 0.001, math.sqrt(5.0))
+        self.assertEqual(self.model.runXY([1.0,2.0]), value)
+        
+    def test2Dphi(self):
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        value = self._func(50.0, 1.0, 0.001, 1.0)*self._func(50.0, 1.0, 0.001, 2.0)
+        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
+        
+        
+class TestLorentz(unittest.TestCase):
+    """
+        Unit tests for Lorentz function
+        
+         F(x) = scale/( 1 + (x*L)^2 ) + bkd
+        
+        The model has three parameters: 
+            L     =  screen Length
+            scale  =  scale factor
+            bkd    =  incoherent background
+    """
+    def _func(self, I0 , L, bgd, qval):
+        return I0/(1.0 + (qval*L)*(qval*L)) + bgd
+    
+    def setUp(self):
+        from sans.models.LorentzModel import LorentzModel
+        self.model= LorentzModel()
+        
+    def test1D(self):
+        self.model.setParam('scale', 100.0)
+        self.model.setParam('Length', 50.0)
+        self.model.setParam('background', 1.0)
+        
+        self.assertEqual(self.model.run(0.0), 101.0)
+        self.assertEqual(self.model.run(2.0), self._func(100.0, 50.0, 1.0, 2.0))
+        self.assertEqual(self.model.runXY(2.0), self._func(100.0, 50.0, 1.0, 2.0))
+        
+    def test2D(self):
+        self.model.setParam('scale', 100.0)
+        self.model.setParam('Length', 50.0)
+        self.model.setParam('background', 1.0)
+        
+        #value = self._func(100.0, 50.0, 1.0, 1.0)*self._func(100.0, 50.0, 1.0, 2.0)    
+        value = self._func(100.0, 50.0, 1.0, math.sqrt(5.0))  
+        self.assertEqual(self.model.runXY([1.0,2.0]), value)
+        
+    def test2Dphi(self):
+        self.model.setParam('scale', 100.0)
+        self.model.setParam('Length', 50.0)
+        self.model.setParam('background', 1.0)
+        
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        value = self._func(100.0, 50.0, 1.0, x)*self._func(100.0, 50.0, 1.0, y)
+        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
+        
+class TestDAB(unittest.TestCase):
+    """
+        Unit tests for DAB function
+        
+         F(x) = scale/( 1 + (x*L)^2 )^(2) + bkd
+        
+        The model has three parameters: 
+            L      =  Correlation Length
+            scale  =  scale factor
+            bkd    =  incoherent background
+    """
+    def _func(self, Izero, range, incoh, qval):
+        return Izero* pow(range,3)/pow((1.0 + (qval*range)*(qval*range)),2) + incoh
+    
+    def setUp(self):
+        from sans.models.DABModel import DABModel
+        self.model= DABModel()
+        self.scale = 10.0
+        self.length = 40.0
+        self.back = 1.0
+        
+        self.model.setParam('scale', self.scale)
+        self.model.setParam('length', self.length)
+        self.model.setParam('background', self.back)
+        
+    def test1D(self):
+
+        self.assertEqual(self.model.run(2.0), self._func(self.scale, self.length, self.back, 2.0))
+        self.assertEqual(self.model.runXY(2.0), self._func(self.scale, self.length, self.back, 2.0))
+        
+    def test2D(self):
+        #value = self._func(self.scale, self.length, self.back, 1.0)*self._func(self.scale, self.length, self.back, 2.0)    
+        value = self._func(self.scale, self.length, self.back, math.sqrt(5.0))
+        self.assertEqual(self.model.runXY([1.0,2.0]), value)
+        
+    def test2Dphi(self):
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        value = self._func(self.scale, self.length, self.back, x)*self._func(self.scale, self.length, self.back, y)
+        self.assertAlmostEquals(self.model.run([x, y]), value,1)
+        
+class TestPowerLaw(unittest.TestCase):
+    """
+        Unit tests for PowerLaw function
+
+        F(x) = scale* (x)^(m) + bkd
+        
+        The model has three parameters: 
+            m     =  power
+            scale  =  scale factor
+            bkd    =  incoherent background
+    """
+    def _func(self, a, m, bgd, qval):
+        return a*math.pow(qval,-m) + bgd
+    
+    
+    def setUp(self):
+        from sans.models.PowerLawModel import PowerLawModel
+        self.model= PowerLawModel()
+        
+    def test1D(self):
+        self.model.setParam('scale', math.exp(-6))
+        self.model.setParam('m', 4.0)
+        self.model.setParam('background', 1.0)
+        
+        #self.assertEqual(self.model.run(0.0), 1.0)
+        self.assertEqual(self.model.run(2.0), self._func(math.exp(-6), 4.0, 1.0, 2.0))
+        self.assertEqual(self.model.runXY(2.0), self._func(math.exp(-6), 4.0, 1.0, 2.0))
+    
+    def testlimit(self):
+        self.model.setParam('scale', math.exp(-6))
+        self.model.setParam('m', -4.0)
+        self.model.setParam('background', 1.0)
+        
+        self.assertEqual(self.model.run(0.0), 1.0)
+        
+    def test2D(self):
+        self.model.setParam('scale', math.exp(-6))
+        self.model.setParam('m', 4.0)
+        self.model.setParam('background', 1.0)
+        
+        #value = self._func(math.exp(-6), 4.0, 1.0, 1.0)\
+        #*self._func(math.exp(-6), 4.0, 1.0, 2.0)    
+        value = self._func(math.exp(-6), 4.0, 1.0, math.sqrt(5.0))
+        
+        self.assertEqual(self.model.runXY([1.0,2.0]), value)
+        
+    def test2Dphi(self):
+        self.model.setParam('scale', math.exp(-6))
+        self.model.setParam('m', 4.0)
+        self.model.setParam('background', 1.0)
+        
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        value = self._func(math.exp(-6), 4.0, 1.0, x)\
+        *self._func(math.exp(-6), 4.0, 1.0, y)
+        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
+                
+class TestTeubnerStrey(unittest.TestCase):
+    """
+        Unit tests for PowerLaw function
+
+        F(x) = 1/( scale + c1*(x)^(2)+  c2*(x)^(4)) + bkd
+        
+        The model has Four parameters: 
+            scale  =  scale factor
+            c1     =  constant
+            c2     =  constant
+            bkd    =  incoherent background
+    """
+    def _func(self, scale, c1, c2, bck, q):
+        
+        q2 = q*q;
+        q4 = q2*q2;
+    
+        return 1.0/(scale + c1*q2+c2*q4) + bck
+    
+    def setUp(self):
+        from sans.models.TeubnerStreyModel import TeubnerStreyModel
+        self.model= TeubnerStreyModel()
+        
+    def test1D(self):
+        
+        self.model.setParam('c1', -30.0) 
+        self.model.setParam('c2', 5000.0) 
+        self.model.setParam('scale', 0.1)
+        self.model.setParam('background', 0.1)
+        #self.assertEqual(1/(math.sqrt(4)), math.pow(4,-1/2))
+        #self.assertEqual(self.model.TeubnerStreyLengths(),False )
+        
+        self.assertEqual(self.model.run(0.0), 10.1)
+        self.assertEqual(self.model.run(2.0), self._func(0.1,-30.0,5000.0,0.1,2.0))
+        self.assertEqual(self.model.runXY(2.0), self._func(0.1,-30.0,5000.0,0.1,2.0))
+        
+    def test2D(self):
+        self.model.setParam('c1', -30.0) 
+        self.model.setParam('c2', 5000.0) 
+        self.model.setParam('scale', 0.1)
+        self.model.setParam('background', 0.1)
+        #value = self._func(0.1,-30.0,5000.0,0.1, 1.0)\
+        #*self._func(0.1,-30.0,5000.0,0.1, 2.0)    
+        value = self._func(0.1,-30.0,5000.0,0.1, math.sqrt(5.0))
+        
+        self.assertEqual(self.model.runXY([1.0,2.0]), value)
+        
+    def test2Dphi(self):
+        self.model.setParam('c1', -30.0) 
+        self.model.setParam('c2', 5000.0) 
+        self.model.setParam('scale', 0.1)
+        self.model.setParam('background', 0.1)
+        
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        #value = self._func(0.1,-30.0,5000.0,0.1, x)\
+        #*self._func(0.1,-30.0,5000.0,0.1, y)
+        value = self._func(0.1,-30.0,5000.0,0.1, r)
+        self.assertAlmostEquals(self.model.run([r, phi]), value,1)
+        
+class TestBEPolyelectrolyte(unittest.TestCase):
+    """
+        Unit tests for  BEPolyelectrolyte function
+        
+        F(x) = K*1/(4*pi()*Lb*(alpha)^(2)*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\
+                       *(q^(2)-(12*h*C/b^(2)))
+        
+        The model has Eight parameters: 
+            K        =  Constrast factor of the polymer
+            Lb       =  Bjerrum length
+            H        =  virial parameter
+            B        =  monomer length
+            Cs       =  Concentration of monovalent salt 
+            alpha    =  ionazation degree 
+            C        = polymer molar concentration
+            bkd      = background
+    """
+    def _func(self, K, Lb, H, B, Cs, alpha, C, bkd, r02, k2,  x):
+        return (K /( (4*math.pi *Lb*(alpha**2)*(x**2 +k2)) *( (1 +(r02**2))  \
+                    *((x**2) + k2)*((x**2) -(12 * H * C/(B**2))) )))+ bkd
+    
+    def setUp(self):
+        from sans.models.BEPolyelectrolyte import BEPolyelectrolyte
+        self.model= BEPolyelectrolyte()
+        
+        self.K = 10.0
+        self.Lb = 6.5
+        self.h = 11
+        self.b = 13
+        self.Cs = 0.1
+        self.alpha = 0.05
+        self.C  = .7
+        self.Bkd =0.01
+       
+        self.model.setParam('K', self.K) 
+        self.model.setParam('Lb', self.Lb) 
+        self.model.setParam('H', self.h)
+        self.model.setParam('B', self.b)
+        self.model.setParam('Cs',self.Cs) 
+        self.model.setParam('alpha', self.alpha) 
+        self.model.setParam('C', self.C)
+        self.model.setParam('background', self.Bkd)
+        
+    def _func(self, q):
+        
+        Ca = self.C *6.022136e-4          
+        Csa = self.Cs * 6.022136e-4        
+        k2= 4*math.pi*self.Lb*(2*self.Cs+self.alpha*Ca)   
+
+        r02 = 1./self.alpha / Ca**0.5*( self.b / (48*math.pi*self.Lb)**0.5 )
+        q2 = q**2    
+        Sq = self.K*1./(4*math.pi*self.Lb*self.alpha**2) * (q2 + k2)  /  (1+(r02**2) * (q2+k2) * (q2- (12*self.h*Ca/self.b**2)) ) + self.Bkd
+        return Sq
+       
+    def test1D(self):
+        
+       
+        q = 0.001
+   
+        self.assertEqual(self.model.run(q), self._func(q))
+        self.assertEqual(self.model.runXY(q), self._func(q))
+         
+    def test2D(self):
+        #self.assertAlmostEquals(self.model.runXY([1.0,2.0]), self._func(1.0)*self._func(2.0), 8)
+        self.assertAlmostEquals(self.model.runXY([1.0,2.0]), self._func(math.sqrt(1.0+2.0**2)), 8)
+        
+    def test2Dphi(self):
+
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        
+        self.assertAlmostEquals(self.model.run([r, phi]), self._func(r), 8)
+        
+class TestFractalModel(unittest.TestCase):
+    """
+        Unit tests for  Number Density Fractal function   
+        F(x)= P(x)*S(x) + bkd
+        The model has Seven parameters: 
+            scale   =  Volume fraction
+            Radius  =  Block radius
+            Fdim    =  Fractal dimension
+            L       =  correlation Length
+            SDLB    =  SDL block
+            SDLS    =  SDL solvent
+            bkd     =  background
+    """
+    def setUp(self):
+        from sans.models.FractalModel import FractalModel
+        self.model= FractalModel()
+        self.r0 = 5.0
+        self.sldp = 2.0e-6
+        self.sldm = 6.35e-6
+        self.phi = 0.05
+        self.Df = 2
+        self.corr = 100.0
+        self.bck = 1.0
+        
+        self.model.setParam('scale', self.phi) 
+        self.model.setParam('radius', self.r0) 
+        self.model.setParam('fractal_dim',self.Df)
+        self.model.setParam('cor_length', self.corr)
+        self.model.setParam('sldBlock', self.sldp) 
+        self.model.setParam('sldSolv', self.sldm) 
+        self.model.setParam('background', self.bck)
+        
+    def _func(self, x):
+        r0 = self.r0
+        sldp = self.sldp
+        sldm = self.sldm
+        phi = self.phi
+        Df = self.Df
+        corr = self.corr
+        bck = self.bck
+        
+        pq = 1.0e8*phi*4.0/3.0*math.pi*r0*r0*r0*(sldp-sldm)*(sldp-sldm)*math.pow((3*(math.sin(x*r0) - x*r0*math.cos(x*r0))/math.pow((x*r0),3)),2);
+        
+        sq = Df*math.exp(gammaln(Df-1.0))*math.sin((Df-1.0)*math.atan(x*corr));
+        sq /= math.pow((x*r0),Df) * math.pow((1.0 + 1.0/(x*corr)/(x*corr)),((Df-1.0)/2.0));
+        sq += 1.0;
+        
+        #self.assertAlmostEqual(self.model._scatterRanDom(x), pq, 8 )
+        #self.assertEqual(self.model._Block(x),sq )
+        
+        return sq*pq+bck
+    
+    def test1D(self):        
+        x = 0.001
+        
+        iq = self._func(x)
+        self.assertEqual(self.model.run(x), iq)
+        self.assertEqual(self.model.runXY(x), iq)
+    
+    def test2D(self):
+        x = 1.0
+        y = 2.0
+        r = math.sqrt(x**2 + y**2)
+        phi = math.atan2(y, x)
+        iq_x = self._func(x)
+        iq_y = self._func(y)
+        
+        #self.assertEqual(self.model.run([r, phi]), iq_x*iq_y)
+        self.assertEqual(self.model.run([r, phi]), self.model.run(r))
+        #self.assertEqual(self.model.runXY([x,y]), iq_x*iq_y)
+        self.assertEqual(self.model.runXY([x,y]), self.model.run(r))
+        
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_other_dispersity.py
===================================================================
--- sansmodels/test/utest_other_dispersity.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_other_dispersity.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,139 @@
+"""
+    Unit tests for dispersion functionality of 
+    C++ model classes
+"""
+
+import unittest, math, numpy
+
+class TestCylinder(unittest.TestCase):
+    """
+        Testing C++ Cylinder model
+    """
+    def setUp(self):
+        from sans.models.CylinderModel import CylinderModel
+        self.model= CylinderModel()
+        
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('radius', 20.0)
+        self.model.setParam('length', 400.0)
+        self.model.setParam('sldCyl', 4.e-6)
+        self.model.setParam('sldSolv', 1.e-6)
+        self.model.setParam('background', 0.0)
+        self.model.setParam('cyl_theta', 0.0)
+        self.model.setParam('cyl_phi', 0.0)
+        
+    def test_simple(self):
+        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
+        
+    def test_constant(self):
+        from sans.models.dispersion_models import DispersionModel
+        disp = DispersionModel()
+        self.model.setParam('scale', 10.0)
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 5.0/20.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.0
+        print "constant",self.model.run(0.001), self.model.dispersion
+        self.assertAlmostEqual(self.model.run(0.001), 1.021051*4527.47250339, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001, 0.001]), 1.021048*4546.997777604715, 2)
+        
+    def test_gaussian(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp = GaussianDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 5.0/20.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.0
+        self.model.setParam('scale', 10.0)
+        
+        self.assertAlmostEqual(self.model.run(0.001), 1.1804794*4723.32213339, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 1.180454*4743.56, 2)
+        
+    def test_clone(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp = GaussianDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 5.0/20.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.0
+        self.model.setParam('scale', 10.0)
+        
+        new_model = self.model.clone()
+        print "gaussian",self.model.run(0.001)
+        self.assertAlmostEqual(new_model.run(0.001), 1.1804794*4723.32213339, 3)
+        self.assertAlmostEqual(new_model.runXY([0.001,0.001]), 1.180454*4743.56, 2)
+        
+    def test_schulz_zero(self):
+        from sans.models.dispersion_models import SchulzDispersion
+        disp = SchulzDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 5.0/20.0
+        #self.model.dispersion['radius']['width'] = 0.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.0
+        self.model.setParam('scale', 1.0)
+        #self.model.setParam('scale', 10.0)
+        print "schulz",self.model.run(0.001), self.model.dispersion
+        self.assertAlmostEqual(self.model.run(0.001), 542.23568, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 544.54864, 3)
+        
+    def test_lognormal_zero(self):
+        from sans.models.dispersion_models import LogNormalDispersion
+        disp = LogNormalDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 5.0/20.0
+        #self.model.dispersion['radius']['width'] = 0.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.0
+        self.model.setParam('scale', 1.0)
+        #self.model.setParam('scale', 10.0)
+        print "model dispersion",self.model.dispersion
+        print "lognormal",self.model.run(0.001)
+        self.assertAlmostEqual(self.model.run(0.001), 450.64237, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.58733, 3)
+        
+    def test_gaussian_zero(self):
+        from sans.models.dispersion_models import GaussianDispersion
+        disp = GaussianDispersion()
+        self.model.set_dispersion('radius', disp)
+        self.model.dispersion['radius']['width'] = 0.0
+        self.model.dispersion['radius']['npts'] = 100
+        self.model.dispersion['radius']['nsigmas'] = 2.0
+        self.model.setParam('scale', 1.0)
+        
+        self.assertAlmostEqual(self.model.run(0.001), 450.355, 3)
+        self.assertAlmostEqual(self.model.runXY([0.001,0.001]), 452.299, 3)
+        
+    def test_array(self):
+        """
+            Perform complete rotational average and
+            compare to 1D
+        """
+        from sans.models.dispersion_models import ArrayDispersion
+        disp_ph = ArrayDispersion()
+        disp_th = ArrayDispersion()
+        
+        values_ph = numpy.zeros(100)
+        values_th = numpy.zeros(100)
+        weights   = numpy.zeros(100)
+        for i in range(100):
+            values_ph[i]=(360/99.0*i)
+            values_th[i]=(180/99.0*i)
+            weights[i]=(1.0)
+        
+        disp_ph.set_weights(values_ph, weights)
+        disp_th.set_weights(values_th, weights)
+        
+        self.model.set_dispersion('cyl_theta', disp_th)
+        self.model.set_dispersion('cyl_phi', disp_ph)
+        
+        val_1d = self.model.run(math.sqrt(0.0002))
+        val_2d = self.model.runXY([0.01,0.01]) 
+        
+        self.assertTrue(math.fabs(val_1d-val_2d)/val_1d < 0.02)
+        
+
+if __name__ == '__main__':
+    unittest.main()
+   
Index: sansmodels/test/utest_other_models.py
===================================================================
--- sansmodels/test/utest_other_models.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_other_models.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,1731 @@
+"""
+    Unit tests for specific models.
+    @since: 08/25/2009 
+    @note:  The models are running also with numpy array as input.
+            Some models return limit of the function at critical point .
+            So the user should expect finite value for some critical points.
+            Only critical q=0 will be tested. 
+            
+            Critical points tests that fail. the user is responsible of changing
+            the model tested or document the failure.
+            
+            Initial values for models are given as the one of Igo software.
+    @author: Gervaise Alina / UTK
+    @summary: Run by G. Alina 10/21/2009
+            Most of the lamellar tests are not passing. Check lamellar im
+            plementation.
+            critial points tested not passing for:
+            - Flexible Cylinder
+            - PeakLorenzt
+            - Squarewell Structure
+            - StickyHstructure
+            - hardSphereStructure
+            
+    @ Note: We don't use matrix for 2D anymore so testEval2D can be ignored (JC)     
+            
+"""
+
+import unittest
+import numpy 
+import math
+
+class TestCoreShell(unittest.TestCase):
+    """ Unit tests for coreshell model """
+    
+    def setUp(self):
+        from sans.models.CoreShellModel import CoreShellModel
+        self.comp = CoreShellModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("radius", 60.0)
+        self.comp.setParam("thickness", 10.0)
+        self.comp.setParam("core_sld", 1.0e-6)
+        self.comp.setParam("shell_sld",2.0e-6)
+        self.comp.setParam("solvent_sld",3.0e-6)
+        self.comp.setParam("Background", 0.001)
+   
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a coreshell """
+        self.assertAlmostEquals(self.comp.run(0.4),0.00169, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a coreshell """
+        self.assertAlmostEquals(self.comp.run([0.4, 1.3]),0.00169, 4)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a coreshell  with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a coreshell  with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point    
+    #def testCriticalPoint(self):
+    #    """ Test coreshell at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+  
+class TestMultiShellModel(unittest.TestCase):
+    """ Unit tests for MultiShell Model """
+    
+    def setUp(self):
+        from sans.models.MultiShellModel import MultiShellModel
+        self.comp = MultiShellModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("core_radius", 60.0)
+        self.comp.setParam("s_thickness", 10.0)
+        self.comp.setParam("w_thickness",10.0 )
+        self.comp.setParam("core_sld",6.4e-6)
+        self.comp.setParam("shell_sld",4e-7)
+        self.comp.setParam("n_pairs", 2)
+        self.comp.setParam("Background", 0.001)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a MultiShell Model """
+        self.assertAlmostEquals(self.comp.run(0.001), 2442.81, 2)
+        
+    def test1D_2(self):
+        """ Test 2D model for a MultiShell Model"""
+        self.assertAlmostEquals(self.comp.run([0.001, 0.30903]), 2442.81, 2)
+      
+    def testEval_1D(self):
+        """ Test 1D model for a MultiShell  with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a MultiShell  with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test multishell at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+    
+class TestVesicleModel(unittest.TestCase):
+    """ Unit tests for Vesicle Model """
+    
+    def setUp(self):
+        from sans.models.VesicleModel import VesicleModel
+        self.comp = VesicleModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("radius", 100.0)
+        self.comp.setParam("core_sld", 6.36e-6)
+        self.comp.setParam("shell_sld",5e-7)
+        self.comp.setParam("thickness",30.0 )
+        self.comp.setParam("Background", 0.001)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        #qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        #qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a Vesicle Model """
+        self.assertAlmostEquals(self.comp.run(0.001), 1.71399e4,1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Vesicle Model"""
+        self.assertAlmostEquals(self.comp.run([0.001, 1.3]), 1.71399e4,1)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a Vesicle with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Vesicle with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test vesicle at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
+        
+        
+class TestBinaryHSModel(unittest.TestCase):
+    """ Unit tests for BinaryHS Model"""
+    
+    def setUp(self):
+        from sans.models.BinaryHSModel import BinaryHSModel
+        self.comp = BinaryHSModel()
+        #Give initial value to model
+        self.comp.setParam("l_radius", 100.0)
+        self.comp.setParam("ls_sld", 3.5e-6)
+        self.comp.setParam("s_radius",25)
+        self.comp.setParam("solvent_sld",6.36e-6 )
+        self.comp.setParam("ss_sld", 5e-7)
+        self.comp.setParam("vol_frac_ss", 0.1)
+        self.comp.setParam("vol_frac_ls", 0.2)
+        self.comp.setParam("Background", 0.001)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        #qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        #qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a BinaryHS Model"""
+        self.assertAlmostEquals(self.comp.run(0.001),60.6785, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a BinaryHS Model"""
+        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),60.6785, 4)
+      
+    def testEval_1D(self):
+        """ Test 1D model for a BinaryHS with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a BinaryHS with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point    
+    #def testCriticalPoint(self):
+    #    """ Test BinaryHS at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+       
+     
+class TestCoreShellCylinderModel(unittest.TestCase):
+    """ Unit tests for CoreShellCylinder Model"""
+    
+    def setUp(self):
+        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
+        self.comp = CoreShellCylinderModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("core_sld", 1e-6)
+        self.comp.setParam("length", 400)
+        self.comp.setParam("radius",20)
+        self.comp.setParam("solvent_sld",1e-6 )
+        self.comp.setParam("shell_sld", 4e-6)
+        self.comp.setParam("thickness", 10.0)
+        self.comp.setParam("Background", 0.01)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for a CoreShellCylinder Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 353.56,1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a CoreShellCylinder Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a CoreShellCylinder with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a CoreShellCylinder with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test CoreShellCylinder at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+ 
+ 
+class TestHollowCylinderModel(unittest.TestCase):
+    """ Unit tests for HollowCylinder Model"""
+    
+    def setUp(self):
+        from sans.models.HollowCylinderModel import HollowCylinderModel
+        self.comp = HollowCylinderModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("core_radius",20.0)
+        self.comp.setParam("radius",30)
+        self.comp.setParam("length", 400)
+        self.comp.setParam("sldCyl",6.3e-6 )
+        self.comp.setParam("sldSolv",1e-6 )
+        self.comp.setParam("Background", 0.01)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for a HollowCylinder Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 1756.76, 1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a HollowCylinder Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1) 
+  
+    def testEval_1D(self):
+        """ Test 1D model for a HollowCylinder with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a HollowCylinder with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point    
+    #def testCriticalPoint(self):
+    #    """ Test HollowCylinder at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+        
+        
+class TestFlexibleCylinderModel(unittest.TestCase):
+    """ Unit tests for FlexibleCylinder Model"""
+    
+    def setUp(self):
+        from sans.models.FlexibleCylinderModel import FlexibleCylinderModel
+        self.comp = FlexibleCylinderModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("sldSolv",6.3e-6 )
+        self.comp.setParam("sldCyl",1e-6 )
+        self.comp.setParam("kuhn_length",100)
+        self.comp.setParam("length", 1000)
+        self.comp.setParam("radius",20)
+        self.comp.setParam("Background", 0.0001)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for a FlexibleCylinder Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 3509.22, 1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a FlexibleCylinder Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1) 
+    def testEval_1D(self):
+        """ Test 1D model for a FlexibleCylinder Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a FlexibleCylinder Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test FlexibleCylinder at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+  
+class TestFlexCylEllipXModel(unittest.TestCase):
+    """ Unit tests for FlexCylEllipXModel"""
+    
+    def setUp(self):
+        from sans.models.FlexCylEllipXModel import FlexCylEllipXModel
+        self.comp = FlexCylEllipXModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("sldSolv",6.3e-6 )
+        self.comp.setParam("sldCyl",1e-6 )
+        self.comp.setParam("kuhn_length",100)
+        self.comp.setParam("length", 1000)
+        self.comp.setParam("radius",20)
+        self.comp.setParam("background", 0.0001)
+        self.comp.setParam("axis_ratio", 1.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for FlexCylEllipXModel"""
+        self.assertAlmostEqual(self.comp.run(0.001), 3509.22, 1)
+        
+    def test1D_2(self):
+        """ Test 2D model for FlexCylEllipXModel"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1) 
+    def testEval_1D(self):
+        """ Test 1D model for FlexCylEllipXModel with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for FlexCylEllipXModel with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+              
+              
+class TestStackedDisksModel(unittest.TestCase):
+    """ Unit tests for StackedDisks Model"""
+    
+    def setUp(self):
+        from sans.models.StackedDisksModel import StackedDisksModel
+        self.comp = StackedDisksModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 0.01 )
+        self.comp.setParam("radius",3000.0 )
+        self.comp.setParam("core_thick", 10.0)
+        self.comp.setParam("layer_thick",15.0 )
+        self.comp.setParam("core_sld",4e-006 )
+        self.comp.setParam("layer_sld",-4e-007 )
+        self.comp.setParam("solvent_sld", 5e-006 )
+        self.comp.setParam("n_stacking",1.0 )
+        self.comp.setParam("sigma_d", 0.0)
+        self.comp.setParam("background",0.001)
+        self.comp.setParam("axis_theta", 0.0 )
+        self.comp.setParam("axis_phi",0.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for a StackedDisks Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 5075.12, 1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a StackedDisks Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a StackedDisks Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a StackedDisks Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test StackedDisks at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0))) 
+   
+  
+class TestParallelepipedModel(unittest.TestCase):
+    """ Unit tests for Parallelepiped Model"""
+    
+    def setUp(self):
+        from sans.models.ParallelepipedModel import ParallelepipedModel
+        self.comp = ParallelepipedModel()
+        #Give initial value to model
+        self.comp.setParam("background", 0.0 )
+        self.comp.setParam("short_a",35)
+        self.comp.setParam("short_b", 75)
+        self.comp.setParam("long_c",400 )
+        self.comp.setParam("sldPipe", 6.3e-006 )
+        self.comp.setParam("sldSolv", 1e-006 )
+        self.comp.setParam("scale",1.0 )
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    
+    def test1D(self):
+        """ Test 1D model for a Parallelepiped Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 2935.82, 2)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Parallelepiped Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a Parallelepiped Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Parallelepiped Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+   
+    def testCriticalPoint(self):
+        """ Test Parallelepiped at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+  
+class TestEllipticalCylinderModel(unittest.TestCase):
+    """ Unit tests for EllipticalCylinder Model"""
+    
+    def setUp(self):
+        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
+        self.comp = EllipticalCylinderModel()
+        self.comp.setParam("scale",1.0) 
+        self.comp.setParam("r_minor",20.0)
+        self.comp.setParam("r_ratio",1.5) 
+        self.comp.setParam("length",400.0)
+        self.comp.setParam("sldCyl",4e-006)
+        self.comp.setParam("sldSolv",1e-006)
+        self.comp.setParam("background",0.0)
+        self.comp.setParam("cyl_theta",0.0)
+        self.comp.setParam("cyl_phi",0.0)
+        self.comp.setParam("cyl_psi",0.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for a EllipticalCylinder Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 675.504402, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a EllipticalCylinder Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a EllipticalCylinder with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a EllipticalCylinder with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test EllipticalCylinder at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0))) 
+  
+        
+class TestEllipsoidModel(unittest.TestCase):
+    """ Unit tests for Ellipsoid Model"""
+    
+    def setUp(self):
+        from sans.models.EllipsoidModel import EllipsoidModel
+        self.comp = EllipsoidModel()
+        self.comp.setParam("scale",1.0) 
+        self.comp.setParam("radius_a",20.0)
+        self.comp.setParam("radius_b",400.0)
+        self.comp.setParam("sldEll",4e-006)
+        self.comp.setParam("sldSolv",1e-006)
+        self.comp.setParam("background",0.0)
+        self.comp.setParam("axis_theta",1.57)
+        self.comp.setParam("axis_phi",0.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for a Ellipsoid Model"""
+        self.assertAlmostEqual(self.comp.run(1.0), 0.000733968, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Ellipsoid Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1)
+    def testEval_1D(self):
+        """ Test 1D model for a Ellipsoid Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Ellipsoid Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test Ellipsoid at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+        
+class TestCoreShellEllipsoidModel(unittest.TestCase):
+    """ Unit tests for CoreShellEllipsoid Model"""
+    
+    def setUp(self):
+        from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel
+        self.comp = CoreShellEllipsoidModel()
+        #Give initial value to model
+        self.comp.setParam("scale", 1.0)
+        self.comp.setParam("equat_core", 200.0)
+        self.comp.setParam("polar_core", 20.0)
+        self.comp.setParam("equat_shell",250.0)
+        self.comp.setParam("polar_shell", 30.0)
+        self.comp.setParam("sld_shell",1e-006)
+        self.comp.setParam("sld_core",2e-006)
+        self.comp.setParam("sld_solvent",6.3e-006)
+        self.comp.setParam("background",0.001)
+        self.comp.setParam("axis_theta", 0.0)
+        self.comp.setParam("axis_phi",0.0)
+         
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+    def test1D(self):
+        """ Test 1D model for a CoreShellEllipsoid Model"""
+        self.assertAlmostEqual(self.comp.run(1.0), 0.001894, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a CoreShellEllipsoid Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a CoreShellEllipsoid with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a CoreShellEllipsoid with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test CoreShellEllipsoid at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+    
+class TestTriaxialEllipsoidModel(unittest.TestCase):
+    """ Unit tests for TriaxialEllipsoid Model"""
+    
+    def setUp(self):
+        from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
+        self.comp = TriaxialEllipsoidModel()
+        self.comp.setParam("scale",1.0)
+        self.comp.setParam("semi_axisA",35.0)
+        self.comp.setParam("semi_axisB", 100.0)
+        self.comp.setParam("semi_axisC",400.0 )
+        self.comp.setParam("sldSolv",6.3e-6)
+        self.comp.setParam("sldEll",1e-6)
+        self.comp.setParam("background",0.0)
+        self.comp.setParam("axis_theta", 1.0)
+        self.comp.setParam("axis_phi",0.0 )
+        self.comp.setParam("axis_psi",0.0 )
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        self.q = 0.001
+        self.phi= math.pi/2
+        self.qx= self.q*math.cos(self.phi)
+        self.qy= self.q*math.sin(self.phi)
+        
+        
+    def test1D(self):
+        """ Test 1D model for a TriaxialEllipsoid Model"""
+        self.assertAlmostEquals(self.comp.run(0.001),16285.6, 1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a TriaxialEllipsoid Model"""
+        self.assertAlmostEqual(self.comp.run([self.q, self.phi]), 
+                              self.comp.runXY([self.qx, self.qy]),1)
+     
+    def testEval_1D(self):
+        """ Test 1D model for a TriaxialEllipsoid Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a TriaxialEllipsoid Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test TriaxialEllipsoid at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))            
+   
+class TestLamellarModel(unittest.TestCase):
+    """ Unit tests for Lamellar Model"""
+    
+    def setUp(self):
+        from sans.models.LamellarModel import LamellarModel
+        self.comp = LamellarModel()
+        self.comp.setParam("scale",1.0) 
+        self.comp.setParam("bi_thick",50.0)
+        self.comp.setParam("sld_bi",1e-006)
+        self.comp.setParam("sld_sol",6.3e-006)
+        self.comp.setParam("background",0.0)
+
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a Lamellar Model"""
+        self.assertAlmostEquals(self.comp.run(0.001), 882289.54309, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Lamellar Model"""
+        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),882289.54309, 3)     
+    
+    def testEval_1D(self):
+        """ Test 1D model for a Lamellar Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Lamellar Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+       
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test Lamellar at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+     
+class TestLamellarFFHGModel(unittest.TestCase):
+    """ Unit tests for LamellarFFHG Model"""
+    
+    def setUp(self):
+        from sans.models.LamellarFFHGModel import LamellarFFHGModel
+        self.comp = LamellarFFHGModel()
+        self.comp.setParam("scale",1.0) 
+        self.comp.setParam("t_length",15.0)
+        self.comp.setParam("h_thickness",10.0)
+        self.comp.setParam("sld_tail",4e-007)
+        self.comp.setParam("sld_head",3e-006)
+        self.comp.setParam("sld_solvent",6e-006)
+        self.comp.setParam("background",0.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        
+    def test1D(self):
+        """ Test 1D model for a LamellarFFHG Model"""
+        self.assertAlmostEquals(self.comp.run(0.001),653143.9209, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a LamellarFFHG Model"""
+        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),653143.9209, 3)
+    
+    def testEval_1D(self):
+        """ Test 1D model for a LamellarFFHG Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a LamellarFFHG Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+      
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test LamellarFFHG at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))              
+    
+class TestLamellarPSModel(unittest.TestCase):
+    """ Unit tests for LamellarPS Model"""
+    
+    def setUp(self):
+        from sans.models.LamellarPSModel import LamellarPSModel
+        self.comp = LamellarPSModel()
+        self.comp.setParam("scale",1.0) 
+        self.comp.setParam("spacing",400.0)
+        self.comp.setParam("delta",30.0)
+        self.comp.setParam("sld_bi",6.3e-006)
+        self.comp.setParam("sld_sol",1e-006)
+        self.comp.setParam("n_plates",20.0) 
+        self.comp.setParam("caille", 0.1)
+        self.comp.setParam("background",0.0)
+
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        
+    def test1D(self):
+        """ Test 1D model for a LamellarPS Model"""
+        self.assertAlmostEquals(self.comp.run(0.001), 27899.30836, 1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a LamellarPS Model"""
+        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),27899.30836, 1) 
+    
+    def testEval_1D(self):
+        """ Test 1D model for a LamellarPS Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a LamellarPS Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+      
+    # No more singular point        
+    #def testCriticalPoint(self):
+    #    """ Test LamellarPS at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+     
+class TestLamellarPSHGModel(unittest.TestCase):
+    """ Unit tests for LamellarPSHG Model"""
+    
+    def setUp(self):
+        from sans.models.LamellarPSHGModel import LamellarPSHGModel
+        self.comp = LamellarPSHGModel()
+        self.comp.setParam("scale",1.0)
+        self.comp.setParam("spacing",40.0)
+        self.comp.setParam("deltaT",10.0)
+        self.comp.setParam("deltaH",2.0)
+        self.comp.setParam("sld_tail",4e-7)
+        self.comp.setParam("sld_head",2e-6)
+        self.comp.setParam("sld_solvent",6e-6)
+        self.comp.setParam("n_plates",30)
+        self.comp.setParam("caille",0.001)
+        self.comp.setParam("background",0.001)
+
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a LamellarPSHG Model"""
+        self.assertAlmostEquals(self.comp.run(0.001),6831387.29466, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a LamellarPSHG Model"""
+        self.assertAlmostEquals(self.comp.run([0.001, 1.3]),6831387.29466,3)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a LamellarPSHG Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a LamellarPSHG Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+       
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test LamellarPSHG at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+     
+class TestSquareWellStructure(unittest.TestCase):
+    """ Unit tests for SquareWellStructure """
+    
+    def setUp(self):
+        from sans.models.SquareWellStructure import SquareWellStructure
+        self.comp = SquareWellStructure()
+        self.comp.setParam("effect_radius",50.0)
+        self.comp.setParam("volfraction",0.04)
+        self.comp.setParam("welldepth",1.5 )
+        self.comp.setParam("wellwidth",1.2)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        
+    def test1D(self):
+        """ Test 1D model for a SquareWellStructure"""
+        self.assertAlmostEqual(self.comp.run(0.001), 0.976657, 2)
+        
+    def test1D_2(self):
+        """ Test 2D model for a SquareWellStructure"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.9776657,2)     
+    
+    def testEval_1D(self):
+        """ Test 1D model for a SquareWellStructure with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a SquareWellStructure with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test SquareWellStructure at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))                     
+     
+class TestHardsphereStructure(unittest.TestCase):
+    """ Unit tests for HardsphereStructure"""
+    
+    def setUp(self):
+        from sans.models.HardsphereStructure import HardsphereStructure
+        self.comp = HardsphereStructure()
+        self.comp.setParam("effect_radius",50.0)
+        self.comp.setParam("volfraction", 0.2)
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+        
+    def test1D(self):
+        """ Test 1D model for a HardsphereStructure"""
+        self.assertAlmostEqual(self.comp.run(0.001),0.209128, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a HardsphereStructure"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.209128, 4)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a HardsphereStructure with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a HardsphereStructure with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test HardsphereStructure at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))                  
+    
+class TestStickyHSStructure(unittest.TestCase):
+    """ Unit tests for StickyHSStructure"""
+    
+    def setUp(self):
+        from sans.models.StickyHSStructure import StickyHSStructure
+        self.comp = StickyHSStructure()
+        self.comp.setParam("effect_radius",50.0)
+        self.comp.setParam("volfraction",0.1)
+        self.comp.setParam("perturb",0.05)
+        self.comp.setParam("stickiness",0.2)
+
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a StickyHSStructure"""
+        self.assertAlmostEqual(self.comp.run(0.001),1.09718, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a StickyHSStructure"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),1.09718, 4)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a StickyHSStructure with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a StickyHSStructure with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point           
+    #def testCriticalPoint(self):
+    #    """ Test StickyHSStructure at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0))) 
+        
+class TestHayterMSAStructure(unittest.TestCase):
+    """ Unit tests for HayterMSAStructure"""
+    
+    def setUp(self):
+        from sans.models.HayterMSAStructure import HayterMSAStructure
+        self.comp = HayterMSAStructure()
+        self.comp.setParam("effect_radius",20.75)
+        self.comp.setParam("charge",19.0)
+        self.comp.setParam("volfraction",0.0192 )
+        self.comp.setParam("temperature",298)
+        self.comp.setParam("saltconc",0.0)
+        self.comp.setParam("dielectconst",78)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+
+    def test1D(self):
+        """ Test 1D model for a HayterMSAStructure"""
+        self.assertAlmostEqual(self.comp.run(0.001),0.0712928, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a HayterMSAStructure"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.0712928, 4) 
+        
+    def testEval_1D(self):
+        """ Test 1D model for a HayterMSAStructure with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a HayterMSAStructure with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test HayterMSAStructure at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))                   
+     
+     
+class TestBEPolyelectrolyte(unittest.TestCase):
+    """ Unit tests for BEPolyelectrolyte"""
+    
+    def setUp(self):
+        from sans.models.BEPolyelectrolyte import BEPolyelectrolyte
+        self.comp = BEPolyelectrolyte()
+       
+        self.comp.setParam('k',10)
+        self.comp.setParam('lb',7.1)
+        self.comp.setParam('h',12)
+        self.comp.setParam('b',10)
+        self.comp.setParam('cs', 0.0)
+        self.comp.setParam('alpha',0.05)
+        self.comp.setParam('c', 0.7)
+        self.comp.setParam('background',0.001)
+         
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+
+    def test1D(self):
+        """ Test 1D model for a BEPolyelectrolyte"""
+        self.assertAlmostEqual(self.comp.run(0.001),0.0948, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a BEPolyelectrolyte"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),0.0948, 3)
+      
+    def testEval_1D(self):
+        """ Test 1D model for a BEPolyelectrolyte with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a BEPolyelectrolyte with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+   
+    def testCriticalPoint(self):
+        """ Test BEPolyelectrolyte at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))            
+             
+             
+class TestDABModel(unittest.TestCase):
+    """ Unit tests for DABModel"""
+    
+    def setUp(self):
+        from sans.models.DABModel import DABModel
+        self.comp = DABModel()
+        self.comp.setParam('length',40.0)
+        self.comp.setParam('scale',10.0)
+        self.comp.setParam('background',1.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+    
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a DABModel"""
+        self.assertAlmostEqual(self.comp.run(0.001),637957.9047, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a DABModel"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),637957.90473, 3)
+         
+    def testEval_1D(self):
+        """ Test 1D model for a DABModel with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a DABModel with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test DABModel at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))           
+             
+    
+class TestGuinierModel(unittest.TestCase):
+    """ Unit tests for Guinier Model"""
+    
+    def setUp(self):
+        from sans.models.GuinierModel import GuinierModel
+        self.comp = GuinierModel()
+        self.comp.setParam('scale',1.0)
+        self.comp.setParam('rg', 1)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a GuinierModel"""
+        self.assertAlmostEqual(self.comp.run(1.0),0.716531, 4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a GuinierModel"""
+        self.assertAlmostEqual(self.comp.run([1.0, 1.3]),0.716531, 4)
+     
+    def testEval_1D(self):
+        """ Test 1D model for a GuinierModel with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a GuinierModel with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test GuinierModel at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+        
+        
+class TestDebyeModel(unittest.TestCase):
+    """ Unit tests for Debye Model"""
+    
+    def setUp(self):
+        from sans.models.DebyeModel import DebyeModel
+        self.comp = DebyeModel()
+        self.comp.setParam('rg', 50.0)
+        self.comp.setParam('scale',1.0)
+        self.comp.setParam('background',0.001)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a DebyeModel"""
+        self.assertAlmostEqual(self.comp.run(0.001),1.00017,4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a DebyeModel"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),1.00017,4)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a DebyeModel with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a DebyeModel with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test DebyeModel at the critical point"""
+        self.assertEquals(self.comp.run(0.0),1.001)
+        
+       
+class TestPorodModel(unittest.TestCase):
+    """ Unit tests for PorodModel"""
+    
+    def setUp(self):
+        from sans.models.PorodModel import PorodModel
+        self.comp = PorodModel()
+        self.comp.setParam('scale', 1.0)
+        self.comp.setParam('background', 0.0)
+         
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a PorodModel"""
+        self.assertEquals(self.comp.run(0.5), 16)
+        
+    def test1D_2(self):
+        """ Test 2D model for a PorodModel"""
+        self.assertEquals(self.comp.run([0.5, 1.3]),16)  
+        
+    def testEval_1D(self):
+        """ Test 1D model for a PorodModel with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a PorodModel with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCreaticalPoint(self):
+        """ Test for critical point for PorodModel run"""
+        self.assertRaises(ZeroDivisionError, self.comp.run, 0.0)
+        
+        
+class TestPeakGaussModel(unittest.TestCase):
+    """ Unit tests for PeakGaussModel"""
+    
+    def setUp(self):
+        from sans.models.PeakGaussModel import PeakGaussModel
+        self.comp = PeakGaussModel()
+        self.comp.setParam('scale', 100)
+        self.comp.setParam('B', 0.005)
+        self.comp.setParam('q0',0.05)
+        self.comp.setParam('background',1.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a PeakGauss Model"""
+        self.assertEquals(self.comp.run(0.001),1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a PeakGauss Model"""
+        self.assertEquals(self.comp.run([0.001, 1.3]),1)  
+        
+    def testEval_1D(self):
+        """ Test 1D model for a PeakGauss Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a PeakGauss Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+    
+    def testCriticalPoint(self):
+        """ Test PeakGauss at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))    
+        
+class TestPeakLorentzModel(unittest.TestCase):
+    """ Unit tests for PeakLorentzModel"""
+    
+    def setUp(self):
+        from sans.models.PeakLorentzModel import PeakLorentzModel
+        self.comp = PeakLorentzModel()
+        self.comp.setParam('scale', 100)
+        self.comp.setParam('B', 0.005)
+        self.comp.setParam('q0',0.05)
+        self.comp.setParam('background',1.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a PeakLorentz Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 2.0305, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a PeakLorentz Model"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]), 2.0305, 3)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a PeakLorentz Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a PeakLorentz Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+        
+    def testCriticalPoint(self):
+        """ Test PeakLorentz at the critical point"""
+        self.comp.setParam('B', 0.0)
+        self.assertRaises(ZeroDivisionError, self.comp.run, 10)
+        #self.assert_(numpy.isfinite(self.comp.run(0.0)))  
+        
+       
+class TestFractalAbsModel(unittest.TestCase):
+    """ Unit tests for FractalAbsModel"""
+    
+    def setUp(self):
+        from sans.models.FractalAbsModel import FractalAbsModel
+        self.comp = FractalAbsModel()
+        self.comp.setParam('scale', 0.05)
+        self.comp.setParam('radius', 5.0)
+        self.comp.setParam('fractal_dim', 2.0)
+        self.comp.setParam('cor_length',100.0)
+        self.comp.setParam('sldBlock', 2.0e-6)
+        self.comp.setParam('sldSolv', 6.35e-6)
+        self.comp.setParam('background',0.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a Fractal Abs Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 39.2881, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Fractal Abs Model"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]), 39.2881, 3)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a Fractal Abs Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Fractal Abs Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point
+    #def testCriticalPoint(self):
+    #    """ Test Fractal Abs at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))    
+   
+class TestFractalModel(unittest.TestCase):
+    """ Unit tests for FractalModel"""
+    
+    def setUp(self):
+        from sans.models.FractalModel import FractalModel
+        self.comp = FractalModel()
+        self.comp.setParam('scale', 0.05)
+        self.comp.setParam('radius', 5.0)
+        self.comp.setParam('fractal_dim', 2.0)
+        self.comp.setParam('cor_length',100.0)
+        self.comp.setParam('sldBlock', 2.0e-6)
+        self.comp.setParam('sldSolv', 6.35e-6)
+        self.comp.setParam('background',0.0)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a Fractal Model"""
+        self.assertAlmostEqual(self.comp.run(0.001), 39.2881, 3)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Fractal Model"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]), 39.2881, 3)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a Fractal Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Fractal Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    # No more singular point    
+    #def testCriticalPoint(self):
+    #    """ Test Fractal at the critical point"""
+    #    self.assert_(numpy.isfinite(self.comp.run(0.0)))
+    
+class TestLorentzModel(unittest.TestCase):
+    """ Unit tests for LorentzModel"""
+    
+    def setUp(self):
+        from sans.models.LorentzModel import LorentzModel
+        self.comp = LorentzModel()
+        self.comp.setParam("background",1)
+        self.comp.setParam("length",50)
+        self.comp.setParam("scale",100)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a Lorentz Model"""
+        self.assertAlmostEqual(self.comp.run(0.001),100.751, 2)
+        
+    def test1D_2(self):
+        """ Test 2D model for a Lorentz Model"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),100.751, 2)
+    
+    def testEval_1D(self):
+        """ Test 1D model for a Lorentz Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Lorentz Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+          
+    def testCriticalPoint(self):
+        """ Test Lorentz at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+        
+          
+class TestPowerLawAbsModel(unittest.TestCase):
+    """ Unit tests for PowerLawAbsModel"""
+    
+    def setUp(self):
+        from sans.models.PowerLawAbsModel import PowerLawAbsModel
+        self.comp = PowerLawAbsModel()
+        self.comp.setParam("background",1)
+        self.comp.setParam("m",4)
+        self.comp.setParam("scale",1e-6)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a PowerLawAbs Model"""
+        self.assertAlmostEqual(self.comp.run(0.19189), 1.00074,4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a PowerLawAbs Model"""
+        self.assertAlmostEqual(self.comp.run([0.19189,1.3]), 1.00074,4)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a PowerLawAbs Model with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a PowerLawAbs Model with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test PowerLawAbs at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+        
+        
+class TestPowerLawModel(unittest.TestCase):
+    """ Unit tests for PowerLawModel"""
+    
+    def setUp(self):
+        from sans.models.PowerLawModel import PowerLawModel
+        self.comp = PowerLawModel()
+        self.comp.setParam("background",1)
+        self.comp.setParam("m",4)
+        self.comp.setParam("scale",1e-6)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a PowerLaw Model"""
+        self.assertAlmostEquals(self.comp.run(0.19189), 1.00074,4)
+        
+    def test1D_2(self):
+        """ Test 2D model for a PowerLawModel"""
+        self.assertAlmostEquals(self.comp.run([0.19189,1.3]), 1.00074,4)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a PowerLawModel with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a PowerLawModel with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test PowerLawModel at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+      
+      
+class TestTeubnerStreyModel(unittest.TestCase):
+    """ Unit tests for TeubnerStreyModel"""
+    
+    def setUp(self):
+        from sans.models.TeubnerStreyModel import TeubnerStreyModel
+        self.comp = TeubnerStreyModel()
+        self.comp.setParam("background",0.1)
+        self.comp.setParam("c1",-30)
+        self.comp.setParam("c2",5000)
+        self.comp.setParam("scale",0.1)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a TeubnerStrey Model"""
+        self.assertAlmostEqual(self.comp.run(0.001),10.103, 1)
+        
+    def test1D_2(self):
+        """ Test 2D model for a TeubnerStrey Model"""
+        self.assertAlmostEqual(self.comp.run([0.001, 1.3]),10.103, 1)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a TeubnerStrey  with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a TeubnerStrey  with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0],8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test TeubnerStrey at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))    
+      
+      
+class TestLineModel(unittest.TestCase):
+    """ Unit tests for LineModel"""
+    
+    def setUp(self):
+        from sans.models.LineModel import LineModel
+        self.comp = LineModel()
+        self.comp.setParam("A",1)
+        self.comp.setParam("B",1)
+        
+        self.x = numpy.array([0.4, 1.3])
+        self.y = numpy.array([0.5, 1.57])
+        self.x_array = self.comp.evalDistribution(self.x)
+        self.y_array = self.comp.evalDistribution(self.y)
+        qx_prime = numpy.reshape(self.x, [1,len(self.x)])
+        qy_prime = numpy.reshape(self.y, [len(self.y),1])
+        self.xy_matrix = self.comp.evalDistribution([self.x, self.y])
+        
+    def test1D(self):
+        """ Test 1D model for a Line Model"""
+        self.assertEquals(self.comp.run(1.0),2)
+        
+    def testEval_1D(self):
+        """ Test 1D model for a Line  with evalDistribution"""
+        self.assertEquals(self.comp.run(0.4),self.x_array[0])
+        self.assertEquals(self.comp.run(1.3),self.x_array[1])
+        
+    def testEval_2D(self):
+        """ Test 2D model for a Line  with evalDistribution"""
+        self.assertAlmostEquals(self.comp.runXY([0.4, 0.5]),self.xy_matrix[0], 8)
+        self.assertAlmostEquals(self.comp.runXY([1.3,1.57]),self.xy_matrix[1], 8)
+
+    
+    def testCriticalPoint(self):
+        """ Test line at the critical point"""
+        self.assert_(numpy.isfinite(self.comp.run(0.0)))
+ 
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/utest_smearing.py
===================================================================
--- sansmodels/test/utest_smearing.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_smearing.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,150 @@
+"""
+    Unit tests for data manipulations
+"""
+
+
+import unittest
+import numpy, math
+from sans.dataloader.loader import  Loader
+from sans.dataloader.data_info import Data1D, Data2D
+#from DataLoader.qsmearing import SlitSmearer, QSmearer, smear_selection
+from sans.models.qsmearing import SlitSmearer, QSmearer, smear_selection
+from sans.models.SphereModel import SphereModel
+import os.path
+from time import time
+class smear_tests(unittest.TestCase):
+    
+    def setUp(self):
+        self.data = Loader().load("cansas1d_slit.xml")
+        
+        x = 0.001*numpy.arange(1,11)
+        y = 12.0-numpy.arange(1,11)
+        dxl = 0.00*numpy.ones(10)
+        dxw = 0.00*numpy.ones(10)
+        dx = 0.00*numpy.ones(10)
+        
+        self.data.dx = dx
+        self.data.x = x
+        self.data.y = y
+        self.data.dxl = dxl
+        self.data.dxw = dxw
+        
+    def test_slit(self):
+        """
+            Test identity smearing
+        """
+        # Create smearer for our data
+        s = SlitSmearer(self.data)
+        
+        input = 12.0-numpy.arange(1,11)
+        output = s(input)
+        for i in range(len(input)):
+            self.assertEquals(input[i], output[i])
+
+    def test_slit2(self):
+        """
+            Test basic smearing
+        """
+        dxl = 0.005*numpy.ones(10)
+        dxw = 0.0*numpy.ones(10)
+        self.data.dxl = dxl
+        self.data.dxw = dxw
+        # Create smearer for our data
+        s = SlitSmearer(self.data)
+        
+        input = 12.0-numpy.arange(1,11)
+        output = s(input)
+        # The following commented line was the correct output for even bins [see smearer.cpp for details] 
+        #answer = [ 9.666,  9.056,  8.329,  7.494,  6.642,  5.721,  4.774,  3.824,  2.871, 2.   ]
+        answer = [ 9.0618,  8.6401,  8.1186,  7.1391,  6.1528,  5.5555,     4.5584,  3.5606,  2.5623, 2.    ]
+        for i in range(len(input)):
+            self.assertAlmostEqual(answer[i], output[i], 3)
+        
+    def test_q(self):
+        """
+            Test identity resolution smearing
+        """
+        # Create smearer for our data
+        s = QSmearer(self.data)
+        
+        input = 12.0-numpy.arange(1,11)
+        output = s(input)
+        for i in range(len(input)):
+            self.assertAlmostEquals(input[i], output[i], 5)
+
+    def test_q2(self):
+        """
+            Test basic smearing
+        """
+        dx = 0.001*numpy.ones(10)
+        self.data.dx = dx
+
+        # Create smearer for our data
+        s = QSmearer(self.data)
+        
+        input = 12.0-numpy.arange(1,11)
+        output = s(input)
+        
+        answer = [ 10.44785079,   9.84991299,   8.98101708,   
+                  7.99906585,   6.99998311,   6.00001689,
+                  5.00093415,   4.01898292,   3.15008701,   2.55214921]
+        for i in range(len(input)):
+            self.assertAlmostEqual(answer[i], output[i], 2)
+      
+class smear_test_1Dpinhole(unittest.TestCase):
+    
+    def setUp(self):
+        # NIST sample data
+        self.data = Loader().load("CMSphere5.txt")
+        # NIST smeared sphere w/ param values below
+        self.answer = Loader().load("CMSphere5smearsphere.txt")
+        # call spheremodel
+        self.model = SphereModel()
+        # setparams consistent with Igor default
+        self.model.setParam('scale', 1.0)
+        self.model.setParam('background', 0.01)
+        self.model.setParam('radius', 60.0)
+        self.model.setParam('sldSolv', 6.3e-06)
+        self.model.setParam('sldSph', 1.0e-06)
+        
+    def test_q(self):
+        """
+        Compare Pinhole resolution smearing with NIST
+        """
+        # x values
+        input = numpy.zeros(len(self.data.x))
+        # set time
+        st1 = time()
+        # cal I w/o smear
+        input = self.model.evalDistribution(self.data.x)
+        # Cal_smear (first call)
+        for i in range(1000):
+            s = QSmearer(self.data, self.model)
+        # stop and record time taken
+        first_call_time = time()-st1
+        # set new time
+        st = time()
+        # cal I w/o smear (this is not neccessary to call but just to be fare
+        input = self.model.evalDistribution(self.data.x)
+        # smear cal (after first call done above)
+        for i in range(1000):
+            output = s(input)
+
+        # record time taken
+        last_call_time = time()-st
+        # compare the ratio of ((NIST_answer-SsanView_answer)/NIST_answer)
+        # If the ratio less than 1%, pass the test 
+        for i in range(len(self.data.x)):
+            ratio  = math.fabs((self.answer.y[i]-output[i])/self.answer.y[i])
+            if ratio > 0.006:
+                ratio = 0.006
+            self.assertEqual(math.fabs((self.answer.y[i]-output[i])/ \
+                                       self.answer.y[i]), ratio) 
+        # print
+        print "\n NIST_time = 10sec:"
+        print "Cal_time(1000 times of first_calls; ) = ",  first_call_time  
+        print "Cal_time(1000 times of calls) = ",  last_call_time 
+        
+if __name__ == '__main__':
+    unittest.main()
+   
Index: sansmodels/test/utest_state.py
===================================================================
--- sansmodels/test/utest_state.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_state.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+""" 
+    Test for setstate and reduce_ex operations for models
+"""
+import unittest
+
+from sans.models.SphereModel import SphereModel
+
+class TestSphere(unittest.TestCase):
+    def setUp(self):
+        self.sphere = SphereModel()
+        
+    def test_state_IO(self):
+        """
+            Check that a state oject is independent from the model object it
+            was generated with
+        """
+        self.sphere.setParam('radius', 44.0)
+        _, _, state, _, _ = self.sphere.__reduce_ex__(0)
+        
+        sphere_copy = SphereModel()
+        sphere_copy.__setstate__(state)
+        sphere_clone = sphere_copy.clone()
+        self.assertEqual(sphere_copy.getParam('radius'), 44)
+        
+        self.sphere.setParam('radius', 33.0)
+        
+        self.assertEqual(sphere_clone.getParam('radius'), 44)
+        
+    
+if __name__ == '__main__':
+    unittest.main()
Index: sansmodels/test/validate_1D_model.py
===================================================================
--- sansmodels/test/validate_1D_model.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/validate_1D_model.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+""" 
+    Class to validate a given model by reading a test data set
+    generated from the IGOR SANS analysis tool from the NCNR
+"""
+import sys, math
+
+
+class Validate1D:
+    """ 
+        Class to validate a given model by reading a test data set
+        generated from the IGOR SANS analysis tool from the NCNR
+    """
+    
+    def __init__(self):
+        """ Initialization """
+        # Precision for the result comparison
+        self.precision = 0.0001
+        # Flag for end result
+        self.passed = True
+                
+    def __call__(self, filename):
+        """ 
+            Perform test on a data file
+            @param filename: name of the test data set
+        """
+        from sans.models.ModelFactory import ModelFactory
+        
+        # Read the data file
+        file_obj = open(filename,'r')
+        content = file_obj.read()
+        
+        # Flag to determine whether we are in the DATA section
+        started_data = False
+        # Model to test
+        model_object = None
+        
+        # Process each line of the file
+        for line in content.split('\n'):
+            if len(line)==0:
+                continue
+            try:
+                # Catch class name
+                if line.count("pythonclass")>0 and model_object==None:
+                    toks = line.split('=')
+                    print "Found class", toks[1]
+                    classname = toks[1].lstrip().rstrip()
+                    model_object = ModelFactory().getModel(classname)
+                
+                    # Output file for plotting
+                    file_out = open("%s_out.txt" % classname, 'w')
+                    file_out.write("<q>  <I_danse>  <I_igor>\n")
+                
+                # Process data
+                elif started_data:
+                    toks = line.split()
+                    q = float(toks[0])
+                    iq = float(toks[1])
+                    
+                    value = model_object.run(q)
+                    
+                    file_out.write("%g %g %g\n" % (q, value, iq))
+                    
+                    if math.fabs( (value - iq)/iq )>self.precision:
+                        self.passed = False
+                        print "ERROR q=%g: %g <> %g" % (q, model_object.run(q), iq)
+                        
+                # Catch DATA tag
+                elif line.count("DATA")>0:
+                    started_data = True
+                                
+                # Process parameters
+                elif started_data == False and not model_object==None:
+                    toks = line.split('=')
+                    if len(toks)==2:
+                        print "Setting parameter", line
+                        model_object.setParam(toks[0].lstrip().rstrip(), 
+                                              float(toks[1]))
+            except:
+                print "Could not parse line:\n %s" % line
+                print sys.exc_value
+            
+        file_obj.close()
+        file_out.close()
+        
+        print "Test passed = ", self.passed
+        return self.passed
+            
+if __name__ == '__main__':
+    validator = Validate1D()
+    all_pass = True
+    all_pass = all_pass and validator("sphere_testdata.txt")
+    print '\n'
+    all_pass = all_pass and validator("cylinder_testdata.txt")
+    print '\n'
+    all_pass = all_pass and validator("core_shell_cyl_testdata.txt")
+    print '\n'
+    all_pass = all_pass and validator("core_shell_testdata.txt")
+    print '\n'
+    all_pass = all_pass and validator("ellipsoid_testdata.txt")
+    print '\n'
+    all_pass = all_pass and validator("elliptical_cylinder_testdata.txt")
+
+    print '\nOverall result:', all_pass
+        
+        
+        
+  
+    
Index: sansmodels/test/validate_2D_3axes_shape_model.py
===================================================================
--- sansmodels/test/validate_2D_3axes_shape_model.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/validate_2D_3axes_shape_model.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,138 @@
+#!/usr/bin/env python
+""" 
+    Class to validate a given 2D model w/ 3 axes by averaging it
+    and comparing to 1D prediction.
+    
+    The equation used for averaging is:
+    
+        (integral dphi from 0 to 2pi)(integral dtheta from 0 to pi)
+             p(theta, phi) I(q) sin(theta) dtheta
+             
+        = (1/N_phi) (1/N_theta) (pi/2) (sum over N_phi) (sum over N_theta)
+             p(theta_i, phi_i) I(q) sin(theta_i)
+             
+    where p(theta, phi) is the probability distribution normalized to 4pi.
+    In the current case, we put p(theta, phi) = 1.
+    
+    The normalization factor results from:
+          2pi/N_phi      for the phi sum
+        x pi/N_theta     for the theta sum
+        x 1/(4pi)        because p is normalized to 4pi
+        --------------
+        = (1/N_phi) (1/N_theta) (pi/2)
+    
+    Note: 
+        Averaging the 3-axes 2D scattering intensity give a slightly
+        different output than the 1D function  
+        at hight Q (Q>~0.2). This is due to the way the IGOR library 
+        averages(?), taking only 76 points in alpha, the angle between
+        the axis of the ellipsoid and the q vector.
+        
+    Note: Core-shell and sphere models are symmetric around
+        all axes and don't need to be tested in the following way.
+"""
+import sys, math
+from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
+from sans.models.ParallelepipedModel import ParallelepipedModel
+from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
+
+class Validate2D:
+    """ 
+        Class to validate a given 2D model by averaging it
+        and comparing to 1D prediction.
+    """
+    
+    def __init__(self):
+        """ Initialization """
+        # Precision for the result comparison
+        self.precision = 0.000001
+        # Flag for end result
+        self.passed = True
+                
+    def __call__(self, model_class=EllipticalCylinderModel, points = 101):
+        """ 
+            Perform test and produce output file
+            @param model_class: python class of the model to test
+        """
+        print "Averaging %s: Note; takes loooong time." % model_class.__name__
+        passed = True
+        
+        npts =points
+        #The average values are very sensitive to npts of phi so npts_alpha should be large enough.
+        npts_alpha =180 #npts of phi
+        model = model_class()
+        #model.setParam('scale', 1.0)
+        #model.setParam('contrast', 1.0)
+        
+        theta_label = 'cyl_theta'
+        if not model.params.has_key(theta_label):
+            theta_label = 'parallel_theta'
+        if not model.params.has_key(theta_label):
+            theta_label = 'axis_theta'
+            
+        phi_label = 'cyl_phi'
+        if not model.params.has_key(phi_label):
+            phi_label = 'parallel_phi'
+        if not model.params.has_key(phi_label):
+            phi_label = 'axis_phi'
+            
+        psi_label = 'cyl_psi'
+        if not model.params.has_key(psi_label):
+            psi_label = 'parallel_psi'
+        if not model.params.has_key(psi_label):
+            psi_label = 'axis_psi'
+            
+        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')
+        output_f.write("<q_average> <2d_average> <1d_average>\n")
+            
+        for i_q in range(1, 23):
+            q = 0.01*i_q
+            sum = 0.0
+            weight = 0.0
+            for i_theta in range(npts):
+                theta = 180.0/npts*(i_theta+1)
+                
+                model.setParam(theta_label, theta)
+                
+                for j in range(npts_alpha):
+                    model.setParam(phi_label, 180.0 * 2.0 / npts_alpha * j)
+                    for k in range(npts):
+                        model.setParam(psi_label, 180.0 * 2.0 / npts * k)
+                        if str(model.run([q, 0])).count("INF")>0:                        
+                            print "ERROR", q, theta, 180.0 * 2.0 / npts * k
+                            
+                        # sin() is due to having not uniform bin number density wrt the q plane.
+                        sum += model.run([q, 0])*math.sin(theta*math.pi/180.0)
+                        weight += math.sin(theta*math.pi/180.0) 
+
+            value = sum/weight #*math.pi/2.0
+            ana = model.run(q)
+            if q<0.3 and (value-ana)/ana>0.05:
+                passed = False
+            output_f.write("%10g %10g %10g\n" % (q, value, ana))
+            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
+        
+        output_f.close()
+        return passed
+    
+        
+        
+if __name__ == '__main__':
+    validator = Validate2D()
+    
+    #Note: Test one model by one model, otherwise it could crash depending on the memory.
+    
+    te_passed =validator(TriaxialEllipsoidModel, points=76)
+    #pp_passed = validator(ParallelepipedModel, points=76)
+    #ell_passed = validator(EllipticalCylinderModel, points=76)
+        
+    print ""
+    print "Model             Passed"
+    print "TriaxialEllipsoid         %s" % te_passed
+    #print "ParallelepipedModel    %s" % pp_passed
+    #print "EllipticalCylinder        %s" % ell_passed
+ 
+        
+        
+  
+    
Index: sansmodels/test/validate_2D_elliptical_cyl.py
===================================================================
--- sansmodels/test/validate_2D_elliptical_cyl.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/validate_2D_elliptical_cyl.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,234 @@
+#!/usr/bin/env python
+""" 
+    Test for Elliptical Cylinder model.
+    Class to validate a given 2D model by averaging it
+    and comparing to 1D prediction.
+    
+"""
+import sys, math
+from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
+
+
+class Validate2D:
+    """ 
+        Class to validate a given 2D model by averaging it
+        and comparing to 1D prediction.
+    """
+    
+    def __init__(self):
+        """ Initialization """
+        # Precision for the result comparison
+        self.precision = 0.000001
+        # Flag for end result
+        self.passed = True
+        # Verbose flag
+        self.verbose = True
+                
+    def __call__(self, npts = 101):
+        """ 
+            Perform test and produce output file
+            @param npts: number of points to average over
+            @return: True if the test passed, otherwise False
+        """
+        passed = True
+        
+        model = EllipticalCylinderModel()
+        
+        theta_label = 'cyl_theta'
+        if not model.params.has_key(theta_label):
+            theta_label = 'axis_theta'
+            
+        phi_label = 'cyl_phi'
+        if not model.params.has_key(phi_label):
+            phi_label = 'axis_phi'
+        
+        output_f = open("average_func.txt",'w')    
+        output_f.write("<q_average> <2d_average> <1d_average>\n")
+            
+        for i_q in range(1, 15):
+            q = 0.3/15.0*i_q
+            value = self.average_point_3D(model, q, npts)
+            ana = model.run(q)
+            if q<0.3 and (value-ana)/ana>0.05:
+                passed = False
+            output_f.write("%10g %10g %10g\n" % (q, value, ana))
+            if self.verbose:
+                print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
+        
+        output_f.close()
+        return passed
+    
+    def average_point_3D(self, model, q, npts):
+        """
+            Average intensity over all orientations
+            of the main cylinder axis and the 
+            rotation around that axis
+            
+            @param model: model to test
+            @param q: q-value
+            @param npts: number of points to average over
+            @return: average intensity
+        """
+        sum = 0.0
+        for i_theta in range(npts):
+            theta = math.pi/npts*i_theta
+            
+            model.setParam('cyl_theta', theta)
+            
+            for j in range(npts):
+                model.setParam('cyl_phi', math.pi * 2.0 / npts * j)
+                     
+                for k in range(npts):
+                    model.setParam("cyl_psi", math.pi * 2.0 / npts * k)
+                    
+                    if str(model.run([q, 0])).count("IN")>0:                        
+                        if self.verbose:
+                            #print "ERROR", q, theta, math.pi * 2.0 / npts * j
+                            pass
+                    else:
+                        sum += math.sin(theta)*model.run([q, 0])
+         
+        value = sum/npts/npts/npts
+        return value
+
+    def checkCylinder2D(self, phi):
+        """ 
+            Check that the 2D scattering intensity reduces
+            to a cylinder when r_ratio = 1.0
+            @param phi: angle of the vector q on the detector
+            @return: True if the test passed, otherwise False
+        """
+        from sans.models.CylinderModel import CylinderModel
+        
+        cyl = CylinderModel()
+        cyl.setParam("cyl_theta", 90)
+        cyl.setParam("cyl_phi", 0.0)
+        cyl.setParam("radius", 20)
+        cyl.setParam("length", 400)
+        cyl.setParam("sldCyl", 2.0e-6)
+        cyl.setParam("sldSolv", 1.0e-6)
+
+        ell = EllipticalCylinderModel()
+        ell.setParam("r_ratio", 1.0)
+        ell.setParam("r_minor", 20)
+        ell.setParam("cyl_theta", 90)
+        ell.setParam("cyl_phi", 0.0)
+        ell.setParam("length", 400)
+        ell.setParam("sldCyl", 2.0e-6)
+        ell.setParam("sldSolv", 1.0e-6)
+        
+        passed = True
+        for i_q in range(1, 30):
+            q = 0.025*i_q
+            ell_val = ell.run([q, phi])
+            cyl_val = cyl.run([q, phi])
+            if self.verbose:
+                print "Q=%g    Ell=%g    Cyl=%g   R=%g" %(q, ell_val, cyl_val, ell_val/cyl_val)
+            if math.fabs(ell_val-cyl_val)/cyl_val>0.05:
+                passed= False
+                
+        return passed
+
+        
+    def checkCylinder(self, points):
+        """
+            Compare the average over all orientations
+            of the main cylinder axis for a cylinder
+            and the elliptical cylinder with r_ratio = 1
+            
+            @param points: number of points to average over
+            @return: True if the test passed, otherwise False
+        """
+        from sans.models.CylinderModel import CylinderModel
+        
+        passed = True
+        
+        npts =points
+        model = EllipticalCylinderModel()
+        model.setParam('r_ratio', 1.0)
+        model.setParam("r_minor", 20)
+        model.setParam("cyl_theta", 90)
+        model.setParam("cyl_phi", 0.0)
+        model.setParam("length", 400)
+        model.setParam("sldEll", 2.0e-6)
+        model.setParam("sldSolv", 1.0e-6)
+        
+        cyl = CylinderModel()
+        cyl.setParam("cyl_theta", 90)
+        cyl.setParam("cyl_phi", 0.0)
+        cyl.setParam("radius", 20)
+        cyl.setParam("length", 400)
+        cyl.setParam("sldCyl", 2.0e-6)
+        cyl.setParam("sldSolv", 1.0e-6)
+
+        
+        output_f = open("average_func.txt",'w')    
+        output_f.write("<q_average> <2d_average> <1d_average>\n")
+            
+        for i_q in range(1, 15):
+            q = 0.3/15.0*i_q
+            value = self.average_point_2D(model, q, npts)
+            
+            ana = cyl.run(q)
+            if q<0.3 and math.fabs(value-ana)/ana>0.05:
+                passed = False
+            output_f.write("%10g %10g %10g\n" % (q, value, ana))
+            if self.verbose:
+                print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
+        
+        output_f.close()
+        return passed
+        
+        
+
+    def average_point_2D(self, model, q, npts):
+        """
+            Average intensity over all orientations
+            of the main cylinder axis
+            
+            @param model: model to test
+            @param q: q-value
+            @param npts: number of points to average over
+            @return: average intensity
+        """
+        sum = 0.0
+        
+        for i_theta in range(npts):
+            theta = math.pi/npts*i_theta            
+            model.setParam('cyl_theta', theta * 180 / math.pi)
+            
+            for j in range(npts):
+                model.setParam('cyl_phi', 180 * 2.0 / npts * j)
+                     
+                if str(model.run([q, 0])).count("IN")>0:                        
+                    if self.verbose:
+                        print "ERROR", q, theta, 180 * 2.0 / npts * j
+                else:
+                    sum += math.sin(theta)*model.run([q, 0])
+        
+        value = sum/npts/npts*math.pi/2.0
+        return value
+
+    
+if __name__ == '__main__':
+    select = 0
+
+    validator = Validate2D()
+    validator.verbose = True
+    
+    print "Testing Elliptical cylinder to 5%\n"
+    
+    if select == 0 or select == 1:
+        # Check that the scat intensity reduces to a cylinder
+        # for r_ratio = 1
+        print "Comparing to Cyl I(q,theta):", validator.checkCylinder2D(1.5)
+    elif select == 0 or select == 2:
+        print "Comparing average to Cyl I(q):", validator.checkCylinder(100)
+    elif select == 0 or select == 3:
+        ellcyl_passed = validator(100)
+    
+        
+        
+        
+  
+    
Index: sansmodels/test/validate_2D_model.py
===================================================================
--- sansmodels/test/validate_2D_model.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/validate_2D_model.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
@@ -0,0 +1,206 @@
+#!/usr/bin/env python
+""" 
+    Class to validate a given 2D model by averaging it
+    and comparing to 1D prediction.
+    
+    The equation used for averaging is:
+    
+        (integral dphi from 0 to 2pi)(integral dtheta from 0 to pi)
+             p(theta, phi) I(q) sin(theta) dtheta
+             
+        = (1/N_phi) (1/N_theta) (pi/2) (sum over N_phi) (sum over N_theta)
+             p(theta_i, phi_i) I(q) sin(theta_i)
+             
+    where p(theta, phi) is the probability distribution normalized to 4pi.
+    In the current case, we put p(theta, phi) = 1.
+    
+    The normalization factor results from:
+          2pi/N_phi      for the phi sum
+        x pi/N_theta     for the theta sum
+        x 1/(4pi)        because p is normalized to 4pi
+        --------------
+        = (1/N_phi) (1/N_theta) (pi/2)
+    
+    Note: Ellipsoid
+        Averaging the 2D ellipsoid scattering intensity give a slightly
+        different output than the 1D function from the IGOR library 
+        at hight Q (Q>0.3). This is due to the way the IGOR library 
+        averages, taking only 76 points in alpha, the angle between
+        the axis of the ellipsoid and the q vector.
+        
+    Note: Core-shell and sphere models are symmetric around
+        all axes and don't need to be tested in the following way.
+"""
+import sys, math
+from sans.models.SphereModel import SphereModel
+from sans.models.CylinderModel import CylinderModel
+from sans.models.EllipsoidModel import EllipsoidModel
+from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
+
+
+class Validate2D:
+    """ 
+        Class to validate a given 2D model by averaging it
+        and comparing to 1D prediction.
+    """
+    
+    def __init__(self):
+        """ Initialization """
+        # Precision for the result comparison
+        self.precision = 0.000001
+        # Flag for end result
+        self.passed = True
+                
+    def __call__(self, model_class=CylinderModel, points = 101):
+        """ 
+            Perform test and produce output file
+            @param model_class: python class of the model to test
+        """
+        print "Averaging %s" % model_class.__name__
+        passed = True
+        
+        npts =points
+        model = model_class()
+        #model.setParam('scale', 1.0)
+        #model.setParam('contrast', 1.0)
+        
+        theta_label = 'cyl_theta'
+        if not model.params.has_key(theta_label):
+            theta_label = 'axis_theta'
+            
+        phi_label = 'cyl_phi'
+        if not model.params.has_key(phi_label):
+            phi_label = 'axis_phi'
+        
+        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')    
+        output_f.write("<q_average> <2d_average> <1d_average>\n")
+            
+        for i_q in range(1, 30):
+            q = 0.025 *i_q
+            sum = 0.0
+            for i_theta in range(npts):
+                theta = 180.0 / npts * i_theta
+                
+                model.setParam(theta_label, theta)
+                
+                for j in range(npts):
+                    model.setParam(phi_label, 180.0 * 2.0 / npts * j)
+                    if str(model.run([q, 0])).count("INF")>0:                        
+                        print "ERROR", q, theta, 180.0 * 2.0 / npts * j
+                    sum += math.sin(theta*math.pi/180.0)*model.run([q, 0])
+                    #sum += model.run([q, 0])
+            
+            value = sum/npts/npts*math.pi/2.0
+            ana = model.run(q)
+            if q<0.25 and (value-ana)/ana>0.05:
+                passed = False
+            output_f.write("%10g %10g %10g\n" % (q, value, ana))
+            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
+        
+        output_f.close()
+        return passed
+    
+    def average(self, model_class=CylinderModel, points = 101):
+        """ 
+            Perform test and produce output file
+            @param model_class: python class of the model to test
+        """
+        print "Averaging %s" % model_class.__name__
+        passed = True
+        
+        npts =points
+        model = model_class()
+        model.setParam('scale', 1.0)
+        model.setParam('contrast', 1.0)
+        
+        theta_label = 'cyl_theta'
+        if not model.params.has_key(theta_label):
+            theta_label = 'axis_theta'
+            
+        phi_label = 'cyl_phi'
+        if not model.params.has_key(phi_label):
+            phi_label = 'axis_phi'
+        
+        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')    
+        output_f.write("<q_average> <2d_average> <1d_average>\n")
+            
+        for i_q in range(1, 30):
+            q = 0.025*i_q
+            sum = 0.0
+            theta = 90.0
+            
+            model.setParam(theta_label, theta)
+            
+            for j in range(npts):
+                model.setParam(phi_label, 180.0 / 2.0 / npts * j)
+                if str(model.run([q, 0])).count("INF")>0:                        
+                    print "ERROR", q, theta, 180.0 * 2.0 / npts * j
+                #sum += math.sin(theta*math.pi/180.0)*model.run([q, 0])
+                sum += math.sin(math.pi / 2.0 / npts * j)*model.run([q, 0])
+                #sum += model.run([q, 0])
+            
+            value = sum/npts
+            ana = model.run(q)
+            if q<0.25 and (value-ana)/ana>0.05:
+                passed = False
+            output_f.write("%10g %10g %10g\n" % (q, value, ana))
+            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
+        
+        output_f.close()
+        return passed
+        
+    def test_non_oriented(self, model_class=SphereModel, points = 101):
+        """ 
+            Perform test and produce output file
+            @param model_class: python class of the model to test
+        """
+        print "Averaging %s" % model_class.__name__
+        passed = True
+        
+        npts =points
+        model = model_class()
+        #model.setParam('scale', 1.0)
+        #model.setParam('contrast', 1.0)
+        
+        output_f = open("%s_avg.txt" % model.__class__.__name__,'w')    
+        output_f.write("<q_average> <2d_average> <1d_average>\n")
+            
+        for i_q in range(1, 30):
+            q = 0.025*i_q
+            sum = 0.0
+            for i_theta in range(npts):
+                theta = 180.0/npts*i_theta
+                
+                for j in range(npts):
+                    if str(model.run([q, 0])).count("INF")>0:                        
+                        print "ERROR", q, theta, 180.0 * 2.0 / npts * j
+                    sum += math.sin(theta*math.pi/180.0)*model.run([q, 0])
+            
+            value = sum/npts/npts*math.pi/2.0
+            ana = model.run(q)
+            if q<0.25 and (value-ana)/ana>0.05:
+                passed = False
+            output_f.write("%10g %10g %10g\n" % (q, value, ana))
+            print "Q=%g: %10g %10g %10g %10g" % (q, value, ana, value-ana, value/ana)
+        
+        output_f.close()
+        return passed
+            
+        
+if __name__ == '__main__':
+    validator = Validate2D()
+    cyl_passed = validator(CylinderModel, points=201)
+    ell_passed = validator(EllipsoidModel, points=501)
+    cylcorehsell_passed = validator(CoreShellCylinderModel, points=201) 
+    sph_passed = validator.test_non_oriented(SphereModel, points=211) 
+        
+    print ""
+    print "Model             Passed"
+    print "Cylinder          %s" % cyl_passed
+    print "Ellipsoid         %s" % ell_passed
+    print "Core-shell cyl    %s" % cylcorehsell_passed
+    print "Sphere            %s" % sph_passed
+        
+        
+  
+    
