Changeset 5124c969 in sasmodels for sasmodels/compare_many.py


Ignore:
Timestamp:
Feb 27, 2017 3:55: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:
c713c85
Parents:
a3002be
Message:

allow multicompare to select opencl+single+1d

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare_many.py

    r424fe00 r5124c969  
    106106    header = ('\n"Model","%s","Count","%d","Dimension","%s"' 
    107107              % (name, N, "2D" if is_2d else "1D")) 
    108     if not mono: header += ',"Cutoff",%g'%(cutoff,) 
     108    if not mono: 
     109        header += ',"Cutoff",%g'%(cutoff,) 
    109110    print(header) 
    110111 
     
    161162    max_diff = [0] 
    162163    for k in range(N): 
    163         print("%s %d"%(name, k), file=sys.stderr) 
     164        print("Model %s %d"%(name, k+1), file=sys.stderr) 
    164165        seed = np.random.randint(1e6) 
    165166        pars_i = randomize_pars(model_info, pars, seed) 
    166167        constrain_pars(model_info, pars_i) 
    167         constrain_new_to_old(model_info, pars_i) 
     168        if 'sasview' in (base, comp): 
     169            constrain_new_to_old(model_info, pars_i) 
    168170        if mono: 
    169171            pars_i = suppress_pd(pars_i) 
     
    204206    print("""\ 
    205207 
    206 MODEL is the model name of the model or "all" for all the models 
    207 in alphabetical order. 
     208MODEL is the model name of the model or one of the model types listed in 
     209sasmodels.core.list_models (all, py, c, double, single, opencl, 1d, 2d, 
     210nonmagnetic, magnetic).  Model types can be combined, such as 2d+single. 
    208211 
    209212COUNT is the number of randomly generated parameter sets to try. A value 
     
    237240        return 
    238241 
    239     model = argv[0] 
    240     if not (model in MODELS) and (model != "all"): 
    241         print('Bad model %s.  Use "all" or one of:'%model) 
     242    target = argv[0] 
     243    try: 
     244        model_list = [target] if target in MODELS else core.list_models(target) 
     245    except ValueError: 
     246        print('Bad model %s.  Use model type or one of:'%model) 
    242247        print_models() 
     248        print('model types: all, py, c, double, single, opencl, 1d, 2d, nonmagnetic, magnetic') 
    243249        return 
    244250    try: 
     
    258264    data, index = make_data({'qmax':1.0, 'is2d':is2D, 'nq':Nq, 'res':0., 
    259265                             'accuracy': 'Low', 'view':'log', 'zero': False}) 
    260     model_list = [model] if model != "all" else MODELS 
    261266    for model in model_list: 
    262267        compare_instance(model, data, index, N=count, mono=mono, 
Note: See TracChangeset for help on using the changeset viewer.