Changes in / [cb0dc22:6cff473] in sasmodels
- Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
rf72d70a rf72d70a 30 30 31 31 import sys 32 import os 32 33 import math 33 34 import datetime … … 40 41 from . import kerneldll 41 42 from . import exception 42 from .data import plot_theory, empty_data1D, empty_data2D 43 from .data import plot_theory, empty_data1D, empty_data2D, load_data 43 44 from .direct_model import DirectModel 44 45 from .convert import revert_name, revert_pars, constrain_new_to_old … … 85 86 -html shows the model docs instead of running the model 86 87 -title="note" adds note to the plot title, after the model name 88 -data="path" uses q, dq from the data file 87 89 88 90 Any two calculation engines can be selected for comparison: … … 747 749 comp = opts['engines'][1] if have_comp else None 748 750 data = opts['data'] 751 use_data = have_base ^ have_comp 749 752 750 753 # Plot if requested … … 763 766 if have_base: 764 767 if have_comp: plt.subplot(131) 765 plot_theory(data, base_value, view=view, use_data= False, limits=limits)768 plot_theory(data, base_value, view=view, use_data=use_data, limits=limits) 766 769 plt.title("%s t=%.2f ms"%(base.engine, base_time)) 767 770 #cbar_title = "log I" … … 769 772 if have_base: plt.subplot(132) 770 773 if not opts['is2d'] and have_base: 771 plot_theory(data, base_value, view=view, use_data= False, limits=limits)772 plot_theory(data, comp_value, view=view, use_data= False, limits=limits)774 plot_theory(data, base_value, view=view, use_data=use_data, limits=limits) 775 plot_theory(data, comp_value, view=view, use_data=use_data, limits=limits) 773 776 plt.title("%s t=%.2f ms"%(comp.engine, comp_time)) 774 777 #cbar_title = "log I" … … 784 787 err[err>cutoff] = cutoff 785 788 #err,errstr = base/comp,"ratio" 786 plot_theory(data, None, resid=err, view=errview, use_data= False)789 plot_theory(data, None, resid=err, view=errview, use_data=use_data) 787 790 if view == 'linear': 788 791 plt.xscale('linear') … … 834 837 VALUE_OPTIONS = [ 835 838 # Note: random is both a name option and a value option 836 'cutoff', 'random', 'nq', 'res', 'accuracy', 'title', 839 'cutoff', 'random', 'nq', 'res', 'accuracy', 'title', 'data', 837 840 ] 838 841 … … 951 954 'html' : False, 952 955 'title' : None, 956 'data' : None, 953 957 } 954 958 engines = [] … … 971 975 elif arg.startswith('-cutoff='): opts['cutoff'] = float(arg[8:]) 972 976 elif arg.startswith('-random='): opts['seed'] = int(arg[8:]) 973 elif arg.startswith('-title'): opts['title'] = arg[7:] 977 elif arg.startswith('-title='): opts['title'] = arg[7:] 978 elif arg.startswith('-data='): opts['data'] = arg[6:] 974 979 elif arg == '-random': opts['seed'] = np.random.randint(1000000) 975 980 elif arg == '-preset': opts['seed'] = -1 … … 1112 1117 1113 1118 # Create the computational engines 1114 data, _ = make_data(opts) 1119 if opts['data'] is not None: 1120 data = load_data(os.path.expanduser(opts['data'])) 1121 else: 1122 data, _ = make_data(opts) 1115 1123 if n1: 1116 1124 base = make_engine(model_info, data, engines[0], opts['cutoff']) -
sasmodels/data.py
r40a87fa ra769b54 54 54 if data is None: 55 55 raise IOError("Data %r could not be loaded" % filename) 56 if hasattr(data, 'x'): 57 data.qmin, data.qmax = data.x.min(), data.x.max() 58 data.mask = (np.isnan(data.y) if data.y is not None 59 else np.zeros_like(data.x, dtype='bool')) 56 60 return data 57 61 … … 348 352 # data, but they already handle the masking and graph markup already, so 349 353 # do not repeat. 350 if hasattr(data, ' lam'):354 if hasattr(data, 'isSesans') and data.isSesans: 351 355 _plot_result_sesans(data, None, None, use_data=True, limits=limits) 352 356 elif hasattr(data, 'qx_data'): … … 376 380 *Iq_calc* is the raw theory values without resolution smearing 377 381 """ 378 if hasattr(data, ' lam'):382 if hasattr(data, 'isSesans') and data.isSesans: 379 383 _plot_result_sesans(data, theory, resid, use_data=True, limits=limits) 380 384 elif hasattr(data, 'qx_data'): -
sasmodels/direct_model.py
rb397165 ra769b54 192 192 193 193 # interpret data 194 if hasattr(data, ' lam'):194 if hasattr(data, 'isSesans') and data.isSesans: 195 195 self.data_type = 'sesans' 196 196 elif hasattr(data, 'qx_data'):
Note: See TracChangeset
for help on using the changeset viewer.