Changeset cadd595a in sasview for src/sas/qtgui
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py
r7b21c05 rcadd595a 25 25 class MyMplCanvas(FigureCanvas): 26 26 """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" 27 def __init__(self, parent=None, width=5, height=4, dpi=100): 27 def __init__(self, model, parent=None, width=5, height=4, dpi=100): 28 self.model = model 28 29 self.fig = Figure(figsize=(width, height), dpi=dpi) 29 30 self.axes = self.fig.add_subplot(111) … … 38 39 39 40 self.data = None 41 self.extrap = None 42 43 def drawQSpace(self): 44 self.fig.clf() 45 40 46 self.qmin = None 41 47 self.qmax1 = None 42 48 self.qmax2 = None 43 self.extrap = None44 45 def drawQSpace(self):46 self.fig.clf()47 49 48 50 self.axes = self.fig.add_subplot(111) … … 50 52 self.axes.set_yscale("log") 51 53 54 qmin = float(self.model.item(W.W_QMIN).text()) 55 qmax1 = float(self.model.item(W.W_QMAX).text()) 56 qmax2 = float(self.model.item(W.W_QCUTOFF).text()) 57 52 58 if self.data: 53 59 self.axes.plot(self.data.x, self.data.y) 54 if self.qmin: 55 self.axes.axvline(self.qmin) 56 if self.qmax1: 57 self.axes.axvline(self.qmax1) 58 if self.qmax2: 59 self.axes.axvline(self.qmax2) 60 self.axes.axvline(qmin) 61 self.axes.axvline(qmax1) 62 self.axes.axvline(qmax2) 63 self.axes.set_xlim(min(self.data.x), max(self.data.x)*1.5-0.5*min(self.data.x)) 60 64 if self.extrap: 61 65 self.axes.plot(self.extrap.x, self.extrap.y) … … 72 76 if self.data: 73 77 self.axes.plot(self.data.x, self.data.y) 78 self.axes.set_xlim(min(self.data.x), max(self.data.x)/4) 74 79 75 80 self.draw() … … 99 104 self._calculator = CorfuncCalculator() 100 105 101 self._canvas = MyMplCanvas(self )102 self._realplot = MyMplCanvas(self )106 self._canvas = MyMplCanvas(self.model, self) 107 self._realplot = MyMplCanvas(self.model, self) 103 108 self.verticalLayout_7.insertWidget(0, self._canvas) 104 109 self.verticalLayout_7.insertWidget(1, self._realplot) … … 160 165 print("{} Changed".format(item)) 161 166 162 self._update_calculator()163 167 self.mapper.toFirst() 164 168 self._canvas.drawQSpace() … … 172 176 173 177 def extrapolate(self): 178 self._update_calculator() 174 179 params, extrapolation = self._calculator.compute_extrapolation() 175 180 … … 205 210 self.model.setItem(W.W_PERIOD, QtGui.QStandardItem(str(params['max']))) 206 211 212 self._update_calculator() 207 213 self._calculator.compute_transform(extrap, method, bg, completefn, updatefn) 208 214 … … 233 239 234 240 def calculateBackground(self): 241 self._update_calculator() 235 242 bg = self._calculator.compute_background() 236 243 temp = QtGui.QStandardItem(str(bg))
Note: See TracChangeset
for help on using the changeset viewer.