Changes in sasmodels/compare_many.py [f72d70a:424fe00] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare_many.py
rf72d70a r424fe00 106 106 header = ('\n"Model","%s","Count","%d","Dimension","%s"' 107 107 % (name, N, "2D" if is_2d else "1D")) 108 if not mono: 109 header += ',"Cutoff",%g'%(cutoff,) 108 if not mono: header += ',"Cutoff",%g'%(cutoff,) 110 109 print(header) 111 110 … … 162 161 max_diff = [0] 163 162 for k in range(N): 164 print(" Model %s %d"%(name, k+1), file=sys.stderr)163 print("%s %d"%(name, k), file=sys.stderr) 165 164 seed = np.random.randint(1e6) 166 165 pars_i = randomize_pars(model_info, pars, seed) 167 166 constrain_pars(model_info, pars_i) 168 if 'sasview' in (base, comp): 169 constrain_new_to_old(model_info, pars_i) 167 constrain_new_to_old(model_info, pars_i) 170 168 if mono: 171 169 pars_i = suppress_pd(pars_i) … … 189 187 Print the command usage string. 190 188 """ 191 print("usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono) (single|double|quad)", 192 file=sys.stderr) 189 print("usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono) (single|double|quad)") 193 190 194 191 … … 207 204 print("""\ 208 205 209 MODEL is the model name of the model or one of the model types listed in 210 sasmodels.core.list_models (all, py, c, double, single, opencl, 1d, 2d, 211 nonmagnetic, magnetic). Model types can be combined, such as 2d+single. 206 MODEL is the model name of the model or "all" for all the models 207 in alphabetical order. 212 208 213 209 COUNT is the number of randomly generated parameter sets to try. A value … … 224 220 below the cutoff will be ignored. Use "mono" for monodisperse models. The 225 221 choice of polydisperse parameters, and the number of points in the distribution 226 is set in compare.py defaults for each model. Polydispersity is given in the 227 "demo" attribute of each model. 222 is set in compare.py defaults for each model. 228 223 229 224 PRECISION is the floating point precision to use for comparisons. If two 230 precisions are given, then compare one to the other. Precision is one of 231 fast, single, double for GPU or single!, double!, quad! for DLL. If no 232 precision is given, then use single and double! respectively. 225 precisions are given, then compare one to the other, ignoring sasview. 233 226 234 227 Available models: … … 240 233 Main program. 241 234 """ 242 if len(argv) not in ( 3, 4,5, 6):235 if len(argv) not in (5, 6): 243 236 print_help() 244 237 return 245 238 246 target = argv[0] 247 try: 248 model_list = [target] if target in MODELS else core.list_models(target) 249 except ValueError: 250 print('Bad model %s. Use model type or one of:' % target, file=sys.stderr) 239 model = argv[0] 240 if not (model in MODELS) and (model != "all"): 241 print('Bad model %s. Use "all" or one of:'%model) 251 242 print_models() 252 print('model types: all, py, c, double, single, opencl, 1d, 2d, nonmagnetic, magnetic')253 243 return 254 244 try: … … 257 247 assert argv[2][1] == 'd' 258 248 Nq = int(argv[2][2:]) 259 mono = len(argv) <= 3 orargv[3] == 'mono'249 mono = argv[3] == 'mono' 260 250 cutoff = float(argv[3]) if not mono else 0 261 base = argv[4] if len(argv) > 4 else "single"262 comp = argv[5] if len(argv) > 5 else " double!"251 base = argv[4] 252 comp = argv[5] if len(argv) > 5 else "sasview" 263 253 except Exception: 264 254 traceback.print_exc() … … 268 258 data, index = make_data({'qmax':1.0, 'is2d':is2D, 'nq':Nq, 'res':0., 269 259 'accuracy': 'Low', 'view':'log', 'zero': False}) 260 model_list = [model] if model != "all" else MODELS 270 261 for model in model_list: 271 262 compare_instance(model, data, index, N=count, mono=mono,
Note: See TracChangeset
for help on using the changeset viewer.