Changeset ff31782 in sasmodels for sasmodels/generate.py


Ignore:
Timestamp:
Nov 6, 2017 4:10:09 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
d4db147
Parents:
74768cb
Message:

add -ngauss option to compare in order to set the number of integration points

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r4991048 rff31782  
    268268""" 
    269269 
     270 
     271def set_integration_size(info, n): 
     272    # type: (ModelInfo, int) -> None 
     273    """ 
     274    Update the model definition, replacing the gaussian integration with 
     275    a gaussian integration of a different size. 
     276 
     277    Note: this really ought to be a method in modelinfo, but that leads to 
     278    import loops. 
     279    """ 
     280    if (info.source and any(lib.startswith('lib/gauss') for lib in info.source)): 
     281        import os.path 
     282        from .gengauss import gengauss 
     283        path = os.path.join(MODEL_PATH, "lib", "gauss%d.c"%n) 
     284        if not os.path.exists(path): 
     285            gengauss(n, path) 
     286        info.source = ["lib/gauss%d.c"%n if lib.startswith('lib/gauss') 
     287                        else lib for lib in info.source] 
    270288 
    271289def format_units(units): 
Note: See TracChangeset for help on using the changeset viewer.