Changes in / [e4041a2:0dcb71d] in sasview
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingLogic.py
r61f0c75 r61f0c75 220 220 return plots 221 221 222 def getScalarIntermediateResults(self, return_data):223 """224 Returns a dict of scalar-only intermediate results from the return data.225 """226 res = {}227 for name, int_res in return_data["intermediate_results"].items():228 if isinstance(int_res, np.ndarray):229 continue230 res[name] = int_res231 return res232 233 222 def computeDataRange(self): 234 223 """ -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r0dcb71d r0dcb71d 2229 2229 # TODO: multishell params in self.kernel_module.details[??] = value 2230 2230 2231 # handle display of effective radius parameter according to radius_effective_mode; pass ER into model if2232 # necessary2233 self.processEffectiveRadius()2234 2235 2231 # Force the chart update when actual parameters changed 2236 2232 if model_column == 1: … … 2239 2235 # Update state stack 2240 2236 self.updateUndo() 2241 2242 def processEffectiveRadius(self):2243 """2244 Checks the value of radius_effective_mode, if existent, and processes radius_effective as necessary.2245 * mode == 0: This means 'unconstrained'; ensure use can specify ER.2246 * mode > 0: This means it is constrained to a P(Q)-computed value in sasmodels; prevent user from editing ER.2247 2248 Note: If ER has been computed, it is passed back to SasView as an intermediate result. That value must be2249 displayed for the user; that is not dealt with here, but in complete1D.2250 """2251 ER_row = self.getRowFromName("radius_effective")2252 if ER_row is None:2253 return2254 2255 ER_mode_row = self.getRowFromName("radius_effective_mode")2256 if ER_mode_row is None:2257 return2258 2259 try:2260 ER_mode = int(self._model_model.item(ER_mode_row, 1).text())2261 except ValueError:2262 logging.error("radius_effective_mode was set to an invalid value.")2263 return2264 2265 if ER_mode == 0:2266 # ensure the ER value can be modified by user2267 self.setParamEditableByRow(ER_row, True)2268 elif ER_mode > 0:2269 # ensure the ER value cannot be modified by user2270 self.setParamEditableByRow(ER_row, False)2271 else:2272 logging.error("radius_effective_mode was set to an invalid value.")2273 2274 def setParamEditableByRow(self, row, editable=True):2275 """2276 Sets whether the user can edit a parameter in the table. If they cannot, the parameter name's font is changed,2277 the value itself cannot be edited if clicked on, and the parameter may not be fitted.2278 """2279 item_name = self._model_model.item(row, 0)2280 item_value = self._model_model.item(row, 1)2281 2282 item_value.setEditable(editable)2283 2284 if editable:2285 # reset font2286 item_name.setFont(QtGui.QFont())2287 # reset colour2288 item_name.setForeground(QtGui.QBrush())2289 # make checkable2290 item_name.setCheckable(True)2291 else:2292 # change font2293 font = QtGui.QFont()2294 font.setItalic(True)2295 item_name.setFont(font)2296 # change colour2297 item_name.setForeground(QtGui.QBrush(QtGui.QColor(50, 50, 50)))2298 # make not checkable (and uncheck)2299 item_name.setCheckState(QtCore.Qt.Unchecked)2300 item_name.setCheckable(False)2301 2237 2302 2238 def isCheckable(self, row): … … 2505 2441 self.communicate.plotUpdateSignal.emit([plot]) 2506 2442 2507 # Update radius_effective if relevant2508 def updateRadiusEffective():2509 ER_mode_row = self.getRowFromName("radius_effective_mode")2510 if ER_mode_row is None:2511 return2512 try:2513 ER_mode = int(self._model_model.item(ER_mode_row, 1).text())2514 except ValueError:2515 logging.error("radius_effective_mode was set to an invalid value.")2516 return2517 if ER_mode < 1:2518 # does not need updating if it is not being computed2519 return2520 2521 ER_row = self.getRowFromName("radius_effective")2522 if ER_row is None:2523 return2524 2525 scalar_results = self.logic.getScalarIntermediateResults(return_data)2526 ER_value = scalar_results.get("effective_radius") # note name of key2527 if ER_value is None:2528 return2529 # ensure the model does not recompute when updating the value2530 self._model_model.blockSignals(True)2531 self._model_model.item(ER_row, 1).setText(str(ER_value))2532 self._model_model.blockSignals(False)2533 # ensure the view is updated immediately2534 self._model_model.layoutChanged.emit()2535 2536 updateRadiusEffective()2537 2538 2443 def complete2D(self, return_data): 2539 2444 """
Note: See TracChangeset
for help on using the changeset viewer.