Changeset 304e42f in sasview for src/sas/qtgui


Ignore:
Timestamp:
Mar 22, 2018 7:40:43 PM (6 years ago)
Author:
krzywon
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
8289ae3
Parents:
e51e078
Message:

More work to update gui values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    re51e078 r304e42f  
    3030MAX_DIST = 140.0 
    3131DICT_KEYS = ["Calculator", "PrPlot", "DataPlot", "DMaxWindow", 
    32              "Logic", "NFunc", "NFuncEst", "BackgroundEst"] 
    33  
    34  
     32             "Logic", "NFuncEst"] 
     33 
     34 
     35# TODO: Remove not working 
     36# TODO: Explore window not working 
    3537# TODO: Update help with batch capabilities 
    3638# TODO: Method to export results in some meaningful way 
     
    6870        # p(r) calculator for self._data 
    6971        self._calculator = Invertor() 
     72        # Default to background estimate 
     73        self._calculator.set_est_bck(True) 
    7074        # plots of self._data 
    7175        self.pr_plot = None 
     
    151155 
    152156        self.backgroundInput.editingFinished.connect( 
    153             lambda: self._calculator.set_est_bck(is_float(self.backgroundInput.text()))) 
     157            lambda: self._calculator.set_background(is_float(self.backgroundInput.text()))) 
    154158        self.minQInput.editingFinished.connect( 
    155159            lambda: self._calculator.set_qmin(is_float(self.minQInput.text()))) 
     
    305309        self.updateDataList(ref_item) 
    306310        self.setCurrentData(ref_item) 
     311        self.updateGuiValues() 
    307312 
    308313    ###################################################################### 
     
    355360        if sender is self.estimateBgd: 
    356361            self.backgroundInput.setEnabled(False) 
     362            self._calculator.set_est_bck = True 
    357363        else: 
    358364            self.backgroundInput.setEnabled(True) 
     365            self._calculator.set_est_bck = False 
    359366 
    360367    def openExplorerWindow(self): 
     
    398405            self.performEstimate() 
    399406        self.enableButtons() 
     407        self.updateGuiValues() 
    400408 
    401409    def updateDataList(self, dataRef): 
     
    409417            DICT_KEYS[3]: self.dmaxWindow, 
    410418            DICT_KEYS[4]: self.logic, 
    411             DICT_KEYS[5]: self.getNFunc(), 
    412             DICT_KEYS[6]: self.nTermsSuggested, 
    413             DICT_KEYS[7]: self.backgroundInput.text() 
     419            DICT_KEYS[5]: self.nTermsSuggested 
    414420        } 
    415421 
     
    426432    def setCurrentData(self, data_ref): 
    427433        """Get the data by reference and display as necessary""" 
     434        if data_ref is None: 
     435            return 
    428436        if not isinstance(data_ref, QtGui.QStandardItem): 
    429437            msg = "Incorrect type passed to the P(r) Perspective" 
     
    437445        self.dmaxWindow = self._data_list[data_ref].get(DICT_KEYS[3]) 
    438446        self.logic = self._data_list[data_ref].get(DICT_KEYS[4]) 
     447        self.nTermsSuggested = self._data_list[data_ref].get(DICT_KEYS[5]) 
    439448        self.updateGuiValues() 
    440449 
     
    451460                           QtGui.QStandardItem("{:.4g}".format(pr.get_qmax()))) 
    452461        self.model.setItem(WIDGETS.W_BACKGROUND_INPUT, 
    453                            QtGui.QStandardItem("{:.3f}".format(pr.est_bck))) 
     462                           QtGui.QStandardItem("{:.3f}".format(pr.background))) 
    454463        self.model.setItem(WIDGETS.W_BACKGROUND_OUTPUT, 
    455464                           QtGui.QStandardItem("{:.3g}".format(pr.background))) 
     
    458467        if alpha != 0: 
    459468            self.regConstantSuggestionButton.setText("{:-3.2g}".format(alpha)) 
    460         self.regConstantSuggestionButton.setEnabled(alpha != 0) 
     469        self.regConstantSuggestionButton.setEnabled(alpha != self._calculator.alpha) 
    461470        if nterms != self.nTermsSuggested: 
    462471            self.noOfTermsSuggestionButton.setText( 
     
    466475                           QtGui.QStandardItem("{:.2g}".format(elapsed))) 
    467476 
    468         if isinstance(pr.chi2, list): 
     477        if isinstance(pr.chi2, np.ndarray): 
    469478            self.model.setItem(WIDGETS.W_CHI_SQUARED, 
    470479                               QtGui.QStandardItem("{:.3g}".format(pr.chi2[0]))) 
     
    500509            self.enableButtons() 
    501510        self.dataList.setCurrentIndex(0) 
     511        self.updateGuiValues() 
    502512 
    503513    ###################################################################### 
     
    590600        """ 
    591601        alpha, message, elapsed = output_tuple 
    592         # Save useful info 
    593602        self.updateGuiValues() 
    594603        if message: 
     
    644653        if self.pr_plot is None: 
    645654            self.pr_plot = self.logic.newPRPlot(out, self._calculator, cov) 
    646         else: 
    647             title = self.pr_plot.name 
    648             GuiUtils.updateModelItemWithPlot(self._data, self.pr_plot, title) 
    649655        if self.data_plot is None: 
    650656            self.data_plot = self.logic.new1DPlot(out, self._calculator) 
    651         else: 
    652             title = self.data_plot.name 
    653             GuiUtils.updateModelItemWithPlot(self._data, self.data_plot, title) 
    654657        self.updateDataList(self._data) 
    655658        self.updateGuiValues() 
Note: See TracChangeset for help on using the changeset viewer.