Changeset 8f20419d in sasview for sansmodels/src/sans/models
- Timestamp:
- Oct 14, 2010 12:30:23 PM (14 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:
- 29100cb
- Parents:
- 4cc8285c
- Location:
- sansmodels/src/sans/models
- Files:
-
- 8 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/bcc.c
rd5b6a9d r8f20419d 91 91 b1_y = cos(pars->psi); 92 92 // b2 axis orientation 93 b2_x = sqrt(1 -sin(pars->theta)*cos(pars->phi))*cos(pars->psi);94 b2_y = sqrt(1 -sin(pars->theta)*cos(pars->phi))*sin(pars->psi);93 b2_x = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*cos(pars->psi); 94 b2_y = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*sin(pars->psi); 95 95 96 96 // a3 axis orientation -
sansmodels/src/sans/models/c_extensions/ellipsoid.c
rf10063e r8f20419d 32 32 33 33 // Spherical scattering ampliture, with modified length for ellipsoid 34 sph_func = 3 *( sin(q*length) - q*length*cos(q*length) ) / (q*q*q*length*length*length);34 sph_func = 3.0*( sin(q*length) - q*length*cos(q*length) ) / (q*q*q*length*length*length); 35 35 36 36 return sph_func*sph_func; … … 99 99 100 100 // q vector 101 q_z = 0 ;101 q_z = 0.0; 102 102 103 103 // Compute the angle btw vector q and the -
sansmodels/src/sans/models/c_extensions/fcc.c
r339ce67 r8f20419d 91 91 b1_y = cos(pars->psi); 92 92 // b2 axis orientation 93 b2_x = sqrt(1 -sin(pars->theta)*cos(pars->phi))*cos(pars->psi);94 b2_y = sqrt(1 -sin(pars->theta)*cos(pars->phi))*sin(pars->psi);93 b2_x = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*cos(pars->psi); 94 b2_y = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*sin(pars->psi); 95 95 96 96 // a3 axis orientation … … 109 109 110 110 // Compute the angle btw vector q and the a3 axis 111 cos_val_a3 = a3_x*q_x + a3_y*q_y + a3_z*q_z;111 cos_val_a3 = a3_x*q_x + a3_y*q_y;// + a3_z*q_z; 112 112 a3_dot_q = aa*q*cos_val_a3; 113 113 -
sansmodels/src/sans/models/c_extensions/sc.c
rd5b6a9d r8f20419d 99 99 100 100 // a2 axis orientation 101 a2_x = sqrt(1 -sin(pars->theta)*cos(pars->phi))*cos(pars->psi);102 a2_y = sqrt(1 -sin(pars->theta)*cos(pars->phi))*sin(pars->psi);101 a2_x = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*cos(pars->psi); 102 a2_y = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*sin(pars->psi); 103 103 // a2 axis 104 cos_val_a2 = sin(acos(cos_val_a1)) ;104 cos_val_a2 = a2_x*q_x + a2_y*q_y;//sin(acos(cos_val_a1)) ; 105 105 a2_dot_q = aa*q*cos_val_a2; 106 106 -
sansmodels/src/sans/models/c_extensions/triaxial_ellipsoid.c
r13eb1c4 r8f20419d 97 97 98 98 // q vector 99 q_z = 0 ;99 q_z = 0.0; 100 100 101 101 //dx = 1.0; -
sansmodels/src/sans/models/test/utest_extra_models.py
r339ce67 r8f20419d 178 178 self.assertAlmostEqual(self.model.run(0.215268), 0.00927739, 6) 179 179 self.assertAlmostEqual(self.model.runXY(0.414467), 0.000406973, 6) 180 180 181 182 class TestGuinierPorod(unittest.TestCase): 183 """ 184 Unit tests for GuinierPorod Model function 185 """ 186 def setUp(self): 187 from sans.models.GuinierPorodModel import GuinierPorodModel 188 self.model= GuinierPorodModel() 189 190 def test1D(self): 191 # the values are from Igor pro calculation 192 # the different digits are due to precision of q values 193 self.assertAlmostEqual(self.model.run(0.001), 995.112, 3) 194 self.assertAlmostEqual(self.model.run(0.105363), 0.162904, 5) 195 self.assertAlmostEqual(self.model.runXY(0.441623), 0.100854, 6) 196 197 class TestGaussLorentzGel(unittest.TestCase): 198 """ 199 Unit tests for GuinierPorod Model function 200 """ 201 def setUp(self): 202 from sans.models.GaussLorentzGelModel import GaussLorentzGelModel 203 self.model= GaussLorentzGelModel() 204 205 def test1D(self): 206 # the values are from Igor pro calculation 207 # the different digits are due to precision of q values 208 self.assertAlmostEqual(self.model.run(0.001), 149.481, 3) 209 self.assertAlmostEqual(self.model.run(0.105363), 9.1903, 4) 210 self.assertAlmostEqual(self.model.runXY(0.441623), 0.632811, 5) 211 212 213 class TestTwoPowerLaw(unittest.TestCase): 214 """ 215 Unit tests for TwoPowerLaw Model function 216 """ 217 def setUp(self): 218 from sans.models.TwoPowerLawModel import TwoPowerLawModel 219 self.model= TwoPowerLawModel() 220 221 def test1D(self): 222 # the values are from Igor pro calculation 223 # the different digits are due to precision of q values 224 self.assertEqual(self.model.run(0.001), 1000) 225 self.assertAlmostEqual(self.model.run(0.150141), 0.125945, 5) 226 self.assertAlmostEqual(self.model.runXY(0.442528), 0.00166884, 7) 227 228 class TestTwoLorentzian(unittest.TestCase): 229 """ 230 Unit tests for TwoLorentzian Model function 231 """ 232 def setUp(self): 233 from sans.models.TwoLorentzianModel import TwoLorentzianModel 234 self.model= TwoLorentzianModel() 235 236 def test1D(self): 237 # the values are from Igor pro calculation 238 # the different digits are due to precision of q values 239 self.assertAlmostEqual(self.model.run(0.001), 11.0899, 3) 240 self.assertAlmostEqual(self.model.run(0.150141), 0.410245, 5) 241 self.assertAlmostEqual(self.model.runXY(0.442528), 0.148699, 6) 242 243 244 class TestCorrLengthLaw(unittest.TestCase): 245 """ 246 Unit tests for CorrLength Model function 247 """ 248 def setUp(self): 249 from sans.models.CorrLengthModel import CorrLengthModel 250 self.model= CorrLengthModel() 251 252 def test1D(self): 253 # the values are from Igor pro calculation 254 # the different digits are due to precision of q values 255 self.assertAlmostEqual(self.model.run(0.001), 1010.08, 1) 256 self.assertAlmostEqual(self.model.run(0.150141), 0.274645, 5) 257 self.assertAlmostEqual(self.model.runXY(0.442528), 0.120396, 6) 258 259 260 class TestBroadPeak(unittest.TestCase): 261 """ 262 Unit tests for BroadPeak Model function 263 """ 264 def setUp(self): 265 from sans.models.BroadPeakModel import BroadPeakModel 266 self.model= BroadPeakModel() 267 268 def test1D(self): 269 # the values are from Igor pro calculation 270 # the different digits are due to precision of q values 271 self.assertAlmostEqual(self.model.run(0.001), 10000.5, 1) 272 self.assertAlmostEqual(self.model.run(0.1501412), 1.47557, 5) 273 self.assertAlmostEqual(self.model.runXY(0.4425284), 0.134093, 6) 274 275 class TestFractalCoreShell(unittest.TestCase): 276 """ 277 Unit tests for FractalCoreShell Model function 278 """ 279 def setUp(self): 280 from sans.models.FractalCoreShellModel import FractalCoreShellModel 281 self.model= FractalCoreShellModel() 282 283 def test1D(self): 284 #self.model.setParam('radius.width', 2.0) 285 # the values are from Igor pro calculation 286 # the different digits are due to precision of q values 287 self.assertAlmostEqual(self.model.run(0.001), 273.742, 3) 288 self.assertAlmostEqual(self.model.run(0.1501412), 0.040079, 6) 289 self.assertAlmostEqual(self.model.runXY(0.4425284), 0.00141167, 6) 290 181 291 if __name__ == '__main__': 182 292 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.