Changeset e900a47 in sasview


Ignore:
Timestamp:
Mar 28, 2019 6:22:55 AM (5 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_bumps_abstraction, ESS_GUI_opencl
Children:
b8bdbcc, aa47ea5
Parents:
770c42c
Message:

Fixed smearing control behaviour. SASVIEW-1212

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

Legend:

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

    rc149fba re900a47  
    28702870        self.createNewIndex(weighted_data) 
    28712871 
    2872         # Plot residuals if actual data 
    2873         if not self.data_is_loaded: 
    2874             return 
    2875  
    28762872        # Calculate difference between return_data and logic.data 
    28772873        self.chi2 = FittingUtilities.calculateChi2(weighted_data, self.data) 
     
    28792875        chi2_repr = "---" if self.chi2 is None else GuiUtils.formatNumber(self.chi2, high=True) 
    28802876        self.lblChi2Value.setText(chi2_repr) 
     2877 
     2878        # Plot residuals if actual data 
     2879        if not self.data_is_loaded: 
     2880            return 
    28812881 
    28822882        residuals_plot = FittingUtilities.plotResiduals(self.data, weighted_data) 
  • src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py

    ra5f7bf4 re900a47  
    6464        self.kernel_model = None 
    6565        # dQ data variables 
    66         smear_type = None 
    67         dq_l = None 
    68         dq_r = None 
     66        self.smear_type = None 
     67        self.dq_l = None 
     68        self.dq_r = None 
     69 
     70        # current pinhole/slot values 
     71        self.pinhole = 0.0 
     72        self.slit_height = 0.0 
     73        self.slit_width = 0.0 
     74 
    6975        # Let only floats in the line edits 
    7076        self.txtSmearDown.setValidator(GuiUtils.DoubleValidator()) 
     
    184190        # Recalculate the smearing 
    185191        index = self.cbSmearing.currentIndex() 
     192        ## update the backup values based on model choice 
     193        smearing, accuracy, d_down, d_up = self.state() 
     194        # don't save the state if dQ Data 
     195        if smearing == "Custom Pinhole Smear": 
     196            self.pinhole = d_down 
     197            self.accuracy = accuracy 
     198        elif smearing == 'Custom Slit Smear': 
     199            self.slit_height = d_up 
     200            self.slit_width = d_down 
     201 
    186202        self.onIndexChange(index) 
    187203 
     
    221237            self.lblSmearUp.setText('<html><head/><body><p>dQ/Q</p></body></html>') 
    222238            self.lblUnitUp.setText('%') 
     239        self.txtSmearUp.setText(str(self.pinhole)) 
     240 
    223241        self.txtSmearDown.setEnabled(True) 
    224242        self.txtSmearUp.setEnabled(True) 
     
    234252        self.lblUnitDown.setText('<html><head/><body><p>à
    235253<span style=" vertical-align:super;">-1</span></p></body></html>') 
     254        self.txtSmearDown.setText(str(self.slit_height)) 
     255        self.txtSmearUp.setText(str(self.slit_width)) 
    236256        self.txtSmearDown.setEnabled(True) 
    237257        self.txtSmearUp.setEnabled(True) 
     
    277297            accuracy = str(self.model.item(MODEL.index('ACCURACY')).text()) 
    278298            try: 
    279                 d_down = float(self.model.item(MODEL.index('PINHOLE_MIN')).text()) 
     299                d_down = float(self.txtSmearUp.text()) 
    280300            except ValueError: 
    281301                d_down = None 
    282302            try: 
    283                 d_up = float(self.model.item(MODEL.index('PINHOLE_MAX')).text()) 
     303                d_up = float(self.txtSmearDown.text()) 
    284304            except ValueError: 
    285305                d_up = None 
     
    292312        """ 
    293313        # Update the model -> controls update automatically 
    294         #if smearing is not None: 
    295             #self.model.item(MODEL.index('SMEARING')).setText(smearing) 
    296314        if accuracy is not None: 
    297315            self.model.item(MODEL.index('ACCURACY')).setText(accuracy) 
     
    347365        if d_height is None: 
    348366            d_height = 0.0 
     367 
     368        self.slit_width = d_width 
     369        self.slit_height = d_height 
    349370 
    350371        if isinstance(self.data, Data2D): 
Note: See TracChangeset for help on using the changeset viewer.