Changes in / [1ba88515:0e80658] in sasview
- Location:
- src/sas
- Files:
-
- 3 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/_config.py
rf7d14a1 r88e1f57 110 110 try: 111 111 module = load_module_from_path('sas.custom_config', path) 112 #logger.info("GuiManager loaded %s", path)112 logger.info("GuiManager loaded %s", path) 113 113 return module 114 114 except Exception as exc: -
src/sas/qtgui/MainWindow/GuiManager.py
rd6b8a1d r412e069e 184 184 Respond to change of the perspective signal 185 185 """ 186 187 # Save users from themselves...188 if isinstance(self._current_perspective, Perspectives.PERSPECTIVES[str(perspective_name)]):189 self.setupPerspectiveMenubarOptions(self._current_perspective)190 return191 192 186 # Close the previous perspective 193 self.clearPerspectiveMenubarOptions(self._current_perspective)194 187 if self._current_perspective: 195 188 self._current_perspective.setClosable() … … 397 390 self._workspace.actionCombine_Batch_Fit.triggered.connect(self.actionCombine_Batch_Fit) 398 391 self._workspace.actionFit_Options.triggered.connect(self.actionFit_Options) 399 self._workspace.actionGPU_Options.triggered.connect(self.actionGPU_Options)400 392 self._workspace.actionFit_Results.triggered.connect(self.actionFit_Results) 401 393 self._workspace.actionChain_Fitting.triggered.connect(self.actionChain_Fitting) … … 633 625 pass 634 626 635 def actionGPU_Options(self):636 """637 Load the OpenCL selection dialog if the fitting perspective is active638 """639 if hasattr(self._current_perspective, "gpu_options_widget"):640 self._current_perspective.gpu_options_widget.show()641 pass642 643 627 def actionFit_Results(self): 644 628 """ … … 662 646 def actionFitting(self): 663 647 """ 664 Change to the Fitting perspective665 """666 self.perspectiveChanged("Fitting")648 """ 649 print("actionFitting TRIGGERED") 650 pass 667 651 668 652 def actionInversion(self): 669 653 """ 670 Change to the Inversion perspective 671 """ 672 # For now we'll just update the analysis menu status but when the inversion is implemented delete from here 673 self.checkAnalysisOption(self._workspace.actionInversion) 654 """ 674 655 print("actionInversion TRIGGERED") 675 # to here and uncomment the following line 676 # self.perspectiveChanged("Inversion") 656 pass 677 657 678 658 def actionInvariant(self): 679 659 """ 680 Change to the Invariant perspective681 """682 self.perspectiveChanged("Invariant")660 """ 661 print("actionInvariant TRIGGERED") 662 pass 683 663 684 664 #============ WINDOW ================= … … 779 759 if hasattr(self, "filesWidget"): 780 760 self.filesWidget.displayData(plot) 781 782 def uncheckAllMenuItems(self, menuObject):783 """784 Uncheck all options in a given menu785 """786 menuObjects = menuObject.actions()787 788 for menuItem in menuObjects:789 menuItem.setChecked(False)790 791 def checkAnalysisOption(self, analysisMenuOption):792 """793 Unchecks all the items in the analysis menu and checks the item passed794 """795 self.uncheckAllMenuItems(self._workspace.menuAnalysis)796 analysisMenuOption.setChecked(True)797 798 def clearPerspectiveMenubarOptions(self, perspective):799 """800 When closing a perspective, clears the menu bar801 """802 for menuItem in self._workspace.menuAnalysis.actions():803 menuItem.setChecked(False)804 805 if isinstance(self._current_perspective, Perspectives.PERSPECTIVES["Fitting"]):806 self._workspace.menubar.removeAction(self._workspace.menuFitting.menuAction())807 808 def setupPerspectiveMenubarOptions(self, perspective):809 """810 When setting a perspective, sets up the menu bar811 """812 if isinstance(perspective, Perspectives.PERSPECTIVES["Fitting"]):813 self.checkAnalysisOption(self._workspace.actionFitting)814 # Put the fitting menu back in815 # This is a bit involved but it is needed to preserve the menu ordering816 self._workspace.menubar.removeAction(self._workspace.menuWindow.menuAction())817 self._workspace.menubar.removeAction(self._workspace.menuHelp.menuAction())818 self._workspace.menubar.addAction(self._workspace.menuFitting.menuAction())819 self._workspace.menubar.addAction(self._workspace.menuWindow.menuAction())820 self._workspace.menubar.addAction(self._workspace.menuHelp.menuAction())821 elif isinstance(perspective, Perspectives.PERSPECTIVES["Invariant"]):822 self.checkAnalysisOption(self._workspace.actionInvariant)823 # elif isinstance(perspective, Perspectives.PERSPECTIVES["Inversion"]):824 # self.checkAnalysisOption(self._workspace.actionInversion) -
src/sas/qtgui/MainWindow/UI/MainWindowUI.ui
r06ce180 rb00414d 25 25 <y>0</y> 26 26 <width>915</width> 27 <height>2 6</height>27 <height>21</height> 28 28 </rect> 29 29 </property> … … 103 103 <addaction name="separator"/> 104 104 <addaction name="actionFit_Options"/> 105 <addaction name="actionGPU_Options"/>106 105 <addaction name="actionFit_Results"/> 107 106 <addaction name="separator"/> … … 500 499 </property> 501 500 </action> 502 <action name="actionGPU_Options">503 <property name="text">504 <string>GPU Options</string>505 </property>506 <property name="softKeyRole">507 <enum>QAction::NoSoftKey</enum>508 </property>509 </action>510 501 </widget> 511 502 <resources/> -
src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py
r53c771e r3e8dee3 171 171 172 172 # Populate the model 173 filename = ["cyl_400_20.txt", "cyl_400_20.txt", "cyl_400_20.txt"] 173 #filename = ["cyl_400_20.txt", "P123_D2O_10_percent.dat", "cyl_400_20.txt"] 174 filename = ["cyl_400_20.txt", "cyl_400_20.txt", "P123_D2O_10_percent.dat"] 174 175 self.form.readData(filename) 175 176 -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
r4992ff2 r0849aec 12 12 from sas.qtgui.Perspectives.Fitting.FittingWidget import FittingWidget 13 13 from sas.qtgui.Perspectives.Fitting.FittingOptions import FittingOptions 14 from sas.qtgui.Perspectives.Fitting.GPUOptions import GPUOptions15 14 #from sas.qtgui.Perspectives.Fitting import ModelUtilities 16 15 … … 64 63 self.fit_options_widget.fit_option_changed.connect(self.onFittingOptionsChange) 65 64 66 # GPU Options 67 self.gpu_options_widget = GPUOptions(self) 65 #self.menu_manager = ModelUtilities.ModelManager() 66 ## TODO: reuse these in FittingWidget properly 67 #self.model_list_box = self.menu_manager.get_model_list() 68 #self.model_dictionary = self.menu_manager.get_model_dictionary() 68 69 69 70 #self.setWindowTitle('Fit panel - Active Fitting Optimizer: %s' % self.optimizer) -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r53c771e r3e8dee3 18 18 #from PyQt5 import QtWebEngineWidgets 19 19 20 from sasmodels import product21 20 from sasmodels import generate 22 21 from sasmodels import modelinfo … … 152 151 def data(self, value): 153 152 """ data setter """ 154 # Value is either a list of indices for batch fitting or a simple index155 # for standard fitting. Assure we have a list, regardless.156 153 if isinstance(value, list): 157 154 self.is_batch_fitting = True … … 167 164 168 165 # Update logics with data items 169 # Logics.data contains only a single Data1D/Data2D object170 166 self.logic.data = GuiUtils.dataFromItem(value[0]) 171 167 … … 173 169 self.is2D = True if isinstance(self.logic.data, Data2D) else False 174 170 175 # Let others know we're full of data now176 171 self.data_is_loaded = True 177 172 … … 353 348 self.chk2DView.setVisible(False) 354 349 self.chkMagnetism.setEnabled(self.is2D) 355 self.tabFitting.setTabEnabled(TAB_MAGNETISM, self.is2D)356 350 # Combo box or label for file name" 357 351 if self.is_batch_fitting: … … 1288 1282 structure_module = generate.load_kernel_module(structure_factor) 1289 1283 structure_parameters = modelinfo.make_parameter_table(getattr(structure_module, 'parameters', [])) 1290 structure_kernel = self.models[structure_factor]()1291 1292 self.kernel_module._model_info = product.make_product_info(self.kernel_module._model_info, structure_kernel._model_info)1293 1284 1294 1285 new_rows = FittingUtilities.addSimpleParametersToModel(structure_parameters, self.is2D) -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
r53c771e r3e8dee3 104 104 self.assertEqual(delegate.editableParameters(), [1, 2, 3, 4, 5]) 105 105 self.assertEqual(delegate.poly_function, 6) 106 self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal)107 108 def testSelectMagnetism(self):109 """110 Test if models have been loaded properly111 """112 fittingWindow = self.widget113 114 self.assertIsInstance(fittingWindow.lstMagnetic.itemDelegate(), QtGui.QStyledItemDelegate)115 #Test loading from json categories116 fittingWindow.SASModelToQModel("cylinder")117 mag_index = fittingWindow.lstMagnetic.model().index(0,0)118 self.assertEqual(str(mag_index.data().toString()), "up:frac_i")119 mag_index = fittingWindow.lstMagnetic.model().index(1,0)120 self.assertEqual(str(mag_index.data().toString()), "up:frac_f")121 mag_index = fittingWindow.lstMagnetic.model().index(2,0)122 self.assertEqual(str(mag_index.data().toString()), "up:angle")123 mag_index = fittingWindow.lstMagnetic.model().index(3,0)124 self.assertEqual(str(mag_index.data().toString()), "M0:sld")125 mag_index = fittingWindow.lstMagnetic.model().index(4,0)126 self.assertEqual(str(mag_index.data().toString()), "mtheta:sld")127 mag_index = fittingWindow.lstMagnetic.model().index(5,0)128 self.assertEqual(str(mag_index.data().toString()), "mphi:sld")129 mag_index = fittingWindow.lstMagnetic.model().index(6,0)130 self.assertEqual(str(mag_index.data().toString()), "M0:sld_solvent")131 mag_index = fittingWindow.lstMagnetic.model().index(7,0)132 self.assertEqual(str(mag_index.data().toString()), "mtheta:sld_solvent")133 mag_index = fittingWindow.lstMagnetic.model().index(8,0)134 self.assertEqual(str(mag_index.data().toString()), "mphi:sld_solvent")135 136 # test the delegate a bit137 delegate = fittingWindow.lstMagnetic.itemDelegate()138 self.assertEqual(delegate.editableParameters(), [1, 2, 3])139 106 self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) 140 107 … … 860 827 self.assertEqual(self.widget.cbModel.currentText(), 'onion') 861 828 self.assertTrue(self.widget.chkPolydispersity.isChecked()) 862 #Check if polidispersity tab is available863 self.assertTrue(self.widget.tabFitting.isTabEnabled(3))864 865 #Check if magnetism box and tab are disabled when 1D data is loaded866 self.assertFalse(self.widget.chkMagnetism.isEnabled())867 self.assertFalse(self.widget.tabFitting.isTabEnabled(4))868 869 def testReadFitPage2D(self):870 """871 Read in the fitpage object and restore state872 """873 # Set data874 875 test_data = Data2D(image=[1.0, 2.0, 3.0],876 err_image=[0.01, 0.02, 0.03],877 qx_data=[0.1, 0.2, 0.3],878 qy_data=[0.1, 0.2, 0.3],879 xmin=0.1, xmax=0.3, ymin=0.1, ymax=0.3,880 mask=[True, True, True])881 882 # Force same data into logic883 self.widget.logic.data = test_data884 self.widget.data_is_loaded = True885 886 #item = QtGui.QStandardItem()887 #updateModelItem(item, [test_data], "test")888 # Force same data into logic889 #self.widget.logic.data = item890 #self.widget.data_is_loaded = True891 892 category_index = self.widget.cbCategory.findText("Cylinder")893 self.widget.cbCategory.setCurrentIndex(category_index)894 895 # Test no fitting params896 self.widget.parameters_to_fit = ['scale']897 898 # Invoke the tested method899 fp = self.widget.currentState()900 901 # Prepare modified fit page902 fp.current_model = 'cylinder'903 fp.is_polydisperse = True904 fp.is_magnetic = True905 fp.is2D = True906 907 # Read in modified state908 self.widget.readFitPage(fp)909 910 # Check if the widget got updated accordingly911 self.assertEqual(self.widget.cbModel.currentText(), 'cylinder')912 self.assertTrue(self.widget.chkPolydispersity.isChecked())913 self.assertTrue(self.widget.chkPolydispersity.isEnabled())914 #Check if polidispersity tab is available915 self.assertTrue(self.widget.tabFitting.isTabEnabled(3))916 917 #Check if magnetism box and tab are disabled when 1D data is loaded918 self.assertTrue(self.widget.chkMagnetism.isChecked())919 self.assertTrue(self.widget.chkMagnetism.isEnabled())920 self.assertTrue(self.widget.tabFitting.isTabEnabled(4))921 829 922 830 def testCurrentState(self): -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
rd6b8a1d r412e069e 220 220 221 221 def editableParameters(self): 222 return [self.mag_ value, self.mag_min, self.mag_max]222 return [self.mag_min, self.mag_max] 223 223 224 224 def addErrorColumn(self): -
src/sas/qtgui/Plotting/Plotter.py
rfbfc488 r6280464 51 51 self.xLabel = "%s(%s)"%(value._xaxis, value._xunit) 52 52 self.yLabel = "%s(%s)"%(value._yaxis, value._yunit) 53 if value.isSesans:54 self.xscale = 'linear'55 self.yscale = 'linear'56 53 self.title(title=value.name) 57 54 -
src/sas/qtgui/Plotting/PlotterData.py
rcee5c78 r895e7359 54 54 self.yaxis(data1d._yaxis, data1d._yunit) 55 55 self.title = data1d.title 56 self.isSesans = data1d.isSesans57 56 58 57 def __str__(self): -
src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py
r53c771e r3e8dee3 77 77 self.assertTrue(FigureCanvas.draw_idle.called) 78 78 self.plotter.figure.clf() 79 80 def testPlotWithSesans(self):81 """ Ensure that Sesans data is plotted in linear cooredinates"""82 data = Data1D(x=[1.0, 2.0, 3.0],83 y=[10.0, 11.0, 12.0],84 dx=[0.1, 0.2, 0.3],85 dy=[0.1, 0.2, 0.3])86 data.title = "Sesans data"87 data.name = "Test Sesans"88 data.isSesans = True89 data.id = 290 91 self.plotter.data = data92 self.plotter.show()93 FigureCanvas.draw = MagicMock()94 95 self.plotter.plot(hide_error=True)96 97 self.assertEqual(self.plotter.ax.get_xscale(), 'linear')98 self.assertEqual(self.plotter.ax.get_yscale(), 'linear')99 self.assertTrue(FigureCanvas.draw.called)100 79 101 80 def testCreateContextMenuQuick(self): -
src/sas/sascalc/dataloader/data_info.py
r749b715 rdeaa0c6 775 775 clone.meta_data = deepcopy(self.meta_data) 776 776 clone.errors = deepcopy(self.errors) 777 clone.isSesans = self.isSesans778 777 779 778 return clone
Note: See TracChangeset
for help on using the changeset viewer.