Changeset ff31782 in sasmodels
- Timestamp:
- Nov 6, 2017 4:10:09 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- d4db147
- Parents:
- 74768cb
- Location:
- sasmodels
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
r376b0ee rff31782 44 44 from .direct_model import DirectModel, get_mesh 45 45 from .convert import revert_name, revert_pars, constrain_new_to_old 46 from .generate import FLOAT_RE 46 from .generate import FLOAT_RE, set_integration_size 47 47 from .weights import plot_weights 48 48 … … 801 801 return data, index 802 802 803 def make_engine(model_info, data, dtype, cutoff ):803 def make_engine(model_info, data, dtype, cutoff, ngauss=0): 804 804 # type: (ModelInfo, Data, str, float) -> Calculator 805 805 """ … … 809 809 than OpenCL. 810 810 """ 811 if ngauss: 812 set_integration_size(model_info, ngauss) 813 811 814 if dtype == 'sasview': 812 815 return eval_sasview(model_info, data) … … 1045 1048 'poly', 'mono', 'cutoff=', 1046 1049 'magnetic', 'nonmagnetic', 1047 'accuracy=', 1050 'accuracy=', 'ngauss=', 1048 1051 'neval=', # for timing... 1049 1052 … … 1179 1182 'show_weights' : False, 1180 1183 'sphere' : 0, 1184 'ngauss' : '0', 1181 1185 } 1182 1186 for arg in flags: … … 1205 1209 elif arg.startswith('-engine='): opts['engine'] = arg[8:] 1206 1210 elif arg.startswith('-neval='): opts['count'] = arg[7:] 1211 elif arg.startswith('-ngauss='): opts['ngauss'] = arg[8:] 1207 1212 elif arg.startswith('-random='): 1208 1213 opts['seed'] = int(arg[8:]) … … 1260 1265 1261 1266 comparison = any(PAR_SPLIT in v for v in values) 1267 1262 1268 if PAR_SPLIT in name: 1263 1269 names = name.split(PAR_SPLIT, 2) … … 1272 1278 return None 1273 1279 1280 if PAR_SPLIT in opts['ngauss']: 1281 opts['ngauss'] = [int(k) for k in opts['ngauss'].split(PAR_SPLIT, 2)] 1282 comparison = True 1283 else: 1284 opts['ngauss'] = [int(opts['ngauss'])]*2 1285 1274 1286 if PAR_SPLIT in opts['engine']: 1275 1287 opts['engine'] = opts['engine'].split(PAR_SPLIT, 2) … … 1290 1302 opts['cutoff'] = [float(opts['cutoff'])]*2 1291 1303 1292 base = make_engine(model_info[0], data, opts['engine'][0], opts['cutoff'][0]) 1304 base = make_engine(model_info[0], data, opts['engine'][0], 1305 opts['cutoff'][0], opts['ngauss'][0]) 1293 1306 if comparison: 1294 comp = make_engine(model_info[1], data, opts['engine'][1], opts['cutoff'][1]) 1307 comp = make_engine(model_info[1], data, opts['engine'][1], 1308 opts['cutoff'][1], opts['ngauss'][1]) 1295 1309 else: 1296 1310 comp = None -
sasmodels/generate.py
r4991048 rff31782 268 268 """ 269 269 270 271 def set_integration_size(info, n): 272 # type: (ModelInfo, int) -> None 273 """ 274 Update the model definition, replacing the gaussian integration with 275 a gaussian integration of a different size. 276 277 Note: this really ought to be a method in modelinfo, but that leads to 278 import loops. 279 """ 280 if (info.source and any(lib.startswith('lib/gauss') for lib in info.source)): 281 import os.path 282 from .gengauss import gengauss 283 path = os.path.join(MODEL_PATH, "lib", "gauss%d.c"%n) 284 if not os.path.exists(path): 285 gengauss(n, path) 286 info.source = ["lib/gauss%d.c"%n if lib.startswith('lib/gauss') 287 else lib for lib in info.source] 270 288 271 289 def format_units(units):
Note: See TracChangeset
for help on using the changeset viewer.