Changeset ba69383 in sasmodels
- Timestamp:
- Oct 31, 2014 4:44:17 PM (10 years ago)
- 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:
- 31819c5
- Parents:
- ef2861b
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
compare.py
r2d0aced rba69383 89 89 90 90 def compare(name, pars, Ncpu, Ngpu, opts, set_pars): 91 92 91 # Sort out data 93 92 qmax = 1.0 if '-highq' in opts else (0.2 if '-midq' in opts else 0.05) … … 180 179 resid[index] = (gpu - cpu)[index] 181 180 relerr[index] = resid[index]/cpu[index] 181 #bad = (relerr>1e-4) 182 #print relerr[bad],cpu[bad],gpu[bad],data.qx_data[bad],data.qy_data[bad] 182 183 print "max(|ocl-%s|)"%comp, max(abs(resid[index])) 183 print "max(|(ocl-%s)/ocl|)"%comp, max(abs(relerr[index])) 184 print "max(|(ocl-%s)/%s|)"%(comp,comp), max(abs(relerr[index])) 185 p98 = int(len(relerr[index])*0.98) 186 print "98%% (|(ocl-%s)/%s|) <"%(comp,comp), np.sort(abs(relerr[index]))[p98] 187 184 188 185 189 # Plot if requested … … 201 205 plot_data(data, err, scale='linear') 202 206 plt.title("max %s = %.3g"%(errstr, max(abs(err[index])))) 203 if is2D: plt.colorbar() 207 if is2D: plt.colorbar() 208 209 if Ncpu > 0 and Ngpu > 0 and '-hist' in opts: 210 plt.figure() 211 v = relerr[index] 212 v[v==0] = 0.5*np.min(np.abs(v[v!=0])) 213 plt.hist(np.log10(np.abs(v)), normed=1, bins=50); 214 plt.xlabel('log10(err), err = | F(q) single - F(q) double| / | F(q) double |'); 215 plt.ylabel('P(err)') 216 plt.title('Comparison of single and double precision models for %s'%name) 217 204 218 plt.show() 205 219 … … 228 242 -pars/-nopars* prints the parameter set or not 229 243 -abs/-rel* plot relative or absolute error 244 -hist/-nohist* plot histogram of relative error 230 245 231 246 Key=value pairs allow you to set specific values to any of the model … … 247 262 'nopars','pars', 248 263 'rel','abs', 264 'hist','nohist', 249 265 ] 250 266 … … 272 288 name, pars = MODELS[args[0]]() 273 289 Nopencl = int(args[1]) if len(args) > 1 else 5 274 Nsasview = int(args[2]) if len(args) > 3else 1290 Nsasview = int(args[2]) if len(args) > 2 else 1 275 291 276 292 # Fill in default polydispersity parameters -
sasmodels/bumps_model.py
r78356b31 rba69383 167 167 xmin, xmax = min(data.qx_data), max(data.qx_data) 168 168 ymin, ymax = min(data.qy_data), max(data.qy_data) 169 if vmin is None: vmin = iq[valid&~data.mask].min() 170 if vmax is None: vmax = iq[valid&~data.mask].max() 169 171 plt.imshow(plottable.reshape(128,128), 170 172 interpolation='nearest', aspect=1, origin='upper',
Note: See TracChangeset
for help on using the changeset viewer.