Changeset f712bf30 in sasview


Ignore:
Timestamp:
Sep 9, 2018 2:56:21 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:
bb477f5
Parents:
2b8286c
Message:

add default number of shells when a multi-shell model is selected

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

Legend:

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

    r0dcb71d rf712bf30  
    28132813        self._n_shells_row = shell_row - 1 
    28142814 
    2815         # Set the index to the state-kept value 
    2816         func.setCurrentIndex(self.current_shell_displayed 
    2817                              if self.current_shell_displayed < func.count() else 0) 
     2815        # Get the default number of shells for the model 
     2816        kernel_pars = self.kernel_module._model_info.parameters.kernel_parameters 
     2817        shell_par = None 
     2818        for par in kernel_pars: 
     2819            if par.name == param_name: 
     2820                shell_par = par 
     2821                break 
     2822        if not shell_par: 
     2823            logger.error("Could not find %s in kernel parameters.", param_name) 
     2824        default_shell_count = shell_par.default 
     2825 
     2826        # Add default number of shells to the model 
     2827        func.setCurrentIndex(default_shell_count) 
    28182828 
    28192829    def modifyShellsInList(self, index): 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r4ea8020 rf712bf30  
    613613 
    614614        # Check that the number of rows increased 
     615        # (note that n == 1 by default in core_multi_shell so this increases index by 2) 
    615616        more_rows = self.widget._model_model.rowCount() - last_row 
    616         self.assertEqual(more_rows, 6) # 6 new rows: 2 params per index 
    617  
    618         # Back to 0 
     617        self.assertEqual(more_rows, 4) # 4 new rows: 2 params per index 
     618 
     619        # Set to 0 
    619620        self.widget.lstParams.indexWidget(func_index).setCurrentIndex(0) 
    620         self.assertEqual(self.widget._model_model.rowCount(), last_row) 
     621        self.assertEqual(self.widget._model_model.rowCount(), last_row - 2) # 2 fewer rows than default 
    621622 
    622623    def testPlotTheory(self): 
Note: See TracChangeset for help on using the changeset viewer.