Changeset db03406 in sasmodels for sasmodels/modelinfo.py


Ignore:
Timestamp:
Dec 1, 2017 2:36:52 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Children:
13cf47a
Parents:
791281c
Message:

first pass at python to C translator for kernels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/modelinfo.py

    r2d81cfe rdb03406  
    1212from os.path import abspath, basename, splitext 
    1313import inspect 
     14import logging 
    1415 
    1516import numpy as np  # type: ignore 
     17 
     18from . import autoc 
    1619 
    1720# Optional typing 
     
    3235    TestCondition = Tuple[ParameterSetUser, TestInput, TestValue] 
    3336# pylint: enable=unused-import 
     37 
     38logger = logging.getLogger(__name__) 
    3439 
    3540# If MAX_PD changes, need to change the loop macros in kernel_iq.c 
     
    789794    info.structure_factor = getattr(kernel_module, 'structure_factor', False) 
    790795    info.profile_axes = getattr(kernel_module, 'profile_axes', ['x', 'y']) 
     796    info.c_code = getattr(kernel_module, 'c_code', None) 
    791797    info.source = getattr(kernel_module, 'source', []) 
    792798    # TODO: check the structure of the tests 
     
    812818 
    813819    _find_source_lines(info, kernel_module) 
     820    try: 
     821        autoc.convert(info, kernel_module) 
     822    except Exception as exc: 
     823        raise 
     824        logger.warn(str(exc)) 
    814825 
    815826    return info 
     
    935946    #: See :attr:`ER` for details on the parameters. 
    936947    VR = None               # type: Optional[Callable[[np.ndarray], Tuple[np.ndarray, np.ndarray]]] 
     948    #: Arbitrary C code containing supporting functions, etc., to be inserted 
     949    #: after everything in source.  This can include Iq and Iqxy functions with 
     950    #: the full function signature, including all parameters. 
     951    c_code = None 
    937952    #: Returns the form volume for python-based models.  Form volume is needed 
    938953    #: for volume normalization in the polydispersity integral.  If no 
Note: See TracChangeset for help on using the changeset viewer.