Changeset 86e8e66 in sasmodels
- Timestamp:
- Dec 20, 2016 12:08:41 PM (8 years ago)
- 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
- Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/conversion_table.py
r298621b r86e8e66 28 28 29 29 CONVERSION_TABLE = { 30 "4.0.1": {},31 "3.1.2": {30 (4,0,1) : {}, 31 (3,1,2) : { 32 32 "adsorbed_layer": [ 33 33 "Core2ndMomentModel", -
sasmodels/convert.py
r54fb5d8 r86e8e66 92 92 93 93 94 def _get_translation_table(model_info, version= '3.1.2'):94 def _get_translation_table(model_info, version=(3,1,2)): 95 95 _, translation = CONVERSION_TABLE.get(version).get(model_info.id, [None, {}]) 96 96 translation = translation.copy() … … 145 145 return newpars 146 146 147 def _conversion_target(model_name, version= '3.1.2'):147 def _conversion_target(model_name, version=(3,1,2)): 148 148 """ 149 149 Find the sasmodel name which translates into the sasview name. … … 159 159 return None 160 160 161 def _hand_convert(name, oldpars, version= '3.1.2'):162 if version == '3.1.2':161 def _hand_convert(name, oldpars, version=(3,1,2)): 162 if version == (3,1,2): 163 163 oldpars = _hand_convert_3_1_2_to_4_1(name, oldpars) 164 164 return oldpars … … 316 316 newpars = _hand_convert(newname, newpars, version) 317 317 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): 319 320 newpars = _rescale_sld(model_info, newpars, 1e6) 320 321 newpars.setdefault('scale', 1.0) -
sasmodels/sasview_model.py
r01ecc31 r86e8e66 57 57 import sas.models 58 58 from sasmodels.conversion_table import CONVERSION_TABLE 59 for version, _ in sorted(CONVERSION_TABLE.iteritems()): 60 for new_name, conversion in CONVERSION_TABLE.get(version).items(): 61 # CoreShellEllipsoidModel => core_shell_ellipsoid:1 62 new_name = new_name.split(':')[0] 63 old_name = conversion[0] 64 module_attrs = {old_name: find_model(new_name)} 65 ConstructedModule = type(old_name, (), module_attrs) 66 old_path = 'sas.models.' + old_name 67 setattr(sas.models, old_path, ConstructedModule) 68 sys.modules[old_path] = ConstructedModule 59 for new_name, conversion in CONVERSION_TABLE.get((3,1,2)).items(): 60 # CoreShellEllipsoidModel => core_shell_ellipsoid:1 61 new_name = new_name.split(':')[0] 62 old_name = conversion[0] 63 module_attrs = {old_name: find_model(new_name)} 64 ConstructedModule = type(old_name, (), module_attrs) 65 old_path = 'sas.models.' + old_name 66 setattr(sas.models, old_path, ConstructedModule) 67 sys.modules[old_path] = ConstructedModule 69 68 70 69
Note: See TracChangeset
for help on using the changeset viewer.