Changeset 5124c969 in sasmodels
- Timestamp:
- Feb 27, 2017 5:55:59 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c713c85
- Parents:
- a3002be
- Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare_many.py
r424fe00 r5124c969 106 106 header = ('\n"Model","%s","Count","%d","Dimension","%s"' 107 107 % (name, N, "2D" if is_2d else "1D")) 108 if not mono: header += ',"Cutoff",%g'%(cutoff,) 108 if not mono: 109 header += ',"Cutoff",%g'%(cutoff,) 109 110 print(header) 110 111 … … 161 162 max_diff = [0] 162 163 for k in range(N): 163 print(" %s %d"%(name, k), file=sys.stderr)164 print("Model %s %d"%(name, k+1), file=sys.stderr) 164 165 seed = np.random.randint(1e6) 165 166 pars_i = randomize_pars(model_info, pars, seed) 166 167 constrain_pars(model_info, pars_i) 167 constrain_new_to_old(model_info, pars_i) 168 if 'sasview' in (base, comp): 169 constrain_new_to_old(model_info, pars_i) 168 170 if mono: 169 171 pars_i = suppress_pd(pars_i) … … 204 206 print("""\ 205 207 206 MODEL is the model name of the model or "all" for all the models 207 in alphabetical order. 208 MODEL is the model name of the model or one of the model types listed in 209 sasmodels.core.list_models (all, py, c, double, single, opencl, 1d, 2d, 210 nonmagnetic, magnetic). Model types can be combined, such as 2d+single. 208 211 209 212 COUNT is the number of randomly generated parameter sets to try. A value … … 237 240 return 238 241 239 model = argv[0] 240 if not (model in MODELS) and (model != "all"): 241 print('Bad model %s. Use "all" or one of:'%model) 242 target = argv[0] 243 try: 244 model_list = [target] if target in MODELS else core.list_models(target) 245 except ValueError: 246 print('Bad model %s. Use model type or one of:'%model) 242 247 print_models() 248 print('model types: all, py, c, double, single, opencl, 1d, 2d, nonmagnetic, magnetic') 243 249 return 244 250 try: … … 258 264 data, index = make_data({'qmax':1.0, 'is2d':is2D, 'nq':Nq, 'res':0., 259 265 'accuracy': 'Low', 'view':'log', 'zero': False}) 260 model_list = [model] if model != "all" else MODELS261 266 for model in model_list: 262 267 compare_instance(model, data, index, N=count, mono=mono, -
sasmodels/core.py
r52e9a45 r5124c969 69 69 * magnetic: models with an sld 70 70 * nommagnetic: models without an sld 71 """ 72 if kind and kind not in KINDS: 71 72 For multiple conditions, combine with plus. For example, *c+single+2d* 73 would return all oriented models implemented in C which can be computed 74 accurately with single precision arithmetic. 75 """ 76 if kind and any(k not in KINDS for k in kind.split('+')): 73 77 raise ValueError("kind not in " + ", ".join(KINDS)) 74 78 files = sorted(glob(joinpath(generate.MODEL_PATH, "[a-zA-Z]*.py"))) 75 79 available_models = [basename(f)[:-3] for f in files] 76 selected = [name for name in available_models if _matches(name, kind)] 80 if kind and '+' in kind: 81 all_kinds = kind.split('+') 82 condition = lambda name: all(_matches(name, k) for k in all_kinds) 83 else: 84 condition = lambda name: _matches(name, kind) 85 selected = [name for name in available_models if condition(name)] 77 86 78 87 return selected -
sasmodels/modelinfo.py
r85fe7f8 r5124c969 730 730 info.docs = kernel_module.__doc__ 731 731 info.category = getattr(kernel_module, 'category', None) 732 info.single = getattr(kernel_module, 'single', True)733 info.opencl = getattr(kernel_module, 'opencl', True)734 732 info.structure_factor = getattr(kernel_module, 'structure_factor', False) 735 733 info.profile_axes = getattr(kernel_module, 'profile_axes', ['x', 'y']) … … 745 743 info.profile = getattr(kernel_module, 'profile', None) # type: ignore 746 744 info.sesans = getattr(kernel_module, 'sesans', None) # type: ignore 745 # Default single and opencl to True for C models. Python models have callable Iq. 746 info.opencl = getattr(kernel_module, 'opencl', not callable(info.Iq)) 747 info.single = getattr(kernel_module, 'single', not callable(info.Iq)) 747 748 748 749 # multiplicity info
Note: See TracChangeset
for help on using the changeset viewer.