Changeset b171acd in sasmodels for sasmodels/modelinfo.py
- Timestamp:
- Jan 29, 2019 1:54:28 PM (5 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 4f4d3e3
- Parents:
- 15c80af
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/modelinfo.py
rbd547d0 rb171acd 291 291 example, might be used to set the value of a shape parameter. 292 292 293 These values are set by :func:`make_parameter_table` and 293 Control parameters are used for variant models such as :ref:`rpa` which 294 have different cases with different parameters, as well as models 295 like :ref:`spherical_sld` with its user defined number of shells. 296 The control parameter should appear in the parameter table along with the 297 parameters it is is controlling. For variant models, use *[CASES]* in 298 place of the parameter limits Within the parameter definition table, 299 with case names such as:: 300 301 CASES = ["diblock copolymer", "triblock copolymer", ...] 302 303 This should give *limits=[[case1, case2, ...]]*, but the model loader 304 translates it to *limits=[0, len(CASES)-1]*, and adds *choices=CASES* to 305 the :class:`Parameter` definition. Note that models can use a list of 306 cases as a parameter without it being a control parameter. Either way, 307 the parameter is sent to the model evaluator as *float(choice_num)*, 308 where choices are numbered from 0. :meth:`ModelInfo.get_hidden_parameters` 309 will determine which parameers to display. 310 311 The class contructor should not be called directly, but instead the 312 parameter table is built using :func:`make_parameter_table` and 294 313 :func:`parse_parameter` therein. 295 314 """ … … 813 832 info.single = getattr(kernel_module, 'single', not callable(info.Iq)) 814 833 info.random = getattr(kernel_module, 'random', None) 815 816 # multiplicity info817 control_pars = [p.id for p in parameters.kernel_parameters if p.is_control]818 default_control = control_pars[0] if control_pars else None819 info.control = getattr(kernel_module, 'control', default_control)820 834 info.hidden = getattr(kernel_module, 'hidden', None) # type: ignore 821 835 … … 872 886 #: *sphere*hardsphere* or *cylinder+sphere*. 873 887 composition = None # type: Optional[Tuple[str, List[ModelInfo]]] 874 #: Name of the control parameter for a variant model such as :ref:`rpa`.875 #: The *control* parameter should appear in the parameter table, with876 #: limits defined as *[CASES]*, for case names such as877 #: *CASES = ["diblock copolymer", "triblock copolymer", ...]*.878 #: This should give *limits=[[case1, case2, ...]]*, but the879 #: model loader translates this to *limits=[0, len(CASES)-1]*, and adds880 #: *choices=CASES* to the :class:`Parameter` definition. Note that881 #: models can use a list of cases as a parameter without it being a882 #: control parameter. Either way, the parameter is sent to the model883 #: evaluator as *float(choice_num)*, where choices are numbered from 0.884 #: See also :attr:`hidden`.885 control = None # type: str886 888 #: Different variants require different parameters. In order to show 887 889 #: just the parameters needed for the variant selected by :attr:`control`,
Note: See TracChangeset
for help on using the changeset viewer.