Changeset 5d80bbf in sasmodels
- Timestamp:
- Nov 19, 2015 6:50:00 PM (9 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:
- 525f3a9
- Parents:
- 66ebdd6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/bumps_model.py
rcd8dde1 r5d80bbf 35 35 import datetime 36 36 import warnings 37 import traceback 37 38 38 39 import numpy as np … … 216 217 Boxcut(x_min=-np.inf, x_max=np.inf, y_min=-np.inf, y_max=cutoff)(data) 217 218 218 219 def protect(fn): 220 def wrapper(*args, **kw): 221 try: 222 return fn(*args, **kw) 223 except: 224 traceback.print_exc() 225 return wrapper 226 227 @protect 219 228 def _plot_result1D(data, theory, resid, view, include_data=True): 220 229 """ … … 234 243 plt.subplot(121) 235 244 245 positive = False 236 246 if include_data: 237 247 plt.errorbar(data.x, scale*mdata, yerr=data.dy, fmt='.') 248 positive = positive or (mdata>0).any() 238 249 if theory is not None: 239 250 mtheory = masked_array(theory, mdata.mask) 240 251 plt.plot(data.x, scale*mtheory, '-', hold=True) 252 positive = positive or (mtheory>0).any() 241 253 plt.xscale(view) 242 plt.yscale('linear' if view == 'q4' else view)254 plt.yscale('linear' if view == 'q4' or not positive else view) 243 255 plt.xlabel('Q') 244 256 plt.ylabel('I(Q)') … … 252 264 253 265 # pylint: disable=unused-argument 266 @protect 254 267 def _plot_sesans(data, theory, resid, view): 255 268 import matplotlib.pyplot as plt … … 264 277 plt.ylabel('residuals (P/P0)') 265 278 279 @protect 266 280 def _plot_result2D(data, theory, resid, view): 267 281 """ … … 290 304 plt.colorbar() 291 305 306 @protect 292 307 def _plot_2d_signal(data, signal, vmin=None, vmax=None, view='log'): 293 308 """
Note: See TracChangeset
for help on using the changeset viewer.