Changeset 16fd9e5 in sasmodels


Ignore:
Timestamp:
Dec 9, 2016 11:48:21 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:
01ecc31
Parents:
298621b
Message:

#795: A check for the spherical SLD is now in place and versioning is now based off of the SasView? version being converted from.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    r298621b r16fd9e5  
    9292 
    9393 
    94 def _get_translation_table(model_info, version='4.0.1'): 
     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='4.0.1'): 
     147def _conversion_target(model_name, version='3.1.2'): 
    148148    """ 
    149149    Find the sasmodel name which translates into the sasview name. 
     
    218218        if 'ndensity.upper' in oldpars: 
    219219            oldpars['ndensity.upper'] /= 1e15 
    220     elif name == 'rpa' and version == '4.0.1': 
     220    elif name == 'rpa' and version == base_version: 
    221221        # convert scattering lengths from femtometers to centimeters 
    222222        for p in "L1", "L2", "L3", "L4": 
     
    228228                oldpars[p + ".upper"] /= 1e-13 
    229229    elif name == 'spherical_sld' and version == base_version: 
    230         oldpars["CONTROL"] = 0 
    231         i = 0 
    232         while "nu_inter" + str(i) in oldpars: 
    233             oldpars["CONTROL"] += 1 
    234             i += 1 
     230        j = 0 
     231        while "func_inter" + str(j) in oldpars: 
     232            name = "func_inter" + str(j) 
     233            new_name = "shape" + str(j + 1) 
     234            if oldpars[name] == 'Erf(|nu|*z)': 
     235                oldpars[new_name] = int(0) 
     236            elif oldpars[name] == 'RPower(z^|nu|)': 
     237                oldpars[new_name] = int(1) 
     238            elif oldpars[name] == 'LPower(z^|nu|)': 
     239                oldpars[new_name] = int(2) 
     240            elif oldpars[name] == 'RExp(-|nu|*z)': 
     241                oldpars[new_name] = int(3) 
     242            elif oldpars[name] == 'LExp(-|nu|*z)': 
     243                oldpars[new_name] = int(4) 
     244            else: 
     245                oldpars[new_name] = int(0) 
     246            oldpars.pop(name) 
     247            oldpars['n_shells'] = str(j + 1) 
     248            j += 1 
    235249    elif name == 'teubner_strey' and version == base_version: 
    236250        # basically undoing the entire Teubner-Strey calculations here. 
Note: See TracChangeset for help on using the changeset viewer.