Changeset b8e5e21 in sasmodels for sasmodels/core.py


Ignore:
Timestamp:
Mar 16, 2016 8:22:29 AM (8 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:
28da77d
Parents:
667a6f2
Message:

had structure_factor, has_2d and variants to info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/core.py

    r17bbadd rb8e5e21  
    3434    return available_models 
    3535 
     36def isstr(s): 
     37    """ 
     38    Return True if *s* is a string-like object. 
     39    """ 
     40    try: s + '' 
     41    except: return False 
     42    return True 
     43 
     44def load_model(model_name, **kw): 
     45    """ 
     46    Load model info and build model. 
     47    """ 
     48    return build_model(load_model_info(model_name), **kw) 
    3649 
    3750def load_model_info(model_name): 
     
    4659    return generate.make_model_info(kernel_module) 
    4760 
    48  
    49 def precompile_dll(model_name, dtype="double"): 
    50     """ 
    51     Precompile the dll for a model. 
    52  
    53     Returns the path to the compiled model, or None if the model is a pure 
    54     python model. 
    55  
    56     This can be used when build the windows distribution of sasmodels 
    57     (which may be missing the OpenCL driver and the dll compiler), or 
    58     otherwise sharing models with windows users who do not have a compiler. 
    59  
    60     See :func:`sasmodels.kerneldll.make_dll` for details on controlling the 
    61     dll path and the allowed floating point precision. 
    62     """ 
    63     model_info = load_model_info(model_name) 
    64     source = generate.make_source(model_info) 
    65     return kerneldll.make_dll(source, model_info, dtype=dtype) if source else None 
    66  
    67  
    68 def isstr(s): 
    69     """ 
    70     Return True if *s* is a string-like object. 
    71     """ 
    72     try: s + '' 
    73     except: return False 
    74     return True 
    7561 
    7662def build_model(model_info, dtype=None, platform="ocl"): 
     
    114100    else: 
    115101        return kernelcl.GpuModel(source, model_info, dtype) 
     102 
     103def precompile_dll(model_name, dtype="double"): 
     104    """ 
     105    Precompile the dll for a model. 
     106 
     107    Returns the path to the compiled model, or None if the model is a pure 
     108    python model. 
     109 
     110    This can be used when build the windows distribution of sasmodels 
     111    (which may be missing the OpenCL driver and the dll compiler), or 
     112    otherwise sharing models with windows users who do not have a compiler. 
     113 
     114    See :func:`sasmodels.kerneldll.make_dll` for details on controlling the 
     115    dll path and the allowed floating point precision. 
     116    """ 
     117    model_info = load_model_info(model_name) 
     118    source = generate.make_source(model_info) 
     119    return kerneldll.make_dll(source, model_info, dtype=dtype) if source else None 
     120 
    116121 
    117122def make_kernel(model, q_vectors): 
Note: See TracChangeset for help on using the changeset viewer.