Changeset 745b7bb in sasmodels for doc/genmodel.py


Ignore:
Timestamp:
Aug 4, 2016 11:32:17 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
4e0968b
Parents:
54bcd4a
Message:

spherical sld: doc cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/genmodel.py

    ra5b8477 r745b7bb  
    66sys.path.insert(0, os.path.abspath('..')) 
    77from sasmodels import generate, core 
    8 from sasmodels.direct_model import DirectModel 
     8from sasmodels.direct_model import DirectModel, call_profile 
    99from sasmodels.data import empty_data1D, empty_data2D 
    1010 
     
    1717    from sasmodels.kernel import KernelModel 
    1818    from sasmodels.modelinfo import ModelInfo 
     19 
    1920 
    2021def plot_1d(model, opts, ax): 
     
    5556    ax.set_xlabel(r'$Q_x \/(\AA^{-1})$') 
    5657    ax.set_ylabel(r'$Q_y \/(\AA^{-1})$') 
     58 
     59def plot_profile_inset(model_info, ax): 
     60    p = ax.get_position() 
     61    width, height = 0.4*(p.x1-p.x0), 0.4*(p.y1-p.y0) 
     62    left, bottom = p.x1-width, p.y1-height 
     63    inset = plt.gcf().add_axes([left, bottom, width, height]) 
     64    x, y, labels = call_profile(model_info) 
     65    inset.plot(x, y, '-') 
     66    inset.locator_params(nbins=4) 
     67    #inset.set_xlabel(labels[0]) 
     68    #inset.set_ylabel(labels[1]) 
     69    inset.text(0.99, 0.99, "profile", 
     70               horizontalalignment="right", 
     71               verticalalignment="top", 
     72               transform=inset.transAxes) 
    5773 
    5874def figfile(model_info): 
     
    100116        ax1d = fig.add_axes([ax_left, ax_bottom, ax_width, ax_height]) 
    101117        plot_1d(model, opts, ax1d) 
     118 
     119    if model_info.profile: 
     120        plot_profile_inset(model_info, ax1d) 
    102121 
    103122    # Save image in model/img 
Note: See TracChangeset for help on using the changeset viewer.