Changeset 6e5c0b7 in sasmodels for sasmodels/compare.py
- Timestamp:
- Apr 4, 2017 3:28:58 PM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3a45c2c
- Parents:
- 933af72 (diff), c4e3215 (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
r01ea374 r6e5c0b7 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 -help/-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 … … 1113 1118 1114 1119 # Create the computational engines 1115 data, _ = make_data(opts) 1120 if opts['data'] is not None: 1121 data = load_data(os.path.expanduser(opts['data'])) 1122 else: 1123 data, _ = make_data(opts) 1116 1124 if n1: 1117 1125 base = make_engine(model_info, data, engines[0], opts['cutoff']) … … 1143 1151 show html docs for the model 1144 1152 """ 1145 import wx # type: ignore 1146 from .generate import view_html_from_info 1147 app = wx.App() if wx.GetApp() is None else None 1148 view_html_from_info(opts['def'][0]) 1149 if app: app.MainLoop() 1150 1153 import os 1154 from .generate import make_html 1155 from . import rst2html 1156 1157 info = opts['def'][0] 1158 html = make_html(info) 1159 path = os.path.dirname(info.filename) 1160 url = "file://"+path.replace("\\","/")[2:]+"/" 1161 rst2html.view_html_qtapp(html, url) 1151 1162 1152 1163 def explore(opts):
Note: See TracChangeset
for help on using the changeset viewer.