Changeset 62827da in sasview for sansmodels
- Timestamp:
- Dec 18, 2012 11:12:03 AM (12 years ago)
- 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
- Location:
- sansmodels/test
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/test/utest_dispersity.py
r019a943 r62827da 29 29 self.model.setParam('background', 0.0) 30 30 self.model.setParam('cyl_theta', 0.0) 31 self.model.setParam('cyl_phi', 0.0)31 self.model.setParam('cyl_phi', 90.0) 32 32 33 33 def test_simple(self): … … 134 134 self.model.setParam('background', 0.0) 135 135 self.model.setParam('axis_theta', 0.0) 136 self.model.setParam('axis_phi', 0.0)136 self.model.setParam('axis_phi', 90.0) 137 137 138 138 def test_simple(self): … … 282 282 self.model.setParam('sldSolv', 1.e-6) 283 283 self.model.setParam('background', 0.0) 284 self.model.setParam('axis_theta', 89.95445)284 self.model.setParam('axis_theta', 0.0) 285 285 self.model.setParam('axis_phi', 0.0) 286 286 -
sansmodels/test/utest_models.py
r1e40ed1 r62827da 60 60 def test2D(self): 61 61 """ 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) 64 64 self.assertAlmostEqual(self.comp.run([0.2, 2.5]), 65 0.038176446608393366, 4)65 0.038176446608393366, 2) 66 66 67 67 class TestGaussian(unittest.TestCase): … … 96 96 self.assertAlmostEqual(self.gauss.run([math.sqrt(8.0), math.pi/4.0]), 2.0*2.0*value*value, 5) 97 97 98 class TestStarPolymer(unittest.TestCase):99 """Unit tests for Star Polymer"""100 def setUp(self):101 from sans.models.StarPolymer import StarPolymer102 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.009539392014169456113 y = 0.003114 # together these have modulus 1115 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 131 98 class TestLorentzian(unittest.TestCase): 132 99 """Unit tests for Lorentzian function""" … … 134 101 def setUp(self): 135 102 from sans.models.Lorentzian import Lorentzian 136 self.lor 103 self.lor= Lorentzian() 137 104 138 105 def test1D(self): -
sansmodels/test/utest_models_array.py
r18e250c r62827da 69 69 def test1D_2(self): 70 70 """ 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) 73 73 self.assertAlmostEqual(self.comp.run([0.2, 2.5]), 74 0.038176446608393366, 3)74 0.038176446608393366, 2) 75 75 76 76 def test1D_3(self): -
sansmodels/test/utest_other_dispersity.py
rc6cc2910 r62827da 21 21 self.model.setParam('background', 0.0) 22 22 self.model.setParam('cyl_theta', 0.0) 23 self.model.setParam('cyl_phi', 0.0)23 self.model.setParam('cyl_phi', 90.0) 24 24 25 25 def test_simple(self): -
sansmodels/test/validate_2D_3axes_shape_model.py
r18e250c r62827da 103 103 104 104 # 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) ) 107 107 108 108 value = sum/weight #*math.pi/2.0 -
sansmodels/test/validate_2D_elliptical_cyl.py
r18e250c r62827da 87 87 pass 88 88 else: 89 sum += math. sin(theta)*model.run([q, 0])89 sum += math.fabs(math.cos(theta))*model.run([q, 0]) 90 90 91 91 value = sum/npts/npts/npts … … 205 205 print "ERROR", q, theta, 180 * 2.0 / npts * j 206 206 else: 207 sum += math. sin(theta)*model.run([q, 0])207 sum += math.fabs(math.cos(theta))*model.run([q, 0]) 208 208 209 209 value = sum/npts/npts*math.pi/2.0 -
sansmodels/test/validate_2D_model.py
r18e250c r62827da 88 88 if str(model.run([q, 0])).count("INF")>0: 89 89 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]) 91 91 #sum += model.run([q, 0]) 92 92 … … 112 112 model = model_class() 113 113 model.setParam('scale', 1.0) 114 model.setParam('contrast', 1.0)114 #model.setParam('contrast', 1.0) 115 115 116 116 theta_label = 'cyl_theta'
Note: See TracChangeset
for help on using the changeset viewer.