Changes in / [cfd4625:3750279] in sasmodels
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
compare.py
r373d1b6 r29f5536 163 163 if len(split) == 2) 164 164 # 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 166 166 Nq = int(opt_values.get('-Nq', '128')) 167 167 is2D = not "-1d" in opts … … 225 225 plot_data(data, cpu, scale='log') 226 226 plt.title("%s t=%.1f ms"%(comp,cpu_time)) 227 cbar_title = "log I" 227 228 if Nocl > 0: 228 229 if Ncpu > 0: plt.subplot(132) 229 230 plot_data(data, ocl, scale='log') 230 231 plt.title("opencl t=%.1f ms"%ocl_time) 232 cbar_title = "log I" 231 233 if Ncpu > 0 and Nocl > 0: 232 234 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" 235 239 #err,errstr = ocl/cpu,"ratio" 236 plot_data(data, err, scale='l inear')240 plot_data(data, err, scale='log') #'linear') 237 241 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) 239 246 240 247 if Ncpu > 0 and Nocl > 0 and '-hist' in opts: … … 265 272 -plot*/-noplot plots or suppress the plot of the model 266 273 -single*/-double uses double precision for comparison 267 -lowq*/-midq/-highq use q values up to 0.05, 0.2 or 1.0274 -lowq*/-midq/-highq/-exq use q values up to 0.05, 0.2, 1.0, 10.0 268 275 -Nq=128 sets the number of Q points in the data set 269 276 -1d/-2d* computes 1d or 2d data … … 287 294 'plot','noplot', 288 295 'single','double', 289 'lowq','midq','highq', 296 'lowq','midq','highq','exq', 290 297 '2d','1d', 291 298 'preset','random', -
compare_many.py
rf786ff3 rab55943 7 7 from sasmodels.kernelcl import environment 8 8 from 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) 10 10 11 11 def get_stats(target, value, index): … … 31 31 print(','.join('"%s"'%c for c in columns)) 32 32 33 def compare_instance( model, data, index, N=1, mono=True, cutoff=1e-5):34 name, pars = MODELS[model]()33 def compare_instance(name, data, index, N=1, mono=True, cutoff=1e-5): 34 pars = get_demo_pars(name) 35 35 header = '\n"Model","%s","Count","%d"'%(name, N) 36 36 if not mono: header += ',"Cutoff",%g'%(cutoff,) … … 102 102 103 103 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 105 105 for model in model_list: 106 106 compare_instance(model, data, index, N=count, mono=mono, cutoff=cutoff) -
sasmodels/bumps_model.py
r9c117a2 r29f5536 165 165 import matplotlib.pyplot as plt 166 166 if hasattr(data, 'qx_data'): 167 iq = iq [:]167 iq = iq+0 168 168 valid = np.isfinite(iq) 169 169 if scale == 'log': -
sasmodels/convert.py
rfd1c792 r99e6860 54 54 Convert model from new style parameter names to old style. 55 55 """ 56 sasmodels =__import__('sasmodels.models.'+name)57 newmodel = getattr(sasmodels.models, name, None)58 mapping = newmodel.oldpars59 oldname = newmodel.oldname56 __import__('sasmodels.models.'+name) 57 model = getattr(sasmodels.models, name, None) 58 mapping = model.oldpars 59 oldname = model.oldname 60 60 oldpars = _rename_pars(_unscale_sld(pars), mapping) 61 61 return oldname, oldpars -
sasmodels/generate.py
r51bfbeb r99e6860 187 187 # TODO: identify model files which have changed since loading and reload them. 188 188 189 __all__ = ["make ,doc", "sources", "use_single"]189 __all__ = ["make", "doc", "sources", "use_single"] 190 190 191 191 import sys … … 266 266 # define local 267 267 # define constant const 268 # define powr(a,b) pow(a,b)269 268 #else 270 269 # ifdef USE_SINCOS … … 273 272 # define SINCOS(angle,svar,cvar) do {svar=sin(angle);cvar=cos(angle);} while (0) 274 273 # endif 274 # define pow(a,b) powr(a,b) 275 275 #endif 276 276 -
sasmodels/kerneldll.py
rafb2c78 r68d3c1b 20 20 elif os.name == 'nt': 21 21 # 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" 28 30 else: 29 31 COMPILE = "cc -shared -fPIC -std=c99 -fopenmp -O2 -Wall %(source)s -o %(output)s -lm" -
sasmodels/models/broad_peak.py
rfd1c792 rf57d123 17 17 The scattering intensity *I(q)* is calculated as 18 18 19 .. image:: img/image174.jpg 19 .. math: 20 21 I(q) = \frac{A}{Q^n} + \frac{C}{1 + (Q\xi}^m} + B 20 22 21 23 Here the peak position is related to the d-spacing as *Q0* = 2|pi| / *d0*. … … 24 26 where the *q* vector is defined as 25 27 26 .. image:: img/image040.gif 28 .. math: 29 30 q = \sqrt{q_x^2 + q_y^2} 27 31 28 32 ===================== ========= ============= -
sasmodels/models/cylinder.py
r5428233 r143e2f7 108 108 """ 109 109 110 import numpy as np 110 111 from numpy import pi, inf 111 112 … … 182 183 # Precision defaults to 7 digits (relative) for single, 14 for double 183 184 # May want a limited precision version that checks for 8-n or 15-n digits respectively 185 qx,qy = 0.2*np.cos(2.5), 0.2*np.sin(2.5) 184 186 tests = [ 185 187 [{}, 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]], 189 191 ] 190 192 del qx,qy # not necessary to delete, but cleaner -
sasmodels/models/lamellarCailleHG.py
rdc02af0 rcd55ac3 128 128 tail_length_pd= 0.1, tail_length_pd_n=20, 129 129 head_length_pd= 0.05, head_length_pd_n=30, 130 spacing_pd= 0 , spacing_pd_n=40130 spacing_pd= 0.2, spacing_pd_n=40 131 131 ) 132 132 -
sasmodels/models/lamellarCailleHG_kernel.c
rdc02af0 rcd55ac3 36 36 Pq = (head_sld-solvent_sld)*(sin(qval*(head_length+tail_length))-sin(qval*tail_length)) + 37 37 (tail_sld-solvent_sld)*sin(qval*tail_length); 38 Pq *= Pq; 39 Pq *= 4.0/(qval*qval); 38 40 39 41 NNint = (int)NN; //cast to an integer for the loop
Note: See TracChangeset
for help on using the changeset viewer.