Changeset 86e8e66 in sasmodels for sasmodels/convert.py


Ignore:
Timestamp:
Dec 20, 2016 12:08:41 PM (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:
0795293
Parents:
54fb5d8
Message:

Changed conversion table keys to tuples to enforce proper ordering when version ≥ 10. Changed load old models to only check for 3.1.2 models.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    r54fb5d8 r86e8e66  
    9292 
    9393 
    94 def _get_translation_table(model_info, version='3.1.2'): 
     94def _get_translation_table(model_info, version=(3,1,2)): 
    9595    _, translation = CONVERSION_TABLE.get(version).get(model_info.id, [None, {}]) 
    9696    translation = translation.copy() 
     
    145145    return newpars 
    146146 
    147 def _conversion_target(model_name, version='3.1.2'): 
     147def _conversion_target(model_name, version=(3,1,2)): 
    148148    """ 
    149149    Find the sasmodel name which translates into the sasview name. 
     
    159159    return None 
    160160 
    161 def _hand_convert(name, oldpars, version='3.1.2'): 
    162     if version == '3.1.2': 
     161def _hand_convert(name, oldpars, version=(3,1,2)): 
     162    if version == (3,1,2): 
    163163        oldpars = _hand_convert_3_1_2_to_4_1(name, oldpars) 
    164164    return oldpars 
     
    316316        newpars = _hand_convert(newname, newpars, version) 
    317317        newpars = _convert_pars(newpars, translation) 
    318         if not model_info.structure_factor: 
     318        # TODO: Still not convinced this is the best check 
     319        if not model_info.structure_factor and version == (3,1,2): 
    319320            newpars = _rescale_sld(model_info, newpars, 1e6) 
    320321        newpars.setdefault('scale', 1.0) 
Note: See TracChangeset for help on using the changeset viewer.