Changeset f8f5a37 in sasmodels


Ignore:
Timestamp:
Nov 17, 2016 11:51:53 AM (8 years ago)
Author:
krzywon
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
3a45c2c
Parents:
47fafe9
Message:

#795: Working on reparameterized models: Teubner-Strey and Hollow Cylinder load properly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    r47fafe9 rf8f5a37  
    4949# Convert new style names for polydispersity info to old style names 
    5050PD_DOT = [ 
    51     ("", ""), 
    5251    ("_pd", ".width"), 
    5352    ("_pd_n", ".npts"), 
     
    5554    ("_pd_type", ".type"), 
    5655    ] 
    57  
    58 CONVERT_OLD =[ 
    59     "fittable", 
    60     "std", 
    61     "upper", 
    62     "lower", 
    63     "units" 
    64 ] 
    6556 
    6657def _rescale(par, scale): 
     
    220211        # now uses radius and thickness 
    221212        thickness = oldpars['radius'] - oldpars['core_radius'] 
    222         pd = oldpars['radius.width']*oldpars['radius']/thickness 
    223213        oldpars['radius'] = thickness 
    224         oldpars['radius.width'] = pd 
     214        if 'radius.width' in oldpars: 
     215            pd = oldpars['radius.width']*oldpars['radius']/thickness 
     216            oldpars['radius.width'] = pd 
    225217    elif name == 'pearl_necklace': 
    226218        pass 
     
    267259        p_c1 = oldpars['c1'] 
    268260        p_c2= oldpars['c2'] 
    269         xi = math.sqrt(2/(math.sqrt(p_scale/p_c2) + 0.5*p_c1/p_c2)) 
     261        i_1 = 0.5*p_c1/p_c2 
     262        i_2 = math.sqrt(math.fabs(p_scale/p_c2)) 
     263        i_3 = 2/(i_1 + i_2) 
     264        xi = math.sqrt(math.fabs(i_3)) 
    270265 
    271266        # find d from xi 
    272         k = math.sqrt(1 - 0.5*p_c1/p_c2*xi**2) 
     267        k = math.sqrt(math.fabs(1 - 0.5*p_c1/p_c2*xi**2)) 
    273268        d = 2*math.pi*xi/k 
    274269 
     
    302297        model_info = load_model_info(newname) 
    303298        translation = _get_translation_table(model_info) 
    304     newpars = _convert_name(translation, pars.copy()) 
    305     newpars = _hand_convert(newname, newpars) 
     299    newpars = _hand_convert(newname, pars.copy()) 
     300    newpars = _convert_name(translation, newpars) 
    306301    newpars = _convert_pars(newpars, translation) 
    307302    if not model_info.structure_factor: 
Note: See TracChangeset for help on using the changeset viewer.