Changeset 13ed84c in sasmodels
- Timestamp:
- Feb 4, 2016 7:31:28 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 199d40d
- Parents:
- 5054e80
- Location:
- sasmodels
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/model_test.py
r5c962df r13ed84c 100 100 test_name = "Model: %s, Kernel: OpenCL"%model_name 101 101 test_method_name = "test_%s_opencl" % model_name 102 # Using dtype=None so that the models that are only 103 # correct for double precision are not tested using 104 # single precision. The choice is determined by the 105 # presence of *single=False* in the model file. 102 106 test = ModelTestCase(test_name, model_definition, 103 107 test_method_name, 104 platform="ocl", dtype= 'single')108 platform="ocl", dtype=None) 105 109 #print("defining", test_name) 106 110 suite.addTest(test) … … 157 161 ## values an error. Only do so for the "dll" tests 158 162 ## to reduce noise from both opencl and dll, and because 159 ## python kernels us 163 ## python kernels use platform="dll". 160 164 #raise Exception("No test cases provided") 161 165 pass … … 198 202 'invalid f(%s): %s' % (xi, actual_yi)) 199 203 else: 200 err = abs(yi - actual_yi) 201 nrm = abs(yi) 202 self.assertLess(err * 10**5, nrm, 204 self.assertTrue(is_near(yi, actual_yi, 5), 203 205 'f(%s); expected:%s; actual:%s' 204 206 % (xi, yi, actual_yi)) … … 206 208 return ModelTestCase 207 209 208 210 def is_near(target, actual, digits=5): 211 """ 212 Returns true if *actual* is within *digits* significant digits of *target*. 213 """ 214 import math 215 shift = 10**math.ceil(math.log10(abs(target))) 216 return abs(target-actual)/shift < 1.5*10**-digits 209 217 210 218 def main(): … … 217 225 218 226 models = sys.argv[1:] 227 if models and models[0] == '-v': 228 verbosity = 2 229 models = models[1:] 230 else: 231 verbosity = 1 219 232 if models and models[0] == 'opencl': 220 233 if not HAVE_OPENCL: … … 235 248 print("""\ 236 249 usage: 237 python -m sasmodels.model_test [opencl|dll|opencl_and_dll] model1 model2 ... 250 python -m sasmodels.model_test [-v] [opencl|dll] model1 model2 ... 251 252 If -v is included on the 253 If neither opencl nor dll is specified, then models will be tested with 254 both opencl and dll; the compute target is ignored for pure python models. 238 255 239 256 If model1 is 'all', then all except the remaining models will be tested. 240 If no compute target is specified, then models will be tested with both opencl 241 and dll; the compute target is ignored for pure python models.""")257 258 """) 242 259 243 260 return 1 244 261 245 262 #runner = unittest.TextTestRunner() 246 runner = xmlrunner.XMLTestRunner(output='logs' )263 runner = xmlrunner.XMLTestRunner(output='logs', verbosity=verbosity) 247 264 result = runner.run(make_suite(loaders, models)) 248 265 return 1 if result.failures or result.errors else 0 -
sasmodels/models/HayterMSAsq.py
r7f47777 r13ed84c 56 56 parameters used in P(Q). 57 57 """ 58 single = False # double precision only for now 58 59 # [ "name", "units", default, [lower, upper], "type", "description" ], 59 60 parameters = [["effect_radius", "Ang", 20.75, [0, inf], "volume", -
sasmodels/models/bcc.py
rdcdf29d r13ed84c 116 116 """ 117 117 category = "shape:paracrystal" 118 119 single = False 120 118 121 # pylint: disable=bad-whitespace, line-too-long 119 122 # ["name", "units", default, [lower, upper], "type","description" ], -
sasmodels/models/core_shell_ellipsoid.py
r81dd619 r13ed84c 96 96 category = "shape:ellipsoid" 97 97 98 single = False # TODO: maybe using sph_j1c inside gfn would help? 98 99 # pylint: disable=bad-whitespace, line-too-long 99 100 # ["name", "units", default, [lower, upper], "type", "description"], -
sasmodels/models/fcc.py
reb69cce r13ed84c 112 112 category = "shape:paracrystal" 113 113 114 single = False 115 114 116 # ["name", "units", default, [lower, upper], "type","description"], 115 117 parameters = [["dnn", "Ang", 220, [-inf, inf], "", "Nearest neighbour distance"], -
sasmodels/models/flexible_cylinder.py
r168052c r13ed84c 78 78 79 79 category = "shape:cylinder" 80 single = False 80 81 81 82 # pylint: disable=bad-whitespace, line-too-long -
sasmodels/models/flexible_cylinder_ex.py
r504abee r13ed84c 98 98 during model fitting. 99 99 """ 100 single = False 100 101 101 102 category = "shape:cylinder" -
sasmodels/models/gaussian_peak.py
reb69cce r13ed84c 42 42 category = "shape-independent" 43 43 44 single = False 44 45 # ["name", "units", default, [lower, upper], "type","description"], 45 46 parameters = [["q0", "1/Ang", 0.05, [-inf, inf], "", "Peak position"], -
sasmodels/models/hardsphere.py
r7f47777 r13ed84c 55 55 "volume fraction of hard spheres"], 56 56 ] 57 single = False 57 58 58 59 # No volume normalization despite having a volume parameter -
sasmodels/models/lamellarCaille.py
r7f47777 r13ed84c 87 87 category = "shape:lamellae" 88 88 89 single = False 90 89 91 # ["name", "units", default, [lower, upper], "type","description"], 90 92 parameters = [["thickness", "Ang", 30.0, [0, inf], "volume", "sheet thickness"], -
sasmodels/models/lamellarCailleHG.py
r7f47777 r13ed84c 91 91 category = "shape:lamellae" 92 92 93 single = False 93 94 parameters = [ 94 95 # [ "name", "units", default, [lower, upper], "type", -
sasmodels/models/lamellarPC.py
r7f47777 r13ed84c 111 111 category = "shape:lamellae" 112 112 113 single = False 114 113 115 # ["name", "units", default, [lower, upper], "type","description"], 114 116 parameters = [["thickness", "Ang", 33.0, [0, inf], "volume", -
sasmodels/models/lib/gfn.c
r81dd619 r13ed84c 6 6 // <OBLATE ELLIPSOID> 7 7 // function gfn4 for oblate ellipsoids 8 double8 static double 9 9 gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq) 10 10 { -
sasmodels/models/lib/wrc_cyl.c
r504abee r13ed84c 379 379 } 380 380 381 double Sk_WR(double q, double L, double b); 381 382 double Sk_WR(double q, double L, double b) 382 383 { -
sasmodels/models/rpa.c
r82c299f r13ed84c 205 205 const double Kbb = 0.0; 206 206 const double Kcc = 0.0; 207 const double Kdd = 0.0;207 //const double Kdd = 0.0; 208 208 const double Zaa = Kaa - Kad - Kad; 209 209 const double Zab = Kab - Kad - Kbd; … … 278 278 const double Q12 = (-Mab*Mcc + Mac*Mcb)/DenQ; 279 279 const double Q13 = ( Mab*Mbc - Mac*Mbb)/DenQ; 280 const double Q21 = (-Mba*Mcc + Mbc*Mca)/DenQ;280 //const double Q21 = (-Mba*Mcc + Mbc*Mca)/DenQ; 281 281 const double Q22 = ( Maa*Mcc - Mac*Mca)/DenQ; 282 282 const double Q23 = (-Maa*Mbc + Mac*Mba)/DenQ; 283 const double Q31 = ( Mba*Mcb - Mbb*Mca)/DenQ;284 const double Q32 = (-Maa*Mcb + Mab*Mca)/DenQ;283 //const double Q31 = ( Mba*Mcb - Mbb*Mca)/DenQ; 284 //const double Q32 = (-Maa*Mcb + Mab*Mca)/DenQ; 285 285 const double Q33 = ( Maa*Mbb - Mab*Mba)/DenQ; 286 286 -
sasmodels/models/star_polymer.py
r168052c r13ed84c 55 55 """ 56 56 category = "shape-independent" 57 single = False 57 58 # pylint: disable=bad-whitespace, line-too-long 58 59 # ["name", "units", default, [lower, upper], "type","description"], -
sasmodels/models/stickyhardsphere.py
r7f47777 r13ed84c 85 85 category = "structure-factor" 86 86 87 single = False 87 88 # ["name", "units", default, [lower, upper], "type","description"], 88 89 parameters = [
Note: See TracChangeset
for help on using the changeset viewer.