Changeset 373d1b6 in sasmodels


Ignore:
Timestamp:
Feb 18, 2015 6:04:55 AM (10 years ago)
Author:
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:
56fc97a
Parents:
a503bfd
Message:

refactor model parameter handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • compare.py

    ra503bfd r373d1b6  
    299299    ] 
    300300 
     301def get_demo_pars(name): 
     302    import sasmodels.models 
     303    __import__('sasmodels.models.'+name) 
     304    model = getattr(sasmodels.models, name) 
     305    pars = getattr(model, 'demo', None) 
     306    if pars is None: pars = dict((p[0],p[2]) for p in model.parameters) 
     307    return pars 
     308 
    301309def main(): 
    302310    opts = [arg for arg in sys.argv[1:] if arg.startswith('-')] 
     
    320328    # if model does not define demo parameters 
    321329    name = args[0] 
    322     import sasmodels.models 
    323     __import__('sasmodels.models.'+name) 
    324     model = getattr(sasmodels.models, name) 
    325     pars = getattr(model, 'demo', None) 
    326     if pars is None: pars = dict((p[0],p[2]) for p in model.parameters) 
     330    pars = get_demo_pars(name) 
    327331 
    328332    Nopencl = int(args[1]) if len(args) > 1 else 5 
Note: See TracChangeset for help on using the changeset viewer.