Changeset 5b0335b in sasmodels for sasmodels/core.py
- Timestamp:
- Apr 4, 2016 9:36:11 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 68e7f9d
- Parents:
- 885ee37 (diff), 204fd9b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/core.py
rfb5914f r5b0335b 2 2 Core model handling routines. 3 3 """ 4 __all__ = [ 5 "list_models", "load_model_info", "precompile_dll", 6 "build_model", "make_kernel", "call_kernel", "call_ER_VR", 7 ] 4 8 5 9 from os.path import basename, dirname, join as joinpath, splitext … … 39 43 return module 40 44 41 42 43 __all__ = [ 44 "list_models", "load_model_info", "precompile_dll", 45 "build_model", "call_kernel", "call_ER_VR", 46 ] 45 try: 46 np.meshgrid([]) 47 meshgrid = np.meshgrid 48 except ValueError: 49 # CRUFT: np.meshgrid requires multiple vectors 50 def meshgrid(*args): 51 if len(args) > 1: 52 return np.meshgrid(*args) 53 else: 54 return [np.asarray(v) for v in args] 47 55 48 56 def list_models(): … … 90 98 return product.make_product_info(P_info, Q_info) 91 99 92 return make_model_by_name(model_name) 93 94 95 def make_model_by_name(model_name): 100 kernel_module = load_kernel_module(model_name) 101 return generate.make_model_info(kernel_module) 102 103 104 def load_kernel_module(model_name): 96 105 if model_name.endswith('.py'): 97 106 path = model_name … … 106 115 kernel_module = getattr(models, model_name, None) 107 116 #import sys; print "\n".join(sys.path) 108 return generate.make_model_info(kernel_module) 117 __import__('sasmodels.models.'+model_name) 118 kernel_module = getattr(models, model_name, None) 119 return kernel_module 109 120 110 121 … … 210 221 """ 211 222 value, weight = zip(*pars) 212 value = [v.flatten() for v in np.meshgrid(*value)]213 weight = np.vstack([v.flatten() for v in np.meshgrid(*weight)])223 value = [v.flatten() for v in meshgrid(*value)] 224 weight = np.vstack([v.flatten() for v in meshgrid(*weight)]) 214 225 weight = np.prod(weight, axis=0) 215 226 return value, weight
Note: See TracChangeset
for help on using the changeset viewer.