Ignore:
Timestamp:
Sep 7, 2018 10:33:01 AM (6 years ago)
Author:
GitHub <noreply@…>
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:
9d23e4c, c0de493
Parents:
c2f3ca2 (diff), 5fb714b (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.
git-author:
Torin Cooper-Bennun <40573959+tcbennun@…> (09/07/18 10:33:01)
git-committer:
GitHub <noreply@…> (09/07/18 10:33:01)
Message:

Merge pull request #171 from SasView?/ESS_GUI_iss1032

SASVIEW-1032: Support for fixed-choice model parameters, e.g structure_factor_mode

File:
1 edited

Legend:

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

    rc2f3ca2 rf0365a2e  
    20732073        self.shell_names = self.shellNamesList() 
    20742074 
    2075         # Get new rows for QModel 
    2076         new_rows = FittingUtilities.addParametersToModel(self.model_parameters, self.kernel_module, self.is2D) 
    2077  
    20782075        # Add heading row 
    20792076        FittingUtilities.addHeadingRowToModel(self._model_model, model_name) 
    20802077 
    2081         # Update QModel 
    2082         for row in new_rows: 
    2083             self._model_model.appendRow(row) 
     2078        # Update the QModel 
     2079        FittingUtilities.addParametersToModel( 
     2080                self.model_parameters, 
     2081                self.kernel_module, 
     2082                self.is2D, 
     2083                self._model_model, 
     2084                self.lstParams) 
    20842085 
    20852086    def fromStructureFactorToQModel(self, structure_factor): 
     
    20902091            return 
    20912092 
    2092         s_kernel = self.models[structure_factor]() 
    2093         p_kernel = self.kernel_module 
    2094  
    2095         if p_kernel is None: 
    2096             # Not a product model, just S(Q) 
    2097             self.kernel_module = s_kernel 
    2098             params = modelinfo.ParameterTable(self.kernel_module._model_info.parameters.kernel_parameters) 
    2099             new_rows = FittingUtilities.addSimpleParametersToModel(params, self.is2D) 
     2093        if self.kernel_module is None: 
     2094            # Structure factor is the only selected model; build it and show all its params 
     2095            self.kernel_module = self.models[structure_factor]() 
     2096            s_params = self.kernel_module._model_info.parameters 
     2097            s_params_orig = s_params 
     2098 
    21002099        else: 
     2100            s_kernel = self.models[structure_factor]() 
     2101            p_kernel = self.kernel_module 
     2102 
    21012103            p_pars_len = len(p_kernel._model_info.parameters.kernel_parameters) 
    21022104            s_pars_len = len(s_kernel._model_info.parameters.kernel_parameters) 
     
    21072109 
    21082110            # S(Q) params from the product model are not necessarily the same as those from the S(Q) model; any 
    2109             # conflicting names with P(Q) params will cause a rename; we also lose radius_effective (for now...) 
    2110  
    2111             # TODO: merge rest of beta approx implementation in 
    2112             # This is to ensure compatibility when we merge beta approx support in...! 
    2113  
    2114             # radius_effective is always s_params[0] 
    2115  
    2116             # if radius_effective_mode is in all_params, then all_params contains radius_effective and we want to 
    2117             # keep it in the model 
    2118  
    2119             # if radius_effective_mode is NOT in all_params, then radius_effective should NOT be kept, because the user 
    2120             # cannot specify it themselves; but, make sure we only remove it if it's actually there in the first place 
    2121             # (sasmodels master removes it already) 
     2111            # conflicting names with P(Q) params will cause a rename 
     2112 
    21222113            if "radius_effective_mode" in all_param_names: 
    21232114                # Show all parameters 
     
    21322123                    s_params = modelinfo.ParameterTable(all_params[p_pars_len:p_pars_len+s_pars_len-1]) 
    21332124 
    2134             # Get new rows for QModel 
    2135             # Any renamed parameters are stored as data in the relevant item, for later handling 
    2136             new_rows = FittingUtilities.addSimpleParametersToModel(s_params, self.is2D, s_params_orig) 
    2137  
    2138             # TODO: merge rest of beta approx implementation in 
    2139             # These parameters are not part of P(Q) nor S(Q), but are added only to the product model (e.g. specifying 
    2140             # structure factor calculation mode) 
    2141             # product_params = all_params[p_pars_len+s_pars_len:] 
    2142  
    21432125        # Add heading row 
    21442126        FittingUtilities.addHeadingRowToModel(self._model_model, structure_factor) 
    21452127 
    2146         # Update QModel 
    2147         for row in new_rows: 
    2148             self._model_model.appendRow(row) 
    2149             # disable fitting of parameters not listed in self.kernel_module (probably radius_effective) 
    2150             # if row[0].text() not in self.kernel_module.params.keys(): 
    2151             #     row_num = self._model_model.rowCount() - 1 
    2152             #     FittingUtilities.markParameterDisabled(self._model_model, row_num) 
     2128        # Get new rows for QModel 
     2129        # Any renamed parameters are stored as data in the relevant item, for later handling 
     2130        FittingUtilities.addSimpleParametersToModel( 
     2131                s_params, 
     2132                self.is2D, 
     2133                s_params_orig, 
     2134                self._model_model, 
     2135                self.lstParams) 
    21532136 
    21542137    def haveParamsToFit(self): 
     
    28132796            self._model_model.removeRows(first_row, remove_rows) 
    28142797 
    2815         new_rows = FittingUtilities.addShellsToModel(self.model_parameters, self._model_model, index, first_row) 
     2798        new_rows = FittingUtilities.addShellsToModel( 
     2799                self.model_parameters, 
     2800                self._model_model, 
     2801                index, 
     2802                first_row, 
     2803                self.lstParams) 
     2804 
    28162805        self._num_shell_params = len(new_rows) 
    2817  
    28182806        self.current_shell_displayed = index 
    28192807 
Note: See TracChangeset for help on using the changeset viewer.