Changeset 56fac50 in sasmodels for sasmodels/compare.py


Ignore:
Timestamp:
Mar 14, 2016 4:35:17 AM (8 years ago)
Author:
smk78
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:
cf95788
Parents:
4b0e1f3 (diff), 6869ceb (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.
Message:

Merge branch 'master' of https://github.com/SasView/sasmodels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    ra4a7308 r6869ceb  
    3131import sys 
    3232import math 
    33 from os.path import basename, dirname, join as joinpath 
    34 import glob 
    3533import datetime 
    3634import traceback 
     
    9896kerneldll.ALLOW_SINGLE_PRECISION_DLLS = True 
    9997 
    100 # List of available models 
    101 ROOT = dirname(__file__) 
    102 MODELS = [basename(f)[:-3] 
    103           for f in sorted(glob.glob(joinpath(ROOT, "models", "[a-zA-Z]*.py")))] 
     98MODELS = core.list_models() 
    10499 
    105100# CRUFT python 2.6 
     
    671666    Parse command line options. 
    672667    """ 
     668    MODELS = core.list_models() 
    673669    flags = [arg for arg in sys.argv[1:] 
    674670             if arg.startswith('-')] 
     
    683679        print(columnize(MODELS, indent="  ")) 
    684680        sys.exit(1) 
    685     if args[0] not in MODELS: 
    686         print("Model %r not available. Use one of:\n    %s"%(args[0], models)) 
     681 
     682    name = args[0] 
     683    try: 
     684        model_definition = core.load_model_definition(name) 
     685    except ImportError, exc: 
     686        print(str(exc)) 
     687        print("Use one of:\n    " + models) 
    687688        sys.exit(1) 
    688689    if len(args) > 3: 
     
    764765        del engines[2:] 
    765766 
    766     name = args[0] 
    767     model_definition = core.load_model_definition(name) 
    768  
    769767    n1 = int(args[1]) if len(args) > 1 else 1 
    770768    n2 = int(args[2]) if len(args) > 2 else 1 
Note: See TracChangeset for help on using the changeset viewer.