Changes in / [1ba88515:0e80658] in sasview


Ignore:
Location:
src/sas
Files:
3 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • src/sas/_config.py

    rf7d14a1 r88e1f57  
    110110        try: 
    111111            module = load_module_from_path('sas.custom_config', path) 
    112             #logger.info("GuiManager loaded %s", path) 
     112            logger.info("GuiManager loaded %s", path) 
    113113            return module 
    114114        except Exception as exc: 
  • src/sas/qtgui/MainWindow/GuiManager.py

    rd6b8a1d r412e069e  
    184184        Respond to change of the perspective signal 
    185185        """ 
    186  
    187         # Save users from themselves... 
    188         if isinstance(self._current_perspective, Perspectives.PERSPECTIVES[str(perspective_name)]): 
    189             self.setupPerspectiveMenubarOptions(self._current_perspective) 
    190             return 
    191  
    192186        # Close the previous perspective 
    193         self.clearPerspectiveMenubarOptions(self._current_perspective) 
    194187        if self._current_perspective: 
    195188            self._current_perspective.setClosable() 
     
    397390        self._workspace.actionCombine_Batch_Fit.triggered.connect(self.actionCombine_Batch_Fit) 
    398391        self._workspace.actionFit_Options.triggered.connect(self.actionFit_Options) 
    399         self._workspace.actionGPU_Options.triggered.connect(self.actionGPU_Options) 
    400392        self._workspace.actionFit_Results.triggered.connect(self.actionFit_Results) 
    401393        self._workspace.actionChain_Fitting.triggered.connect(self.actionChain_Fitting) 
     
    633625        pass 
    634626 
    635     def actionGPU_Options(self): 
    636         """ 
    637         Load the OpenCL selection dialog if the fitting perspective is active 
    638         """ 
    639         if hasattr(self._current_perspective, "gpu_options_widget"): 
    640             self._current_perspective.gpu_options_widget.show() 
    641         pass 
    642  
    643627    def actionFit_Results(self): 
    644628        """ 
     
    662646    def actionFitting(self): 
    663647        """ 
    664         Change to the Fitting perspective 
    665         """ 
    666         self.perspectiveChanged("Fitting") 
     648        """ 
     649        print("actionFitting TRIGGERED") 
     650        pass 
    667651 
    668652    def actionInversion(self): 
    669653        """ 
    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        """ 
    674655        print("actionInversion TRIGGERED") 
    675         # to here and uncomment the following line 
    676         # self.perspectiveChanged("Inversion") 
     656        pass 
    677657 
    678658    def actionInvariant(self): 
    679659        """ 
    680         Change to the Invariant perspective 
    681         """ 
    682         self.perspectiveChanged("Invariant") 
     660        """ 
     661        print("actionInvariant TRIGGERED") 
     662        pass 
    683663 
    684664    #============ WINDOW ================= 
     
    779759        if hasattr(self, "filesWidget"): 
    780760            self.filesWidget.displayData(plot) 
    781  
    782     def uncheckAllMenuItems(self, menuObject): 
    783         """ 
    784         Uncheck all options in a given menu 
    785         """ 
    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 passed 
    794         """ 
    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 bar 
    801         """ 
    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 bar 
    811         """ 
    812         if isinstance(perspective, Perspectives.PERSPECTIVES["Fitting"]): 
    813             self.checkAnalysisOption(self._workspace.actionFitting) 
    814             # Put the fitting menu back in 
    815             # This is a bit involved but it is needed to preserve the menu ordering 
    816             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  
    2525     <y>0</y> 
    2626     <width>915</width> 
    27      <height>26</height> 
     27     <height>21</height> 
    2828    </rect> 
    2929   </property> 
     
    103103    <addaction name="separator"/> 
    104104    <addaction name="actionFit_Options"/> 
    105     <addaction name="actionGPU_Options"/> 
    106105    <addaction name="actionFit_Results"/> 
    107106    <addaction name="separator"/> 
     
    500499   </property> 
    501500  </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> 
    510501 </widget> 
    511502 <resources/> 
  • src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py

    r53c771e r3e8dee3  
    171171 
    172172        # 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"] 
    174175        self.form.readData(filename) 
    175176 
  • src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py

    r4992ff2 r0849aec  
    1212from sas.qtgui.Perspectives.Fitting.FittingWidget import FittingWidget 
    1313from sas.qtgui.Perspectives.Fitting.FittingOptions import FittingOptions 
    14 from sas.qtgui.Perspectives.Fitting.GPUOptions import GPUOptions 
    1514#from sas.qtgui.Perspectives.Fitting import ModelUtilities 
    1615 
     
    6463        self.fit_options_widget.fit_option_changed.connect(self.onFittingOptionsChange) 
    6564 
    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() 
    6869 
    6970        #self.setWindowTitle('Fit panel - Active Fitting Optimizer: %s' % self.optimizer) 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r53c771e r3e8dee3  
    1818#from PyQt5 import QtWebEngineWidgets 
    1919 
    20 from sasmodels import product 
    2120from sasmodels import generate 
    2221from sasmodels import modelinfo 
     
    152151    def data(self, value): 
    153152        """ data setter """ 
    154         # Value is either a list of indices for batch fitting or a simple index 
    155         # for standard fitting. Assure we have a list, regardless. 
    156153        if isinstance(value, list): 
    157154            self.is_batch_fitting = True 
     
    167164 
    168165        # Update logics with data items 
    169         # Logics.data contains only a single Data1D/Data2D object 
    170166        self.logic.data = GuiUtils.dataFromItem(value[0]) 
    171167 
     
    173169        self.is2D = True if isinstance(self.logic.data, Data2D) else False 
    174170 
    175         # Let others know we're full of data now 
    176171        self.data_is_loaded = True 
    177172 
     
    353348        self.chk2DView.setVisible(False) 
    354349        self.chkMagnetism.setEnabled(self.is2D) 
    355         self.tabFitting.setTabEnabled(TAB_MAGNETISM, self.is2D) 
    356350        # Combo box or label for file name" 
    357351        if self.is_batch_fitting: 
     
    12881282        structure_module = generate.load_kernel_module(structure_factor) 
    12891283        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) 
    12931284 
    12941285        new_rows = FittingUtilities.addSimpleParametersToModel(structure_parameters, self.is2D) 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r53c771e r3e8dee3  
    104104        self.assertEqual(delegate.editableParameters(), [1, 2, 3, 4, 5]) 
    105105        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 properly 
    111         """ 
    112         fittingWindow =  self.widget 
    113  
    114         self.assertIsInstance(fittingWindow.lstMagnetic.itemDelegate(), QtGui.QStyledItemDelegate) 
    115         #Test loading from json categories 
    116         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 bit 
    137         delegate = fittingWindow.lstMagnetic.itemDelegate() 
    138         self.assertEqual(delegate.editableParameters(), [1, 2, 3]) 
    139106        self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) 
    140107 
     
    860827        self.assertEqual(self.widget.cbModel.currentText(), 'onion') 
    861828        self.assertTrue(self.widget.chkPolydispersity.isChecked()) 
    862         #Check if polidispersity tab is available 
    863         self.assertTrue(self.widget.tabFitting.isTabEnabled(3)) 
    864  
    865         #Check if magnetism box and tab are disabled when 1D data is loaded 
    866         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 state 
    872         """ 
    873         # Set data 
    874  
    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 logic 
    883         self.widget.logic.data = test_data 
    884         self.widget.data_is_loaded = True 
    885  
    886         #item = QtGui.QStandardItem() 
    887         #updateModelItem(item, [test_data], "test") 
    888         # Force same data into logic 
    889         #self.widget.logic.data = item 
    890         #self.widget.data_is_loaded = True 
    891  
    892         category_index = self.widget.cbCategory.findText("Cylinder") 
    893         self.widget.cbCategory.setCurrentIndex(category_index) 
    894  
    895         # Test no fitting params 
    896         self.widget.parameters_to_fit = ['scale'] 
    897  
    898         # Invoke the tested method 
    899         fp = self.widget.currentState() 
    900  
    901         # Prepare modified fit page 
    902         fp.current_model = 'cylinder' 
    903         fp.is_polydisperse = True 
    904         fp.is_magnetic = True 
    905         fp.is2D = True 
    906  
    907         # Read in modified state 
    908         self.widget.readFitPage(fp) 
    909  
    910         # Check if the widget got updated accordingly 
    911         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 available 
    915         self.assertTrue(self.widget.tabFitting.isTabEnabled(3)) 
    916  
    917         #Check if magnetism box and tab are disabled when 1D data is loaded 
    918         self.assertTrue(self.widget.chkMagnetism.isChecked()) 
    919         self.assertTrue(self.widget.chkMagnetism.isEnabled()) 
    920         self.assertTrue(self.widget.tabFitting.isTabEnabled(4)) 
    921829 
    922830    def testCurrentState(self): 
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    rd6b8a1d r412e069e  
    220220 
    221221    def editableParameters(self): 
    222         return [self.mag_value, self.mag_min, self.mag_max] 
     222        return [self.mag_min, self.mag_max] 
    223223 
    224224    def addErrorColumn(self): 
  • src/sas/qtgui/Plotting/Plotter.py

    rfbfc488 r6280464  
    5151        self.xLabel = "%s(%s)"%(value._xaxis, value._xunit) 
    5252        self.yLabel = "%s(%s)"%(value._yaxis, value._yunit) 
    53         if value.isSesans: 
    54             self.xscale = 'linear' 
    55             self.yscale = 'linear' 
    5653        self.title(title=value.name) 
    5754 
  • src/sas/qtgui/Plotting/PlotterData.py

    rcee5c78 r895e7359  
    5454        self.yaxis(data1d._yaxis, data1d._yunit) 
    5555        self.title = data1d.title 
    56         self.isSesans = data1d.isSesans 
    5756         
    5857    def __str__(self): 
  • src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py

    r53c771e r3e8dee3  
    7777        self.assertTrue(FigureCanvas.draw_idle.called) 
    7878        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 = True 
    89         data.id = 2 
    90  
    91         self.plotter.data = data 
    92         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) 
    10079 
    10180    def testCreateContextMenuQuick(self): 
  • src/sas/sascalc/dataloader/data_info.py

    r749b715 rdeaa0c6  
    775775        clone.meta_data = deepcopy(self.meta_data) 
    776776        clone.errors = deepcopy(self.errors) 
    777         clone.isSesans = self.isSesans 
    778777 
    779778        return clone 
Note: See TracChangeset for help on using the changeset viewer.