Changes in / [cb39d66:34f13a83] in sasview
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingLogic.py
ra54bbf2b ra54bbf2b 223 223 return plots 224 224 225 def getScalarIntermediateResults(self, return_data):226 """227 Returns a dict of scalar-only intermediate results from the return data.228 """229 res = {}230 for name, int_res in return_data["intermediate_results"].items():231 if isinstance(int_res, np.ndarray):232 continue233 res[name] = int_res234 return res235 236 225 def computeDataRange(self): 237 226 """ -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r085409e3 r085409e3 2297 2297 # TODO: multishell params in self.kernel_module.details[??] = value 2298 2298 2299 # handle display of effective radius parameter according to radius_effective_mode; pass ER into model if2300 # necessary2301 self.processEffectiveRadius()2302 2303 2299 # Force the chart update when actual parameters changed 2304 2300 if model_column == 1: … … 2307 2303 # Update state stack 2308 2304 self.updateUndo() 2309 2310 def processEffectiveRadius(self):2311 """2312 Checks the value of radius_effective_mode, if existent, and processes radius_effective as necessary.2313 * mode == 0: This means 'unconstrained'; ensure use can specify ER.2314 * mode > 0: This means it is constrained to a P(Q)-computed value in sasmodels; prevent user from editing ER.2315 2316 Note: If ER has been computed, it is passed back to SasView as an intermediate result. That value must be2317 displayed for the user; that is not dealt with here, but in complete1D.2318 """2319 ER_row = self.getRowFromName("radius_effective")2320 if ER_row is None:2321 return2322 2323 ER_mode_row = self.getRowFromName("radius_effective_mode")2324 if ER_mode_row is None:2325 return2326 2327 try:2328 ER_mode = int(self._model_model.item(ER_mode_row, 1).text())2329 except ValueError:2330 logging.error("radius_effective_mode was set to an invalid value.")2331 return2332 2333 if ER_mode == 0:2334 # ensure the ER value can be modified by user2335 self.setParamEditableByRow(ER_row, True)2336 elif ER_mode > 0:2337 # ensure the ER value cannot be modified by user2338 self.setParamEditableByRow(ER_row, False)2339 else:2340 logging.error("radius_effective_mode was set to an invalid value.")2341 2342 def setParamEditableByRow(self, row, editable=True):2343 """2344 Sets whether the user can edit a parameter in the table. If they cannot, the parameter name's font is changed,2345 the value itself cannot be edited if clicked on, and the parameter may not be fitted.2346 """2347 item_name = self._model_model.item(row, 0)2348 item_value = self._model_model.item(row, 1)2349 2350 item_value.setEditable(editable)2351 2352 if editable:2353 # reset font2354 item_name.setFont(QtGui.QFont())2355 # reset colour2356 item_name.setForeground(QtGui.QBrush())2357 # make checkable2358 item_name.setCheckable(True)2359 else:2360 # change font2361 font = QtGui.QFont()2362 font.setItalic(True)2363 item_name.setFont(font)2364 # change colour2365 item_name.setForeground(QtGui.QBrush(QtGui.QColor(50, 50, 50)))2366 # make not checkable (and uncheck)2367 item_name.setCheckState(QtCore.Qt.Unchecked)2368 item_name.setCheckable(False)2369 2305 2370 2306 def isCheckable(self, row): … … 2599 2535 self.communicate.plotUpdateSignal.emit([plot]) 2600 2536 2601 # Update radius_effective if relevant2602 self.updateEffectiveRadius(return_data)2603 2604 2537 def complete2D(self, return_data): 2605 2538 """ … … 2628 2561 for plot in new_plots: 2629 2562 self.communicate.plotUpdateSignal.emit([plot]) 2630 2631 def updateEffectiveRadius(self, return_data):2632 """2633 Given return data from sasmodels, update the effective radius parameter in the GUI table with the new2634 calculated value as returned by sasmodels (if the value was returned).2635 """2636 ER_mode_row = self.getRowFromName("radius_effective_mode")2637 if ER_mode_row is None:2638 return2639 try:2640 ER_mode = int(self._model_model.item(ER_mode_row, 1).text())2641 except ValueError:2642 logging.error("radius_effective_mode was set to an invalid value.")2643 return2644 if ER_mode < 1:2645 # does not need updating if it is not being computed2646 return2647 2648 ER_row = self.getRowFromName("radius_effective")2649 if ER_row is None:2650 return2651 2652 scalar_results = self.logic.getScalarIntermediateResults(return_data)2653 ER_value = scalar_results.get("effective_radius") # note name of key2654 if ER_value is None:2655 return2656 # ensure the model does not recompute when updating the value2657 self._model_model.blockSignals(True)2658 self._model_model.item(ER_row, 1).setText(str(ER_value))2659 self._model_model.blockSignals(False)2660 # ensure the view is updated immediately2661 self._model_model.layoutChanged.emit()2662 2563 2663 2564 def calculateResiduals(self, fitted_data):
Note: See TracChangeset
for help on using the changeset viewer.