Changes in src/sas/qtgui/Perspectives/Fitting/FittingWidget.py [5a96a72:0dcb71d] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r5a96a72 r0dcb71d 1841 1841 data_to_show = self.data if self.data_is_loaded else self.model_data 1842 1842 if data_to_show is not None: 1843 self.communicate.plotRequestedSignal.emit([data_to_show] )1843 self.communicate.plotRequestedSignal.emit([data_to_show], self.tab_id) 1844 1844 1845 1845 def onOptionsUpdate(self): … … 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): … … 2351 2287 fitted_data.symbol = "Line" 2352 2288 self.createTheoryIndex(fitted_data) 2289 # Switch to the theory tab for user's glee 2290 self.communicate.changeDataExplorerTabSignal.emit(1) 2353 2291 2354 2292 def updateModelIndex(self, fitted_data): … … 2486 2424 2487 2425 if self.data_is_loaded: 2426 # delete any plots associated with the data that were not updated (e.g. to remove beta(Q), S_eff(Q)) 2488 2427 GuiUtils.deleteRedundantPlots(self.all_data[self.data_index], new_plots) 2428 pass 2489 2429 else: 2490 2430 # delete theory items for the model, in order to get rid of any redundant items, e.g. beta(Q), S_eff(Q) … … 2500 2440 for plot in new_plots: 2501 2441 self.communicate.plotUpdateSignal.emit([plot]) 2502 2503 # Update radius_effective if relevant2504 def updateRadiusEffective():2505 ER_mode_row = self.getRowFromName("radius_effective_mode")2506 if ER_mode_row is None:2507 return2508 try:2509 ER_mode = int(self._model_model.item(ER_mode_row, 1).text())2510 except ValueError:2511 logging.error("radius_effective_mode was set to an invalid value.")2512 return2513 if ER_mode < 1:2514 # does not need updating if it is not being computed2515 return2516 2517 ER_row = self.getRowFromName("radius_effective")2518 if ER_row is None:2519 return2520 2521 scalar_results = self.logic.getScalarIntermediateResults(return_data)2522 ER_value = scalar_results.get("effective_radius") # note name of key2523 if ER_value is None:2524 return2525 # ensure the model does not recompute when updating the value2526 self._model_model.blockSignals(True)2527 self._model_model.item(ER_row, 1).setText(str(ER_value))2528 self._model_model.blockSignals(False)2529 # ensure the view is updated immediately2530 self._model_model.layoutChanged.emit()2531 2532 updateRadiusEffective()2533 2442 2534 2443 def complete2D(self, return_data): … … 3220 3129 param_value = str(self._model_model.item(row, 1).text()) 3221 3130 param_error = None 3131 param_min = None 3132 param_max = None 3222 3133 column_offset = 0 3223 3134 if self.has_error_column: 3224 3135 param_error = str(self._model_model.item(row, 2).text()) 3225 3136 column_offset = 1 3226 param_min = str(self._model_model.item(row, 2+column_offset).text()) 3227 param_max = str(self._model_model.item(row, 3+column_offset).text()) 3137 3138 try: 3139 param_min = str(self._model_model.item(row, 2+column_offset).text()) 3140 param_max = str(self._model_model.item(row, 3+column_offset).text()) 3141 except: 3142 pass 3143 3228 3144 param_list.append([param_name, param_checked, param_value, param_error, param_min, param_max]) 3229 3145 … … 3315 3231 3316 3232 # limits 3317 limit_lo = item[3] 3318 context[name].append(limit_lo) 3319 limit_hi = item[4] 3320 context[name].append(limit_hi) 3233 try: 3234 limit_lo = item[3] 3235 context[name].append(limit_lo) 3236 limit_hi = item[4] 3237 context[name].append(limit_hi) 3238 except: 3239 pass 3321 3240 3322 3241 # Polydisp … … 3377 3296 ioffset = 1 3378 3297 # min/max 3379 param_repr = GuiUtils.formatNumber(param_dict[param_name][2+ioffset], high=True) 3380 self._model_model.item(row, 2+ioffset).setText(param_repr) 3381 param_repr = GuiUtils.formatNumber(param_dict[param_name][3+ioffset], high=True) 3382 self._model_model.item(row, 3+ioffset).setText(param_repr) 3298 try: 3299 param_repr = GuiUtils.formatNumber(param_dict[param_name][2+ioffset], high=True) 3300 self._model_model.item(row, 2+ioffset).setText(param_repr) 3301 param_repr = GuiUtils.formatNumber(param_dict[param_name][3+ioffset], high=True) 3302 self._model_model.item(row, 3+ioffset).setText(param_repr) 3303 except: 3304 pass 3305 3383 3306 self.setFocus() 3307 3384 3308 3385 3309
Note: See TracChangeset
for help on using the changeset viewer.