Changeset aa4946b in sasmodels for sasmodels/bumps_model.py


Ignore:
Timestamp:
Mar 11, 2015 11:15:40 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

refactor so kernels are loaded via core.load_model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/bumps_model.py

    r63b32bb raa4946b  
    11""" 
    2 Sasmodels core. 
     2Wrap sasmodels for direct use by bumps. 
    33""" 
     4 
    45import datetime 
    56 
    6 from sasmodels import sesans 
     7import numpy as np 
     8 
     9from . import sesans 
    710 
    811# CRUFT python 2.6 
     
    1518        """Return number date-time delta as number seconds""" 
    1619        return dt.total_seconds() 
    17  
    18 import numpy as np 
    19  
    20 try: 
    21     from .kernelcl import load_model as _loader 
    22 except RuntimeError, exc: 
    23     import warnings 
    24     warnings.warn(str(exc)) 
    25     warnings.warn("OpenCL not available --- using ctypes instead") 
    26     from .kerneldll import load_model as _loader 
    27  
    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 model 
    3620 
    3721 
     
    263247    *data* is the data to be fitted. 
    264248 
    265     *model* is the SAS model, e.g., from :func:`gen.opencl_model`. 
     249    *model* is the SAS model from :func:`core.load_model`. 
    266250 
    267251    *cutoff* is the integration cutoff, which avoids computing the 
     
    280264        self.model = model 
    281265        self.cutoff = cutoff 
    282 # TODO       if  isinstance(data,SESANSData1D) 
    283266        if hasattr(data, 'lam'): 
    284267            self.data_type = 'sesans' 
     
    431414    def _get_weights(self, par): 
    432415        """ 
    433             Get parameter dispersion weights 
     416        Get parameter dispersion weights 
    434417        """ 
    435418        from . import weights 
Note: See TracChangeset for help on using the changeset viewer.