Changeset 0633048 in sasview for src/sas/sasgui/perspectives/fitting
- Timestamp:
- Dec 9, 2016 1:52:27 PM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 8aec639
- Parents:
- 9eb8fae
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
ra321c52 r0633048 1156 1156 self._show_combox_helper() 1157 1157 # select the current model 1158 try: 1159 # to support older version 1160 category_pos = int(state.categorycombobox) 1161 except: 1162 state._convert_to_sasmodels() 1163 state.categorycombobox = unicode(state.categorycombobox) 1164 if state.categorycombobox in self.categorybox.Items: 1165 category_pos = self.categorybox.Items.index( 1166 state.categorycombobox) 1167 else: 1168 # Look in master list for model name (model.lower) 1169 category_pos = self.get_cat_combo_box_pos(state) 1158 state._convert_to_sasmodels() 1159 state.categorycombobox = unicode(state.categorycombobox) 1160 if state.categorycombobox in self.categorybox.Items: 1161 category_pos = self.categorybox.Items.index( 1162 state.categorycombobox) 1163 else: 1164 # Look in master list for model name (model.lower) 1165 category_pos = self.get_cat_combo_box_pos(state) 1170 1166 1171 1167 self.categorybox.Select(category_pos) 1172 1168 self._show_combox(None) 1173 try: 1174 # to support older version 1175 formfactor_pos = int(state.formfactorcombobox) 1176 except: 1177 if self.categorybox.GetValue() == 'Customized Models' \ 1178 and '[plug-in]' not in state.formfactorcombobox: 1179 state.formfactorcombobox = \ 1180 '[plug-in] ' + state.formfactorcombobox 1181 formfactor_pos = 0 1182 for ind_form in range(self.formfactorbox.GetCount()): 1183 if self.formfactorbox.GetString(ind_form) == \ 1184 (state.formfactorcombobox): 1185 formfactor_pos = int(ind_form) 1169 if self.categorybox.GetValue() == 'Customized Models' \ 1170 and '[plug-in]' not in state.formfactorcombobox: 1171 state.formfactorcombobox = \ 1172 '[plug-in] ' + state.formfactorcombobox 1173 formfactor_pos = 0 1174 for ind_form in range(self.formfactorbox.GetCount()): 1175 if self.formfactorbox.GetString(ind_form) == \ 1176 (state.formfactorcombobox): 1177 formfactor_pos = int(ind_form) 1178 break 1179 1180 self.formfactorbox.Select(formfactor_pos) 1181 1182 structfactor_pos = 0 1183 if state.structurecombobox is not None: 1184 state.structurecombobox = unicode(state.structurecombobox) 1185 for ind_struct in range(self.structurebox.GetCount()): 1186 if self.structurebox.GetString(ind_struct) == \ 1187 (state.structurecombobox): 1188 structfactor_pos = int(ind_struct) 1186 1189 break 1187 1188 self.formfactorbox.Select(formfactor_pos)1189 1190 structfactor_pos = 01191 try:1192 # to support older version1193 structfactor_pos = int(state.structurecombobox)1194 except:1195 if state.structurecombobox is not None:1196 state.structurecombobox = unicode(state.structurecombobox)1197 for ind_struct in range(self.structurebox.GetCount()):1198 if self.structurebox.GetString(ind_struct) == \1199 (state.structurecombobox):1200 structfactor_pos = int(ind_struct)1201 break1202 1190 1203 1191 self.structurebox.SetSelection(structfactor_pos) -
src/sas/sasgui/perspectives/fitting/pagestate.py
r9eb8fae r0633048 392 392 self.formfactorcombobox = 'hardsphere' 393 393 394 def param_remap_to_sasmodels_convert(self, params ):394 def param_remap_to_sasmodels_convert(self, params, is_string=False): 395 395 """ 396 396 Remaps the parameters for sasmodels conversion … … 412 412 lower[0] = False 413 413 lower[1] = numpy.nan 414 p[name] = float(value) 414 if is_string: 415 p[name] = str(value) 416 else: 417 p[name] = float(value) 415 418 p[name + ".fittable"] = bool(fittable) 416 419 p[name + ".std"] = float(uncert[1]) … … 468 471 convert.convert_model(self.formfactorcombobox, params) 469 472 if len(self.str_parameters) > 0: 470 str_p = self.param_remap_to_sasmodels_convert(self.str_parameters) 471 formfactor, str_params = convert.convert_model(formfactor, str_p) 472 else: 473 str_params = None 473 str_pars = self.param_remap_to_sasmodels_convert( 474 self.str_parameters, True) 475 formfactor, str_params = convert.convert_model( 476 self.formfactorcombobox, str_pars) 477 for key, value in str_params.iteritems(): 478 params[key] = value 474 479 475 480 # Only convert if old != new, otherwise all the same 476 481 if formfactor != self.formfactorcombobox or \ 477 482 structurefactor != self.structurecombobox: 483 # Spherical SLD number of layers changed between 3.1.2 and 4.0 484 if self.formfactorcombobox == 'SphericalSLDModel': 485 self.multi_factor += 1 478 486 self.formfactorcombobox = formfactor 479 487 self.structurecombobox = structurefactor 480 488 self.parameters = [] 481 489 self.parameters = self.param_remap_from_sasmodels_convert(params) 482 if str_params:483 self.str_parameters = \484 self.param_remap_from_sasmodels_convert(str_params)485 490 486 491 def _repr_helper(self, list, rep):
Note: See TracChangeset
for help on using the changeset viewer.