Changeset 3c24ccd in sasmodels for sasmodels/weights.py


Ignore:
Timestamp:
Oct 18, 2017 10:03:43 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
ef8e68c
Parents:
fbb9397
Message:

add -weights option to sascomp to show dispersity distribution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/weights.py

    r8698a0d r3c24ccd  
    232232 
    233233 
    234 def plot_weights(model_info, pairs): 
    235     # type: (ModelInfo, List[Tuple[np.ndarray, np.ndarray]]) -> None 
     234def plot_weights(model_info, mesh): 
     235    # type: (ModelInfo, List[Tuple[float, np.ndarray, np.ndarray]]) -> None 
    236236    """ 
    237237    Plot the weights returned by :func:`get_weights`. 
    238238 
    239     *model_info* is 
    240     :param model_info: 
    241     :param pairs: 
    242     :return: 
     239    *model_info* defines model parameters, etc. 
     240 
     241    *mesh* is a list of tuples containing (*value*, *dispersity*, *weights*) 
     242    for each parameter, where (*dispersity*, *weights*) pairs are the 
     243    distributions to be plotted. 
    243244    """ 
    244245    import pylab 
    245246 
    246     if any(len(values)>1 for values, weights in pairs): 
     247    if any(len(dispersity)>1 for value, dispersity, weights in mesh): 
    247248        labels = [p.name for p in model_info.parameters.call_parameters] 
    248         pylab.interactive(True) 
     249        #pylab.interactive(True) 
    249250        pylab.figure() 
    250         for (v,w), s in zip(pairs, labels): 
    251             if len(v) > 1: 
    252                 #print("weights for", s, v, w) 
    253                 pylab.plot(v, w, '-o', label=s) 
     251        for (v,x,w), s in zip(mesh, labels): 
     252            if len(x) > 1: 
     253                pylab.plot(x, w, '-o', label=s) 
    254254        pylab.grid(True) 
    255255        pylab.legend() 
Note: See TracChangeset for help on using the changeset viewer.