Changeset f72d70a in sasmodels for sasmodels/compare_many.py


Ignore:
Timestamp:
Mar 7, 2017 2:44:59 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
598857b
Parents:
c68c5e9
Message:

multi-compare: slightly nicer interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare_many.py

    r5124c969 rf72d70a  
    189189    Print the command usage string. 
    190190    """ 
    191     print("usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono) (single|double|quad)") 
     191    print("usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono) (single|double|quad)", 
     192          file=sys.stderr) 
    192193 
    193194 
     
    223224below the cutoff will be ignored.  Use "mono" for monodisperse models.  The 
    224225choice of polydisperse parameters, and the number of points in the distribution 
    225 is set in compare.py defaults for each model. 
     226is set in compare.py defaults for each model.  Polydispersity is given in the 
     227"demo" attribute of each model. 
    226228 
    227229PRECISION is the floating point precision to use for comparisons.  If two 
    228 precisions are given, then compare one to the other, ignoring sasview. 
     230precisions are given, then compare one to the other.  Precision is one of 
     231fast, single, double for GPU or single!, double!, quad! for DLL.  If no 
     232precision is given, then use single and double! respectively. 
    229233 
    230234Available models: 
     
    236240    Main program. 
    237241    """ 
    238     if len(argv) not in (5, 6): 
     242    if len(argv) not in (3, 4, 5, 6): 
    239243        print_help() 
    240244        return 
     
    244248        model_list = [target] if target in MODELS else core.list_models(target) 
    245249    except ValueError: 
    246         print('Bad model %s.  Use model type or one of:'%model) 
     250        print('Bad model %s.  Use model type or one of:' % target, file=sys.stderr) 
    247251        print_models() 
    248252        print('model types: all, py, c, double, single, opencl, 1d, 2d, nonmagnetic, magnetic') 
     
    253257        assert argv[2][1] == 'd' 
    254258        Nq = int(argv[2][2:]) 
    255         mono = argv[3] == 'mono' 
     259        mono = len(argv) <= 3 or argv[3] == 'mono' 
    256260        cutoff = float(argv[3]) if not mono else 0 
    257         base = argv[4] 
    258         comp = argv[5] if len(argv) > 5 else "sasview" 
     261        base = argv[4] if len(argv) > 4 else "single" 
     262        comp = argv[5] if len(argv) > 5 else "double!" 
    259263    except Exception: 
    260264        traceback.print_exc() 
Note: See TracChangeset for help on using the changeset viewer.