Changeset be6f7af in sasview
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py
r7be7136 rbe6f7af 1 # pylint: disable=E1101 2 1 3 # global 2 4 from PyQt4 import QtCore … … 30 32 31 33 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 32 40 self.fig.clf() 33 41 … … 53 61 54 62 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.""" 55 69 self.fig.clf() 56 70 … … 71 85 72 86 class 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.""" 75 88 name = "Corfunc" # For displaying in the combo box 76 89 … … 81 94 self.setWindowTitle("Corfunc Perspective") 82 95 96 self.mapper = None 83 97 self.model = QtGui.QStandardItemModel(self) 84 98 self.communicate = GuiUtils.Communicate() 85 99 self._calculator = CorfuncCalculator() 100 self._allow_close = True 86 101 87 102 self._canvas = MyMplCanvas(self.model) … … 101 116 102 117 def setup_slots(self): 118 """Connect the buttons to their appropriate slots.""" 103 119 self.extrapolateBtn.clicked.connect(self.extrapolate) 104 120 self.transformBtn.clicked.connect(self.transform) 105 121 106 self.calculateBgBtn.clicked.connect(self.calculate Background)107 108 self.model.itemChanged.connect(self.model Changed)122 self.calculateBgBtn.clicked.connect(self.calculate_background) 123 124 self.model.itemChanged.connect(self.model_changed) 109 125 110 126 def setup_model(self): 127 """Populate the model with default data.""" 111 128 self.model.setItem(W.W_QMIN, 112 129 QtGui.QStandardItem("0.01")) … … 134 151 self.model.setItem(W.W_PERIOD, QtGui.QStandardItem(str(0))) 135 152 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 137 157 self.mapper.toFirst() 138 158 self._canvas.draw_q_space() … … 147 167 148 168 def extrapolate(self): 169 """Extend the experiemntal data with guinier and porod curves.""" 149 170 self._update_calculator() 150 171 params, extrapolation, _ = self._calculator.compute_extrapolation() … … 160 181 161 182 def transform(self): 183 """Calculate the real space version of the extrapolation.""" 162 184 if self.fourierBtn.isChecked(): 163 185 method = "fourier" … … 166 188 167 189 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) 172 195 173 196 def completefn(transforms): 197 """Extract the values from the transforms and plot""" 174 198 (trans1, trans3, idf) = transforms 175 199 self._realplot.data = trans1 … … 192 216 193 217 self._update_calculator() 194 self._calculator.compute_transform(extrap, method, b g,218 self._calculator.compute_transform(extrap, method, background, 195 219 completefn, updatefn) 196 220 197 221 def setup_mapper(self): 222 """Creating mapping between model and gui elements.""" 198 223 self.mapper = QtGui.QDataWidgetMapper(self) 199 224 self.mapper.setOrientation(QtCore.Qt.Vertical) … … 219 244 self.mapper.toFirst() 220 245 221 def calculateBackground(self): 246 def calculate_background(self): 247 """Find a good estimate of the background value.""" 222 248 self._update_calculator() 223 b g= self._calculator.compute_background()224 temp = QtGui.QStandardItem(str(b g))249 background = self._calculator.compute_background() 250 temp = QtGui.QStandardItem(str(background)) 225 251 self.model.setItem(W.W_BACKGROUND, temp) 226 252 … … 244 270 raise AttributeError(msg) 245 271 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) 248 274 self._calculator.set_data(data) 249 275
Note: See TracChangeset
for help on using the changeset viewer.