Changeset 600005c in sasview for src/sas/sasgui
- Timestamp:
- Nov 15, 2016 8:39:13 AM (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:
- b4fc0f9
- Parents:
- 64c7f39 (diff), 3d29f26b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
rc8e1996 r64c7f39 1157 1157 category_pos = int(state.categorycombobox) 1158 1158 except: 1159 state.formfactorcombobox = state.formfactorcombobox.lower() 1160 state.formfactorcombobox = \ 1161 state.formfactorcombobox.replace('model', '') 1162 state.formfactorcombobox = unicode(state.formfactorcombobox) 1159 if state.formfactorcombobox is not None: 1160 state._convert_to_sasmodels() 1163 1161 state.categorycombobox = unicode(state.categorycombobox) 1164 1162 if state.categorycombobox in self.categorybox.Items: … … 1528 1526 index_data = ((self.qmin_x <= self.data.x) & 1529 1527 (self.data.x <= self.qmax_x)) 1530 val = str(len( self.data.x[index_data is True]))1528 val = str(len([index_data is True])) 1531 1529 self.Npts_fit.SetValue(val) 1532 1530 else: … … 1576 1574 if len(statelist) != len(listtorestore): 1577 1575 return 1576 1577 ordered_list = [] 1578 for i in range(len(listtorestore)) : 1579 for param in statelist: 1580 if param[1] == listtorestore[i][1]: 1581 ordered_list.append(param) 1582 break 1583 statelist = ordered_list 1578 1584 1579 1585 for j in range(len(listtorestore)): -
src/sas/sasgui/perspectives/fitting/pagestate.py
rc8e1996 r64c7f39 355 355 obj.saved_states[copy_name] = copy_state 356 356 return obj 357 358 def _convert_to_sasmodels(self): 359 """ 360 Convert parameters to a form usable by sasmodels converter 361 362 :return: None 363 """ 364 from sasmodels import convert 365 import re 366 # Create conversion dictionary to send to sasmodels 367 p = dict() 368 for fittable, name, value, _, uncert, lower, upper, units in \ 369 self.parameters: 370 if not value: 371 value = numpy.nan 372 if not uncert or uncert[1] == '': 373 uncert[0] = False 374 uncert[1] = numpy.nan 375 if not upper or upper[1] == '': 376 upper[0] = False 377 upper[1] = numpy.nan 378 if not lower or lower[1] == '': 379 lower[0] = False 380 lower[1] = numpy.nan 381 p[name] = float(value) 382 p[name + ".fittable"] = bool(fittable) 383 p[name + ".std"] = float(uncert[1]) 384 p[name + ".upper"] = float(upper[1]) 385 p[name + ".lower"] = float(lower[1]) 386 p[name + ".units"] = units 387 name, params = convert.convert_model(self.formfactorcombobox, p) 388 389 # Only convert if old != new, otherwise all the same 390 if name != self.formfactorcombobox: 391 self.formfactorcombobox = name 392 self.parameters = [] 393 for name, info in params.iteritems(): 394 if ".fittable" in name or ".std" in name or ".upper" in name or\ 395 ".lower" in name or ".units" in name: 396 pass 397 else: 398 fittable = params.get(name + ".fittable") 399 std = params.get(name + ".std") 400 upper = params.get(name + ".upper") 401 lower = params.get(name + ".lower") 402 units = params.get(name + ".units") 403 if std is not None: 404 std = [True, str(std)] 405 else: 406 std = [False, ''] 407 if lower is not None: 408 lower = [True, str(lower)] 409 else: 410 lower = [False, ''] 411 if upper is not None: 412 upper = [True, str(upper)] 413 else: 414 upper = [False, ''] 415 param_list = [bool(fittable), str(name), str(info), 416 "+/-", std, lower, upper, str(units)] 417 self.parameters.append(param_list) 418 357 419 358 420 def _repr_helper(self, list, rep):
Note: See TracChangeset
for help on using the changeset viewer.