Changeset 9d266d2 in sasview


Ignore:
Timestamp:
Apr 19, 2017 7:07:46 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
e1e3e09
Parents:
cd2cc745
Message:

Added data weighting prototype

Location:
src/sas/qtgui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/GuiManager.py

    r83eb5208 r9d266d2  
    5252        self._workspace = parent 
    5353        self._parent = parent 
    54  
    55         # Reactor - singleton 
    56         self.setReactor(reactor) 
    5754 
    5855        # Add signal callbacks 
     
    162159        self.progress.setVisible(False) 
    163160 
    164     def fileRead(self, data): 
     161    def fileWasRead(self, data): 
    165162        """ 
    166163        Callback for fileDataReceivedSignal 
     
    208205        """ Accessor for the communicator """ 
    209206        return self.communicate 
    210  
    211     def reactor(self): 
    212         """ Accessor for the reactor """ 
    213         return self._reactor 
    214  
    215     def setReactor(self, reactor): 
    216         """ Reactor setter """ 
    217         self._reactor = reactor 
    218207 
    219208    def perspective(self): 
     
    338327        """ 
    339328        self.communicate = GuiUtils.Communicate() 
    340         self.communicate.fileDataReceivedSignal.connect(self.fileRead) 
     329        self.communicate.fileDataReceivedSignal.connect(self.fileWasRead) 
    341330        self.communicate.statusBarUpdateSignal.connect(self.updateStatusBar) 
    342331        self.communicate.updatePerspectiveWithDataSignal.connect(self.updatePerspective) 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r83eb5208 r9d266d2  
    2525from sas.sasgui.perspectives.fitting.model_thread import Calc1D 
    2626from sas.sasgui.perspectives.fitting.model_thread import Calc2D 
     27from sas.sasgui.perspectives.fitting.utils import get_weight 
    2728 
    2829from UI.FittingWidgetUI import Ui_FittingWidgetUI 
     
    6768        # Parameters to fit 
    6869        self.parameters_to_fit = None 
     70        # Weight radio box group 
     71        self.weightingGroup = QtGui.QButtonGroup() 
    6972 
    7073        # Which tab is this widget displayed in? 
     
    231234        self.tabFitting.setTabEnabled(TAB_MAGNETISM, False) 
    232235        self.lblChi2Value.setText("---") 
    233         # group boxes 
     236        # Group boxes 
    234237        self.boxWeighting.setEnabled(False) 
    235238        self.cmdMaskEdit.setEnabled(False) 
     239        # Button groups 
     240        self.weightingGroup.addButton(self.rbWeighting1) 
     241        self.weightingGroup.addButton(self.rbWeighting2) 
     242        self.weightingGroup.addButton(self.rbWeighting3) 
     243        self.weightingGroup.addButton(self.rbWeighting4) 
    236244 
    237245    def initializeSignals(self): 
     
    260268        self.txtSmearUp.editingFinished.connect(self.onSmearUp) 
    261269        self.txtSmearDown.editingFinished.connect(self.onSmearDown) 
     270        # Button groups 
     271        self.weightingGroup.buttonClicked.connect(self.onWeightingChoice) 
    262272 
    263273        # Respond to change in parameters from the UI 
     
    353363        """ 
    354364        pass 
     365 
     366    def onWeightingChoice(self, button): 
     367        """ 
     368        Update weighting in the fit state 
     369        """ 
     370        button_id = button.group().checkedId() 
     371        button_id = abs(button_id + 2) 
     372        #self.fitPage.weighting = button_id 
     373        print button_id 
    355374 
    356375    def onPolyModelChange(self, item): 
     
    401420        params_to_fit = self.parameters_to_fit 
    402421 
     422        # Potential weights added 
     423        self.addWeightingToData(data) 
     424 
    403425        # These should be updating somehow? 
    404426        fit_id = 0 
     
    688710        checked_list = ['scale', '1.0', '0.0', 'inf', ''] 
    689711        FittingUtilities.addCheckedListToModel(model, checked_list) 
     712 
     713    def addWeightingToData(self, data): 
     714        """ 
     715        Adds weighting contribution to fitting data 
     716        """ 
     717        # Check the state of the Weighting radio buttons 
     718        button_id = self.weightingGroup.checkedId() 
     719        button_id = abs(button_id + 2) 
     720        if button_id == 0: 
     721            return 
     722        # Send original data for weighting 
     723        weight = get_weight(data=data, is2d=self.is2D, flag=button_id) 
     724        if self.is2D: 
     725            data.err_data = weight 
     726        else: 
     727            data.dy = weight 
    690728 
    691729    def updateQRange(self): 
  • src/sas/qtgui/Perspectives/Fitting/UI/FittingWidgetUI.ui

    r6c8fb2c r9d266d2  
    511511           <layout class="QVBoxLayout" name="verticalLayout"> 
    512512            <item> 
    513              <widget class="QRadioButton" name="radioButton"> 
     513             <widget class="QRadioButton" name="rbWeighting1"> 
    514514              <property name="text"> 
    515515               <string>None</string> 
     
    521521            </item> 
    522522            <item> 
    523              <widget class="QRadioButton" name="radioButton_2"> 
     523             <widget class="QRadioButton" name="rbWeighting2"> 
    524524              <property name="text"> 
    525525               <string>Use dI Data</string> 
     
    528528            </item> 
    529529            <item> 
    530              <widget class="QRadioButton" name="radioButton_3"> 
     530             <widget class="QRadioButton" name="rbWeighting3"> 
    531531              <property name="text"> 
    532532               <string>Use |sqrt(I Data)|</string> 
     
    535535            </item> 
    536536            <item> 
    537              <widget class="QRadioButton" name="radioButton_4"> 
     537             <widget class="QRadioButton" name="rbWeighting4"> 
    538538              <property name="text"> 
    539539               <string>Use |I Data|</string> 
Note: See TracChangeset for help on using the changeset viewer.