Changeset 790b16bb in sasmodels


Ignore:
Timestamp:
Dec 23, 2016 12:55:54 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
119fa13
Parents:
bb584b3 (diff), a297255 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ticket-795' of github.com:sasview/sasmodels into ticket-795

Location:
sasmodels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/conversion_table.py

    rbb584b3 r790b16bb  
    2828 
    2929CONVERSION_TABLE = { 
    30     (4,0,1) : {}, 
    31     (4,0,0) : {}, 
    3230    (3,1,2) : { 
    3331    "adsorbed_layer": [ 
  • sasmodels/convert.py

    r0795293 ra297255  
    9393 
    9494def _get_translation_table(model_info, version=(3,1,2)): 
    95     _, translation = CONVERSION_TABLE.get(version).get(model_info.id, [None, {}]) 
     95    _, translation = CONVERSION_TABLE.get(version, {}).get(model_info.id, [None, {}]) 
    9696    translation = translation.copy() 
    9797    for p in model_info.parameters.kernel_parameters: 
     
    154154    """ 
    155155    for sasmodels_name, [sasview_name, _] in \ 
    156             CONVERSION_TABLE.get(version).items(): 
     156            CONVERSION_TABLE.get(version, {}).items(): 
    157157        if sasview_name == model_name: 
    158158            return sasmodels_name 
     
    302302    keys = sorted(CONVERSION_TABLE.keys()) 
    303303    for i, version in enumerate(keys): 
     304        # Don't allow indices outside list 
     305        next_i = i + 1 
     306        if next_i == len(keys): 
     307            next_i = i 
    304308        # If the save state is from a later version, skip the check 
    305         if model_version > version and model_version != keys[i+1]: 
    306             continue 
    307         newname = _conversion_target(name, version) 
     309        if model_version <= keys[next_i]: 
     310            newname = _conversion_target(name, version) 
     311        else: 
     312            newname = None 
    308313        # If no conversion is found, move on 
    309314        if newname is None: 
     
    315320            # Can't use _get_translation_table since that will return the 'bare' 
    316321            # version. 
    317             translation = CONVERSION_TABLE.get(version)[newname][1] 
     322            translation = CONVERSION_TABLE.get(version, {})[newname][1] 
    318323        else: 
    319324            model_info = load_model_info(newname) 
  • sasmodels/sasview_model.py

    rbb584b3 r790b16bb  
    5757    import sas.models 
    5858    from sasmodels.conversion_table import CONVERSION_TABLE 
    59     for new_name, conversion in CONVERSION_TABLE.get((3,1,2)).items(): 
     59    for new_name, conversion in CONVERSION_TABLE.get((3,1,2), {}).items(): 
    6060        # CoreShellEllipsoidModel => core_shell_ellipsoid:1 
    6161        new_name = new_name.split(':')[0] 
Note: See TracChangeset for help on using the changeset viewer.