Changeset 0c86b79 in sasmodels for sasmodels/modelinfo.py


Ignore:
Timestamp:
Mar 31, 2019 7:59:48 AM (5 years ago)
Author:
GitHub <noreply@…>
Parents:
1dd78a2b (diff), 225bf94 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Kienzle <pkienzle@…> (03/31/19 07:59:48)
git-committer:
GitHub <noreply@…> (03/31/19 07:59:48)
Message:

Merge 225bf94c769a67d6fdab4091c85fde04b9f7db52 into 1dd78a2b6501dbd20963af88b80e45c6b89beda5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/modelinfo.py

    ra34b811 r0c86b79  
    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 
     
    860865    info.profile = getattr(kernel_module, 'profile', None) # type: ignore 
    861866    info.sesans = getattr(kernel_module, 'sesans', None) # type: ignore 
     867    info.random = getattr(kernel_module, 'random', None) 
     868    info.hidden = getattr(kernel_module, 'hidden', None) # type: ignore 
     869 
     870    info.lineno = {} 
     871    _find_source_lines(info, kernel_module) 
     872    if getattr(kernel_module, 'py2c', False): 
     873        try: 
     874            warnings = autoc.convert(info, kernel_module) 
     875        except Exception as exc: 
     876            warnings = [str(exc)] 
     877        if warnings: 
     878            warnings.append("while converting %s from C to python"%name) 
     879            if len(warnings) > 2: 
     880                warnings = "\n".join(warnings) 
     881            else: 
     882                warnings = " ".join(warnings) 
     883            logger.warn(warnings) 
     884 
    862885    # Default single and opencl to True for C models.  Python models have callable Iq. 
     886    # Needs to come after autoc.convert since the Iq symbol may have been 
     887    # converted from python to C 
    863888    info.opencl = getattr(kernel_module, 'opencl', not callable(info.Iq)) 
    864889    info.single = getattr(kernel_module, 'single', not callable(info.Iq)) 
    865     info.random = getattr(kernel_module, 'random', None) 
    866     info.hidden = getattr(kernel_module, 'hidden', None) # type: ignore 
    867  
     890     
    868891    # Set control flag for explicitly set parameters, e.g., in the RPA model. 
    869892    control = getattr(kernel_module, 'control', None) 
     
    874897        raise ValueError("oriented python models not supported") 
    875898 
    876     info.lineno = {} 
    877     _find_source_lines(info, kernel_module) 
    878899    return info 
    879900 
Note: See TracChangeset for help on using the changeset viewer.