Changeset fb9a3b6 in sasmodels for sasmodels/core.py
- Timestamp:
- Aug 31, 2017 12:07:59 PM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- bcdd6c9
- Parents:
- 573ffab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/core.py
r2e66ef5 rfb9a3b6 126 126 127 127 128 def load_model_info(model_name ):128 def load_model_info(model_name, force_mixture=False): 129 129 # type: (str) -> modelinfo.ModelInfo 130 130 """ … … 134 134 such as sphere*hardsphere or sphere+cylinder. 135 135 136 *force_mixture* if true, MixtureModel will be used for combining models. 137 Otherwise either MixtureModel will be used for addition and ProductModel 138 will be used for multiplication 139 136 140 This returns a handle to the module defining the model. This can be 137 141 used with functions in generate to build the docs or extract model info. … … 139 143 parts = model_name.split('+') 140 144 if len(parts) > 1: 145 # Always use MixtureModel for addition 141 146 model_info_list = [load_model_info(p) for p in parts] 142 147 return mixture.make_mixture_info(model_info_list) … … 144 149 parts = model_name.split('*') 145 150 if len(parts) > 1: 151 if force_mixture: 152 # Use MixtureModel for multiplication if forced 153 model_info_list = [load_model_info(p) for p in parts] 154 return mixture.make_mixture_info(model_info_list, operation='*') 146 155 if len(parts) > 2: 147 156 raise ValueError("use P*S to apply structure factor S to model P") 157 # Use ProductModel 148 158 P_info, Q_info = [load_model_info(p) for p in parts] 149 159 return product.make_product_info(P_info, Q_info)
Note: See TracChangeset
for help on using the changeset viewer.