Changeset 86d3207 in sasview


Ignore:
Timestamp:
Sep 14, 2018 4:58:21 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
9d23e4c, 305114c
Parents:
768387e0
Message:

Added SLD profile view. SASVIEW-1050

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r557fc498 r86d3207  
    2828from sas.qtgui.Plotting.PlotterData import Data1D 
    2929from sas.qtgui.Plotting.PlotterData import Data2D 
     30from sas.qtgui.Plotting.Plotter import PlotterWidget 
    3031 
    3132from sas.qtgui.Perspectives.Fitting.UI.FittingWidgetUI import Ui_FittingWidgetUI 
     
    28252826        item4 = QtGui.QStandardItem() 
    28262827 
    2827         self._model_model.appendRow([item1, item2, item3, item4]) 
     2828        # cell 4: SLD button 
     2829        item5 = QtGui.QStandardItem() 
     2830        button = QtWidgets.QPushButton() 
     2831        button.setText("Show SLD Profile") 
     2832 
     2833        self._model_model.appendRow([item1, item2, item3, item4, item5]) 
    28282834 
    28292835        # Beautify the row:  span columns 2-4 
    28302836        shell_row = self._model_model.rowCount() 
    28312837        shell_index = self._model_model.index(shell_row-1, 1) 
     2838        button_index = self._model_model.index(shell_row-1, 4) 
    28322839 
    28332840        self.lstParams.setIndexWidget(shell_index, func) 
     2841        self.lstParams.setIndexWidget(button_index, button) 
    28342842        self._n_shells_row = shell_row - 1 
    28352843 
     
    28582866        func.currentTextChanged.connect(self.modifyShellsInList) 
    28592867 
     2868        # Respond to button press 
     2869        button.clicked.connect(self.onShowSLDProfile) 
     2870 
    28602871        # Available range of shells displayed in the combobox 
    28612872        func.addItems([str(i) for i in range(shell_min, shell_max+1)]) 
     
    28772888            index = 0 
    28782889            logger.error("Multiplicity incorrect! Setting to 0") 
    2879  
     2890        self.kernel_module.multiplicity = index 
    28802891        if remove_rows > 1: 
    28812892            self._model_model.removeRows(first_row, remove_rows) 
     
    29032914        self.setPolyModel() 
    29042915        self.setMagneticModel() 
     2916 
     2917    def onShowSLDProfile(self): 
     2918        """ 
     2919        Show a quick plot of SLD profile 
     2920        """ 
     2921        # get profile data 
     2922        x, y = self.kernel_module.getProfile() 
     2923        y *= 1.0e6 
     2924        profile_data = Data1D(x=x, y=y) 
     2925        profile_data.name = "SLD" 
     2926        profile_data.scale = 'linear' 
     2927        profile_data.symbol = 'Line' 
     2928        profile_data.hide_error = True 
     2929        profile_data._xaxis = "R(\AA)" 
     2930        profile_data._yaxis = "SLD(10^{-6}\AA^{-2})" 
     2931 
     2932        plotter = PlotterWidget(self, quickplot=True) 
     2933        plotter.data = profile_data 
     2934        plotter.showLegend = True 
     2935        plotter.plot(hide_error=True, marker='-') 
     2936 
     2937        self.plot_widget = QtWidgets.QWidget() 
     2938        self.plot_widget.setWindowTitle("Scattering Length Density Profile") 
     2939        layout = QtWidgets.QVBoxLayout() 
     2940        layout.addWidget(plotter) 
     2941        self.plot_widget.setLayout(layout) 
     2942        self.plot_widget.show() 
    29052943 
    29062944    def setInteractiveElements(self, enabled=True): 
Note: See TracChangeset for help on using the changeset viewer.