Changeset f3bd37f in sasmodels


Ignore:
Timestamp:
Jul 17, 2016 2:36:34 PM (8 years ago)
Author:
Paul Kienzle <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:
46ed760
Parents:
b9c12fe5
Message:

fix compare_many

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    rdef2c1b rf3bd37f  
    257257    Randomize a single parameter. 
    258258    """ 
    259     if any(p.endswith(s) for s in ('_pd_n', '_pd_nsigma', '_pd_type')): 
     259    if any(p.endswith(s) for s in ('_pd', '_pd_n', '_pd_nsigma', '_pd_type')): 
    260260        return v 
    261261 
     
    405405            raise ValueError("sasview mixture models not supported by compare") 
    406406    else: 
    407         model = get_model(revert_name(model_info)) 
     407        old_name = revert_name(model_info) 
     408        if old_name is None: 
     409            raise ValueError("model %r does not exist in old sasview" 
     410                            % model_info.id) 
     411        model = get_model(old_name) 
    408412 
    409413    # build a smearer with which to call the model, if necessary 
  • sasmodels/compare_many.py

    r7ae2b7f rf3bd37f  
    2020 
    2121from . import core 
    22 from .compare import (MODELS, randomize_pars, suppress_pd, make_data, 
     22from .compare import (randomize_pars, suppress_pd, make_data, 
    2323                      make_engine, get_pars, columnize, 
    2424                      constrain_pars, constrain_new_to_old) 
     25 
     26MODELS = core.list_models() 
    2527 
    2628def calc_stats(target, value, index): 
     
    108110 
    109111    if is_2d: 
    110         if not model_info['parameters'].has_2d: 
     112        if not model_info.parameters.has_2d: 
    111113            print(',"1-D only"') 
    112114            return 
     
    145147 
    146148 
    147     calc_base = make_engine(model_info, data, base, cutoff) 
    148     calc_comp = make_engine(model_info, data, comp, cutoff) 
     149    try: 
     150        calc_base = make_engine(model_info, data, base, cutoff) 
     151        calc_comp = make_engine(model_info, data, comp, cutoff) 
     152    except Exception as exc: 
     153        #raise 
     154        print('"Error: %s"'%str(exc).replace('"',"'")) 
     155        print('"good","%d of %d","max diff",%g'%(0, N, np.NaN)) 
     156        return 
    149157    expected = max(PRECISION[base], PRECISION[comp]) 
    150158 
     
    155163        print("%s %d"%(name, k), file=sys.stderr) 
    156164        seed = np.random.randint(1e6) 
    157         pars_i = randomize_pars(pars, seed) 
     165        pars_i = randomize_pars(model_info, pars, seed) 
    158166        constrain_pars(model_info, pars_i) 
    159167        constrain_new_to_old(model_info, pars_i) 
     
    172180        else: 
    173181            print(("%d,"%seed)+','.join("%s"%v for v in columns)) 
    174     print('"good","%d/%d","max diff",%g'%(num_good, N, max_diff[0])) 
     182    print('"good","%d of %d","max diff",%g'%(num_good, N, max_diff[0])) 
    175183 
    176184 
     
    249257 
    250258    data, index = make_data({'qmax':1.0, 'is2d':is2D, 'nq':Nq, 'res':0., 
    251                              'accuracy': 'Low', 'view':'log'}) 
     259                             'accuracy': 'Low', 'view':'log', 'zero': False}) 
    252260    model_list = [model] if model != "all" else MODELS 
    253261    for model in model_list: 
Note: See TracChangeset for help on using the changeset viewer.