Ignore:
Timestamp:
Oct 28, 2017 10:44:29 AM (7 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:
fca1f50, 26f42b1
Parents:
57ad773
Message:

Start of P(r) batch capability work.

File:
1 edited

Legend:

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

    r57ad773 rd132f33  
    6464        self._data_index = 0 
    6565        # list mapping data to p(r) calculation 
    66         self._data_list = [] 
     66        self._data_list = {} 
    6767        if not isinstance(data, list): 
    68             data = [data] 
    69         for datum in data: 
    70             self._data_list.append({datum: self._calculator.clone()}) 
     68            data_list = [data] 
     69        if data is not None: 
     70            for datum in data_list: 
     71                self._data_list[datum] = self._calculator.clone() 
    7172 
    7273        # plots 
     
    9091 
    9192    def allowBatch(self): 
    92         return False 
     93        return True 
    9394 
    9495    def setClosable(self, value=True): 
     
    118119        """Connect the use controls to their appropriate methods""" 
    119120        self.enableButtons() 
    120         # TODO: enable the drop down box once batch is working 
    121         self.dataList.setEnabled(False) 
    122         # TODO: enable displayChange once batch is working 
    123         # self.dataList.currentIndexChanged.connect(self.displayChange) 
     121        self.dataList.currentIndexChanged.connect(self.displayChange) 
    124122        self.calculateButton.clicked.connect(self._calculation) 
    125123        self.helpButton.clicked.connect(self.help) 
     
    272270            self.regConstantSuggestionButton.text())) 
    273271 
     272    def displayChange(self): 
     273        data_name = str(self.dataList.currentText()) 
     274        # TODO: Find data ref based on file name 
     275        # TODO: Find way to link standardmodelitem with combobox entry 
     276 
    274277    ###################################################################### 
    275278    # GUI Interaction Events 
     
    285288        Calculate the P(r) for every data set in the data list 
    286289        """ 
    287         # Set data before running the calculations 
    288         self.update_calculator() 
    289         # Run 
    290         self.startThread() 
     290        for data_ref, pr in self._data_list.items(): 
     291            self._data_set = GuiUtils.dataFromItem(data_ref) 
     292            self._calculator = pr 
     293            # Set data before running the calculations 
     294            self.update_calculator() 
     295            # Run 
     296            self.startThread() 
    291297 
    292298    def model_changed(self): 
     
    355361 
    356362        for data in data_item: 
     363            # Data references 
    357364            self._data = data 
    358365            self._data_set = GuiUtils.dataFromItem(data) 
    359366            self.populateDataComboBox(self._data_set.filename) 
     367            self._data_list[self._data] = self._calculator 
    360368 
    361369            # Estimate initial values from data 
     
    363371            self.logic = InversionLogic(self._data_set) 
    364372 
     373            # Estimate q range 
    365374            qmin, qmax = self.logic.computeDataRange() 
    366  
    367375            self.model.setItem(WIDGETS.W_QMIN, QtGui.QStandardItem( 
    368376                "{:.4g}".format(qmin))) 
     
    371379 
    372380            self.enableButtons() 
    373  
    374             # TODO: Only load 1st data until batch mode working. Thus, break 
    375             break 
    376381 
    377382    ###################################################################### 
     
    527532        self._calculator = pr 
    528533        # Append data to data list 
    529         self._data_list.append({self._data: pr}) 
     534        self._data_list[self._data] = self._calculator.clone() 
    530535 
    531536        if self.pr_plot is None: 
Note: See TracChangeset for help on using the changeset viewer.