Changeset 0795293 in sasmodels


Ignore:
Timestamp:
Dec 21, 2016 10:00:35 AM (7 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:
a297255, bb584b3
Parents:
86e8e66
Message:

Add a check for the version of the incoming pagestate to skip previous versions.

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/conversion_table.py

    r86e8e66 r0795293  
    2929CONVERSION_TABLE = { 
    3030    (4,0,1) : {}, 
     31    (4,0,0) : {}, 
    3132    (3,1,2) : { 
    3233    "adsorbed_layer": [ 
  • sasmodels/convert.py

    r86e8e66 r0795293  
    295295    return oldpars 
    296296 
    297 def convert_model(name, pars, use_underscore=False): 
     297def convert_model(name, pars, use_underscore=False, model_version=(3,1,2)): 
    298298    """ 
    299299    Convert model from old style parameter names to new style. 
    300300    """ 
    301301    newpars = pars 
    302     for version, _ in sorted(CONVERSION_TABLE.iteritems()): 
     302    keys = sorted(CONVERSION_TABLE.keys()) 
     303    for i, version in enumerate(keys): 
     304        # 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 
    303307        newname = _conversion_target(name, version) 
     308        # If no conversion is found, move on 
    304309        if newname is None: 
    305310            newname = name 
Note: See TracChangeset for help on using the changeset viewer.