Changeset 3750279 in sasmodels


Ignore:
Timestamp:
Feb 20, 2015 6:03:08 AM (9 years ago)
Author:
ajj
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:
2eaae42
Parents:
cfd4625 (diff), 99e6860 (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' of https://github.com/SasView/sasmodels

Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • compare.py

    rf173599 r29f5536  
    163163                      if len(split) == 2) 
    164164    # Sort out data 
    165     qmax = 1.0 if '-highq' in opts else (0.2 if '-midq' in opts else 0.05) 
     165    qmax = 10.0 if '-exq' in opts else 1.0 if '-highq' in opts else 0.2 if '-midq' in opts else 0.05 
    166166    Nq = int(opt_values.get('-Nq', '128')) 
    167167    is2D = not "-1d" in opts 
     
    225225        plot_data(data, cpu, scale='log') 
    226226        plt.title("%s t=%.1f ms"%(comp,cpu_time)) 
     227        cbar_title = "log I" 
    227228    if Nocl > 0: 
    228229        if Ncpu > 0: plt.subplot(132) 
    229230        plot_data(data, ocl, scale='log') 
    230231        plt.title("opencl t=%.1f ms"%ocl_time) 
     232        cbar_title = "log I" 
    231233    if Ncpu > 0 and Nocl > 0: 
    232234        plt.subplot(133) 
    233         err = resid if '-abs' in opts else relerr 
    234         errstr = "abs err" if '-abs' in opts else "rel err" 
     235        if '-abs' in opts: 
     236            err,errstr = resid, "abs err" 
     237        else: 
     238            err,errstr = relerr, "rel err" 
    235239        #err,errstr = ocl/cpu,"ratio" 
    236         plot_data(data, err, scale='linear') 
     240        plot_data(data, err, scale='log') #'linear') 
    237241        plt.title("max %s = %.3g"%(errstr, max(abs(err[index])))) 
    238     if is2D: plt.colorbar() 
     242        cbar_title = "log "+errstr 
     243    if is2D: 
     244        h = plt.colorbar() 
     245        h.ax.set_title(cbar_title) 
    239246 
    240247    if Ncpu > 0 and Nocl > 0 and '-hist' in opts: 
     
    265272    -plot*/-noplot plots or suppress the plot of the model 
    266273    -single*/-double uses double precision for comparison 
    267     -lowq*/-midq/-highq use q values up to 0.05, 0.2 or 1.0 
     274    -lowq*/-midq/-highq/-exq use q values up to 0.05, 0.2, 1.0, 10.0 
    268275    -Nq=128 sets the number of Q points in the data set 
    269276    -1d/-2d* computes 1d or 2d data 
     
    287294    'plot','noplot', 
    288295    'single','double', 
    289     'lowq','midq','highq', 
     296    'lowq','midq','highq','exq', 
    290297    '2d','1d', 
    291298    'preset','random', 
  • compare_many.py

    rf786ff3 rab55943  
    77from sasmodels.kernelcl import environment 
    88from compare import (MODELS, randomize_model, suppress_pd, eval_sasview, 
    9                      eval_opencl, eval_ctypes, make_data) 
     9                     eval_opencl, eval_ctypes, make_data, get_demo_pars) 
    1010 
    1111def get_stats(target, value, index): 
     
    3131    print(','.join('"%s"'%c for c in columns)) 
    3232 
    33 def compare_instance(model, data, index, N=1, mono=True, cutoff=1e-5): 
    34     name, pars = MODELS[model]() 
     33def compare_instance(name, data, index, N=1, mono=True, cutoff=1e-5): 
     34    pars = get_demo_pars(name) 
    3535    header = '\n"Model","%s","Count","%d"'%(name, N) 
    3636    if not mono: header += ',"Cutoff",%g'%(cutoff,) 
     
    102102 
    103103    data, index = make_data(qmax=1.0, is2D=is2D, Nq=Nq) 
    104     model_list = [model] if model != "all" else list(sorted(MODELS.keys())) 
     104    model_list = [model] if model != "all" else MODELS 
    105105    for model in model_list: 
    106106        compare_instance(model, data, index, N=count, mono=mono, cutoff=cutoff) 
  • sasmodels/bumps_model.py

    r8632a35 r29f5536  
    165165    import matplotlib.pyplot as plt 
    166166    if hasattr(data, 'qx_data'): 
    167         iq = iq[:] 
     167        iq = iq+0 
    168168        valid = np.isfinite(iq) 
    169169        if scale == 'log': 
  • sasmodels/convert.py

    rfd1c792 r99e6860  
    5454    Convert model from new style parameter names to old style. 
    5555    """ 
    56     sasmodels = __import__('sasmodels.models.'+name) 
    57     newmodel = getattr(sasmodels.models, name, None) 
    58     mapping = newmodel.oldpars 
    59     oldname = newmodel.oldname 
     56    __import__('sasmodels.models.'+name) 
     57    model = getattr(sasmodels.models, name, None) 
     58    mapping = model.oldpars 
     59    oldname = model.oldname 
    6060    oldpars = _rename_pars(_unscale_sld(pars), mapping) 
    6161    return oldname, oldpars 
  • sasmodels/generate.py

    r12076cf r3750279  
    187187# TODO: identify model files which have changed since loading and reload them. 
    188188 
    189 __all__ = ["make, doc", "sources", "use_single"] 
     189__all__ = ["make", "doc", "sources", "use_single"] 
    190190 
    191191import sys 
     
    266266#  define local 
    267267#  define constant const 
    268 #  define powr(a,b) pow(a,b) 
    269268#else 
    270269#  ifdef USE_SINCOS 
     
    273272#    define SINCOS(angle,svar,cvar) do {svar=sin(angle);cvar=cos(angle);} while (0) 
    274273#  endif 
     274#  define pow(a,b) powr(a,b) 
    275275#endif 
    276276 
  • sasmodels/kerneldll.py

    rafb2c78 r68d3c1b  
    2020elif os.name == 'nt': 
    2121    # make sure vcvarsall.bat is called first in order to set compiler, headers, lib paths, etc. 
    22     ##COMPILER = r'"C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe"' 
    23     # Can't find VCOMP90.DLL (don't know why), so remove openmp support from windows compiler build 
    24     #COMPILE = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG /Tp%(source)s /link /DLL /INCREMENTAL:NO /MANIFEST /OUT:%(output)s" 
    25     #COMPILE = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG /Tp%(source)s /openmp /link /DLL /INCREMENTAL:NO /MANIFEST /OUT:%(output)s" 
    26     #COMPILE = "gcc -shared -fPIC -std=c99 -fopenmp -O2 -Wall %(source)s -o %(output)s -lm" 
    27     COMPILE = "gcc -shared -fPIC -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" 
     22    if "VCINSTALLDIR" in os.environ: 
     23        # MSVC compiler is available, so use it. 
     24        COMPILE = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG /Tp%(source)s /openmp /link /DLL /INCREMENTAL:NO /MANIFEST /OUT:%(output)s" 
     25        # Can't find VCOMP90.DLL (don't know why), so remove openmp support from windows compiler build 
     26        #COMPILE = "cl /nologo /Ox /MD /W3 /GS- /DNDEBUG /Tp%(source)s /link /DLL /INCREMENTAL:NO /MANIFEST /OUT:%(output)s" 
     27    else: 
     28        #COMPILE = "gcc -shared -fPIC -std=c99 -fopenmp -O2 -Wall %(source)s -o %(output)s -lm" 
     29        COMPILE = "gcc -shared -fPIC -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" 
    2830else: 
    2931    COMPILE = "cc -shared -fPIC -std=c99 -fopenmp -O2 -Wall %(source)s -o %(output)s -lm" 
  • sasmodels/models/broad_peak.py

    rfd1c792 rf57d123  
    1717The scattering intensity *I(q)* is calculated as 
    1818 
    19 .. image:: img/image174.jpg 
     19.. math: 
     20 
     21    I(q) = \frac{A}{Q^n} + \frac{C}{1 + (Q\xi}^m} + B 
    2022 
    2123Here the peak position is related to the d-spacing as *Q0* = 2|pi| / *d0*. 
     
    2426where the *q* vector is defined as 
    2527 
    26 .. image:: img/image040.gif 
     28.. math: 
     29 
     30    q = \sqrt{q_x^2 + q_y^2} 
    2731 
    2832=====================  =========  ============= 
  • sasmodels/models/cylinder.py

    rea7ffce r143e2f7  
    108108""" 
    109109 
     110import numpy as np 
    110111from numpy import pi, inf 
    111112 
     
    182183# Precision defaults to 7 digits (relative) for single, 14 for double 
    183184# May want a limited precision version that checks for 8-n or 15-n digits respectively 
     185qx,qy = 0.2*np.cos(2.5), 0.2*np.sin(2.5) 
    184186tests = [ 
    185187    [{},  0.2, 0.041761386790780453], 
    186     [{'theta':10.0, 'phi':10.0}, [0.2], [0.041761386790780453]], 
    187     [{'theta':10.0, 'phi':10.0}, (0.2, 2.5), 0.038176446608393366], 
    188     [{'theta':10.0, 'phi':10.0}, [(0.2, 2.5)], [0.038176446608393366]], 
     188    [{}, [0.2], [0.041761386790780453]], 
     189    [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03414647218513852], 
     190    [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03414647218513852]], 
    189191    ] 
    190  
     192del qx,qy  # not necessary to delete, but cleaner 
  • sasmodels/models/lamellarCailleHG.py

    rdc02af0 rcd55ac3  
    128128                tail_length_pd= 0.1, tail_length_pd_n=20, 
    129129                head_length_pd= 0.05, head_length_pd_n=30, 
    130                 spacing_pd= 0, spacing_pd_n=40 
     130                spacing_pd= 0.2, spacing_pd_n=40 
    131131         ) 
    132132 
  • sasmodels/models/lamellarCailleHG_kernel.c

    rdc02af0 rcd55ac3  
    3636  Pq = (head_sld-solvent_sld)*(sin(qval*(head_length+tail_length))-sin(qval*tail_length)) +  
    3737              (tail_sld-solvent_sld)*sin(qval*tail_length); 
     38  Pq *= Pq; 
     39  Pq *= 4.0/(qval*qval); 
    3840 
    3941  NNint = (int)NN;    //cast to an integer for the loop 
Note: See TracChangeset for help on using the changeset viewer.