Changeset 18d5c94a in sasview for src/sas/qtgui/Perspectives


Ignore:
Timestamp:
Aug 1, 2018 11:33:42 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
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:
b87dc1a
Parents:
cf8d6c9
Message:

use MultiplicationModel?, fixing SASVIEW-971 and SASVIEW-960; grey-out un-fittable parameters

Location:
src/sas/qtgui/Perspectives/Fitting
Files:
2 edited

Legend:

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

    r57be490 r18d5c94a  
    149149        item.append([item1, item2, item4, item5, item6]) 
    150150    return item 
     151 
     152def markParameterDisabled(model, row): 
     153    """Given the QModel row number, format to show it is not available for 
     154    fitting""" 
     155    items = [model.item(row, c) for c in range(5)] 
     156 
     157    model.blockSignals(True) 
     158 
     159    for item in items: 
     160        if item is None: 
     161            continue 
     162        item.setEditable(False) 
     163        item.setSelectable(False) 
     164        item.setCheckable(False) 
     165 
     166    item = items[0] 
     167 
     168    font = QtGui.QFont() 
     169    font.setItalic(True) 
     170    item.setFont(font) 
     171    item.setForeground(QtGui.QBrush(QtGui.QColor(100, 100, 100))) 
     172    item.setToolTip("This parameter cannot be fitted.") 
     173 
     174    model.blockSignals(False) 
    151175 
    152176def addCheckedListToModel(model, param_list): 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    rdc71408 r18d5c94a  
    1515from PyQt5 import QtWidgets 
    1616 
    17 from sasmodels import product 
    1817from sasmodels import generate 
    1918from sasmodels import modelinfo 
    2019from sasmodels.sasview_model import load_standard_models 
     20from sasmodels.sasview_model import MultiplicationModel 
    2121from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS 
    2222 
     
    19611961        structure_module = generate.load_kernel_module(structure_factor) 
    19621962        structure_parameters = modelinfo.make_parameter_table(getattr(structure_module, 'parameters', [])) 
     1963 
    19631964        structure_kernel = self.models[structure_factor]() 
    1964  
    1965         self.kernel_module._model_info = product.make_product_info(self.kernel_module._model_info, structure_kernel._model_info) 
     1965        form_kernel = self.kernel_module 
     1966 
     1967        self.kernel_module = MultiplicationModel(form_kernel, structure_kernel) 
    19661968 
    19671969        new_rows = FittingUtilities.addSimpleParametersToModel(structure_parameters, self.is2D) 
    19681970        for row in new_rows: 
    19691971            self._model_model.appendRow(row) 
     1972            # disable fitting of parameters not listed in self.kernel_module 
     1973            # (probably radius_effective) 
     1974            if row[0].text() not in self.kernel_module.params.keys(): 
     1975                row_num = self._model_model.rowCount() - 1 
     1976                FittingUtilities.markParameterDisabled(self._model_model, row_num) 
     1977 
    19701978        # Update the counter used for multishell display 
    19711979        self._last_model_row = self._model_model.rowCount() 
Note: See TracChangeset for help on using the changeset viewer.