Changeset d00475d in sasview for src/sas/qtgui/Perspectives


Ignore:
Timestamp:
Oct 26, 2018 4:44:15 AM (5 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
b1b71ad
Parents:
a3c59503 (diff), 75906a1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ESS_GUI' into ESS_GUI_project_save

Location:
src/sas/qtgui/Perspectives
Files:
6 edited

Legend:

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

    rb8dccb8 rd00475d  
    15731573        if param_dict is None: 
    15741574            return 
     1575        if hasattr(res, 'convergence') and len(res.convergence)>0: 
     1576            self.communicate.resultPlotUpdateSignal.emit(result[0]) 
    15751577 
    15761578        elapsed = result[1] 
     
    23332335        max_column = self.lstParams.itemDelegate().param_max 
    23342336        if model_column == param_column: 
    2335             self.kernel_module.setParam(parameter_name, value) 
     2337            # don't try to update multiplicity counters if they aren't there. 
     2338            # Note that this will fail for proper bad update where the model 
     2339            # doesn't contain multiplicity parameter 
     2340            if parameter_name != self.kernel_module.multiplicity_info.control: 
     2341                self.kernel_module.setParam(parameter_name, value) 
    23362342        elif model_column == min_column: 
    23372343            # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf] 
     
    33733379        else: 
    33743380            index = self.theory_item 
     3381        params = FittingUtilities.getStandardParam(self._model_model) 
    33753382        report_logic = ReportPageLogic(self, 
    33763383                                       kernel_module=self.kernel_module, 
    33773384                                       data=self.data, 
    33783385                                       index=index, 
    3379                                        model=self._model_model) 
     3386                                       params=params) 
    33803387 
    33813388        return report_logic.reportList() 
  • src/sas/qtgui/Perspectives/Fitting/ReportPageLogic.py

    r085ee014 r75906a1  
    1313 
    1414import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    15 from sas.qtgui.Perspectives.Fitting import FittingUtilities 
    1615 
    1716class ReportPageLogic(object): 
     
    1918    Logic for the Report Page functionality. Refactored from FittingWidget. 
    2019    """ 
    21     def __init__(self, parent=None, kernel_module=None, data=None, index=None, model=None): 
     20    def __init__(self, parent=None, kernel_module=None, data=None, index=None, params=None): 
    2221 
    2322        self.parent = parent 
     
    2524        self.data = data 
    2625        self._index = index 
    27         self.model = model 
     26        self.params = params 
    2827 
    2928    @staticmethod 
     
    119118        Look at widget state and extract parameters 
    120119        """ 
    121         pars = FittingUtilities.getStandardParam(self.model) 
    122         if pars is None: 
     120        if self.params is None: 
    123121            return "" 
    124122 
    125123        report = "" 
    126124        plus_minus = " &#177; " 
    127         for value in pars: 
     125        for value in self.params: 
    128126            try: 
    129127                par_name = value[1] 
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    r6ae7466 raed159f  
    473473            self._calculator.set_qmax(qmax) 
    474474            if np.size(self.logic.data.dy) == 0 or np.all(self.logic.data.dy) == 0: 
    475                 self.logic.data.dy = self._calculator.add_errors(self.logic.data.y) 
     475                self._calculator.add_errors() 
    476476            self.updateDataList(data) 
    477477            self.populateDataComboBox(self.logic.data.filename, data) 
  • src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py

    rd2007a8 ra3c59503  
    112112    def onLatexCopy(self): 
    113113        self.currentTab.onCopyToClipboard("Latex") 
     114 
     115    def serializeAllFitpage(self): 
     116        # serialize all active fitpages and return 
     117        # a dictionary: {data_id: fitpage_state} 
     118        params = {} 
     119        for i, tab in enumerate(self.tabs): 
     120            tab_data = self.getSerializedFitpage(tab) 
     121            if tab.tab_id is None: continue 
     122            id = tab_data['data_id'][0] 
     123            params[id] = tab_data 
     124        return params 
     125 
     126    def serializeCurrentFitpage(self): 
     127        # serialize current(active) fitpage 
     128        return self.getSerializedFitpage(self.currentTab) 
     129 
     130    def getSerializedFitpage(self, tab): 
     131        """ 
     132        get serialize requested fit tab 
     133        """ 
     134        fitpage_state = tab.getFitPage() 
     135        fitpage_state += tab.getFitModel() 
     136        # put the text into dictionary 
     137        line_dict = {} 
     138        for line in fitpage_state: 
     139            #content = line.split(',') 
     140            if len(line) > 1: 
     141                line_dict[line[0]] = line[1:] 
     142        return line_dict 
     143 
     144    def currentTabDataId(self): 
     145        """ 
     146        Returns the data ID of the current tab 
     147        """ 
     148        tab_id = None 
     149        if self.currentTab.data: 
     150            tab_id = self.currentTab.data.id 
     151        return tab_id 
     152 
     153    def updateFromParameters(self, parameters): 
     154        """ 
     155        Pass the update parameters to the current fit page 
     156        """ 
     157        self.currentTab.createPageForParameters(parameters) 
    114158 
    115159    def closeEvent(self, event): 
     
    258302        return True 
    259303 
     304    def isSerializable(self): 
     305        """ 
     306        Tell the caller that this perspective writes its state 
     307        """ 
     308        return True 
     309 
    260310    def setData(self, data_item=None, is_batch=False): 
    261311        """ 
     
    337387        pass 
    338388 
     389    def getCurrentStateAsXml(self): 
     390        """ 
     391        Returns an XML version of the current state 
     392        """ 
     393        state = {} 
     394        for tab in self.tabs: 
     395            pass 
     396        return state 
     397 
    339398    @property 
    340399    def currentTab(self): 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/ComplexConstraintTest.py

    r725d9c06 r2eeda93  
    3434        category_index = self.tab1.cbCategory.findText("Shape Independent") 
    3535        self.tab1.cbCategory.setCurrentIndex(category_index) 
     36        model_index = self.tab1.cbModel.findText("be_polyelectrolyte") 
     37        self.tab1.cbModel.setCurrentIndex(model_index) 
     38 
    3639        category_index = self.tab2.cbCategory.findText("Cylinder") 
    3740        self.tab2.cbCategory.setCurrentIndex(category_index) 
     41        model_index = self.tab2.cbModel.findText("barbell") 
     42        self.tab2.cbModel.setCurrentIndex(model_index) 
    3843 
    3944        tabs = [self.tab1, self.tab2] 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    rd2007a8 r2eeda93  
    175175        category_index = self.widget.cbCategory.findText("Shape Independent") 
    176176        self.widget.cbCategory.setCurrentIndex(category_index) 
     177        model_index = self.widget.cbModel.findText("be_polyelectrolyte") 
     178        self.widget.cbModel.setCurrentIndex(model_index) 
    177179 
    178180        # test the model combo content 
    179         self.assertEqual(self.widget.cbModel.count(), 29) 
     181        self.assertEqual(self.widget.cbModel.count(), 30) 
    180182 
    181183        # Try to change back to default 
     
    201203        category_index = self.widget.cbCategory.findText("Shape Independent") 
    202204        self.widget.cbCategory.setCurrentIndex(category_index) 
     205        model_index = self.widget.cbModel.findText("be_polyelectrolyte") 
     206        self.widget.cbModel.setCurrentIndex(model_index) 
    203207 
    204208        # check the enablement of controls 
     
    215219        #  
    216220        # Now change the model 
    217         self.widget.cbModel.setCurrentIndex(3) 
     221        self.widget.cbModel.setCurrentIndex(4) 
    218222        self.assertEqual(self.widget.cbModel.currentText(),'dab') 
    219223 
     
    226230        self.widget.data_is_loaded = True 
    227231        # Reset the sasmodel index 
    228         self.widget.cbModel.setCurrentIndex(1) 
     232        self.widget.cbModel.setCurrentIndex(2) 
    229233        self.assertEqual(self.widget.cbModel.currentText(),'broad_peak') 
    230234 
     
    377381        category_index = self.widget.cbCategory.findText("Shape Independent") 
    378382        self.widget.cbCategory.setCurrentIndex(category_index) 
     383        model_index = self.widget.cbModel.findText("be_polyelectrolyte") 
     384        self.widget.cbModel.setCurrentIndex(model_index) 
     385 
    379386        # Check the poly model 
    380387        self.assertEqual(self.widget._poly_model.rowCount(), 0) 
     
    383390        # Change the category index so we have a model available 
    384391        self.widget.cbCategory.setCurrentIndex(2) 
     392        self.widget.cbModel.setCurrentIndex(1) 
    385393 
    386394        # Check the poly model 
     
    556564        category_index = self.widget.cbCategory.findText("Sphere") 
    557565        self.widget.cbCategory.setCurrentIndex(category_index) 
     566        model_index = self.widget.cbModel.findText("adsorbed_layer") 
     567        self.widget.cbModel.setCurrentIndex(model_index) 
    558568 
    559569        # Check the magnetic model 
     
    634644        category_index = self.widget.cbCategory.findText("Sphere") 
    635645        self.widget.cbCategory.setCurrentIndex(category_index) 
     646        model_index = self.widget.cbModel.findText("adsorbed_layer") 
     647        self.widget.cbModel.setCurrentIndex(model_index) 
    636648 
    637649        # Check the enablement/text 
     
    973985        category_index = self.widget.cbCategory.findText("Sphere") 
    974986        self.widget.cbCategory.setCurrentIndex(category_index) 
     987        model_index = self.widget.cbModel.findText("adsorbed_layer") 
     988        self.widget.cbModel.setCurrentIndex(model_index) 
    975989        self.widget.main_params_to_fit = ['scale'] 
    976990 
     
    9861000        self.assertListEqual(fp.main_params_to_fit, ['scale']) 
    9871001 
    988     def testPushFitPage(self): 
     1002    def notestPushFitPage(self): 
    9891003        """ 
    9901004        Push current state of fitpage onto stack 
     
    9971011        self.widget.data = item 
    9981012        category_index = self.widget.cbCategory.findText("Sphere") 
     1013        model_index = self.widget.cbModel.findText("adsorbed_layer") 
     1014        self.widget.cbModel.setCurrentIndex(model_index) 
    9991015 
    10001016        # Asses the initial state of stack 
Note: See TracChangeset for help on using the changeset viewer.