Changeset a1c5758 in sasmodels for sasmodels/compare.py
- Timestamp:
- Oct 23, 2017 10:25:27 AM (7 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
r31eea1f ra1c5758 74 74 -res=0 sets the resolution width dQ/Q if calculating with resolution 75 75 -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 76 77 -nq=128 sets the number of Q points in the data set 77 78 -1d*/-2d computes 1d or 2d data … … 782 783 'accuracy', 'is2d' and 'view' parsed from the command line. 783 784 """ 784 qm ax, nq, res =opts['qmax'], opts['nq'], opts['res']785 qmin, qmax, nq, res = opts['qmin'], opts['qmax'], opts['nq'], opts['res'] 785 786 if opts['is2d']: 786 787 q = np.linspace(-qmax, qmax, nq) # type: np.ndarray … … 791 792 else: 792 793 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) 795 795 else: 796 q = np.linspace( 0.001*qmax, qmax, nq)796 q = np.linspace(qmin, qmax, nq) 797 797 if opts['zero']: 798 798 q = np.hstack((0, q)) … … 984 984 else: 985 985 err, errstr, errview = abs(relerr), "rel err", "log" 986 if (err == 0.).all(): 987 errview = 'linear' 986 988 if 0: # 95% cutoff 987 989 sorted = np.sort(err.flatten()) … … 989 991 err[err > cutoff] = cutoff 990 992 #err,errstr = base/comp,"ratio" 993 <<<<<<< HEAD 991 994 plot_theory(data, None, resid=err, view=errview, use_data=use_data) 992 995 plt.xscale('log' if view == 'log' else linear) 993 996 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 994 1001 plt.title("max %s = %.3g"%(errstr, abs(err).max())) 995 1002 #cbar_title = errstr if errview=="linear" else "log "+errstr … … 1030 1037 1031 1038 # 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', 1034 1041 '2d', '1d', 1035 1042 … … 1152 1159 'view' : 'log', 1153 1160 'is2d' : False, 1161 'qmin' : None, 1154 1162 'qmax' : 0.05, 1155 1163 'nq' : 128, … … 1191 1199 elif arg == '-zero': opts['zero'] = True 1192 1200 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(':')] 1193 1203 elif arg.startswith('-res='): opts['res'] = float(arg[5:]) 1194 1204 elif arg.startswith('-noise='): opts['noise'] = float(arg[7:]) … … 1247 1257 1248 1258 # Create the computational engines 1259 if opts['qmin'] is None: 1260 opts['qmin'] = 0.001*opts['qmax'] 1249 1261 if opts['datafile'] is not None: 1250 1262 data = load_data(os.path.expanduser(opts['datafile']))
Note: See TracChangeset
for help on using the changeset viewer.