Changeset 62827da in sasview


Ignore:
Timestamp:
Dec 18, 2012 9:12:03 AM (11 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
5b07138
Parents:
6550b64
Message:

updating tests

Location:
sansmodels/test
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/test/utest_dispersity.py

    r019a943 r62827da  
    2929        self.model.setParam('background', 0.0) 
    3030        self.model.setParam('cyl_theta', 0.0) 
    31         self.model.setParam('cyl_phi', 0.0) 
     31        self.model.setParam('cyl_phi', 90.0) 
    3232         
    3333    def test_simple(self): 
     
    134134        self.model.setParam('background', 0.0) 
    135135        self.model.setParam('axis_theta', 0.0) 
    136         self.model.setParam('axis_phi', 0.0) 
     136        self.model.setParam('axis_phi', 90.0) 
    137137         
    138138    def test_simple(self): 
     
    282282        self.model.setParam('sldSolv', 1.e-6) 
    283283        self.model.setParam('background', 0.0) 
    284         self.model.setParam('axis_theta', 89.95445) 
     284        self.model.setParam('axis_theta', 0.0) 
    285285        self.model.setParam('axis_phi', 0.0) 
    286286         
  • sansmodels/test/utest_models.py

    r1e40ed1 r62827da  
    6060    def test2D(self): 
    6161        """ Test 2D model of a cylinder """  
    62         self.comp.setParam('cyl_theta', 1*180/math.pi) 
    63         self.comp.setParam('cyl_phi', 1*180/math.pi) 
     62        self.comp.setParam('cyl_theta', 10.0) 
     63        self.comp.setParam('cyl_phi', 10.0) 
    6464        self.assertAlmostEqual(self.comp.run([0.2, 2.5]),  
    65                                0.038176446608393366, 4)  
     65                               0.038176446608393366, 2)  
    6666  
    6767class TestGaussian(unittest.TestCase): 
     
    9696        self.assertAlmostEqual(self.gauss.run([math.sqrt(8.0), math.pi/4.0]), 2.0*2.0*value*value, 5) 
    9797         
    98 class TestStarPolymer(unittest.TestCase): 
    99     """Unit tests for Star Polymer""" 
    100     def setUp(self): 
    101         from sans.models.StarPolymer import StarPolymer 
    102         self.star = StarPolymer() 
    103  
    104     def test1D(self): 
    105         self.star.setParam('scale', 3.0) 
    106         self.star.setParam('arms', 5.0) 
    107         self.star.setParam('R2', 100.0) 
    108         self.star.setParam('background', 1.0) 
    109         self.assertAlmostEqual(self.star.run(0.01), 3.9900214150405686) 
    110  
    111     def test2D(self): 
    112         x = 0.009539392014169456 
    113         y = 0.003 
    114         # together these have modulus 1 
    115         self.star.setParam('scale', 3.0) 
    116         self.star.setParam('arms', 5.0) 
    117         self.star.setParam('R2', 100.0) 
    118         self.star.setParam('background', 1.0) 
    119         self.assertAlmostEqual(self.star.runXY([x, y]), 3.9900214150405686) 
    120  
    121     def test2Dphi(self): 
    122         self.star.setParam('scale', 3.0) 
    123         self.star.setParam('arms', 5.0) 
    124         self.star.setParam('R2', 100.0) 
    125         self.star.setParam('background', 1.0) 
    126          
    127         self.assertAlmostEqual(self.star.run([0.01, math.pi/4.0]), 3.9900214150405686) 
    128  
    129  
    130  
    13198class TestLorentzian(unittest.TestCase): 
    13299    """Unit tests for Lorentzian function""" 
     
    134101    def setUp(self): 
    135102        from sans.models.Lorentzian import Lorentzian 
    136         self.lor = Lorentzian() 
     103        self.lor= Lorentzian() 
    137104         
    138105    def test1D(self): 
  • sansmodels/test/utest_models_array.py

    r18e250c r62827da  
    6969    def test1D_2(self): 
    7070        """ Test 2D model of a cylinder """  
    71         self.comp.setParam('cyl_theta', 1.0 * 180/3.1415) 
    72         self.comp.setParam('cyl_phi', 1.0 * 180/3.1415) 
     71        self.comp.setParam('cyl_theta', 10.0) 
     72        self.comp.setParam('cyl_phi', 10.0) 
    7373        self.assertAlmostEqual(self.comp.run([0.2, 2.5]),  
    74                                0.038176446608393366, 3) 
     74                               0.038176446608393366, 2) 
    7575         
    7676    def test1D_3(self): 
  • sansmodels/test/utest_other_dispersity.py

    rc6cc2910 r62827da  
    2121        self.model.setParam('background', 0.0) 
    2222        self.model.setParam('cyl_theta', 0.0) 
    23         self.model.setParam('cyl_phi', 0.0) 
     23        self.model.setParam('cyl_phi', 90.0) 
    2424         
    2525    def test_simple(self): 
  • sansmodels/test/validate_2D_3axes_shape_model.py

    r18e250c r62827da  
    103103                             
    104104                        # sin() is due to having not uniform bin number density wrt the q plane. 
    105                         sum += model.run([q, 0])*math.sin(theta*math.pi/180.0) 
    106                         weight += math.sin(theta*math.pi/180.0)  
     105                        sum += model.run([q, 0])*math.fabs(math.cos(theta*math.pi/180.0)) 
     106                        weight += math.fabs(math.cos(theta*math.pi/180.0) ) 
    107107 
    108108            value = sum/weight #*math.pi/2.0 
  • sansmodels/test/validate_2D_elliptical_cyl.py

    r18e250c r62827da  
    8787                            pass 
    8888                    else: 
    89                         sum += math.sin(theta)*model.run([q, 0]) 
     89                        sum += math.fabs(math.cos(theta))*model.run([q, 0]) 
    9090          
    9191        value = sum/npts/npts/npts 
     
    205205                        print "ERROR", q, theta, 180 * 2.0 / npts * j 
    206206                else: 
    207                     sum += math.sin(theta)*model.run([q, 0]) 
     207                    sum += math.fabs(math.cos(theta))*model.run([q, 0]) 
    208208         
    209209        value = sum/npts/npts*math.pi/2.0 
  • sansmodels/test/validate_2D_model.py

    r18e250c r62827da  
    8888                    if str(model.run([q, 0])).count("INF")>0:                         
    8989                        print "ERROR", q, theta, 180.0 * 2.0 / npts * j 
    90                     sum += math.sin(theta*math.pi/180.0)*model.run([q, 0]) 
     90                    sum += math.fabs(math.cos(theta*math.pi/180.0))*model.run([q, 0]) 
    9191                    #sum += model.run([q, 0]) 
    9292             
     
    112112        model = model_class() 
    113113        model.setParam('scale', 1.0) 
    114         model.setParam('contrast', 1.0) 
     114        #model.setParam('contrast', 1.0) 
    115115         
    116116        theta_label = 'cyl_theta' 
Note: See TracChangeset for help on using the changeset viewer.