Changeset 80a327d in sasview for src


Ignore:
Timestamp:
Sep 24, 2018 1:14:38 PM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
d99b1a5
Parents:
adf1c2a
Message:

move updateRadiusEffective to class method

File:
1 edited

Legend:

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

    radf1c2a r80a327d  
    25942594 
    25952595        # 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() 
     2596        self.updateRadiusEffective(return_data) 
    26252597 
    26262598    def complete2D(self, return_data): 
     
    26412613        for plot in new_plots: 
    26422614            self.communicate.plotUpdateSignal.emit([plot]) 
     2615 
     2616    def updateRadiusEffective(self, return_data): 
     2617        """ 
     2618        Given return data from sasmodels, update the effective radius parameter in the GUI table with the new 
     2619        calculated value as returned by sasmodels (if the value was returned). 
     2620        """ 
     2621        ER_mode_row = self.getRowFromName("radius_effective_mode") 
     2622        if ER_mode_row is None: 
     2623            return 
     2624        try: 
     2625            ER_mode = int(self._model_model.item(ER_mode_row, 1).text()) 
     2626        except ValueError: 
     2627            logging.error("radius_effective_mode was set to an invalid value.") 
     2628            return 
     2629        if ER_mode < 1: 
     2630            # does not need updating if it is not being computed 
     2631            return 
     2632 
     2633        ER_row = self.getRowFromName("radius_effective") 
     2634        if ER_row is None: 
     2635            return 
     2636 
     2637        scalar_results = self.logic.getScalarIntermediateResults(return_data) 
     2638        ER_value = scalar_results.get("effective_radius") # note name of key 
     2639        if ER_value is None: 
     2640            return 
     2641        # ensure the model does not recompute when updating the value 
     2642        self._model_model.blockSignals(True) 
     2643        self._model_model.item(ER_row, 1).setText(str(ER_value)) 
     2644        self._model_model.blockSignals(False) 
     2645        # ensure the view is updated immediately 
     2646        self._model_model.layoutChanged.emit() 
    26432647 
    26442648    def calculateResiduals(self, fitted_data): 
Note: See TracChangeset for help on using the changeset viewer.