- Timestamp:
- Jul 27, 2017 4:05:50 AM (7 years ago)
- Branches:
- 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
- Children:
- 7adc2a8
- Parents:
- b00414d
- Location:
- src/sas/qtgui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rb00414d r0d13814 167 167 # Which shell is being currently displayed? 168 168 self.current_shell_displayed = 0 169 # List of all shell-unique parameters 170 self.shell_names = [] 169 171 170 172 # Error column presence in parameter display … … 1137 1139 self.undo_supported = temp_undo_state 1138 1140 1141 self.shell_names = self.shellNamesList() 1142 1139 1143 # Update the QModel 1140 1144 new_rows = FittingUtilities.addParametersToModel(self.model_parameters, self.kernel_module, self.is2D) … … 1419 1423 self._poly_model.clear() 1420 1424 1421 [self.setPolyModelParameters( row, param) for row, param in \1425 [self.setPolyModelParameters(param) for _, param in \ 1422 1426 enumerate(self.model_parameters.form_volume_parameters) if param.polydisperse] 1423 1427 FittingUtilities.addPolyHeadersToModel(self._poly_model) 1424 1428 1425 def setPolyModelParameters(self, row, param): 1426 """ 1427 Creates a checked row for a polydisperse parameter 1428 """ 1429 # Not suitable for multishell 1429 def setPolyModelParameters(self, param): 1430 """ 1431 Standard of multishell poly parameter driver 1432 """ 1433 param_name = param.name 1434 # see it the parameter is multishell 1430 1435 if '[' in param.name: 1431 return 1436 # Skip empty shells 1437 if self.current_shell_displayed == 0: 1438 return 1439 else: 1440 # Create as many entries as current shells 1441 for ishell in xrange(1, self.current_shell_displayed+1): 1442 # Remove [n] and add the shell numeral 1443 name = param_name[0:param_name.index('[')] + str(ishell) 1444 self.addNameToPolyModel(name) 1445 else: 1446 # Just create a simple param entry 1447 self.addNameToPolyModel(param_name) 1448 1449 def addNameToPolyModel(self, param_name): 1450 """ 1451 Creates a checked row in the poly model with param_name 1452 """ 1432 1453 # Polydisp. values from the sasmodel 1433 width = self.kernel_module.getParam(param.name + '.width') 1434 npts = self.kernel_module.getParam(param.name + '.npts') 1435 nsigs = self.kernel_module.getParam(param.name + '.nsigmas') 1454 width = self.kernel_module.getParam(param_name + '.width') 1455 npts = self.kernel_module.getParam(param_name + '.npts') 1456 nsigs = self.kernel_module.getParam(param_name + '.nsigmas') 1457 _, min, max = self.kernel_module.details[param_name] 1436 1458 1437 1459 # Construct a row with polydisp. related variable. 1438 1460 # This will get added to the polydisp. model 1439 1461 # Note: last argument needs extra space padding for decent display of the control 1440 checked_list = ["Distribution of " + param .name, str(width),1441 str( param.limits[0]), str(param.limits[1]),1462 checked_list = ["Distribution of " + param_name, str(width), 1463 str(min), str(max), 1442 1464 str(npts), str(nsigs), "gaussian "] 1443 1465 FittingUtilities.addCheckedListToModel(self._poly_model, checked_list) … … 1536 1558 FittingUtilities.addHeadersToModel(self._magnet_model) 1537 1559 1560 def shellNamesList(self): 1561 """ 1562 Returns list of names of all multi-shell parameters 1563 E.g. for sld[n], radius[n], n=1..3 it will return 1564 [sld1, sld2, sld3, radius1, radius2, radius3] 1565 """ 1566 multi_names = [p.name[:p.name.index('[')] for p in self.model_parameters.iq_parameters if '[' in p.name] 1567 top_index = self.kernel_module.multiplicity_info.number 1568 shell_names = [] 1569 for i in xrange(1, top_index+1): 1570 for name in multi_names: 1571 shell_names.append(name+str(i)) 1572 return shell_names 1573 1538 1574 def addCheckedMagneticListToModel(self, param, model): 1539 1575 """ 1540 1576 Wrapper for model update with a subset of magnetic parameters 1541 1577 """ 1578 if param.name[param.name.index(':')+1:] in self.shell_names: 1579 # check if two-digit shell number 1580 try: 1581 shell_index = int(param.name[-2:]) 1582 except ValueError: 1583 shell_index = int(param.name[-1:]) 1584 1585 if shell_index > self.current_shell_displayed: 1586 return 1587 1542 1588 checked_list = [param.name, 1543 1589 str(param.default), … … 1604 1650 FittingUtilities.addShellsToModel(self.model_parameters, self._model_model, index) 1605 1651 self.current_shell_displayed = index 1652 1653 # Update relevant models 1654 self.setPolyModel() 1655 self.setMagneticModel() 1606 1656 1607 1657 def readFitPage(self, fp): -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
- Property mode changed from 100755 to 100644
rb00414d r0d13814 61 61 editor.setValidator(validator) 62 62 return editor 63 if index.column() in [self.PARAM_PROPERTY, self.PARAM_UNIT]: 64 # Set some columns uneditable 65 return None 63 66 64 67 return super(ModelViewDelegate, self).createEditor(widget, option, index) … … 226 229 Overwrite generic painter for certain columns 227 230 """ 228 if index.column() in (self.mag_min, self.mag_max ):231 if index.column() in (self.mag_min, self.mag_max, self.mag_unit): 229 232 # Units - present in nice HTML 230 233 options = QtGui.QStyleOptionViewItemV4(option) -
src/sas/qtgui/path_prepare.py
- Property mode changed from 100755 to 100644
rded2ce3 r0d13814 5 5 import os 6 6 import sys 7 8 def exe_run(): 9 """ 10 Check if the process is run as .exe or as .py 11 Primitive extension check of the name of the running process 12 """ 13 # Could be checking for .exe, but on mac/linux this wouldn't work well 14 return os.path.splitext(sys.argv[0])[1].lower() != ".py" 15 7 16 def addpath(path): 8 17 """ … … 25 34 return mod 26 35 27 root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) 28 addpath(os.path.join(root, 'src')) 29 #addpath(os.path.join(root, '../sasmodels/')) 30 import sas 31 from distutils.util import get_platform 32 sas.sasview = import_package('sas.sasview', os.path.join(root,'sasview')) 33 platform = '%s-%s'%(get_platform(),sys.version[:3]) 34 build_path = os.path.join(root, 'build','lib.'+platform) 35 sys.path.append(build_path) 36 root = "" 37 if exe_run(): 38 root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) 39 addpath(os.path.join(root, 'src')) 40 addpath('src') 41 else: 42 root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) 43 addpath(os.path.join(root, 'src')) 44 addpath('src') 45 # Add the local build directory to PYTHONPATH 46 from distutils.util import get_platform 47 platform = '%s-%s'%(get_platform(),sys.version[:3]) 48 build_path = os.path.join(root, 'build','lib.'+platform) 49 sys.path.append(build_path) 50
Note: See TracChangeset
for help on using the changeset viewer.