Changeset a1c5758 in sasmodels for sasmodels/compare.py


Ignore:
Timestamp:
Oct 23, 2017 10:25:27 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
34823bc
Parents:
ea60e08 (diff), 55d88b4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ticket-776-orientation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    r31eea1f ra1c5758  
    7474    -res=0 sets the resolution width dQ/Q if calculating with resolution 
    7575    -lowq*/-midq/-highq/-exq use q values up to 0.05, 0.2, 1.0, 10.0 
     76    -q=min:max alternative specification of qrange 
    7677    -nq=128 sets the number of Q points in the data set 
    7778    -1d*/-2d computes 1d or 2d data 
     
    782783    'accuracy', 'is2d' and 'view' parsed from the command line. 
    783784    """ 
    784     qmax, nq, res = opts['qmax'], opts['nq'], opts['res'] 
     785    qmin, qmax, nq, res = opts['qmin'], opts['qmax'], opts['nq'], opts['res'] 
    785786    if opts['is2d']: 
    786787        q = np.linspace(-qmax, qmax, nq)  # type: np.ndarray 
     
    791792    else: 
    792793        if opts['view'] == 'log' and not opts['zero']: 
    793             qmax = math.log10(qmax) 
    794             q = np.logspace(qmax-3, qmax, nq) 
     794            q = np.logspace(math.log10(qmin), math.log10(qmax), nq) 
    795795        else: 
    796             q = np.linspace(0.001*qmax, qmax, nq) 
     796            q = np.linspace(qmin, qmax, nq) 
    797797        if opts['zero']: 
    798798            q = np.hstack((0, q)) 
     
    984984        else: 
    985985            err, errstr, errview = abs(relerr), "rel err", "log" 
     986            if (err == 0.).all(): 
     987                errview = 'linear' 
    986988        if 0:  # 95% cutoff 
    987989            sorted = np.sort(err.flatten()) 
     
    989991            err[err > cutoff] = cutoff 
    990992        #err,errstr = base/comp,"ratio" 
     993<<<<<<< HEAD 
    991994        plot_theory(data, None, resid=err, view=errview, use_data=use_data) 
    992995        plt.xscale('log' if view == 'log' else linear) 
    993996        plt.legend(['P%d'%(k+1) for k in range(setnum+1)], loc='best') 
     997======= 
     998        plot_theory(data, None, resid=err, view=view, use_data=use_data) 
     999        plt.yscale(errview) 
     1000>>>>>>> master 
    9941001        plt.title("max %s = %.3g"%(errstr, abs(err).max())) 
    9951002        #cbar_title = errstr if errview=="linear" else "log "+errstr 
     
    10301037 
    10311038    # Data generation 
    1032     'data=', 'noise=', 'res=', 
    1033     'nq=', 'lowq', 'midq', 'highq', 'exq', 'zero', 
     1039    'data=', 'noise=', 'res=', 'nq=', 'q=', 
     1040    'lowq', 'midq', 'highq', 'exq', 'zero', 
    10341041    '2d', '1d', 
    10351042 
     
    11521159        'view'      : 'log', 
    11531160        'is2d'      : False, 
     1161        'qmin'      : None, 
    11541162        'qmax'      : 0.05, 
    11551163        'nq'        : 128, 
     
    11911199        elif arg == '-zero':    opts['zero'] = True 
    11921200        elif arg.startswith('-nq='):       opts['nq'] = int(arg[4:]) 
     1201        elif arg.startswith('-q='): 
     1202            opts['qmin'], opts['qmax'] = [float(v) for v in arg[3:].split(':')] 
    11931203        elif arg.startswith('-res='):      opts['res'] = float(arg[5:]) 
    11941204        elif arg.startswith('-noise='):    opts['noise'] = float(arg[7:]) 
     
    12471257 
    12481258    # Create the computational engines 
     1259    if opts['qmin'] is None: 
     1260        opts['qmin'] = 0.001*opts['qmax'] 
    12491261    if opts['datafile'] is not None: 
    12501262        data = load_data(os.path.expanduser(opts['datafile'])) 
Note: See TracChangeset for help on using the changeset viewer.