Changeset 5fb714b in sasview for src/sas/qtgui/Perspectives/Fitting


Ignore:
Timestamp:
Sep 7, 2018 10:30:38 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:
c0de493
Parents:
b69b549
Message:

fix crash when selecting *only* S(Q)

File:
1 edited

Legend:

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

    rb69b549 r5fb714b  
    20972097            return 
    20982098 
    2099         s_kernel = self.models[structure_factor]() 
    2100         p_kernel = self.kernel_module 
    2101  
    2102         # if p_kernel is None: 
    2103         #     # Not a product model, just S(Q) 
    2104         #     self.kernel_module = s_kernel 
    2105         #     params = modelinfo.ParameterTable(self.kernel_module._model_info.parameters.kernel_parameters) 
    2106         #     FittingUtilities.addSimpleParametersToModel(params, self.is2D) 
    2107         # else: 
    2108         p_pars_len = len(p_kernel._model_info.parameters.kernel_parameters) 
    2109         s_pars_len = len(s_kernel._model_info.parameters.kernel_parameters) 
    2110  
    2111         self.kernel_module = MultiplicationModel(p_kernel, s_kernel) 
    2112         all_params = self.kernel_module._model_info.parameters.kernel_parameters 
    2113         all_param_names = [param.name for param in all_params] 
    2114  
    2115         # S(Q) params from the product model are not necessarily the same as those from the S(Q) model; any 
    2116         # conflicting names with P(Q) params will cause a rename 
    2117  
    2118         if "radius_effective_mode" in all_param_names: 
    2119             # Show all parameters 
    2120             s_params = modelinfo.ParameterTable(all_params[p_pars_len:p_pars_len+s_pars_len]) 
    2121             s_params_orig = modelinfo.ParameterTable(s_kernel._model_info.parameters.kernel_parameters) 
     2099        if self.kernel_module is None: 
     2100            # Structure factor is the only selected model; build it and show all its params 
     2101            self.kernel_module = self.models[structure_factor]() 
     2102            s_params = self.kernel_module._model_info.parameters 
     2103            s_params_orig = s_params 
     2104 
    21222105        else: 
    2123             # Ensure radius_effective is not displayed 
    2124             s_params_orig = modelinfo.ParameterTable(s_kernel._model_info.parameters.kernel_parameters[1:]) 
    2125             if "radius_effective" in all_param_names: 
    2126                 s_params = modelinfo.ParameterTable(all_params[p_pars_len+1:p_pars_len+s_pars_len]) 
     2106            s_kernel = self.models[structure_factor]() 
     2107            p_kernel = self.kernel_module 
     2108 
     2109            p_pars_len = len(p_kernel._model_info.parameters.kernel_parameters) 
     2110            s_pars_len = len(s_kernel._model_info.parameters.kernel_parameters) 
     2111 
     2112            self.kernel_module = MultiplicationModel(p_kernel, s_kernel) 
     2113            all_params = self.kernel_module._model_info.parameters.kernel_parameters 
     2114            all_param_names = [param.name for param in all_params] 
     2115 
     2116            # S(Q) params from the product model are not necessarily the same as those from the S(Q) model; any 
     2117            # conflicting names with P(Q) params will cause a rename 
     2118 
     2119            if "radius_effective_mode" in all_param_names: 
     2120                # Show all parameters 
     2121                s_params = modelinfo.ParameterTable(all_params[p_pars_len:p_pars_len+s_pars_len]) 
     2122                s_params_orig = modelinfo.ParameterTable(s_kernel._model_info.parameters.kernel_parameters) 
    21272123            else: 
    2128                 s_params = modelinfo.ParameterTable(all_params[p_pars_len:p_pars_len+s_pars_len-1]) 
     2124                # Ensure radius_effective is not displayed 
     2125                s_params_orig = modelinfo.ParameterTable(s_kernel._model_info.parameters.kernel_parameters[1:]) 
     2126                if "radius_effective" in all_param_names: 
     2127                    s_params = modelinfo.ParameterTable(all_params[p_pars_len+1:p_pars_len+s_pars_len]) 
     2128                else: 
     2129                    s_params = modelinfo.ParameterTable(all_params[p_pars_len:p_pars_len+s_pars_len-1]) 
    21292130 
    21302131        # Add heading row 
Note: See TracChangeset for help on using the changeset viewer.