Changes in / [9f3db13:5123512] in sasview
- Location:
- src/sas
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py
rdee9e5f r3beadede 7 7 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \ 8 8 as FigureCanvas 9 from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT 9 10 from matplotlib.figure import Figure 10 11 from numpy.linalg.linalg import LinAlgError … … 35 36 self.data = None 36 37 self.extrap = None 38 self.setMinimumSize(300, 300) 37 39 38 40 def draw_q_space(self): … … 49 51 self.axes.set_xscale("log") 50 52 self.axes.set_yscale("log") 53 self.axes.set_xlabel("Q [$\AA^{-1}$]") 54 self.axes.set_ylabel("I(Q) [cm$^{-1}$]") 55 self.axes.set_title("Scattering data") 56 self.fig.tight_layout() 51 57 52 58 qmin = float(self.model.item(W.W_QMIN).text()) … … 55 61 56 62 if self.data: 57 self.axes.plot(self.data.x, self.data.y) 63 # self.axes.plot(self.data.x, self.data.y, label="Experimental Data") 64 self.axes.errorbar(self.data.x, self.data.y, yerr=self.data.dy, label="Experimental Data") 58 65 self.axes.axvline(qmin) 59 66 self.axes.axvline(qmax1) … … 61 68 self.axes.set_xlim(min(self.data.x) / 2, 62 69 max(self.data.x) * 1.5 - 0.5 * min(self.data.x)) 70 self.axes.set_ylim(min(self.data.y) / 2, 71 max(self.data.y) * 1.5 - 0.5 * min(self.data.y)) 72 63 73 if self.extrap: 64 self.axes.plot(self.extrap.x, self.extrap.y) 74 self.axes.plot(self.extrap.x, self.extrap.y, label="Extrapolation") 75 76 if self.data or self.extrap: 77 self.axes.legend() 65 78 66 79 self.draw() … … 78 91 self.axes.set_xscale("linear") 79 92 self.axes.set_yscale("linear") 93 self.axes.set_xlabel("Z [$\AA$]") 94 self.axes.set_ylabel("Correlation") 95 self.axes.set_title("Real Space Correlations") 96 self.fig.tight_layout() 80 97 81 98 if self.data: … … 85 102 self.axes.plot(data_idf.x, data_idf.y, 86 103 label="Interface Distribution Function") 87 self.axes.set_xlim( min(data1.x), max(data1.x) / 4)104 self.axes.set_xlim(0, max(data1.x) / 4) 88 105 self.axes.legend() 89 106 … … 115 132 116 133 self._canvas = MyMplCanvas(self.model) 117 self.mainVerticalLayout.insertWidget(0, self._canvas) 134 self.plotLayout.insertWidget(0, self._canvas) 135 self.plotLayout.insertWidget(1, NavigationToolbar2QT(self._canvas, self)) 136 self._realplot = MyMplCanvas(self.model) 137 self.plotLayout.insertWidget(2, self._realplot) 138 self.plotLayout.insertWidget(3, NavigationToolbar2QT(self._realplot, self)) 139 140 self.gridLayout_8.setColumnStretch(0, 1) 141 self.gridLayout_8.setColumnStretch(1, 3) 118 142 119 143 # Connect buttons to slots. … … 238 262 self.model.setItem(W.W_POLY, QtGui.QStandardItem("{:.3g}".format(params['A']))) 239 263 self.model.setItem(W.W_PERIOD, QtGui.QStandardItem("{:.3g}".format(params['max']))) 240 #self._realplot.data = transforms264 self._realplot.data = transforms 241 265 242 266 self.update_real_space_plot(transforms) 243 267 244 #self._realplot.draw_real_space()268 self._realplot.draw_real_space() 245 269 246 270 def update_real_space_plot(self, datas): … … 358 382 self.cmdTransform.setEnabled(False) 359 383 360 #self._realplot.data = None361 #self._realplot.draw_real_space()384 self._realplot.data = None 385 self._realplot.draw_real_space() 362 386 363 387 def setClosable(self, value=True): -
src/sas/qtgui/Perspectives/Corfunc/UI/CorfuncPanel.ui
rcb4d219 r85503bc 18 18 <layout class="QVBoxLayout" name="mainVerticalLayout"> 19 19 <item> 20 <spacer name="verticalSpacer">21 <property name="orientation">22 <enum>Qt::Vertical</enum>23 </property>24 <property name="sizeHint" stdset="0">25 <size>26 <width>20</width>27 <height>38</height>28 </size>29 </property>30 </spacer>31 </item>32 <item>33 20 <widget class="QGroupBox" name="groupBox"> 34 21 <property name="title"> … … 322 309 </item> 323 310 <item row="0" column="1"> 324 <widget class="QLineEdit" name="txtLongPeriod"/> 311 <widget class="QLineEdit" name="txtLongPeriod" width="50"> 312 <property name="minimumSize" stdset="0"> 313 <size> 314 <width>60</width> 315 <height>20</height> 316 </size> 317 </property> 318 </widget> 325 319 </item> 326 320 <item row="0" column="2"> … … 332 326 </item> 333 327 <item row="0" column="3"> 334 <widget class="QLineEdit" name="txtAvgIntThick"/> 328 <widget class="QLineEdit" name="txtAvgIntThick"> 329 <property name="minimumSize" stdset="0"> 330 <size> 331 <width>60</width> 332 <height>20</height> 333 </size> 334 </property> 335 </widget> 335 336 </item> 336 337 <item row="1" column="0"> … … 417 418 </layout> 418 419 </item> 420 <item> 421 <spacer name="verticalSpacer"> 422 <property name="orientation"> 423 <enum>Qt::Vertical</enum> 424 </property> 425 <property name="sizeHint" stdset="0"> 426 <size> 427 <width>20</width> 428 <height>38</height> 429 </size> 430 </property> 431 </spacer> 432 </item> 433 </layout> 434 </item> 435 <item row="0" column="1"> 436 <layout class="QVBoxLayout" name="plotLayout"> 419 437 </layout> 420 438 </item> -
src/sas/sascalc/corfunc/transform_thread.py
ra859f99 rf7e6b30 45 45 # gamma3(R) = 1/R int_{0}^{R} gamma1(x) dx 46 46 # trapz uses the trapezium rule to calculate the integral 47 mask = xs <= 200.0 # Only calculate gamma3 up to x=200 (as this is all that's plotted)48 47 # gamma3 = [trapz(gamma1[:n], xs[:n])/xs[n-1] for n in range(2, len(xs[mask]) + 1)]j 49 48 # gamma3.insert(0, 1.0) # Gamma_3(0) is defined as 1 50 n = len(xs [mask])49 n = len(xs) 51 50 gamma3 = cumtrapz(gamma1[:n], xs[:n])/xs[1:n] 52 51 gamma3 = np.hstack((1.0, gamma3)) # Gamma_3(0) is defined as 1 … … 79 78 80 79 transform1 = Data1D(xs, gamma1) 81 transform3 = Data1D(xs [xs <= 200], gamma3)80 transform3 = Data1D(xs, gamma3) 82 81 idf = Data1D(xs, idf) 83 82
Note: See TracChangeset
for help on using the changeset viewer.