Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r5a96a72 r0dcb71d  
    18411841        data_to_show = self.data if self.data_is_loaded else self.model_data 
    18421842        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) 
    18441844 
    18451845    def onOptionsUpdate(self): 
     
    22292229        # TODO: multishell params in self.kernel_module.details[??] = value 
    22302230 
    2231         # handle display of effective radius parameter according to radius_effective_mode; pass ER into model if 
    2232         # necessary 
    2233         self.processEffectiveRadius() 
    2234  
    22352231        # Force the chart update when actual parameters changed 
    22362232        if model_column == 1: 
     
    22392235        # Update state stack 
    22402236        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 be 
    2249         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             return 
    2254  
    2255         ER_mode_row = self.getRowFromName("radius_effective_mode") 
    2256         if ER_mode_row is None: 
    2257             return 
    2258  
    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             return 
    2264  
    2265         if ER_mode == 0: 
    2266             # ensure the ER value can be modified by user 
    2267             self.setParamEditableByRow(ER_row, True) 
    2268         elif ER_mode > 0: 
    2269             # ensure the ER value cannot be modified by user 
    2270             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 font 
    2286             item_name.setFont(QtGui.QFont()) 
    2287             # reset colour 
    2288             item_name.setForeground(QtGui.QBrush()) 
    2289             # make checkable 
    2290             item_name.setCheckable(True) 
    2291         else: 
    2292             # change font 
    2293             font = QtGui.QFont() 
    2294             font.setItalic(True) 
    2295             item_name.setFont(font) 
    2296             # change colour 
    2297             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) 
    23012237 
    23022238    def isCheckable(self, row): 
     
    23512287            fitted_data.symbol = "Line" 
    23522288            self.createTheoryIndex(fitted_data) 
     2289            # Switch to the theory tab for user's glee 
     2290            self.communicate.changeDataExplorerTabSignal.emit(1) 
    23532291 
    23542292    def updateModelIndex(self, fitted_data): 
     
    24862424 
    24872425        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)) 
    24882427            GuiUtils.deleteRedundantPlots(self.all_data[self.data_index], new_plots) 
     2428            pass 
    24892429        else: 
    24902430            # delete theory items for the model, in order to get rid of any redundant items, e.g. beta(Q), S_eff(Q) 
     
    25002440        for plot in new_plots: 
    25012441            self.communicate.plotUpdateSignal.emit([plot]) 
    2502  
    2503         # Update radius_effective if relevant 
    2504         def updateRadiusEffective(): 
    2505             ER_mode_row = self.getRowFromName("radius_effective_mode") 
    2506             if ER_mode_row is None: 
    2507                 return 
    2508             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                 return 
    2513             if ER_mode < 1: 
    2514                 # does not need updating if it is not being computed 
    2515                 return 
    2516  
    2517             ER_row = self.getRowFromName("radius_effective") 
    2518             if ER_row is None: 
    2519                 return 
    2520  
    2521             scalar_results = self.logic.getScalarIntermediateResults(return_data) 
    2522             ER_value = scalar_results.get("effective_radius") # note name of key 
    2523             if ER_value is None: 
    2524                 return 
    2525             # ensure the model does not recompute when updating the value 
    2526             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 immediately 
    2530             self._model_model.layoutChanged.emit() 
    2531  
    2532         updateRadiusEffective() 
    25332442 
    25342443    def complete2D(self, return_data): 
     
    32203129            param_value = str(self._model_model.item(row, 1).text()) 
    32213130            param_error = None 
     3131            param_min = None 
     3132            param_max = None 
    32223133            column_offset = 0 
    32233134            if self.has_error_column: 
    32243135                param_error = str(self._model_model.item(row, 2).text()) 
    32253136                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 
    32283144            param_list.append([param_name, param_checked, param_value, param_error, param_min, param_max]) 
    32293145 
     
    33153231 
    33163232                # 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 
    33213240 
    33223241                # Polydisp 
     
    33773296                ioffset = 1 
    33783297            # 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 
    33833306            self.setFocus() 
     3307 
    33843308 
    33853309 
Note: See TracChangeset for help on using the changeset viewer.