Changeset 9a66e65 in sasmodels for sasmodels/compare.py
- Timestamp:
- Dec 9, 2015 9:12:17 AM (8 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:
- 716abe0
- Parents:
- dcef2ee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
rcf404cb r9a66e65 20 20 from .data import plot_theory, empty_data1D, empty_data2D 21 21 from .direct_model import DirectModel 22 from .convert import revert_model 22 from .convert import revert_model, constrain_new_to_old 23 23 kerneldll.ALLOW_SINGLE_PRECISION_DLLS = True 24 24 … … 81 81 82 82 for k,v in pars.items(): 83 if k.startswith("num_pearls_") or k.startswith("thick_string_"): 84 continue 85 if k.endswith("_pd"): 86 model.dispersion[k[:-3]]['width'] = v 87 elif k.endswith("_pd_n"): 88 model.dispersion[k[:-5]]['npts'] = v 89 elif k.endswith("_pd_nsigma"): 90 model.dispersion[k[:-10]]['nsigmas'] = v 91 elif k.endswith("_pd_type"): 92 model.dispersion[k[:-8]]['type'] = v 83 parts = k.split('.') # polydispersity components 84 if len(parts) == 2: 85 model.dispersion[parts[0]][parts[1]] = v 93 86 else: 94 87 model.setParam(k, v) … … 129 122 130 123 def constrain_pars(model_definition, pars): 124 """ 125 Restrict parameters to valid values. 126 """ 131 127 name = model_definition.name 132 128 if name == 'capped_cylinder' and pars['cap_radius'] < pars['radius']: … … 141 137 rg_max = np.sqrt(90*np.log(10) + 3*np.log(pars['scale']))/q_max 142 138 pars['rg'] = min(pars['rg'],rg_max) 143 144 # These constraints are only needed for comparison to sasview145 if name in ('teubner_strey','broad_peak'):146 del pars['scale']147 if name in ('guinier',):148 del pars['background']149 if getattr(model_definition, 'category', None) == 'structure-factor':150 del pars['scale'], pars['background']151 152 139 153 140 def parlist(pars): … … 277 264 pars.update(set_pars) # set value after random to control value 278 265 constrain_pars(model_definition, pars) 266 constrain_new_to_old(model_definition, pars) 279 267 280 268 # parameter selection
Note: See TracChangeset
for help on using the changeset viewer.