Changeset 358b39d in sasview for src


Ignore:
Timestamp:
May 30, 2017 10:14:11 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
aca8418
Parents:
c1e380e
Message:

Minor improvements to the polydisp. function layout

File:
1 edited

Legend:

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

    rc1e380e r358b39d  
    1616from sasmodels import modelinfo 
    1717from sasmodels.sasview_model import load_standard_models 
     18from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS 
     19 
    1820from sas.sascalc.fit.BumpsFitting import BumpsFit as Fit 
    1921 
     
    4042CATEGORY_STRUCTURE = "Structure Factor" 
    4143STRUCTURE_DEFAULT = "None" 
     44 
     45DEFAULT_POLYDISP_FUNCTION = 'gaussian' 
    4246 
    4347# Mapping between column index and relevant parameter name extension 
     
    479483        parameter_name = str(name_index.data().toString()).lower() # "distribution of sld" etc. 
    480484        if "distribution of" in parameter_name: 
    481             parameter_name = parameter_name[16:] 
     485            # just the last word 
     486            parameter_name = parameter_name.rsplit()[-1] 
    482487 
    483488        # Extract changed value. Assumes proper validation by QValidator/Delegate 
     
    9981003        poly_params = self.checkedListFromModel(self._poly_model) 
    9991004        # Retrieve poly params names 
    1000         poly_params = [param[16:]+'.width' for param in poly_params] 
     1005        poly_params = [param.rsplit()[-1] + '.width' for param in poly_params] 
    10011006        # TODO : add magnetic params 
    10021007 
     
    12071212            FittingUtilities.addCheckedListToModel(self._poly_model, checked_list) 
    12081213 
    1209             #TODO: Need to find cleaner way to input functions 
     1214            # All possible polydisp. functions as strings in combobox 
    12101215            func = QtGui.QComboBox() 
    1211             func.addItems(['rectangle', 'array', 'lognormal', 'gaussian', 'schulz',]) 
     1216            func.addItems([str(name_disp) for name_disp in POLYDISPERSITY_MODELS.iterkeys()]) 
     1217            # Default index 
     1218            func.setCurrentIndex(func.findText(DEFAULT_POLYDISP_FUNCTION)) 
     1219            # Index in the view 
    12121220            func_index = self.lstPoly.model().index(row, 6) 
     1221            # Set the combobox in cell 
    12131222            self.lstPoly.setIndexWidget(func_index, func) 
    12141223 
Note: See TracChangeset for help on using the changeset viewer.