Changeset bcd3aa3 in sasmodels


Ignore:
Timestamp:
Mar 23, 2015 3:48:28 PM (10 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:
0a33675
Parents:
7954f5c
Message:

simplify core model loader interface so model can be loaded directly from model name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/core.py

    raa4946b rbcd3aa3  
    6060 
    6161 
     62def isstr(s): 
     63    try: s + '' 
     64    except: return False 
     65    return True 
     66 
    6267def load_model(model_definition, dtype="single", platform="ocl"): 
    6368    """ 
     
    6671    This will return an OpenCL model, a DLL model or a python model depending 
    6772    on the model and the computing platform. 
     73 
     74    *model_definition* is the python module which defines the model.  If the 
     75    model name is given instead, then :func:`load_model_definition` will be 
     76    called with the model name. 
    6877 
    6978    *dtype* indicates whether the model should use single or double precision 
     
    7584    otherwise it uses the default "ocl". 
    7685    """ 
     86    if isstr(model_definition): 
     87        model_definition = load_model_definition(model_definition) 
    7788    source, info = generate.make(model_definition) 
    7889    if callable(info.get('Iq', None)): 
Note: See TracChangeset for help on using the changeset viewer.