Changes in sasmodels/convert.py [78f8308:610ef23] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    r78f8308 r610ef23  
    166166        oldpars = _hand_convert_3_1_2_to_4_1(name, oldpars) 
    167167    if version < (4, 2, 0): 
    168         oldpars = _hand_convert_4_1_to_4_2(name, oldpars) 
     168        oldpars = _rename_magnetic_pars(oldpars) 
    169169    return oldpars 
    170170 
    171 def _hand_convert_4_1_to_4_2(name, oldpars): 
    172     if name in ('bcc_paracrystal', 'fcc_paracrystal', 'sc_paracrystal'): 
    173         oldpars['lattice_spacing'] = oldpars.pop('dnn') 
    174         oldpars['lattice_distortion'] = oldpars.pop('d_factor') 
    175     return oldpars 
     171def _rename_magnetic_pars(pars): 
     172    """ 
     173    Change from M0:par to par_M0, etc. 
     174    """ 
     175    keys = list(pars.items()) 
     176    for k in keys: 
     177        if k.startswith('M0:'): 
     178            pars[k[3:]+'_M0'] = pars.pop(k) 
     179        elif k.startswith('mtheta:'): 
     180            pars[k[7:]+'_mtheta'] = pars.pop(k) 
     181        elif k.startswith('mphi:'): 
     182            pars[k[5:]+'_mphi'] = pars.pop(k) 
     183        elif k.startswith('up:'): 
     184            pars['up_'+k[3:]] = pars.pop(k) 
     185    return pars 
    176186 
    177187def _hand_convert_3_1_2_to_4_1(name, oldpars): 
Note: See TracChangeset for help on using the changeset viewer.