Changeset 454670d in sasview for src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Timestamp:
- Apr 6, 2017 5:33:44 AM (8 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:
- 2155824
- Parents:
- f182f93
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rf182f93 r454670d 4 4 import numpy 5 5 from collections import defaultdict 6 from itertools import izip 6 7 7 8 import logging … … 133 134 self.cbCategory.setCurrentIndex(0) 134 135 136 # Connect signals to controls 137 self.initializeSignals() 138 139 # Initial control state 140 self.initializeControls() 141 135 142 self._index = None 136 143 if data is not None: 137 144 self.data = data 138 139 # Connect signals to controls 140 self.initializeSignals() 141 142 # Initial control state 143 self.initializeControls() 145 # Update Q Ranges 146 #self.updateQRange() 144 147 145 148 @property … … 150 153 def data(self, value): 151 154 """ data setter """ 152 assert isinstance(value [0], QtGui.QStandardItem)155 assert isinstance(value, QtGui.QStandardItem) 153 156 # _index contains the QIndex with data 154 self._index = value [0]157 self._index = value 155 158 156 159 # Update logics with data items 157 self.logic.data = GuiUtils.dataFromItem(value [0])160 self.logic.data = GuiUtils.dataFromItem(value) 158 161 159 162 self.data_is_loaded = True … … 163 166 self.updateQRange() 164 167 self.cmdFit.setEnabled(True) 168 print "set to ", self.cmdFit.isEnabled() 165 169 166 170 def acceptsData(self): … … 189 193 190 194 def togglePoly(self, isChecked): 191 """ 192 Enable/disable the polydispersity tab 193 """ 195 """ Enable/disable the polydispersity tab """ 194 196 self.tabFitting.setTabEnabled(TAB_POLY, isChecked) 195 197 196 198 def toggleMagnetism(self, isChecked): 197 """ 198 Enable/disable the magnetism tab 199 """ 199 """ Enable/disable the magnetism tab """ 200 200 self.tabFitting.setTabEnabled(TAB_MAGNETISM, isChecked) 201 201 202 202 def toggle2D(self, isChecked): 203 """ 204 Enable/disable the controls dependent on 1D/2D data instance 205 """ 203 """ Enable/disable the controls dependent on 1D/2D data instance """ 206 204 self.chkMagnetism.setEnabled(isChecked) 207 205 self.is2D = isChecked … … 223 221 self.tabFitting.setTabEnabled(TAB_MAGNETISM, False) 224 222 self.lblChi2Value.setText("---") 225 # Update Q Ranges226 self.updateQRange()227 223 228 224 def initializeSignals(self): … … 413 409 """ 414 410 Receive and display fitting results 415 416 411 "result" is a tuple of actual result list and the fit time in seconds 417 412 """ … … 426 421 not numpy.all(numpy.isfinite(res.pvec)): 427 422 msg = "Fitting did not converge!!!" 423 self.communicate.statusBarUpdateSignal.emit(msg) 428 424 logging.error(msg) 429 425 return … … 431 427 elapsed = result[1] 432 428 msg = "Fitting completed successfully in: %s s.\n" % GuiUtils.formatNumber(elapsed) 433 434 429 self.communicate.statusBarUpdateSignal.emit(msg) 435 430 … … 438 433 param_values = res.pvec 439 434 param_stderr = res.stderr 440 from itertools import izip441 # TODO: add errors to the dict so they can propagate to the view442 435 params_and_errors = zip(param_values, param_stderr) 443 436 param_dict = dict(izip(param_list, params_and_errors)) … … 451 444 self.lblChi2Value.setText(chi2_repr) 452 445 453 pass446 # Generate charts 454 447 455 448 def iterateOverModel(self, func): … … 475 468 return 476 469 # modify the param value 477 self._model_model.item(row_i, 1).setText(str(param_dict[param_name][0])) 470 param_repr = GuiUtils.formatNumber(param_dict[param_name][0], high=True) 471 self._model_model.item(row_i, 1).setText(param_repr) 478 472 if self.has_error_column: 479 self._model_model.item(row_i, 2).setText(str(param_dict[param_name][1])) 473 error_repr = GuiUtils.formatNumber(param_dict[param_name][1], high=True) 474 self._model_model.item(row_i, 2).setText(error_repr) 480 475 481 476 def createColumn(row_i): … … 500 495 self._model_model.insertColumn(2, error_column) 501 496 FittingUtilities.addErrorHeadersToModel(self._model_model) 502 503 497 504 498 def onPlot(self): … … 674 668 structure_parameters = modelinfo.make_parameter_table(getattr(structure_module, 'parameters', [])) 675 669 FittingUtilities.addSimpleParametersToModel(structure_parameters, self._model_model) 676 # Set the error column width to 0677 self.lstParams.setColumnWidth(2, 20)678 670 # Update the counter used for multishell display 679 671 self._last_model_row = self._model_model.rowCount()
Note: See TracChangeset
for help on using the changeset viewer.