Changeset aa4946b in sasmodels for sasmodels/bumps_model.py
- Timestamp:
- Mar 11, 2015 11:15:40 PM (9 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:
- af1d68c
- Parents:
- 49d1d42f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/bumps_model.py
r63b32bb raa4946b 1 1 """ 2 Sasmodels core.2 Wrap sasmodels for direct use by bumps. 3 3 """ 4 4 5 import datetime 5 6 6 from sasmodels import sesans 7 import numpy as np 8 9 from . import sesans 7 10 8 11 # CRUFT python 2.6 … … 15 18 """Return number date-time delta as number seconds""" 16 19 return dt.total_seconds() 17 18 import numpy as np19 20 try:21 from .kernelcl import load_model as _loader22 except RuntimeError, exc:23 import warnings24 warnings.warn(str(exc))25 warnings.warn("OpenCL not available --- using ctypes instead")26 from .kerneldll import load_model as _loader27 28 def load_model(modelname, dtype='single'):29 """30 Load model by name.31 """32 sasmodels = __import__('sasmodels.models.' + modelname)33 module = getattr(sasmodels.models, modelname, None)34 model = _loader(module, dtype=dtype)35 return model36 20 37 21 … … 263 247 *data* is the data to be fitted. 264 248 265 *model* is the SAS model , e.g., from :func:`gen.opencl_model`.249 *model* is the SAS model from :func:`core.load_model`. 266 250 267 251 *cutoff* is the integration cutoff, which avoids computing the … … 280 264 self.model = model 281 265 self.cutoff = cutoff 282 # TODO if isinstance(data,SESANSData1D)283 266 if hasattr(data, 'lam'): 284 267 self.data_type = 'sesans' … … 431 414 def _get_weights(self, par): 432 415 """ 433 416 Get parameter dispersion weights 434 417 """ 435 418 from . import weights
Note: See TracChangeset
for help on using the changeset viewer.