Changeset 644430f in sasmodels
- Timestamp:
- Dec 23, 2015 10:02:39 AM (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:
- e3a9733
- Parents:
- cade620
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/data.py
r9404dd3 r644430f 275 275 276 276 #print(vmin, vmax) 277 positive = False 277 all_positive = True 278 some_present = False 278 279 if plot_data: 279 mdata = masked_array(data.y, data.mask )280 mdata = masked_array(data.y, data.mask.copy()) 280 281 mdata[~np.isfinite(mdata)] = masked 281 282 if view is 'log': 282 283 mdata[mdata <= 0] = masked 283 plt.errorbar(data.x, scale*mdata, yerr=data.dy, fmt='.') 284 positive = positive or (mdata>0).any() 284 plt.errorbar(data.x/10, scale*mdata, yerr=data.dy, fmt='.') 285 all_positive = all_positive and (mdata>0).all() 286 some_present = some_present or (mdata.count() > 0) 287 285 288 286 289 if plot_theory: 287 mtheory = masked_array(theory, data.mask) 290 mtheory = masked_array(theory, data.mask.copy()) 291 mtheory[~np.isfinite(mtheory)] = masked 288 292 if view is 'log': 289 mtheory[mtheory<= 0] = masked 290 plt.plot(data.x, scale*mtheory, '-', hold=True) 291 positive = positive or (mtheory>0).any() 292 293 plt.xscale(view) 294 plt.yscale('linear' if view == 'q4' or not positive else view) 295 plt.xlabel('Q') 296 plt.ylabel('I(Q)') 293 mtheory[mtheory<=0] = masked 294 plt.plot(data.x/10, scale*mtheory, '-', hold=True) 295 all_positive = all_positive and (mtheory>0).all() 296 some_present = some_present or (mtheory.count() > 0) 297 298 plt.xscale('linear' if not some_present else view) 299 plt.yscale('linear' 300 if view == 'q4' or not some_present or not all_positive 301 else view) 302 plt.xlabel("$q$/nm$^{-1}$") 303 plt.ylabel('$I(q)$') 297 304 298 305 if plot_resid: … … 300 307 plt.subplot(122) 301 308 302 mresid = masked_array(resid, data.mask) 303 plt.plot(data.x, mresid, '-') 309 mresid = masked_array(resid, data.mask.copy()) 310 mresid[~np.isfinite(mresid)] = masked 311 some_present = (mresid.count() > 0) 312 plt.plot(data.x/10, mresid, '-') 313 plt.xlabel("$q$/nm$^{-1}$") 304 314 plt.ylabel('residuals') 305 plt.xlabel('Q') 306 plt.xscale(view) 315 plt.xscale('linear' if not some_present else view) 307 316 308 317 … … 366 375 _plot_2d_signal(data, target, view=view, vmin=vmin, vmax=vmax) 367 376 plt.title('data') 368 plt.colorbar() 377 h = plt.colorbar() 378 h.set_label('$I(q)$') 369 379 370 380 if plot_theory: … … 377 387 _plot_2d_signal(data, theory, view=view, vmin=vmin, vmax=vmax) 378 388 plt.title('theory') 379 plt.colorbar() 389 h = plt.colorbar() 390 h.set_label('$I(q)$') 380 391 381 392 #if plot_data or plot_theory: … … 388 399 plt.subplot(122) 389 400 _plot_2d_signal(data, resid, view='linear') 390 plt.colorbar()391 401 plt.title('residuals') 402 h = plt.colorbar() 403 h.set_label('$\Delta I(q)$') 392 404 393 405 … … 414 426 #plottable = Iq 415 427 plottable = masked_array(image, ~valid | data.mask) 416 xmin, xmax = min(data.qx_data) , max(data.qx_data)417 ymin, ymax = min(data.qy_data) , max(data.qy_data)428 xmin, xmax = min(data.qx_data)/10, max(data.qx_data)/10 429 ymin, ymax = min(data.qy_data)/10, max(data.qy_data)/10 418 430 # TODO: fix vmin, vmax so it is shared for theory/resid 419 431 vmin = vmax = None … … 423 435 except: 424 436 vmin, vmax = 0, 1 425 plt.imshow(plottable.reshape( 128, 128),437 plt.imshow(plottable.reshape(len(data.xbins), len(data.ybins)), 426 438 interpolation='nearest', aspect=1, origin='upper', 427 439 extent=[xmin, xmax, ymin, ymax], vmin=vmin, vmax=vmax) 440 plt.xlabel("$q_x$/nm$^{-1}$") 441 plt.ylabel("$q_y$/nm$^{-1}$") 428 442 429 443
Note: See TracChangeset
for help on using the changeset viewer.