Changes in / [02226a2:259b116] in sasmodels
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
.travis.yml
r5c36bf1 rf3767c2 9 9 - os: linux 10 10 env: 11 - PY=3. 611 - PY=3.7 12 12 - os: osx 13 13 language: generic … … 17 17 language: generic 18 18 env: 19 - PY=3. 519 - PY=3.7 20 20 branches: 21 21 only: -
sasmodels/convert.py
r610ef23 r21c93c3 105 105 translation[newid+str(k)] = oldid+str(k) 106 106 # Remove control parameter from the result 107 if model_info.control: 108 translation[model_info.control] = "CONTROL" 107 control_pars = [p.id for p in model_info.parameters.kernel_parameters 108 if p.is_control] 109 if control_pars: 110 control_id = control_pars[0] 111 translation[control_id] = "CONTROL" 109 112 return translation 110 113 -
sasmodels/modelinfo.py
r39a06c9 r4f4d3e3 290 290 example, might be used to set the value of a shape parameter. 291 291 292 These values are set by :func:`make_parameter_table` and 292 Control parameters are used for variant models such as :ref:`rpa` which 293 have different cases with different parameters, as well as models 294 like :ref:`spherical_sld` with its user defined number of shells. 295 The control parameter should appear in the parameter table along with the 296 parameters it is is controlling. For variant models, use *[CASES]* in 297 place of the parameter limits Within the parameter definition table, 298 with case names such as:: 299 300 CASES = ["diblock copolymer", "triblock copolymer", ...] 301 302 This should give *limits=[[case1, case2, ...]]*, but the model loader 303 translates it to *limits=[0, len(CASES)-1]*, and adds *choices=CASES* to 304 the :class:`Parameter` definition. Note that models can use a list of 305 cases as a parameter without it being a control parameter. Either way, 306 the parameter is sent to the model evaluator as *float(choice_num)*, 307 where choices are numbered from 0. :meth:`ModelInfo.get_hidden_parameters` 308 will determine which parameers to display. 309 310 The class contructor should not be called directly, but instead the 311 parameter table is built using :func:`make_parameter_table` and 293 312 :func:`parse_parameter` therein. 294 313 """ … … 845 864 info.single = getattr(kernel_module, 'single', not callable(info.Iq)) 846 865 info.random = getattr(kernel_module, 'random', None) 847 848 # multiplicity info849 control_pars = [p.id for p in parameters.kernel_parameters if p.is_control]850 default_control = control_pars[0] if control_pars else None851 info.control = getattr(kernel_module, 'control', default_control)852 866 info.hidden = getattr(kernel_module, 'hidden', None) # type: ignore 867 868 # Set control flag for explicitly set parameters, e.g., in the RPA model. 869 control = getattr(kernel_module, 'control', None) 870 if control is not None: 871 parameters[control].is_control = True 853 872 854 873 if callable(info.Iq) and parameters.has_2d: … … 903 922 #: *sphere*hardsphere* or *cylinder+sphere*. 904 923 composition = None # type: Optional[Tuple[str, List[ModelInfo]]] 905 #: Name of the control parameter for a variant model such as :ref:`rpa`.906 #: The *control* parameter should appear in the parameter table, with907 #: limits defined as *[CASES]*, for case names such as908 #: *CASES = ["diblock copolymer", "triblock copolymer", ...]*.909 #: This should give *limits=[[case1, case2, ...]]*, but the910 #: model loader translates this to *limits=[0, len(CASES)-1]*, and adds911 #: *choices=CASES* to the :class:`Parameter` definition. Note that912 #: models can use a list of cases as a parameter without it being a913 #: control parameter. Either way, the parameter is sent to the model914 #: evaluator as *float(choice_num)*, where choices are numbered from 0.915 #: See also :attr:`hidden`.916 control = None # type: str917 924 #: Different variants require different parameters. In order to show 918 925 #: just the parameters needed for the variant selected by :attr:`control`, -
sasmodels/product.py
r99658f6 rb171acd 128 128 # Remember the component info blocks so we can build the model 129 129 model_info.composition = ('product', [p_info, s_info]) 130 model_info.control = p_info.control131 130 model_info.hidden = p_info.hidden 132 131 if getattr(p_info, 'profile', None) is not None: -
sasmodels/sasview_model.py
r3a1afed r21c93c3 253 253 254 254 # Process multiplicity 255 control_pars = [p.id for p in model_info.parameters.kernel_parameters 256 if p.is_control] 257 control_id = control_pars[0] if control_pars else None 255 258 non_fittable = [] # type: List[str] 256 259 xlabel = model_info.profile_axes[0] if model_info.profile is not None else "" 257 260 variants = MultiplicityInfo(0, "", [], xlabel) 258 261 for p in model_info.parameters.kernel_parameters: 259 if p. name == model_info.control:262 if p.id == control_id: 260 263 non_fittable.append(p.name) 261 264 variants = MultiplicityInfo( … … 832 835 """ 833 836 if par.name not in self.params: 834 if par. name== self.multiplicity_info.control:837 if par.id == self.multiplicity_info.control: 835 838 return self.multiplicity, [self.multiplicity], [1.0] 836 839 else:
Note: See TracChangeset
for help on using the changeset viewer.