Changes in sasmodels/compare.py [765eb0e:ced5bd2] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
r765eb0e rced5bd2 73 73 -res=0 sets the resolution width dQ/Q if calculating with resolution 74 74 -lowq*/-midq/-highq/-exq use q values up to 0.05, 0.2, 1.0, 10.0 75 -q=min:max alternative specification of qrange 75 76 -nq=128 sets the number of Q points in the data set 76 77 -1d*/-2d computes 1d or 2d data … … 533 534 % (pd, n, nsigma, nsigma, pdtype) 534 535 if M0 != 0.: 535 line += " M0:%.3f m phi:%.1f mtheta:%.1f" % (M0, mphi, mtheta)536 line += " M0:%.3f mtheta:%.1f mphi:%.1f" % (M0, mtheta, mphi) 536 537 return line 537 538 … … 768 769 'accuracy', 'is2d' and 'view' parsed from the command line. 769 770 """ 770 qm ax, nq, res =opts['qmax'], opts['nq'], opts['res']771 qmin, qmax, nq, res = opts['qmin'], opts['qmax'], opts['nq'], opts['res'] 771 772 if opts['is2d']: 772 773 q = np.linspace(-qmax, qmax, nq) # type: np.ndarray … … 777 778 else: 778 779 if opts['view'] == 'log' and not opts['zero']: 779 qmax = math.log10(qmax) 780 q = np.logspace(qmax-3, qmax, nq) 780 q = np.logspace(math.log10(qmin), math.log10(qmax), nq) 781 781 else: 782 q = np.linspace( 0.001*qmax, qmax, nq)782 q = np.linspace(qmin, qmax, nq) 783 783 if opts['zero']: 784 784 q = np.hstack((0, q)) … … 955 955 else: 956 956 err, errstr, errview = abs(relerr), "rel err", "log" 957 if (err == 0.).all(): 958 errview = 'linear' 957 959 if 0: # 95% cutoff 958 960 sorted = np.sort(err.flatten()) … … 960 962 err[err > cutoff] = cutoff 961 963 #err,errstr = base/comp,"ratio" 962 plot_theory(data, None, resid=err, view=errview, use_data=use_data) 963 if view == 'linear': 964 plt.xscale('linear') 964 plot_theory(data, None, resid=err, view=view, use_data=use_data) 965 plt.yscale(errview) 965 966 plt.title("max %s = %.3g"%(errstr, abs(err).max())) 966 967 #cbar_title = errstr if errview=="linear" else "log "+errstr … … 1001 1002 1002 1003 # Data generation 1003 'data=', 'noise=', 'res=', 1004 ' nq=', 'lowq', 'midq', 'highq', 'exq', 'zero',1004 'data=', 'noise=', 'res=', 'nq=', 'q=', 1005 'lowq', 'midq', 'highq', 'exq', 'zero', 1005 1006 '2d', '1d', 1006 1007 … … 1122 1123 'view' : 'log', 1123 1124 'is2d' : False, 1125 'qmin' : None, 1124 1126 'qmax' : 0.05, 1125 1127 'nq' : 128, … … 1159 1161 elif arg == '-zero': opts['zero'] = True 1160 1162 elif arg.startswith('-nq='): opts['nq'] = int(arg[4:]) 1163 elif arg.startswith('-q='): 1164 opts['qmin'], opts['qmax'] = [float(v) for v in arg[3:].split(':')] 1161 1165 elif arg.startswith('-res='): opts['res'] = float(arg[5:]) 1162 1166 elif arg.startswith('-noise='): opts['noise'] = float(arg[7:]) … … 1207 1211 1208 1212 # Create the computational engines 1213 if opts['qmin'] is None: 1214 opts['qmin'] = 0.001*opts['qmax'] 1209 1215 if opts['datafile'] is not None: 1210 1216 data = load_data(os.path.expanduser(opts['datafile']))
Note: See TracChangeset
for help on using the changeset viewer.