Changes in / [259b116:02226a2] in sasmodels
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
.travis.yml
rf3767c2 r5c36bf1 9 9 - os: linux 10 10 env: 11 - PY=3. 711 - PY=3.6 12 12 - os: osx 13 13 language: generic … … 17 17 language: generic 18 18 env: 19 - PY=3. 719 - PY=3.5 20 20 branches: 21 21 only: -
sasmodels/convert.py
r21c93c3 r610ef23 105 105 translation[newid+str(k)] = oldid+str(k) 106 106 # Remove control parameter from the result 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" 107 if model_info.control: 108 translation[model_info.control] = "CONTROL" 112 109 return translation 113 110 -
sasmodels/modelinfo.py
r4f4d3e3 r39a06c9 290 290 example, might be used to set the value of a shape parameter. 291 291 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 292 These values are set by :func:`make_parameter_table` and 312 293 :func:`parse_parameter` therein. 313 294 """ … … 864 845 info.single = getattr(kernel_module, 'single', not callable(info.Iq)) 865 846 info.random = getattr(kernel_module, 'random', None) 847 848 # multiplicity info 849 control_pars = [p.id for p in parameters.kernel_parameters if p.is_control] 850 default_control = control_pars[0] if control_pars else None 851 info.control = getattr(kernel_module, 'control', default_control) 866 852 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 = True872 853 873 854 if callable(info.Iq) and parameters.has_2d: … … 922 903 #: *sphere*hardsphere* or *cylinder+sphere*. 923 904 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, with 907 #: limits defined as *[CASES]*, for case names such as 908 #: *CASES = ["diblock copolymer", "triblock copolymer", ...]*. 909 #: This should give *limits=[[case1, case2, ...]]*, but the 910 #: model loader translates this to *limits=[0, len(CASES)-1]*, and adds 911 #: *choices=CASES* to the :class:`Parameter` definition. Note that 912 #: models can use a list of cases as a parameter without it being a 913 #: control parameter. Either way, the parameter is sent to the model 914 #: evaluator as *float(choice_num)*, where choices are numbered from 0. 915 #: See also :attr:`hidden`. 916 control = None # type: str 924 917 #: Different variants require different parameters. In order to show 925 918 #: just the parameters needed for the variant selected by :attr:`control`, -
sasmodels/product.py
rb171acd r99658f6 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.control 130 131 model_info.hidden = p_info.hidden 131 132 if getattr(p_info, 'profile', None) is not None: -
sasmodels/sasview_model.py
r21c93c3 r3a1afed 253 253 254 254 # Process multiplicity 255 control_pars = [p.id for p in model_info.parameters.kernel_parameters256 if p.is_control]257 control_id = control_pars[0] if control_pars else None258 255 non_fittable = [] # type: List[str] 259 256 xlabel = model_info.profile_axes[0] if model_info.profile is not None else "" 260 257 variants = MultiplicityInfo(0, "", [], xlabel) 261 258 for p in model_info.parameters.kernel_parameters: 262 if p. id == control_id:259 if p.name == model_info.control: 263 260 non_fittable.append(p.name) 264 261 variants = MultiplicityInfo( … … 835 832 """ 836 833 if par.name not in self.params: 837 if par. id== self.multiplicity_info.control:834 if par.name == self.multiplicity_info.control: 838 835 return self.multiplicity, [self.multiplicity], [1.0] 839 836 else:
Note: See TracChangeset
for help on using the changeset viewer.