- Timestamp:
- Mar 26, 2019 9:44:01 AM (5 years ago)
- Branches:
- ESS_GUI, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl
- Children:
- 3beadede
- Parents:
- f7e6b30 (diff), 60e20d8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
r33c0561 r14e1ff0 128 128 self.is_chain_fitting = False 129 129 130 # Is the fit job running? 131 self.is_running = False 132 self.calc_fit = None 133 130 134 # Remember previous content of modified cell 131 135 self.current_cell = "" … … 257 261 Perform the constrained/simultaneous fit 258 262 """ 263 # Stop if we're running 264 if self.is_running: 265 self.is_running = False 266 #re-enable the Fit button 267 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 268 self.cmdFit.setText("Fit") 269 # stop the fitpages 270 self.calc_fit.stop() 271 return 272 259 273 # Find out all tabs to fit 260 274 tabs_to_fit = self.getTabsForFit() … … 310 324 311 325 # new fit thread object 312 calc_fit = FitThread(handler=handler,326 self.calc_fit = FitThread(handler=handler, 313 327 fn=sim_fitter_list, 314 328 batch_inputs=batch_inputs, … … 321 335 if LocalConfig.USING_TWISTED: 322 336 # start the trhrhread with twisted 323 calc_thread = threads.deferToThread(calc_fit.compute)324 calc_thread.addCallback(completefn)325 calc_thread.addErrback(self.onFitFailed)337 self.calc_fit = threads.deferToThread(self.calc_fit.compute) 338 self.calc_fit.addCallback(completefn) 339 self.calc_fit.addErrback(self.onFitFailed) 326 340 else: 327 341 # Use the old python threads + Queue 328 calc_fit.queue() 329 calc_fit.ready(2.5) 330 331 332 #disable the Fit button 342 self.calc_fit.queue() 343 self.calc_fit.ready(2.5) 344 345 # modify the Fit button 333 346 self.cmdFit.setStyleSheet('QPushButton {color: red;}') 334 self.cmdFit.setText(' Running...')347 self.cmdFit.setText('Stop fit') 335 348 self.parent.communicate.statusBarUpdateSignal.emit('Fitting started...') 336 self. cmdFit.setEnabled(False)349 self.is_running = True 337 350 338 351 def onHelp(self): … … 457 470 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 458 471 self.cmdFit.setText("Fit") 459 self.cmdFit.setEnabled(True)460 472 461 473 # Notify the parent about completed fitting … … 503 515 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 504 516 self.cmdFit.setText("Fit") 505 self.cmdFit.setEnabled(True)506 517 507 518 # Notify the parent about completed fitting … … 538 549 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 539 550 self.cmdFit.setText("Fit") 540 self.cmdFit.setEnabled(True)541 551 542 552 # Notify the parent about completed fitting … … 958 968 if isBatch: 959 969 self.chkChain.setChecked(is_chain) 970 971 def getReport(self): 972 """ 973 Wrapper for non-existent functionality. 974 Tell the user to use the reporting tool 975 on separate fit pages. 976 """ 977 msg = "Please use Report Results directly on fit pages" 978 msg += " involved in the Constrained and Simultaneous fitting process." 979 msgbox = QtWidgets.QMessageBox(self) 980 msgbox.setIcon(QtWidgets.QMessageBox.Warning) 981 msgbox.setText(msg) 982 msgbox.setWindowTitle("Fit Report") 983 _ = msgbox.exec_() 984 return -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
rfb39f28 r14e1ff0 406 406 tab_object.enableInteractiveElements() 407 407 408 pass409 410 408 def getCurrentStateAsXml(self): 411 409 """ -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
rcf9f39e rb38c8c8 729 729 output_string = "sasview_parameter_values:" 730 730 for parameter in parameters: 731 # recast tuples into strings 732 parameter = [str(p) for p in parameter] 731 733 output_string += ",".join([p for p in parameter if p is not None]) 732 734 output_string += ":" -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r1d6899f rd4c9242 522 522 self.cmdFit.setEnabled(False) 523 523 self.cmdPlot.setEnabled(False) 524 self.options_widget.cmdComputePoints.setVisible(False) # probably redundant525 524 self.chkPolydispersity.setEnabled(True) 526 525 self.chkPolydispersity.setCheckState(False) … … 2863 2862 self.createNewIndex(weighted_data) 2864 2863 2864 # Plot residuals if actual data 2865 if not self.data_is_loaded: 2866 return 2867 2865 2868 # Calculate difference between return_data and logic.data 2866 2869 self.chi2 = FittingUtilities.calculateChi2(weighted_data, self.data) … … 2868 2871 chi2_repr = "---" if self.chi2 is None else GuiUtils.formatNumber(self.chi2, high=True) 2869 2872 self.lblChi2Value.setText(chi2_repr) 2870 2871 # Plot residuals if actual data2872 if not self.data_is_loaded:2873 return2874 2873 2875 2874 residuals_plot = FittingUtilities.plotResiduals(self.data, weighted_data) -
src/sas/qtgui/Perspectives/Fitting/OptionsWidget.py
rb764ae5 r17e6a2b 88 88 self.model.blockSignals(True) 89 89 self.updateQRange(self.qmin, self.qmax, self.npts) 90 self.txtMaxRange.setText( str(self.qmax))91 self.txtMinRange.setText( str(self.qmin))90 self.txtMaxRange.setText(GuiUtils.formatNumber(self.qmax, high=True)) 91 self.txtMinRange.setText(GuiUtils.formatNumber(self.qmin, high=True)) 92 92 self.txtNpts.setText(str(self.npts)) 93 93 self.txtNptsFit.setText(str(self.npts)) … … 181 181 Update the local model based on calculated values 182 182 """ 183 self.model.item(MODEL.index('MIN_RANGE')).setText(str(q_range_min)) 184 self.model.item(MODEL.index('MAX_RANGE')).setText(str(q_range_max)) 183 qmax = GuiUtils.formatNumber(self.qmax, high=True) 184 qmin = GuiUtils.formatNumber(self.qmin, high=True) 185 self.model.item(MODEL.index('MIN_RANGE')).setText(qmin) 186 self.model.item(MODEL.index('MAX_RANGE')).setText(qmax) 185 187 self.model.item(MODEL.index('NPTS')).setText(str(npts)) 186 188 self.qmin, self.qmax, self.npts = q_range_min, q_range_max, npts -
src/sas/qtgui/Perspectives/Fitting/UI/OptionsWidgetUI.ui
r309fa1b r17e6a2b 122 122 <item row="0" column="0"> 123 123 <layout class="QGridLayout" name="gridLayout_15"> 124 <item row="0" column="0">125 <widget class="QLabel" name="label_21">126 <property name="text">127 <string>Npts</string>128 </property>129 </widget>130 </item>131 <item row="0" column="1">132 <widget class="QLineEdit" name="txtNpts">133 <property name="toolTip">134 <string><html><head/><body><p>Total number of data points.</p></body></html></string>135 </property>136 </widget>137 </item>138 <item row="0" column="2">139 <widget class="QCheckBox" name="chkLogData">140 <property name="toolTip">141 <string><html><head/><body><p>Check to use log spaced points.</p></body></html></string>142 </property>143 <property name="text">144 <string>Log spaced points</string>145 </property>146 </widget>147 </item>148 <item row="1" column="0">149 <widget class="QLabel" name="label_22">150 <property name="text">151 <string>Npts(Fit)</string>152 </property>153 </widget>154 </item>155 <item row="1" column="1">156 <widget class="QLineEdit" name="txtNptsFit">157 <property name="toolTip">158 <string><html><head/><body><p>Number of points selected for fitting.</p></body></html></string>159 </property>160 <property name="readOnly">161 <bool>true</bool>162 </property>163 </widget>164 </item>165 <item row="2" column="0">166 <widget class="QLabel" name="label_24">167 <property name="text">168 <string><html><head/><body><p>Ï<span style=" vertical-align:super;">2</span>/Npts</p></body></html></string>169 </property>170 </widget>171 </item>172 <item row="2" column="1">173 <widget class="QLineEdit" name="txtChi2">174 <property name="readOnly">175 <bool>true</bool>176 </property>177 </widget>178 </item>179 <item row="2" column="3">180 <widget class="QPushButton" name="cmdComputePoints">181 <property name="text">182 <string>Compute</string>183 </property>184 </widget>185 </item>186 124 <item row="1" column="2"> 187 125 <spacer name="horizontalSpacer_9"> … … 197 135 </spacer> 198 136 </item> 137 <item row="0" column="1"> 138 <widget class="QLineEdit" name="txtNpts"> 139 <property name="toolTip"> 140 <string><html><head/><body><p>Total number of data points.</p></body></html></string> 141 </property> 142 </widget> 143 </item> 144 <item row="1" column="0"> 145 <widget class="QLabel" name="label_22"> 146 <property name="text"> 147 <string>Npts(Fit)</string> 148 </property> 149 </widget> 150 </item> 151 <item row="1" column="1"> 152 <widget class="QLineEdit" name="txtNptsFit"> 153 <property name="toolTip"> 154 <string><html><head/><body><p>Number of points selected for fitting.</p></body></html></string> 155 </property> 156 <property name="readOnly"> 157 <bool>true</bool> 158 </property> 159 </widget> 160 </item> 161 <item row="0" column="2"> 162 <widget class="QCheckBox" name="chkLogData"> 163 <property name="toolTip"> 164 <string><html><head/><body><p>Check to use log spaced points.</p></body></html></string> 165 </property> 166 <property name="text"> 167 <string>Log spaced points</string> 168 </property> 169 </widget> 170 </item> 171 <item row="0" column="0"> 172 <widget class="QLabel" name="label_21"> 173 <property name="text"> 174 <string>Npts</string> 175 </property> 176 </widget> 177 </item> 199 178 </layout> 200 179 </item> -
src/sas/qtgui/Plotting/Plotter.py
rd9e7792 r4c11b2a 420 420 This effectlvely refreshes the chart with changes to one of its plots 421 421 """ 422 423 # Pull the current transform settings from the old plot 424 selected_plot = self.plot_dict[id] 425 new_plot.xtransform = selected_plot.xtransform 426 new_plot.ytransform = selected_plot.ytransform 427 422 428 self.removePlot(id) 423 429 self.plot(data=new_plot) -
src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py
rdee9e5f rf7e6b30 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.fig.tight_layout() 51 56 52 57 qmin = float(self.model.item(W.W_QMIN).text()) … … 61 66 self.axes.set_xlim(min(self.data.x) / 2, 62 67 max(self.data.x) * 1.5 - 0.5 * min(self.data.x)) 68 self.axes.set_ylim(min(self.data.y) / 2, 69 max(self.data.y) * 1.5 - 0.5 * min(self.data.y)) 63 70 if self.extrap: 64 71 self.axes.plot(self.extrap.x, self.extrap.y) … … 78 85 self.axes.set_xscale("linear") 79 86 self.axes.set_yscale("linear") 87 self.axes.set_xlabel("Z [$\AA$]") 88 self.axes.set_ylabel("Correlation") 89 self.fig.tight_layout() 80 90 81 91 if self.data: … … 85 95 self.axes.plot(data_idf.x, data_idf.y, 86 96 label="Interface Distribution Function") 87 self.axes.set_xlim( min(data1.x), max(data1.x) / 4)97 self.axes.set_xlim(0, max(data1.x) / 4) 88 98 self.axes.legend() 89 99 … … 115 125 116 126 self._canvas = MyMplCanvas(self.model) 117 self.mainVerticalLayout.insertWidget(0, self._canvas) 127 self.plotLayout.insertWidget(0, self._canvas) 128 self.plotLayout.insertWidget(1, NavigationToolbar2QT(self._canvas, self)) 129 self._realplot = MyMplCanvas(self.model) 130 self.plotLayout.insertWidget(2, self._realplot) 131 self.plotLayout.insertWidget(3, NavigationToolbar2QT(self._realplot, self)) 132 133 self.gridLayout_8.setColumnStretch(0, 1) 134 self.gridLayout_8.setColumnStretch(1, 3) 118 135 119 136 # Connect buttons to slots. … … 238 255 self.model.setItem(W.W_POLY, QtGui.QStandardItem("{:.3g}".format(params['A']))) 239 256 self.model.setItem(W.W_PERIOD, QtGui.QStandardItem("{:.3g}".format(params['max']))) 240 #self._realplot.data = transforms257 self._realplot.data = transforms 241 258 242 259 self.update_real_space_plot(transforms) 243 260 244 #self._realplot.draw_real_space()261 self._realplot.draw_real_space() 245 262 246 263 def update_real_space_plot(self, datas): … … 358 375 self.cmdTransform.setEnabled(False) 359 376 360 #self._realplot.data = None361 #self._realplot.draw_real_space()377 self._realplot.data = None 378 self._realplot.draw_real_space() 362 379 363 380 def setClosable(self, value=True): -
src/sas/qtgui/Perspectives/Corfunc/UI/CorfuncPanel.ui
rcb4d219 rf6c3f01 322 322 </item> 323 323 <item row="0" column="1"> 324 <widget class="QLineEdit" name="txtLongPeriod"/> 324 <widget class="QLineEdit" name="txtLongPeriod" width="50"> 325 <property name="minimumSize" stdset="0"> 326 <size> 327 <width>60</width> 328 <height>20</height> 329 </size> 330 </property> 331 </widget> 325 332 </item> 326 333 <item row="0" column="2"> … … 332 339 </item> 333 340 <item row="0" column="3"> 334 <widget class="QLineEdit" name="txtAvgIntThick"/> 341 <widget class="QLineEdit" name="txtAvgIntThick"> 342 <property name="minimumSize" stdset="0"> 343 <size> 344 <width>60</width> 345 <height>20</height> 346 </size> 347 </property> 348 </widget> 335 349 </item> 336 350 <item row="1" column="0"> … … 419 433 </layout> 420 434 </item> 435 <item row="0" column="1"> 436 <layout class="QVBoxLayout" name="plotLayout"> 437 </layout> 438 </item> 421 439 </layout> 422 440 </widget> -
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.