Changeset ea75043 in sasmodels for sasmodels/data.py
- Timestamp:
- Mar 29, 2016 8:22:13 PM (8 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:
- d6f5da6
- Parents:
- 1d61d07
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/data.py
r1d61d07 rea75043 322 322 323 323 def plot_theory(data, theory, resid=None, view='log', 324 use_data=True, limits=None ):324 use_data=True, limits=None, Iq_calc=None): 325 325 """ 326 326 Plot theory calculation. … … 343 343 _plot_result2D(data, theory, resid, view, use_data, limits=limits) 344 344 else: 345 _plot_result1D(data, theory, resid, view, use_data, limits=limits) 345 _plot_result1D(data, theory, resid, view, use_data, 346 limits=limits, Iq_calc=Iq_calc) 346 347 347 348 … … 366 367 367 368 @protect 368 def _plot_result1D(data, theory, resid, view, use_data, limits=None): 369 def _plot_result1D(data, theory, resid, view, use_data, 370 limits=None, Iq_calc=None): 369 371 """ 370 372 Plot the data and residuals for 1D data. … … 376 378 use_theory = theory is not None 377 379 use_resid = resid is not None 378 num_plots = (use_data or use_theory) + use_resid 380 use_calc = use_theory and Iq_calc is not None 381 num_plots = (use_data or use_theory) + use_calc + use_resid 382 379 383 380 384 scale = data.x**4 if view == 'q4' else 1.0 … … 416 420 plt.ylabel('$I(q)$') 417 421 422 if use_calc: 423 # Only have use_calc if have use_theory 424 plt.subplot(1, num_plots, 2) 425 qx, qy, Iqxy = Iq_calc 426 plt.pcolormesh(qx, qy, np.log10(Iqxy)) 427 plt.xlabel("$q_x$/A$^{-1}$") 428 plt.xlabel("$q_y$/A$^{-1}$") 429 #plt.axis('equal') 430 418 431 if use_resid: 419 432 mresid = masked_array(resid, data.mask.copy()) … … 422 435 423 436 if num_plots > 1: 424 plt.subplot(1, num_plots, (use_data or use_theory) + 1)437 plt.subplot(1, num_plots, use_calc + 2) 425 438 plt.plot(data.x, mresid, '-') 426 439 plt.xlabel("$q$/A$^{-1}$") … … 562 575 plottable = masked_array(image, ~valid | data.mask) 563 576 # Divide range by 10 to convert from angstroms to nanometers 564 xmin, xmax = min(data.qx_data) /10, max(data.qx_data)/10565 ymin, ymax = min(data.qy_data) /10, max(data.qy_data)/10577 xmin, xmax = min(data.qx_data), max(data.qx_data) 578 ymin, ymax = min(data.qy_data), max(data.qy_data) 566 579 if view == 'log': 567 580 vmin, vmax = np.log10(vmin), np.log10(vmax) 568 581 plt.imshow(plottable.reshape(len(data.x_bins), len(data.y_bins)), 569 interpolation='nearest', aspect=1, origin=' upper',582 interpolation='nearest', aspect=1, origin='lower', 570 583 extent=[xmin, xmax, ymin, ymax], vmin=vmin, vmax=vmax) 571 plt.xlabel("$q_x$/ nm$^{-1}$")572 plt.ylabel("$q_y$/ nm$^{-1}$")584 plt.xlabel("$q_x$/A$^{-1}$") 585 plt.ylabel("$q_y$/A$^{-1}$") 573 586 return vmin, vmax 574 587
Note: See TracChangeset
for help on using the changeset viewer.