Changeset 1e7de38 in sasview for sansmodels
- Timestamp:
- Oct 4, 2010 12:53:10 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:
- 9ec4406
- Parents:
- d267aed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/utest_model_sphereexpshell.py
ra1b2471 r1e7de38 15 15 from sans.models.CoreMultiShellModel import CoreMultiShellModel 16 16 from sans.models.VesicleModel import VesicleModel 17 18 self.model = SphereExpShellModel(n_shells=1) 19 self.model2 = SphereExpShellModel(n_shells=1).model 20 self.model3 = CoreMultiShellModel(n_shells=1) 17 18 # intit models and the multifactor 19 self.model = SphereExpShellModel(1) 20 self.model2 = SphereExpShellModel(1).model 21 self.model3 = CoreMultiShellModel(1) 21 22 self.model4 = VesicleModel() 23 self.model5 = SphereExpShellModel(9) 22 24 23 25 def test_compare_Exp0_flat(self): … … 53 55 def test_compare_Exp0_flat_vesicle(self): 54 56 """ 55 Check if Exp function with A_shell=0 gives the same value as Flat function of vesicle model when sld_solv=sld_core 57 Check if Exp function with A_shell=0 gives the same value as Flat 58 function of vesicle model when sld_solv=sld_core 56 59 """ 57 print "\n*****Note: All tests (test_compare_Exp0_flat and test_compare_Expsmall_line) were passes since Sept. 18, 2010..." 60 print "\n*****Note: All tests (test_compare_Exp0_flat and \ 61 test_compare_Expsmall_line) were passes since Sept. 18, 2010..." 58 62 # Exp: func_shell = 2, Line: func_shell =1 , Flat: func_shell = 0. 59 63 # A_shell = The coefficient of the exponential function: exp(A_shell*(r-ro)/thick_shell) … … 90 94 def test_compare_Expsmall_line(self): 91 95 """ 92 Check if Exp function with A_shell-->0 gives the same value as linear function 96 Check if Exp function with A_shell-->0 gives the same value 97 as a linear function 93 98 """ 94 99 # exp function crosses over to line func as A_shell-->0 … … 101 106 self.assertAlmostEqual(self.model.run(0.1),self.model2.run(0.1),4) 102 107 108 def test_compare_time_linear_flat_functions(self): 109 """ 110 Compare the calculation time between func=1(linear) , and 2 (step). 111 """ 112 from time import time 113 # using linear func 114 self.model5.model.setParam("func_shell1", 1) 115 #input 116 input = [0.01,0.01] 117 st = time() 118 for iter in range(0,100000): 119 self.model5.model.run(0.01) 120 time_linear = time()-st 121 122 # using flat function 123 self.model5.model.setParam("func_shell1", 0) 124 st = time() 125 for iter in range(0,100000): 126 self.model5.model.run(0.01) 127 time_flat = time()-st 128 129 print "time (linear) = %s, \n time (flat) = %s"% (time_linear,time_flat) 130 131 #Compare time of the calculation: time_linear takes a bit longer 132 # but they are not much different 133 self.assertAlmostEqual(time_linear,time_flat,0) 103 134 104 135
Note: See TracChangeset
for help on using the changeset viewer.