Ignore:
Timestamp:
Oct 24, 2017 5:54:06 AM (7 years ago)
Author:
Adam Washington <adam.washington@…>
Children:
7b536da
Parents:
59183b7
git-author:
Adam Washington <adam.washington@…> (10/24/17 05:48:52)
git-committer:
Adam Washington <adam.washington@…> (10/24/17 05:54:06)
Message:

Start calculating results from the model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py

    r59183b7 rb2c8aef  
    1111from sas.qtgui.Plotting.PlotterData import Data1D 
    1212import sas.qtgui.Utilities.GuiUtils as GuiUtils 
     13from sas.sascalc.corfunc.corfunc_calculator import CorfuncCalculator 
    1314 
    1415# local 
     
    3233        self.model = QtGui.QStandardItemModel(self) 
    3334        self.communicate = GuiUtils.Communicate() 
     35        self._calculator = CorfuncCalculator() 
    3436 
    3537        # Connect buttons to slots. 
     
    4850        self.transformBtn.clicked.connect(self.action) 
    4951 
     52        self.calculateBgBtn.clicked.connect(self.calculateBackground) 
     53 
    5054        self.hilbertBtn.clicked.connect(self.action) 
    5155        self.fourierBtn.clicked.connect(self.action) 
     56 
     57        self.model.itemChanged.connect(self.modelChanged) 
    5258 
    5359    def setupModel(self): 
     
    6369                           QtGui.QStandardItem("Fourier")) 
    6470 
     71    def modelChanged(self, item): 
     72        if item.row() == W.W_QMIN: 
     73            value = float(self.model.item(W.W_QMIN).text()) 
     74            self.qMin.setValue(value) 
     75            self._calculator.lowerq = value 
     76        elif item.row() == W.W_QMAX: 
     77            value = float(self.model.item(W.W_QMAX).text()) 
     78            self.qMax1.setValue(value) 
     79            self._calculator.upperq = (value, self._calculator.upperq[1]) 
     80        elif item.row() == W.W_QCUTOFF: 
     81            value = float(self.model.item(W.W_QCUTOFF).text()) 
     82            self.qMax2.setValue(value) 
     83            self._calculator.upperq = (self._calculator.upperq[0], value) 
     84        elif item.row() == W.W_BACKGROUND: 
     85            value = float(self.model.item(W.W_BACKGROUND).text()) 
     86            self.bg.setValue(float(value)) 
     87        else: 
     88            print("{} Changed".format(item)) 
     89 
     90 
    6591    def setupMapper(self): 
    6692        self.mapper = QtGui.QDataWidgetMapper(self) 
     
    75101        self.mapper.toFirst() 
    76102 
     103    def calculateBackground(self): 
     104        bg = self._calculator.compute_background() 
     105        print(bg) 
     106        self.model.setItem(W.W_BACKGROUND, QtGui.QStandardItem(str(bg))) 
    77107 
    78108    def action(self): 
     
    102132        self._model_item = data_item[0] 
    103133        data = GuiUtils.dataFromItem(self._model_item) 
     134        self._calculator.lowerq = 1e-3 
     135        self._calculator.upperq = (2e-1, 3e-1) 
     136        self._calculator.set_data(data) 
    104137 
    105138        # self.model.item(WIDGETS.W_FILENAME).setData(QtCoreQVariant(self._model_item.text())) 
Note: See TracChangeset for help on using the changeset viewer.