Changeset 481ff64 in sasmodels
- Timestamp:
- Sep 5, 2017 4:38:34 AM (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:
- 6a5ccfb
- Parents:
- 61a4bd4
- git-author:
- Lewis O'Driscoll <lewis.o'driscoll@…> (09/05/17 04:38:13)
- git-committer:
- Lewis O'Driscoll <lewis.o'driscoll@…> (09/05/17 04:38:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/core.py
r61a4bd4 r481ff64 125 125 dtype=dtype, platform=platform) 126 126 127 128 # def load_model_info(model_name, force_mixture=False):129 # # type: (str) -> modelinfo.ModelInfo130 # """131 # Load a model definition given the model name.132 133 # *model_name* is the name of the model, or perhaps a model expression134 # such as sphere*hardsphere or sphere+cylinder.135 136 # *force_mixture* if true, MixtureModel will be used for combining models.137 # Otherwise either MixtureModel will be used for addition and ProductModel138 # will be used for multiplication139 140 # This returns a handle to the module defining the model. This can be141 # used with functions in generate to build the docs or extract model info.142 # """143 # parts = model_name.split('+')144 # if len(parts) > 1:145 # # Always use MixtureModel for addition146 # model_info_list = [load_model_info(p) for p in parts]147 # return mixture.make_mixture_info(model_info_list)148 149 # parts = model_name.split('*')150 # if len(parts) > 1:151 # if force_mixture:152 # # Use MixtureModel for multiplication if forced153 # model_info_list = [load_model_info(p) for p in parts]154 # return mixture.make_mixture_info(model_info_list, operation='*')155 # if len(parts) > 2:156 # raise ValueError("use P*S to apply structure factor S to model P")157 # # Use ProductModel158 # P_info, Q_info = [load_model_info(p) for p in parts]159 # return product.make_product_info(P_info, Q_info)160 161 # kernel_module = generate.load_kernel_module(model_name)162 # return modelinfo.make_model_info(kernel_module)163 164 127 def load_model_info(model_string): 165 128 # type: (str) -> modelinfo.ModelInfo … … 167 130 Load a model definition given the model name. 168 131 169 *model_name* is the name of the model, or perhaps a model expression 170 such as sphere*hardsphere or sphere+cylinder. 132 *model_string* is the name of the model, or perhaps a model expression 133 such as sphere*cylinder or sphere+cylinder. Use '@' for a structure 134 factor product, eg sphere@hardsphere. 171 135 172 136 This returns a handle to the module defining the model. This can be 173 137 used with functions in generate to build the docs or extract model info. 174 138 """ 175 # TODO: parse an expression like form@structure to create a P(Q)*S(Q) model 139 if '@' in model_string: 140 parts = model_string.split('@') 141 if len(parts) != 2: 142 raise ValueError("Use P@S to apply a structure factor S to model P") 143 P_info, Q_info = [load_model_info(part) for part in parts] 144 return product.make_product_info(P_info, Q_info) 145 176 146 product_parts = [] 177 147 addition_parts = []
Note: See TracChangeset
for help on using the changeset viewer.