Changeset b2c8aef in sasview


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

Location:
src/sas/qtgui/Perspectives/Corfunc
Files:
2 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())) 
  • src/sas/qtgui/Perspectives/Corfunc/UI/CorfuncPanel.ui

    r6d96bf9 rb2c8aef  
    3838         <string>Values with q &lt; qmin will be used for Guinier back extrapolation</string> 
    3939        </property> 
     40        <property name="decimals"> 
     41         <number>4</number> 
     42        </property> 
     43        <property name="singleStep"> 
     44         <double>0.001000000000000</double> 
     45        </property> 
    4046       </widget> 
    4147      </item> 
     
    5258         <string>Values with Uppder &lt; q &lt; Cutoff will be used for Porod forward extrapolation</string> 
    5359        </property> 
     60        <property name="decimals"> 
     61         <number>4</number> 
     62        </property> 
     63        <property name="singleStep"> 
     64         <double>0.001000000000000</double> 
     65        </property> 
    5466       </widget> 
    5567      </item> 
     
    6577        <property name="toolTip"> 
    6678         <string>Values with Uppder &lt; q &lt; Cutoff will be used for Porod forward extrapolation</string> 
     79        </property> 
     80        <property name="decimals"> 
     81         <number>4</number> 
     82        </property> 
     83        <property name="singleStep"> 
     84         <double>0.001000000000000</double> 
    6785        </property> 
    6886       </widget> 
     
    82100   <property name="geometry"> 
    83101    <rect> 
    84      <x>410</x> 
    85      <y>220</y> 
     102     <x>120</x> 
     103     <y>130</y> 
    86104     <width>160</width> 
    87105     <height>80</height> 
     
    222240         <bool>true</bool> 
    223241        </property> 
    224        </widget> 
    225       </item> 
    226       <item> 
    227        <widget class="QPushButton" name="calculateBackground"> 
     242        <property name="decimals"> 
     243         <number>4</number> 
     244        </property> 
     245       </widget> 
     246      </item> 
     247      <item> 
     248       <widget class="QPushButton" name="calculateBgBtn"> 
    228249        <property name="text"> 
    229250         <string>Calculate Background</string> 
     
    255276     <layout class="QHBoxLayout" name="horizontalLayout"> 
    256277      <item> 
     278       <widget class="QPushButton" name="extrapolateBtn"> 
     279        <property name="text"> 
     280         <string>Extrapolate</string> 
     281        </property> 
     282       </widget> 
     283      </item> 
     284      <item> 
     285       <widget class="QPushButton" name="transformBtn"> 
     286        <property name="text"> 
     287         <string>Transform</string> 
     288        </property> 
     289       </widget> 
     290      </item> 
     291      <item> 
    257292       <widget class="QPushButton" name="extractBtn"> 
    258293        <property name="text"> 
    259294         <string>Extract</string> 
    260         </property> 
    261        </widget> 
    262       </item> 
    263       <item> 
    264        <widget class="QPushButton" name="transformBtn"> 
    265         <property name="text"> 
    266          <string>Transform</string> 
    267         </property> 
    268        </widget> 
    269       </item> 
    270       <item> 
    271        <widget class="QPushButton" name="extrapolateBtn"> 
    272         <property name="text"> 
    273          <string>Extrapolate</string> 
    274295        </property> 
    275296       </widget> 
Note: See TracChangeset for help on using the changeset viewer.