Changeset fcd7bbd in sasmodels for sasmodels/product.py


Ignore:
Timestamp:
Mar 16, 2016 9:27:13 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:
70bbb74
Parents:
63776d3
Message:

use named tuple for parameter information

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/product.py

    r35b4c47 rfcd7bbd  
    2828    s_id, s_name, s_pars = s_info['id'], s_info['name'], s_info['parameters'] 
    2929    # We require models to start with scale and background 
    30     assert s_pars[SCALE][0] == 'scale' 
    31     assert s_pars[BACKGROUND][0] == 'background' 
     30    assert s_pars[SCALE].name == 'scale' 
     31    assert s_pars[BACKGROUND].name == 'background' 
    3232    # We require structure factors to start with effect radius and volfraction 
    33     assert s_pars[EFFECT_RADIUS][0] == 'effect_radius' 
    34     assert s_pars[VOLFRACTION][0] == 'volfraction' 
     33    assert s_pars[EFFECT_RADIUS].name == 'effect_radius' 
     34    assert s_pars[VOLFRACTION].name == 'volfraction' 
    3535    # Combine the parameter sets.  We are skipping the first three 
    3636    # parameters of S since scale, background are defined in P and 
     
    3838    pars = p_pars + s_pars[3:] 
    3939    # check for duplicates; can't use assertion since they may never be checked 
    40     if len(set(p[0] for p in pars)) != len(pars): 
     40    if len(set(p.name for p in pars)) != len(pars): 
    4141        raise ValueError("Duplicate parameters in %s and %s"%(p_id)) 
    4242    # For comparison with sasview, determine the old parameters. 
     
    5252    model_info['title'] = 'Product of %s and structure factor %s'%(p_name, s_name) 
    5353    model_info['description'] = model_info['title'] 
     54    model_info['docs'] = model_info['title'] 
    5455    model_info['category'] = "custom" 
    5556    model_info['parameters'] = pars 
    56     # Remember the component info blocks so we can build the product model 
    57     model_info['composition'] = ('product', [p_info, s_info]) 
     57    #model_info['single'] = p_info['single'] and s_info['single'] 
     58    model_info['structure_factor'] = False 
     59    model_info['variant_info'] = None 
     60    #model_info['tests'] = [] 
     61    #model_info['source'] = [] 
     62    # Iq, Iqxy, form_volume, ER, VR and sesans 
    5863    model_info['oldname'] = oldname 
    5964    model_info['oldpars'] = oldpars 
     65    model_info['composition'] = ('product', [p_info, s_info]) 
    6066    process_parameters(model_info) 
    6167    return model_info 
Note: See TracChangeset for help on using the changeset viewer.