Changeset 158cee4 in sasmodels
- Timestamp:
- Oct 18, 2016 10:28:25 AM (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:
- 3ac4e1b
- Parents:
- b6f10d8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
rb6f10d8 r158cee4 320 320 name = name.split('*')[0] 321 321 322 if name == 'capped_cylinder' and pars['radius_cap'] < pars['radius']: 323 pars['radius'], pars['radius_cap'] = pars['radius_cap'], pars['radius'] 324 if name == 'barbell' and pars['radius_bell'] < pars['radius']: 325 pars['radius'], pars['radius_bell'] = pars['radius_bell'], pars['radius'] 326 327 # Limit guinier to an Rg such that Iq > 1e-30 (single precision cutoff) 328 if name == 'guinier': 322 if name == 'barbell': 323 if pars['radius_bell'] < pars['radius']: 324 pars['radius'], pars['radius_bell'] = pars['radius_bell'], pars['radius'] 325 326 elif name == 'capped_cylinder': 327 if pars['radius_cap'] < pars['radius']: 328 pars['radius'], pars['radius_cap'] = pars['radius_cap'], pars['radius'] 329 330 elif name == 'guinier': 331 # Limit guinier to an Rg such that Iq > 1e-30 (single precision cutoff) 329 332 #q_max = 0.2 # mid q maximum 330 333 q_max = 1.0 # high q maximum … … 332 335 pars['rg'] = min(pars['rg'], rg_max) 333 336 334 if name == 'rpa':337 elif name == 'rpa': 335 338 # Make sure phi sums to 1.0 336 339 if pars['case_num'] < 2: … … 342 345 for c in '1234': 343 346 pars['Phi'+c] /= total 347 348 elif name == 'stacked_disks': 349 pars['n_stacking'] = math.ceil(pars['n_stacking']) 344 350 345 351 def parlist(model_info, pars, is2d): … … 719 725 else: 720 726 err, errstr, errview = abs(relerr), "rel err", "log" 721 #sorted = np.sort(err.flatten()) 722 #cutoff = sorted[int(sorted.size*0.95)] 723 #err[err>cutoff] = cutoff 727 if 0: # 95% cutoff 728 sorted = np.sort(err.flatten()) 729 cutoff = sorted[int(sorted.size*0.95)] 730 err[err>cutoff] = cutoff 724 731 #err,errstr = base/comp,"ratio" 725 732 plot_theory(data, None, resid=err, view=errview, use_data=False) … … 965 972 if model_info != model_info2: 966 973 pars2 = randomize_pars(model_info2, pars2, seed=opts['seed']) 974 # Share values for parameters with the same name 975 for k, v in pars.items(): 976 if k in pars2: 977 pars2[k] = v 967 978 else: 968 979 pars2 = pars.copy() 980 constrain_pars(model_info, pars) 981 constrain_pars(model_info2, pars2) 969 982 print("Randomize using -random=%i"%opts['seed']) 970 983 if opts['mono']: … … 1016 1029 pars2.update(presets2) # set value after random to control value 1017 1030 #import pprint; pprint.pprint(model_info) 1018 constrain_pars(model_info, pars)1019 constrain_pars(model_info2, pars2)1020 1031 1021 1032 same_model = name == name2 and pars == pars
Note: See TracChangeset
for help on using the changeset viewer.