Changeset 6c7ebb88 in sasview
- Timestamp:
- Mar 31, 2019 8:04:26 AM (6 years ago)
- Parents:
- f994f188 (diff), d32a594 (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. - git-author:
- Adam Washington <rprospero@…> (03/31/19 08:04:26)
- git-committer:
- GitHub <noreply@…> (03/31/19 08:04:26)
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotting/Plotter.py
r6edd344 r6c7ebb88 91 91 # make sure we have some function to operate on 92 92 if self.data.xtransform is None: 93 self.data.xtransform = 'log10(x)' 93 if self.data.isSesans: 94 self.data.xtransform='x' 95 else: 96 self.data.xtransform = 'log10(x)' 94 97 if self.data.ytransform is None: 95 self.data.ytransform = 'log10(y)' 98 if self.data.isSesans: 99 self.data.ytransform='y' 100 else: 101 self.data.ytransform = 'log10(y)' 96 102 #Added condition to Dmax explorer from P(r) perspective 97 103 if self.data._xaxis == 'D_{max}': -
src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py
r6edd344 r6c7ebb88 81 81 """ Ensure that Sesans data is plotted in linear cooredinates""" 82 82 data = Data1D(x=[1.0, 2.0, 3.0], 83 y=[ 10.0, 11.0,12.0],83 y=[-10.0, -11.0, -12.0], 84 84 dx=[0.1, 0.2, 0.3], 85 85 dy=[0.1, 0.2, 0.3]) … … 97 97 self.assertEqual(self.plotter.ax.get_xscale(), 'linear') 98 98 self.assertEqual(self.plotter.ax.get_yscale(), 'linear') 99 self.assertEqual(self.plotter.data.ytransform, "y") 99 100 self.assertTrue(FigureCanvas.draw_idle.called) 100 101 -
build_tools/conda_qt5_min_osx.yml
rb9a6546 r7a1481f 50 50 - periodictable==1.5.0 51 51 - bumps==0.7.11 52 - xhtml2pdf==0.2. 252 - xhtml2pdf==0.2.3 53 53 - qt5reactor==0.5 54 54 -
build_tools/conda_qt5_osx.yml
r12dfce6 rf994f188 146 146 - periodictable==1.5.0 147 147 - bumps==0.7.11 148 - xhtml2pdf==0.2. 2148 - xhtml2pdf==0.2.3 149 149 - qt5reactor==0.5 -
src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py
r8137a02 rc02721c4 186 186 # wait a bit for data to be loaded 187 187 time.sleep(0.1) 188 QtWidgets.qApp.processEvents() 189 188 190 # check updated values in ui, read from loaded file 189 191 self.assertEqual(self.widget.txtData.text(), 'sld_file.sld') … … 250 252 251 253 time.sleep(1) 254 QtWidgets.qApp.processEvents() 255 252 256 # check updated values in ui, read from loaded file 253 257 # TODO to be changed … … 310 314 self.assertEqual(self.widget.cmdLoad.text(), 'Loading...') 311 315 time.sleep(2) 316 QtWidgets.qApp.processEvents() 312 317 313 318 self.assertEqual(self.widget.txtData.text(), 'A_Raw_Example-1.omf') … … 396 401 self.assertEqual(self.widget.cmdLoad.text(), 'Loading...') 397 402 time.sleep(1) 403 QtWidgets.qApp.processEvents() 398 404 399 405 self.assertTrue(self.widget.cmdDraw.isEnabled()) … … 417 423 418 424 time.sleep(0.1) 425 QtWidgets.qApp.processEvents() 419 426 420 427 filename1 = "test" 421 428 QtWidgets.QFileDialog.getSaveFileName = MagicMock(return_value=[filename1, '']) 422 429 423 QTest.mouseClick(self.widget.cmdSave, Qt.LeftButton)430 #QTest.mouseClick(self.widget.cmdSave, Qt.LeftButton) 424 431 self.widget.onSaveFile() 432 QtWidgets.qApp.processEvents() 433 425 434 self.assertTrue(os.path.isfile(filename1 + '.sld')) 426 435 self.assertTrue(os.path.getsize(filename1 + '.sld') > 0) -
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
r9ce69ec r6edd344 13 13 14 14 # Local 15 from sas.qtgui.Calculators.SldPanel import SldResult15 #from sas.qtgui.Calculators.SldPanel import SldResult 16 16 from sas.qtgui.Calculators.SldPanel import SldPanel 17 from sas.qtgui.Calculators.SldPanel import sldAlgorithm17 from sas.qtgui.Calculators.SldPanel import neutronSldAlgorithm, xraySldAlgorithm 18 18 from sas.qtgui.Utilities.GuiUtils import FormulaValidator 19 19 … … 22 22 if not QtWidgets.QApplication.instance(): 23 23 app = QtWidgets.QApplication(sys.argv) 24 25 class SldResultTest(unittest.TestCase):26 """ Test the simple container class"""27 def testObjectSize(self):28 results = SldResult(0.0, 0.0, 0.0, 0.0, 0.0, 0.0,29 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)30 self.assertEqual(sys.getsizeof(results), 56)31 24 32 25 … … 38 31 wavelength = 6.0 39 32 40 results = sldAlgorithm( molecular_formula,33 results = neutronSldAlgorithm( molecular_formula, 41 34 mass_density, 42 35 wavelength) 43 self.assertIsInstance(results, SldResult)36 #self.assertIsInstance(results, SldResult) 44 37 self.assertAlmostEqual(results.neutron_length, 0.175463, 5) 45 38 self.assertAlmostEqual(results.neutron_inc_xs, 5.365857, 5) … … 51 44 wavelength = 666.0 52 45 53 results = sldAlgorithm( molecular_formula,46 results = neutronSldAlgorithm( molecular_formula, 54 47 mass_density, 55 48 wavelength) 56 self.assertIsInstance(results, SldResult)49 #self.assertIsInstance(results, SldResult) 57 50 self.assertAlmostEqual(results.neutron_length, 0.059402, 5) 58 51 self.assertAlmostEqual(results.neutron_inc_xs, 0.145427, 5) … … 128 121 129 122 # Assure the mass density field is set 130 #self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '43.4')131 123 self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '2.89') 132 133 # Reset the widget134 self.widget.modelReset()135 136 self.assertEqual(self.widget.ui.editMolecularFormula.text(), "H2O")137 self.assertEqual(self.widget.ui.editMassDensity.text(), "1")138 self.assertEqual(self.widget.ui.editWavelength.text(), "6")139 124 140 125 def testHelp(self): -
src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py
r0989bad rc02721c4 740 740 caption="Save As", 741 741 directory='cyl_400_20_out.txt', 742 filter='Text files (*.txt);;CanSAS 1D files(*.xml) ',742 filter='Text files (*.txt);;CanSAS 1D files(*.xml);;NXcanSAS files (*.h5)', 743 743 parent=None) 744 744 QFileDialog.getSaveFileName.assert_called_once() … … 763 763 caption="Save As", 764 764 directory='P123_D2O_10_percent_out.dat', 765 filter='IGOR/DAT 2D file in Q_map (*.dat) ',765 filter='IGOR/DAT 2D file in Q_map (*.dat);;NXcanSAS files (*.h5)', 766 766 parent=None) 767 767 QFileDialog.getSaveFileName.assert_called_once() -
src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py
r0989bad rc02721c4 147 147 """ 148 148 self.manager.processVersion = MagicMock() 149 version = {'version' : '4.2. 0',149 version = {'version' : '4.2.1', 150 150 'update_url' : 'http://www.sasview.org/sasview.latestversion', 151 151 'download_url': 'https://github.com/SasView/sasview/releases'} -
src/sas/qtgui/Perspectives/Fitting/ComplexConstraint.py
rcf9f39e r460bdf4 150 150 param2 = self.cbParam2.currentText() 151 151 if source == "cbParam1": 152 self.txtParam.setText(self. tab_names[0]+ ":" + param1)152 self.txtParam.setText(self.cbModel1.currentText() + ":" + param1) 153 153 else: 154 self.txtConstraint.setText(self. tab_names[1]+ "." + param2)154 self.txtConstraint.setText(self.cbModel2.currentText() + "." + param2) 155 155 # Check if any of the parameters are polydisperse 156 156 params_list = [param1, param2] -
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
r14e1ff0 r770c42c 432 432 """ 433 433 item = self.tblConstraints.item(row, column) 434 if column != 0: return 435 # Update the tabs for fitting list 436 constraint = self.available_constraints[row] 437 constraint.active = (item.checkState() == QtCore.Qt.Checked) 434 if column == 0: 435 # Update the tabs for fitting list 436 constraint = self.available_constraints[row] 437 constraint.active = (item.checkState() == QtCore.Qt.Checked) 438 return 438 439 # Update the constraint formula 439 440 constraint = self.available_constraints[row] … … 470 471 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 471 472 self.cmdFit.setText("Fit") 473 self.is_running = False 472 474 473 475 # Notify the parent about completed fitting … … 515 517 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 516 518 self.cmdFit.setText("Fit") 519 self.is_running = False 517 520 518 521 # Notify the parent about completed fitting … … 549 552 self.cmdFit.setStyleSheet('QPushButton {color: black;}') 550 553 self.cmdFit.setText("Fit") 554 self.is_running = False 551 555 552 556 # Notify the parent about completed fitting … … 769 773 item = self.uneditableItem(label) 770 774 item = QtWidgets.QTableWidgetItem(label) 771 item.setFlags(item.flags() ^ QtCore.Qt.ItemIsUserCheckable) 775 # Why was this set to non-interactive?? 776 #item.setFlags(item.flags() ^ QtCore.Qt.ItemIsUserCheckable) 772 777 item.setCheckState(QtCore.Qt.Checked) 773 778 self.tblConstraints.insertRow(pos) -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
rf5e2a10a rc7e73e7 166 166 if cbox: 167 167 view.setIndexWidget(item2.index(), cbox) 168 168 169 rows.append(row) 169 170 … … 202 203 item1 = QtGui.QStandardItem(item_name) 203 204 item1.setData(param.name, QtCore.Qt.UserRole) 204 item1.setCheckable( True)205 item1.setCheckable(False) 205 206 item1.setEditable(False) 206 207 … … 219 220 # Append to the model and use the combobox, if required 220 221 if None not in (model, view): 222 221 223 if row_num is None: 222 224 model.appendRow(row) … … 224 226 model.insertRow(row_num, row) 225 227 row_num += 1 226 227 228 if cbox: 229 item1.setCheckable(False) 230 item3.setText("") 231 item4.setText("") 232 item3.setEditable(False) 233 item4.setEditable(False) 228 234 view.setIndexWidget(item2.index(), cbox) 235 else: 236 item1.setCheckable(True) 229 237 230 238 rows.append(row) -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rc149fba r73fb503 1161 1161 if category == CATEGORY_STRUCTURE: 1162 1162 model = None 1163 # copy original clipboard 1164 cb = QtWidgets.QApplication.clipboard() 1165 cb_text = cb.text() 1166 # get the screenshot of the current param state 1167 self.onCopyToClipboard("") 1163 1168 1164 1169 # Reset parameters to fit … … 1168 1173 1169 1174 self.respondToModelStructure(model=model, structure_factor=structure) 1175 # recast the original parameters into the model 1176 self.onParameterPaste() 1177 # revert to the original clipboard 1178 cb.setText(cb_text) 1170 1179 1171 1180 def resetParametersToFit(self): … … 2030 2039 if not self.data_is_loaded: 2031 2040 self.createDefaultDataset() 2041 self.smearing_widget.updateData(self.data) 2032 2042 self.calculateQGridForModel() 2033 2043 … … 2870 2880 self.createNewIndex(weighted_data) 2871 2881 2872 # Plot residuals if actual data2873 if not self.data_is_loaded:2874 return2875 2876 2882 # Calculate difference between return_data and logic.data 2877 2883 self.chi2 = FittingUtilities.calculateChi2(weighted_data, self.data) … … 2879 2885 chi2_repr = "---" if self.chi2 is None else GuiUtils.formatNumber(self.chi2, high=True) 2880 2886 self.lblChi2Value.setText(chi2_repr) 2887 2888 # Plot residuals if actual data 2889 if not self.data_is_loaded: 2890 return 2881 2891 2882 2892 residuals_plot = FittingUtilities.plotResiduals(self.data, weighted_data) -
src/sas/qtgui/Perspectives/Fitting/OptionsWidget.py
r17e6a2b rdc3b34e 173 173 self.rbWeighting2.setEnabled(True) 174 174 self.rbWeighting2.setChecked(True) 175 self.onWeightingChoice(self.rbWeighting2) 175 176 else: 176 177 self.rbWeighting2.setEnabled(False) 177 178 self.rbWeighting1.setChecked(True) 179 self.onWeightingChoice(self.rbWeighting1) 178 180 179 181 def updateQRange(self, q_range_min, q_range_max, npts): -
src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py
ra5f7bf4 r73fb503 64 64 self.kernel_model = None 65 65 # dQ data variables 66 smear_type = None 67 dq_l = None 68 dq_r = None 66 self.smear_type = None 67 self.dq_l = None 68 self.dq_r = None 69 70 # current pinhole/slot values 71 self.pinhole = 0.0 72 self.slit_height = 0.0 73 self.slit_width = 0.0 74 69 75 # Let only floats in the line edits 70 76 self.txtSmearDown.setValidator(GuiUtils.DoubleValidator()) … … 109 115 Update control elements based on data and model passed 110 116 """ 117 # retain the index 118 cur_index = self.cbSmearing.currentIndex() 111 119 self.cbSmearing.clear() 112 120 self.cbSmearing.addItem("None") … … 117 125 model = self.kernel_model 118 126 self.updateKernelModel(model) 127 # already has the required setup so modify the index 128 self.cbSmearing.setCurrentIndex(cur_index) 119 129 120 130 def updateKernelModel(self, kernel_model=None): … … 184 194 # Recalculate the smearing 185 195 index = self.cbSmearing.currentIndex() 196 ## update the backup values based on model choice 197 smearing, accuracy, d_down, d_up = self.state() 198 # don't save the state if dQ Data 199 if smearing == "Custom Pinhole Smear": 200 self.pinhole = d_down 201 self.accuracy = accuracy 202 elif smearing == 'Custom Slit Smear': 203 self.slit_height = d_up 204 self.slit_width = d_down 205 186 206 self.onIndexChange(index) 187 207 … … 221 241 self.lblSmearUp.setText('<html><head/><body><p>dQ/Q</p></body></html>') 222 242 self.lblUnitUp.setText('%') 243 self.txtSmearUp.setText(str(self.pinhole)) 244 223 245 self.txtSmearDown.setEnabled(True) 224 246 self.txtSmearUp.setEnabled(True) … … 234 256 self.lblUnitDown.setText('<html><head/><body><p>Ã 235 257 <span style=" vertical-align:super;">-1</span></p></body></html>') 258 self.txtSmearDown.setText(str(self.slit_height)) 259 self.txtSmearUp.setText(str(self.slit_width)) 236 260 self.txtSmearDown.setEnabled(True) 237 261 self.txtSmearUp.setEnabled(True) … … 277 301 accuracy = str(self.model.item(MODEL.index('ACCURACY')).text()) 278 302 try: 279 d_down = float(self. model.item(MODEL.index('PINHOLE_MIN')).text())303 d_down = float(self.txtSmearUp.text()) 280 304 except ValueError: 281 305 d_down = None 282 306 try: 283 d_up = float(self. model.item(MODEL.index('PINHOLE_MAX')).text())307 d_up = float(self.txtSmearDown.text()) 284 308 except ValueError: 285 309 d_up = None … … 292 316 """ 293 317 # Update the model -> controls update automatically 294 #if smearing is not None:295 #self.model.item(MODEL.index('SMEARING')).setText(smearing)296 318 if accuracy is not None: 297 319 self.model.item(MODEL.index('ACCURACY')).setText(accuracy) … … 347 369 if d_height is None: 348 370 d_height = 0.0 371 372 self.slit_width = d_width 373 self.slit_height = d_height 349 374 350 375 if isinstance(self.data, Data2D): -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
r0989bad r6edd344 205 205 model_index = self.widget.cbModel.findText("be_polyelectrolyte") 206 206 self.widget.cbModel.setCurrentIndex(model_index) 207 QtWidgets.qApp.processEvents() 207 208 208 209 # check the enablement of controls … … 242 243 self.widget.show() 243 244 # Change the category index so we have some models 244 category_index = self.widget.cbCategory.findText(" Shape Independent")245 category_index = self.widget.cbCategory.findText("Cylinder") 245 246 self.widget.cbCategory.setCurrentIndex(category_index) 246 247 # Change the model to one that supports structure factors 247 model_index = self.widget.cbModel.findText(' fractal_core_shell')248 model_index = self.widget.cbModel.findText('cylinder') 248 249 self.widget.cbModel.setCurrentIndex(model_index) 249 250 … … 260 261 self.widget.cbStructureFactor.setCurrentIndex(structure_index) 261 262 262 # We have 3 more param rows now (radius_effective is removed), and a new heading263 self.assertEqual(self.widget._model_model.rowCount(), rowcount+ 4)263 # We have 3 more param rows now (radius_effective is removed), and new headings 264 self.assertEqual(self.widget._model_model.rowCount(), rowcount+7) 264 265 265 266 # Switch models … … 1229 1230 model_index = self.widget.cbModel.findText("pringle") 1230 1231 self.widget.cbModel.setCurrentIndex(model_index) 1232 QtWidgets.qApp.processEvents() 1231 1233 1232 1234 # make sure the parameters are different than before -
src/sas/qtgui/Plotting/PlotterBase.py
r8fad50b rb016f17 111 111 self.contextMenu = QtWidgets.QMenu(self) 112 112 self.toolbar = NavigationToolbar(self.canvas, self) 113 cid = self.canvas.mpl_connect('resize_event', self.onResize) 114 113 115 layout.addWidget(self.toolbar) 114 116 if not quickplot: … … 244 246 raise NotImplementedError("Context menu method must be implemented in derived class.") 245 247 248 def onResize(self, event): 249 """ 250 Redefine default resize event 251 """ 252 pass 253 246 254 def contextMenuEvent(self, event): 247 255 """ -
src/sas/qtgui/Utilities/UnitTesting/TabbedModelEditorTest.py
r80468f6 rc02721c4 204 204 self.widget.editor_widget.txtEditor.toPlainText = MagicMock(return_value=boring_text) 205 205 self.widget.writeFile = MagicMock() 206 self.widget.plugin_widget.is_python = MagicMock() 206 207 #invoke the method 207 208 self.widget.updateFromEditor()
Note: See TracChangeset
for help on using the changeset viewer.