Changes in / [cf3d0ce:646eeaa] in sasmodels


Ignore:
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    re9ed2de re9ed2de  
    88*.so 
    99*.obj 
     10*.o 
    1011/doc/_build/ 
    1112/doc/api/ 
     
    1920/.pydevproject 
    2021/.idea 
     22.vscode 
    2123/sasmodels.egg-info/ 
    2224/example/Fit_*/ 
  • sasmodels/modelinfo.py

    r39a06c9 r39a06c9  
    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 
     
    810815    info.profile = getattr(kernel_module, 'profile', None) # type: ignore 
    811816    info.sesans = getattr(kernel_module, 'sesans', None) # type: ignore 
    812     # Default single and opencl to True for C models.  Python models have callable Iq. 
    813     info.opencl = getattr(kernel_module, 'opencl', not callable(info.Iq)) 
    814     info.single = getattr(kernel_module, 'single', not callable(info.Iq)) 
    815817    info.random = getattr(kernel_module, 'random', None) 
    816818 
     
    821823    info.hidden = getattr(kernel_module, 'hidden', None) # type: ignore 
    822824 
     825    info.lineno = {} 
     826    _find_source_lines(info, kernel_module) 
     827    if getattr(kernel_module, 'py2c', False): 
     828        try: 
     829            warnings = autoc.convert(info, kernel_module) 
     830        except Exception as exc: 
     831            warnings = [str(exc)] 
     832        if warnings: 
     833            warnings.append("while converting %s from C to python"%name) 
     834            if len(warnings) > 2: 
     835                warnings = "\n".join(warnings) 
     836            else: 
     837                warnings = " ".join(warnings) 
     838            logger.warn(warnings) 
     839 
     840    # Default single and opencl to True for C models.  Python models have callable Iq. 
     841    # Needs to come after autoc.convert since the Iq symbol may have been 
     842    # converted from python to C 
     843    info.opencl = getattr(kernel_module, 'opencl', not callable(info.Iq)) 
     844    info.single = getattr(kernel_module, 'single', not callable(info.Iq)) 
     845 
    823846    if callable(info.Iq) and parameters.has_2d: 
    824847        raise ValueError("oriented python models not supported") 
    825848 
    826     info.lineno = {} 
    827     _find_source_lines(info, kernel_module) 
    828849    return info 
    829850 
Note: See TracChangeset for help on using the changeset viewer.