Changes in / [adf1c2a:dad086f] 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
rd8d81ea rd8d81ea 2296 2296 # TODO: multishell params in self.kernel_module.details[??] = value 2297 2297 2298 # handle display of effective radius parameter according to radius_effective_mode; pass ER into model if2299 # necessary2300 self.processEffectiveRadius()2301 2302 2298 # Force the chart update when actual parameters changed 2303 2299 if model_column == 1: … … 2306 2302 # Update state stack 2307 2303 self.updateUndo() 2308 2309 def processEffectiveRadius(self):2310 """2311 Checks the value of radius_effective_mode, if existent, and processes radius_effective as necessary.2312 * mode == 0: This means 'unconstrained'; ensure use can specify ER.2313 * mode > 0: This means it is constrained to a P(Q)-computed value in sasmodels; prevent user from editing ER.2314 2315 Note: If ER has been computed, it is passed back to SasView as an intermediate result. That value must be2316 displayed for the user; that is not dealt with here, but in complete1D.2317 """2318 ER_row = self.getRowFromName("radius_effective")2319 if ER_row is None:2320 return2321 2322 ER_mode_row = self.getRowFromName("radius_effective_mode")2323 if ER_mode_row is None:2324 return2325 2326 try:2327 ER_mode = int(self._model_model.item(ER_mode_row, 1).text())2328 except ValueError:2329 logging.error("radius_effective_mode was set to an invalid value.")2330 return2331 2332 if ER_mode == 0:2333 # ensure the ER value can be modified by user2334 self.setParamEditableByRow(ER_row, True)2335 elif ER_mode > 0:2336 # ensure the ER value cannot be modified by user2337 self.setParamEditableByRow(ER_row, False)2338 else:2339 logging.error("radius_effective_mode was set to an invalid value.")2340 2341 def setParamEditableByRow(self, row, editable=True):2342 """2343 Sets whether the user can edit a parameter in the table. If they cannot, the parameter name's font is changed,2344 the value itself cannot be edited if clicked on, and the parameter may not be fitted.2345 """2346 item_name = self._model_model.item(row, 0)2347 item_value = self._model_model.item(row, 1)2348 2349 item_value.setEditable(editable)2350 2351 if editable:2352 # reset font2353 item_name.setFont(QtGui.QFont())2354 # reset colour2355 item_name.setForeground(QtGui.QBrush())2356 # make checkable2357 item_name.setCheckable(True)2358 else:2359 # change font2360 font = QtGui.QFont()2361 font.setItalic(True)2362 item_name.setFont(font)2363 # change colour2364 item_name.setForeground(QtGui.QBrush(QtGui.QColor(50, 50, 50)))2365 # make not checkable (and uncheck)2366 item_name.setCheckState(QtCore.Qt.Unchecked)2367 item_name.setCheckable(False)2368 2304 2369 2305 def isCheckable(self, row): … … 2593 2529 self.communicate.plotUpdateSignal.emit([plot]) 2594 2530 2595 # Update radius_effective if relevant2596 def updateRadiusEffective():2597 ER_mode_row = self.getRowFromName("radius_effective_mode")2598 if ER_mode_row is None:2599 return2600 try:2601 ER_mode = int(self._model_model.item(ER_mode_row, 1).text())2602 except ValueError:2603 logging.error("radius_effective_mode was set to an invalid value.")2604 return2605 if ER_mode < 1:2606 # does not need updating if it is not being computed2607 return2608 2609 ER_row = self.getRowFromName("radius_effective")2610 if ER_row is None:2611 return2612 2613 scalar_results = self.logic.getScalarIntermediateResults(return_data)2614 ER_value = scalar_results.get("effective_radius") # note name of key2615 if ER_value is None:2616 return2617 # ensure the model does not recompute when updating the value2618 self._model_model.blockSignals(True)2619 self._model_model.item(ER_row, 1).setText(str(ER_value))2620 self._model_model.blockSignals(False)2621 # ensure the view is updated immediately2622 self._model_model.layoutChanged.emit()2623 2624 updateRadiusEffective()2625 2626 2531 def complete2D(self, return_data): 2627 2532 """
Note: See TracChangeset
for help on using the changeset viewer.