Changes in / [adf1c2a:dad086f] in sasview


Ignore:
Location:
src/sas/qtgui/Perspectives/Fitting
Files:
2 edited

Legend:

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

    ra54bbf2b ra54bbf2b  
    223223        return plots 
    224224 
    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                 continue 
    233             res[name] = int_res 
    234         return res 
    235  
    236225    def computeDataRange(self): 
    237226        """ 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    rd8d81ea rd8d81ea  
    22962296        # TODO: multishell params in self.kernel_module.details[??] = value 
    22972297 
    2298         # handle display of effective radius parameter according to radius_effective_mode; pass ER into model if 
    2299         # necessary 
    2300         self.processEffectiveRadius() 
    2301  
    23022298        # Force the chart update when actual parameters changed 
    23032299        if model_column == 1: 
     
    23062302        # Update state stack 
    23072303        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 be 
    2316         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             return 
    2321  
    2322         ER_mode_row = self.getRowFromName("radius_effective_mode") 
    2323         if ER_mode_row is None: 
    2324             return 
    2325  
    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             return 
    2331  
    2332         if ER_mode == 0: 
    2333             # ensure the ER value can be modified by user 
    2334             self.setParamEditableByRow(ER_row, True) 
    2335         elif ER_mode > 0: 
    2336             # ensure the ER value cannot be modified by user 
    2337             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 font 
    2353             item_name.setFont(QtGui.QFont()) 
    2354             # reset colour 
    2355             item_name.setForeground(QtGui.QBrush()) 
    2356             # make checkable 
    2357             item_name.setCheckable(True) 
    2358         else: 
    2359             # change font 
    2360             font = QtGui.QFont() 
    2361             font.setItalic(True) 
    2362             item_name.setFont(font) 
    2363             # change colour 
    2364             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) 
    23682304 
    23692305    def isCheckable(self, row): 
     
    25932529            self.communicate.plotUpdateSignal.emit([plot]) 
    25942530 
    2595         # Update radius_effective if relevant 
    2596         def updateRadiusEffective(): 
    2597             ER_mode_row = self.getRowFromName("radius_effective_mode") 
    2598             if ER_mode_row is None: 
    2599                 return 
    2600             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                 return 
    2605             if ER_mode < 1: 
    2606                 # does not need updating if it is not being computed 
    2607                 return 
    2608  
    2609             ER_row = self.getRowFromName("radius_effective") 
    2610             if ER_row is None: 
    2611                 return 
    2612  
    2613             scalar_results = self.logic.getScalarIntermediateResults(return_data) 
    2614             ER_value = scalar_results.get("effective_radius") # note name of key 
    2615             if ER_value is None: 
    2616                 return 
    2617             # ensure the model does not recompute when updating the value 
    2618             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 immediately 
    2622             self._model_model.layoutChanged.emit() 
    2623  
    2624         updateRadiusEffective() 
    2625  
    26262531    def complete2D(self, return_data): 
    26272532        """ 
Note: See TracChangeset for help on using the changeset viewer.