Changeset a7f909a in sasmodels


Ignore:
Timestamp:
Jan 7, 2016 1:47:25 PM (9 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:
82c299f, 55a8316
Parents:
3f832f9
Message:

fix 2d multi-compare

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare_many.py

    rec7e360 ra7f909a  
    11#!/usr/bin/env python 
     2from __future__ import print_function 
     3 
    24import sys 
    35import traceback 
     
    68 
    79from . import core 
    8 from .kernelcl import environment 
    9 from .compare import (MODELS, randomize_pars, suppress_pd, eval_sasview, 
    10                       eval_opencl, eval_ctypes, make_data, get_demo_pars, 
    11                       columnize, constrain_pars, constrain_new_to_old, 
    12                       make_engine) 
     10from . import generate 
     11from .compare import (MODELS, randomize_pars, suppress_pd, make_data, 
     12                      make_engine, get_demo_pars, columnize, 
     13                      constrain_pars, constrain_new_to_old) 
    1314 
    1415def calc_stats(target, value, index): 
     
    4748def compare_instance(name, data, index, N=1, mono=True, cutoff=1e-5, 
    4849                     base='sasview', comp='double'): 
     50    is2D = hasattr(data, 'qx_data') 
    4951    model_definition = core.load_model_definition(name) 
    5052    pars = get_demo_pars(model_definition) 
    51     header = '\n"Model","%s","Count","%d"'%(name, N) 
     53    header = ('\n"Model","%s","Count","%d","Dimension","%s"' 
     54              % (name, N, "2D" if is2D else "1D")) 
    5255    if not mono: header += ',"Cutoff",%g'%(cutoff,) 
    5356    print(header) 
     57 
     58    if is2D: 
     59        info = generate.make_info(model_definition) 
     60        partype = info['partype'] 
     61        if not partype['orientation'] and not partype['magnetic']: 
     62            print(',"1-D only"') 
     63            return 
    5464 
    5565    # Some not very clean macros for evaluating the models and checking the 
     
    8898    max_diff = [0] 
    8999    for k in range(N): 
    90         print("%s %d"%(name, k)) 
     100        print("%s %d"%(name, k), file=sys.stderr) 
    91101        seed = np.random.randint(1e6) 
    92102        pars_i = randomize_pars(pars, seed) 
Note: See TracChangeset for help on using the changeset viewer.