Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare_many.py

    rf72d70a r424fe00  
    106106    header = ('\n"Model","%s","Count","%d","Dimension","%s"' 
    107107              % (name, N, "2D" if is_2d else "1D")) 
    108     if not mono: 
    109         header += ',"Cutoff",%g'%(cutoff,) 
     108    if not mono: header += ',"Cutoff",%g'%(cutoff,) 
    110109    print(header) 
    111110 
     
    162161    max_diff = [0] 
    163162    for k in range(N): 
    164         print("Model %s %d"%(name, k+1), file=sys.stderr) 
     163        print("%s %d"%(name, k), file=sys.stderr) 
    165164        seed = np.random.randint(1e6) 
    166165        pars_i = randomize_pars(model_info, pars, seed) 
    167166        constrain_pars(model_info, pars_i) 
    168         if 'sasview' in (base, comp): 
    169             constrain_new_to_old(model_info, pars_i) 
     167        constrain_new_to_old(model_info, pars_i) 
    170168        if mono: 
    171169            pars_i = suppress_pd(pars_i) 
     
    189187    Print the command usage string. 
    190188    """ 
    191     print("usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono) (single|double|quad)", 
    192           file=sys.stderr) 
     189    print("usage: compare_many.py MODEL COUNT (1dNQ|2dNQ) (CUTOFF|mono) (single|double|quad)") 
    193190 
    194191 
     
    207204    print("""\ 
    208205 
    209 MODEL is the model name of the model or one of the model types listed in 
    210 sasmodels.core.list_models (all, py, c, double, single, opencl, 1d, 2d, 
    211 nonmagnetic, magnetic).  Model types can be combined, such as 2d+single. 
     206MODEL is the model name of the model or "all" for all the models 
     207in alphabetical order. 
    212208 
    213209COUNT is the number of randomly generated parameter sets to try. A value 
     
    224220below the cutoff will be ignored.  Use "mono" for monodisperse models.  The 
    225221choice of polydisperse parameters, and the number of points in the distribution 
    226 is set in compare.py defaults for each model.  Polydispersity is given in the 
    227 "demo" attribute of each model. 
     222is set in compare.py defaults for each model. 
    228223 
    229224PRECISION is the floating point precision to use for comparisons.  If two 
    230 precisions are given, then compare one to the other.  Precision is one of 
    231 fast, single, double for GPU or single!, double!, quad! for DLL.  If no 
    232 precision is given, then use single and double! respectively. 
     225precisions are given, then compare one to the other, ignoring sasview. 
    233226 
    234227Available models: 
     
    240233    Main program. 
    241234    """ 
    242     if len(argv) not in (3, 4, 5, 6): 
     235    if len(argv) not in (5, 6): 
    243236        print_help() 
    244237        return 
    245238 
    246     target = argv[0] 
    247     try: 
    248         model_list = [target] if target in MODELS else core.list_models(target) 
    249     except ValueError: 
    250         print('Bad model %s.  Use model type or one of:' % target, file=sys.stderr) 
     239    model = argv[0] 
     240    if not (model in MODELS) and (model != "all"): 
     241        print('Bad model %s.  Use "all" or one of:'%model) 
    251242        print_models() 
    252         print('model types: all, py, c, double, single, opencl, 1d, 2d, nonmagnetic, magnetic') 
    253243        return 
    254244    try: 
     
    257247        assert argv[2][1] == 'd' 
    258248        Nq = int(argv[2][2:]) 
    259         mono = len(argv) <= 3 or argv[3] == 'mono' 
     249        mono = argv[3] == 'mono' 
    260250        cutoff = float(argv[3]) if not mono else 0 
    261         base = argv[4] if len(argv) > 4 else "single" 
    262         comp = argv[5] if len(argv) > 5 else "double!" 
     251        base = argv[4] 
     252        comp = argv[5] if len(argv) > 5 else "sasview" 
    263253    except Exception: 
    264254        traceback.print_exc() 
     
    268258    data, index = make_data({'qmax':1.0, 'is2d':is2D, 'nq':Nq, 'res':0., 
    269259                             'accuracy': 'Low', 'view':'log', 'zero': False}) 
     260    model_list = [model] if model != "all" else MODELS 
    270261    for model in model_list: 
    271262        compare_instance(model, data, index, N=count, mono=mono, 
Note: See TracChangeset for help on using the changeset viewer.