Changeset be6f7af in sasview for src


Ignore:
Timestamp:
Oct 25, 2017 4:50:50 AM (7 years ago)
Author:
Adam Washington <adam.washington@…>
Children:
a3c4217
Parents:
7be7136
Message:

Remove a bunch of pylint

File:
1 edited

Legend:

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

    r7be7136 rbe6f7af  
     1# pylint: disable=E1101 
     2 
    13# global 
    24from PyQt4 import QtCore 
     
    3032 
    3133    def draw_q_space(self): 
     34        """Draw the Q space data in the plot window 
     35 
     36        This draws the q space data in self.data, as well 
     37        as the bounds set by self.qmin, self.qmax1, and self.qmax2. 
     38        It will also plot the extrpolation in self.extrap, if it exists.""" 
     39 
    3240        self.fig.clf() 
    3341 
     
    5361 
    5462    def draw_real_space(self): 
     63        """ 
     64        This function draws the real space data onto the plot 
     65 
     66        The 1d correlation function in self.data, the 3d correlation function 
     67        in self.data3, and the interface distribution function in self.data_idf 
     68        are all draw in on the plot in linear cooredinates.""" 
    5569        self.fig.clf() 
    5670 
     
    7185 
    7286class CorfuncWindow(QtGui.QDialog, Ui_CorfuncDialog): 
    73     # The controller which is responsible for managing signal slots connections 
    74     # for the gui and providing an interface to the data model. 
     87    """Displays the correlation function analysis of sas data.""" 
    7588    name = "Corfunc"  # For displaying in the combo box 
    7689 
     
    8194        self.setWindowTitle("Corfunc Perspective") 
    8295 
     96        self.mapper = None 
    8397        self.model = QtGui.QStandardItemModel(self) 
    8498        self.communicate = GuiUtils.Communicate() 
    8599        self._calculator = CorfuncCalculator() 
     100        self._allow_close = True 
    86101 
    87102        self._canvas = MyMplCanvas(self.model) 
     
    101116 
    102117    def setup_slots(self): 
     118        """Connect the buttons to their appropriate slots.""" 
    103119        self.extrapolateBtn.clicked.connect(self.extrapolate) 
    104120        self.transformBtn.clicked.connect(self.transform) 
    105121 
    106         self.calculateBgBtn.clicked.connect(self.calculateBackground) 
    107  
    108         self.model.itemChanged.connect(self.modelChanged) 
     122        self.calculateBgBtn.clicked.connect(self.calculate_background) 
     123 
     124        self.model.itemChanged.connect(self.model_changed) 
    109125 
    110126    def setup_model(self): 
     127        """Populate the model with default data.""" 
    111128        self.model.setItem(W.W_QMIN, 
    112129                           QtGui.QStandardItem("0.01")) 
     
    134151        self.model.setItem(W.W_PERIOD, QtGui.QStandardItem(str(0))) 
    135152 
    136     def modelChanged(self, item): 
     153    def model_changed(self, _): 
     154        """Actions to perform when the data is updated""" 
     155        if not self.mapper: 
     156            return 
    137157        self.mapper.toFirst() 
    138158        self._canvas.draw_q_space() 
     
    147167 
    148168    def extrapolate(self): 
     169        """Extend the experiemntal data with guinier and porod curves.""" 
    149170        self._update_calculator() 
    150171        params, extrapolation, _ = self._calculator.compute_extrapolation() 
     
    160181 
    161182    def transform(self): 
     183        """Calculate the real space version of the extrapolation.""" 
    162184        if self.fourierBtn.isChecked(): 
    163185            method = "fourier" 
     
    166188 
    167189        extrap = self._canvas.extrap 
    168         bg = float(self.model.item(W.W_BACKGROUND).text()) 
    169  
    170         def updatefn(*args, **kwargs): 
    171             pass 
     190        background = float(self.model.item(W.W_BACKGROUND).text()) 
     191 
     192        def updatefn(msg): 
     193            """Report progress of transformation.""" 
     194            self.communicate.statusBarUpdateSignal.emit(msg) 
    172195 
    173196        def completefn(transforms): 
     197            """Extract the values from the transforms and plot""" 
    174198            (trans1, trans3, idf) = transforms 
    175199            self._realplot.data = trans1 
     
    192216 
    193217        self._update_calculator() 
    194         self._calculator.compute_transform(extrap, method, bg, 
     218        self._calculator.compute_transform(extrap, method, background, 
    195219                                           completefn, updatefn) 
    196220 
    197221    def setup_mapper(self): 
     222        """Creating mapping between model and gui elements.""" 
    198223        self.mapper = QtGui.QDataWidgetMapper(self) 
    199224        self.mapper.setOrientation(QtCore.Qt.Vertical) 
     
    219244        self.mapper.toFirst() 
    220245 
    221     def calculateBackground(self): 
     246    def calculate_background(self): 
     247        """Find a good estimate of the background value.""" 
    222248        self._update_calculator() 
    223         bg = self._calculator.compute_background() 
    224         temp = QtGui.QStandardItem(str(bg)) 
     249        background = self._calculator.compute_background() 
     250        temp = QtGui.QStandardItem(str(background)) 
    225251        self.model.setItem(W.W_BACKGROUND, temp) 
    226252 
     
    244270            raise AttributeError(msg) 
    245271 
    246         self._model_item = data_item[0] 
    247         data = GuiUtils.dataFromItem(self._model_item) 
     272        model_item = data_item[0] 
     273        data = GuiUtils.dataFromItem(model_item) 
    248274        self._calculator.set_data(data) 
    249275 
Note: See TracChangeset for help on using the changeset viewer.