source: sasmodels/sasmodels/convert.py @ d2fb4af

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since d2fb4af was d2fb4af, checked in by krzywon, 7 years ago

#795: No longer an issue with multiple backgrounds and scales. A handful of model names were slightly off from the save state names. Currently going through model-by-model to finish this.

  • Property mode set to 100644
File size: 22.5 KB
Line 
1"""
2Convert models to and from sasview.
3"""
4from __future__ import print_function, division
5
6import re
7import math
8import warnings
9
10from .conversion_table import CONVERSION_TABLE
11from .core import load_model_info
12
13# List of models which SasView versions don't contain the explicit 'scale' argument.
14# When converting such a model, please update this list.
15MODELS_WITHOUT_SCALE = [
16    'teubner_strey',
17    'broad_peak',
18    'two_lorentzian',
19    "two_power_law",
20    'gauss_lorentz_gel',
21    'be_polyelectrolyte',
22    'correlation_length',
23    'fractal_core_shell',
24    'binary_hard_sphere',
25    'raspberry'
26]
27
28# List of models which SasView versions don't contain the explicit 'background' argument.
29# When converting such a model, please update this list.
30MODELS_WITHOUT_BACKGROUND = [
31    'guinier',
32]
33
34MODELS_WITHOUT_VOLFRACTION = [
35    'fractal',
36    'vesicle',
37    'multilayer_vesicle',
38]
39
40MAGNETIC_SASVIEW_MODELS = [
41    'core_shell',
42    'core_multi_shell',
43    'cylinder',
44    'parallelepiped',
45    'sphere',
46]
47
48
49# Convert new style names for polydispersity info to old style names
50PD_DOT = [
51    ("_pd", ".width"),
52    ("_pd_n", ".npts"),
53    ("_pd_nsigma", ".nsigmas"),
54    ("_pd_type", ".type"),
55    ]
56
57def _rescale(par, scale):
58    return [pk*scale for pk in par] if isinstance(par, list) else par*scale
59
60def _is_sld(model_info, id):
61    """
62    Return True if parameter is a magnetic magnitude or SLD parameter.
63    """
64    if id.startswith('M0:'):
65        return True
66    if '_pd' in id or '.' in id:
67        return False
68    for p in model_info.parameters.call_parameters:
69        if p.id == id:
70            return p.type == 'sld'
71    # check through kernel parameters in case it is a named as a vector
72    for p in model_info.parameters.kernel_parameters:
73        if p.id == id:
74            return p.type == 'sld'
75    return False
76
77def _rescale_sld(model_info, pars, scale):
78    """
79    rescale all sld parameters in the new model definition by *scale* so the
80    numbers are nicer.  Relies on the fact that all sld parameters in the
81    new model definition end with sld.  For backward conversion use
82    *scale=1e-6*.  For forward conversion use *scale=1e6*.
83    """
84    return dict((id, (_rescale(v, scale) if _is_sld(model_info, id) else v))
85                for id, v in pars.items())
86
87
88def _get_translation_table(model_info):
89    _, translation = CONVERSION_TABLE.get(model_info.id, [None, {}])
90    translation = translation.copy()
91    for p in model_info.parameters.kernel_parameters:
92        if p.length > 1:
93            newid = p.id
94            oldid = translation.get(p.id, p.id)
95            translation.pop(newid, None)
96            for k in range(1, p.length+1):
97                if newid+str(k) not in translation:
98                    translation[newid+str(k)] = oldid+str(k)
99    # Remove control parameter from the result
100    if model_info.control:
101        translation[model_info.control] = "CONTROL"
102    return translation
103
104# ========= FORWARD CONVERSION sasview 3.x => sasmodels ===========
105def _dot_pd_to_underscore_pd(par):
106    if par.endswith(".width"):
107        return par[:-6]+"_pd"
108    elif par.endswith(".type"):
109        return par[:-5]+"_pd_type"
110    elif par.endswith(".nsigmas"):
111        return par[:-8]+"_pd_nsigma"
112    elif par.endswith(".npts"):
113        return par[:-5]+"_pd_n"
114    else:
115        return par
116
117def _pd_to_underscores(pars):
118    return dict((_dot_pd_to_underscore_pd(k), v) for k, v in pars.items())
119
120def _convert_name(conv_dict, pars):
121    """
122    Renames parameter values (upper, lower, etc) to v4.0 names
123    :param conv_dict: conversion dictionary mapping new name : old name
124    :param pars: parameters to convert
125    :return:
126    """
127    new_pars = {}
128    i = 0
129    j = 0
130    for key_par, value_par in pars.iteritems():
131        j += 1
132        for key_conv, value_conv in conv_dict.iteritems():
133            if re.search(value_conv, key_par):
134                new_pars[key_par.replace(value_conv, key_conv)] = value_par
135                i += 1
136                break
137            elif "background" == key_par or "scale" == key_par:
138                new_pars[key_par] = value_par
139                i += 1
140                break
141        if i != j:
142            new_pars[key_par] = value_par
143            i += 1
144    return new_pars
145
146def _convert_pars(pars, mapping):
147    """
148    Rename the parameters and any associated polydispersity attributes.
149    """
150    newpars = pars.copy()
151    for new, old in mapping.items():
152        if old == new: continue
153        if old is None: continue
154        for underscore, dot in PD_DOT:
155            source = old+dot
156            if source in newpars:
157                if new is not None:
158                    target = new+dot
159                else:
160                    target = None
161                if source != target:
162                    if target:
163                        newpars[target] = pars[old+dot]
164                    del newpars[source]
165    return newpars
166
167
168def _conversion_target(model_name):
169    """
170    Find the sasmodel name which translates into the sasview name.
171
172    Note: *CoreShellEllipsoidModel* translates into *core_shell_ellipsoid:1*.
173    This is necessary since there is only one variant in sasmodels for the
174    two variants in sasview.
175    """
176    for sasmodels_name, [sasview_name, _] in CONVERSION_TABLE.items():
177        if sasview_name == model_name:
178            return sasmodels_name
179    return None
180
181
182def _hand_convert(name, oldpars):
183    if name == 'core_shell_parallelepiped':
184        # Make sure pd on rim parameters defaults to zero
185        # ... probably not necessary.
186        oldpars['rimA.width'] = 0.0
187        oldpars['rimB.width'] = 0.0
188        oldpars['rimC.width'] = 0.0
189    elif name == 'core_shell_ellipsoid:1':
190        # Reverse translation (from new to old), from core_shell_ellipsoid.c
191        #    equat_shell = equat_core + thick_shell
192        #    polar_core = equat_core * x_core
193        #    polar_shell = equat_core * x_core + thick_shell*x_polar_shell
194        # Forward translation (from old to new), inverting reverse translation:
195        #    thick_shell = equat_shell - equat_core
196        #    x_core = polar_core / equat_core
197        #    x_polar_shell = (polar_shell - polar_core)/(equat_shell - equat_core)
198        # Auto translation (old <=> new) happens after hand_convert
199        #    equat_shell <=> thick_shell
200        #    polar_core <=> x_core
201        #    polar_shell <=> x_polar_shell
202        # So...
203        equat_core, equat_shell = oldpars['equat_core'], oldpars['equat_shell']
204        polar_core, polar_shell = oldpars['polar_core'], oldpars['polar_shell']
205        oldpars['equat_shell'] = equat_shell - equat_core
206        oldpars['polar_core'] = polar_core / equat_core
207        oldpars['polar_shell'] = (polar_shell-polar_core)/(equat_shell-equat_core)
208    elif name == 'hollow_cylinder':
209        # now uses radius and thickness
210        thickness = oldpars['radius'] - oldpars['core_radius']
211        oldpars['radius'] = thickness
212        if 'radius.width' in oldpars:
213            pd = oldpars['radius.width']*oldpars['radius']/thickness
214            oldpars['radius.width'] = pd
215    elif name == 'pearl_necklace':
216        pass
217        #_remove_pd(oldpars, 'num_pearls', name)
218        #_remove_pd(oldpars, 'thick_string', name)
219    elif name == 'polymer_micelle':
220        if 'ndensity' in oldpars:
221            oldpars['ndensity'] /= 1e15
222        if 'ndensity.lower' in oldpars:
223            oldpars['ndensity.lower'] /= 1e15
224        if 'ndensity.upper' in oldpars:
225            oldpars['ndensity.upper'] /= 1e15
226    elif name == 'rpa':
227        # convert scattering lengths from femtometers to centimeters
228        for p in "L1", "L2", "L3", "L4":
229            if p in oldpars:
230                oldpars[p] /= 1e-13
231            if p + ".lower" in oldpars:
232                oldpars[p + ".lower"] /= 1e-13
233            if p + ".upper" in oldpars:
234                oldpars[p + ".upper"] /= 1e-13
235    elif name == 'spherical_sld':
236        oldpars["CONTROL"] = 0
237        i = 0
238        while "nu_inter" + str(i) in oldpars:
239            oldpars["CONTROL"] += 1
240            i += 1
241    elif name == 'teubner_strey':
242        # basically undoing the entire Teubner-Strey calculations here.
243        #    drho = (sld_a - sld_b)
244        #    k = 2.0*math.pi*xi/d
245        #    a2 = (1.0 + k**2)**2
246        #    c1 = 2.0 * xi**2 * (1.0 - k**2)
247        #    c2 = xi**4
248        #    prefactor = 8.0*math.pi*phi*(1.0-phi)*drho**2*c2/xi
249        #    scale = 1e-4*prefactor
250        #    oldpars['scale'] = a2/scale
251        #    oldpars['c1'] = c1/scale
252        #    oldpars['c2'] = c2/scale
253
254        # need xi, d, sld_a, sld_b, phi=volfraction_a
255        # assume contrast is 1.0e-6, scale=1, background=0
256        sld_a, sld_b = 1.0, 0.
257        drho = sld_a - sld_b
258
259        # find xi
260        p_scale = oldpars['scale']
261        p_c1 = oldpars['c1']
262        p_c2= oldpars['c2']
263        i_1 = 0.5*p_c1/p_c2
264        i_2 = math.sqrt(math.fabs(p_scale/p_c2))
265        i_3 = 2/(i_1 + i_2)
266        xi = math.sqrt(math.fabs(i_3))
267
268        # find d from xi
269        k = math.sqrt(math.fabs(1 - 0.5*p_c1/p_c2*xi**2))
270        d = 2*math.pi*xi/k
271
272        # solve quadratic phi (1-phi) = xi/(1e-4 8 pi drho^2 c2)
273        # favour volume fraction in [0, 0.5]
274        c = xi / (1e-4 * 8.0 * math.pi * drho**2 * p_c2)
275        phi = 0.5 - math.sqrt(0.25 - c)
276
277        # scale sld_a by 1e-6 because the translator will scale it back
278        oldpars.update(volfraction_a=phi, xi=xi, d=d, sld_a=sld_a*1e-6,
279                       sld_b=sld_b, scale=1.0)
280        oldpars.pop('c1')
281        oldpars.pop('c2')
282
283    return oldpars
284
285def convert_model(name, pars, use_underscore=False):
286    """
287    Convert model from old style parameter names to new style.
288    """
289    newname = _conversion_target(name)
290    if newname is None:
291        return name, pars
292    if ':' in newname:   # core_shell_ellipsoid:1
293        model_info = load_model_info(newname[:-2])
294        # Know that the table exists and isn't multiplicity so grab it directly
295        # Can't use _get_translation_table since that will return the 'bare'
296        # version.
297        translation = CONVERSION_TABLE[newname][1]
298    else:
299        model_info = load_model_info(newname)
300        translation = _get_translation_table(model_info)
301    newpars = _hand_convert(newname, pars.copy())
302    newpars = _convert_name(translation, newpars)
303    newpars = _convert_pars(newpars, translation)
304    if not model_info.structure_factor:
305        newpars = _rescale_sld(model_info, newpars, 1e6)
306    newpars.setdefault('scale', 1.0)
307    newpars.setdefault('background', 0.0)
308    if use_underscore:
309        newpars = _pd_to_underscores(newpars)
310    return newname, newpars
311
312
313# ========= BACKWARD CONVERSION sasmodels => sasview 3.x ===========
314
315def _revert_pars(pars, mapping):
316    """
317    Rename the parameters and any associated polydispersity attributes.
318    """
319    newpars = pars.copy()
320
321    for new, old in mapping.items():
322        for underscore, dot in PD_DOT:
323            if old and old+underscore == new+dot:
324                continue
325            if new+underscore in newpars:
326                if old is not None:
327                    newpars[old+dot] = pars[new+underscore]
328                del newpars[new+underscore]
329    for k in list(newpars.keys()):
330        for underscore, dot in PD_DOT[1:]:  # skip "" => ""
331            if k.endswith(underscore):
332                newpars[k[:-len(underscore)]+dot] = newpars[k]
333                del newpars[k]
334    return newpars
335
336def revert_name(model_info):
337    oldname, _ = CONVERSION_TABLE.get(model_info.id, [None, {}])
338    return oldname
339
340def _remove_pd(pars, key, name):
341    """
342    Remove polydispersity from the parameter list.
343
344    Note: operates in place
345    """
346    # Bumps style parameter names
347    width = pars.pop(key+".width", 0.0)
348    n_points = pars.pop(key+".npts", 0)
349    if width != 0.0 and n_points != 0:
350        warnings.warn("parameter %s not polydisperse in sasview %s"%(key, name))
351    pars.pop(key+".nsigmas", None)
352    pars.pop(key+".type", None)
353    return pars
354
355def _trim_vectors(model_info, pars, oldpars):
356    _, translation = CONVERSION_TABLE.get(model_info.id, [None, {}])
357    for p in model_info.parameters.kernel_parameters:
358        if p.length_control is not None:
359            n = int(pars[p.length_control])
360            oldname = translation.get(p.id, p.id)
361            for k in range(n+1, p.length+1):
362                for _, old in PD_DOT:
363                    oldpars.pop(oldname+str(k)+old, None)
364    return oldpars
365
366def revert_pars(model_info, pars):
367    """
368    Convert model from new style parameter names to old style.
369    """
370    if model_info.composition is not None:
371        composition_type, parts = model_info.composition
372        if composition_type == 'product':
373            translation = _get_translation_table(parts[0])
374            # structure factor models include scale:scale_factor mapping
375            translation.update(_get_translation_table(parts[1]))
376        else:
377            raise NotImplementedError("cannot convert to sasview sum")
378    else:
379        translation = _get_translation_table(model_info)
380    oldpars = _revert_pars(_rescale_sld(model_info, pars, 1e-6), translation)
381    oldpars = _trim_vectors(model_info, pars, oldpars)
382
383    # Make sure the control parameter is an integer
384    if "CONTROL" in oldpars:
385        oldpars["CONTROL"] = int(oldpars["CONTROL"])
386
387    # Note: update compare.constrain_pars to match
388    name = model_info.id
389    if name in MODELS_WITHOUT_SCALE or model_info.structure_factor:
390        if oldpars.pop('scale', 1.0) != 1.0:
391            warnings.warn("parameter scale not used in sasview %s"%name)
392    if name in MODELS_WITHOUT_BACKGROUND or model_info.structure_factor:
393        if oldpars.pop('background', 0.0) != 0.0:
394            warnings.warn("parameter background not used in sasview %s"%name)
395
396    # Remove magnetic parameters from non-magnetic sasview models
397    if name not in MAGNETIC_SASVIEW_MODELS:
398        oldpars = dict((k, v) for k, v in oldpars.items() if ':' not in k)
399
400    # If it is a product model P*S, then check the individual forms for special
401    # cases.  Note: despite the structure factor alone not having scale or
402    # background, the product model does, so this is below the test for
403    # models without scale or background.
404    namelist = name.split('*') if '*' in name else [name]
405    for name in namelist:
406        if name in MODELS_WITHOUT_VOLFRACTION:
407            del oldpars['volfraction']
408        elif name == 'core_multi_shell':
409            # kill extra shells
410            for k in range(5, 11):
411                oldpars.pop('sld_shell'+str(k), 0)
412                oldpars.pop('thick_shell'+str(k), 0)
413                oldpars.pop('mtheta:sld'+str(k), 0)
414                oldpars.pop('mphi:sld'+str(k), 0)
415                oldpars.pop('M0:sld'+str(k), 0)
416                _remove_pd(oldpars, 'sld_shell'+str(k), 'sld')
417                _remove_pd(oldpars, 'thick_shell'+str(k), 'thickness')
418        elif name == 'core_shell_parallelepiped':
419            _remove_pd(oldpars, 'rimA', name)
420            _remove_pd(oldpars, 'rimB', name)
421            _remove_pd(oldpars, 'rimC', name)
422        elif name == 'hollow_cylinder':
423            # now uses radius and thickness
424            thickness = oldpars['core_radius']
425            oldpars['radius'] += thickness
426            oldpars['radius.width'] *= thickness/oldpars['radius']
427        #elif name in ['mono_gauss_coil', 'poly_gauss_coil']:
428        #    del oldpars['i_zero']
429        elif name == 'onion':
430            oldpars.pop('n_shells', None)
431        elif name == 'pearl_necklace':
432            _remove_pd(oldpars, 'num_pearls', name)
433            _remove_pd(oldpars, 'thick_string', name)
434        elif name == 'polymer_micelle':
435            if 'ndensity' in oldpars:
436                oldpars['ndensity'] *= 1e15
437        elif name == 'rpa':
438            # convert scattering lengths from femtometers to centimeters
439            for p in "L1", "L2", "L3", "L4":
440                if p in oldpars: oldpars[p] *= 1e-13
441            if pars['case_num'] < 2:
442                for k in ("a", "b"):
443                    for p in ("L", "N", "Phi", "b", "v"):
444                        oldpars.pop(p+k, None)
445                for k in "Kab,Kac,Kad,Kbc,Kbd".split(','):
446                    oldpars.pop(k, None)
447            elif pars['case_num'] < 5:
448                for k in ("a",):
449                    for p in ("L", "N", "Phi", "b", "v"):
450                        oldpars.pop(p+k, None)
451                for k in "Kab,Kac,Kad".split(','):
452                    oldpars.pop(k, None)
453        elif name == 'spherical_sld':
454            oldpars["CONTROL"] -= 1
455            # remove polydispersity from shells
456            for k in range(1, 11):
457                _remove_pd(oldpars, 'thick_flat'+str(k), 'thickness')
458                _remove_pd(oldpars, 'thick_inter'+str(k), 'interface')
459            # remove extra shells
460            for k in range(int(pars['n_shells']), 11):
461                oldpars.pop('sld_flat'+str(k), 0)
462                oldpars.pop('thick_flat'+str(k), 0)
463                oldpars.pop('thick_inter'+str(k), 0)
464                oldpars.pop('func_inter'+str(k), 0)
465                oldpars.pop('nu_inter'+str(k), 0)
466        elif name == 'stacked_disks':
467            _remove_pd(oldpars, 'n_stacking', name)
468        elif name == 'teubner_strey':
469            # basically redoing the entire Teubner-Strey calculations here.
470            volfraction = oldpars.pop('volfraction_a')
471            xi = oldpars.pop('xi')
472            d = oldpars.pop('d')
473            sld_a = oldpars.pop('sld_a')
474            sld_b = oldpars.pop('sld_b')
475            drho = 1e6*(sld_a - sld_b)  # conversion autoscaled these
476            k = 2.0*math.pi*xi/d
477            a2 = (1.0 + k**2)**2
478            c1 = 2.0 * xi**2 * (1.0 - k**2)
479            c2 = xi**4
480            prefactor = 8.0*math.pi*volfraction*(1.0-volfraction)*drho**2*c2/xi
481            scale = 1e-4*prefactor
482            oldpars['scale'] = a2/scale
483            oldpars['c1'] = c1/scale
484            oldpars['c2'] = c2/scale
485
486    #print("convert from",list(sorted(pars)))
487    #print("convert to",list(sorted(oldpars.items())))
488    return oldpars
489
490def constrain_new_to_old(model_info, pars):
491    """
492    Restrict parameter values to those that will match sasview.
493    """
494    name = model_info.id
495    # Note: update convert.revert_model to match
496    if name in MODELS_WITHOUT_SCALE or model_info.structure_factor:
497        pars['scale'] = 1
498    if name in MODELS_WITHOUT_BACKGROUND or model_info.structure_factor:
499        pars['background'] = 0
500    # sasview multiplies background by structure factor
501    if '*' in name:
502        pars['background'] = 0
503
504    # Shut off magnetism when comparing non-magnetic sasview models
505    if name not in MAGNETIC_SASVIEW_MODELS:
506        suppress_magnetism = False
507        for key in pars.keys():
508            if key.startswith("M0:"):
509                suppress_magnetism = suppress_magnetism or (pars[key] != 0)
510                pars[key] = 0
511        if suppress_magnetism:
512            warnings.warn("suppressing magnetism for comparison with sasview")
513
514    # Shut off theta polydispersity since algorithm has changed
515    if 'theta_pd_n' in pars:
516        if pars['theta_pd_n'] != 0:
517            warnings.warn("suppressing theta polydispersity for comparison with sasview")
518        pars['theta_pd_n'] = 0
519
520    # If it is a product model P*S, then check the individual forms for special
521    # cases.  Note: despite the structure factor alone not having scale or
522    # background, the product model does, so this is below the test for
523    # models without scale or background.
524    namelist = name.split('*') if '*' in name else [name]
525    for name in namelist:
526        if name in MODELS_WITHOUT_VOLFRACTION:
527            pars['volfraction'] = 1
528        if name == 'core_multi_shell':
529            pars['n'] = min(math.ceil(pars['n']), 4)
530        elif name == 'gel_fit':
531            pars['scale'] = 1
532        elif name == 'line':
533            pars['scale'] = 1
534            pars['background'] = 0
535        elif name == 'mono_gauss_coil':
536            pars['scale'] = 1
537        elif name == 'onion':
538            pars['n_shells'] = math.ceil(pars['n_shells'])
539        elif name == 'pearl_necklace':
540            pars['string_thickness_pd_n'] = 0
541            pars['number_of_pearls_pd_n'] = 0
542        elif name == 'poly_gauss_coil':
543            pars['scale'] = 1
544        elif name == 'rpa':
545            pars['case_num'] = int(pars['case_num'])
546        elif name == 'spherical_sld':
547            pars['n_shells'] = math.ceil(pars['n_shells'])
548            pars['n_steps'] = math.ceil(pars['n_steps'])
549            for k in range(1, 11):
550                pars['shape%d'%k] = math.trunc(pars['shape%d'%k]+0.5)
551            for k in range(2, 11):
552                pars['thickness%d_pd_n'%k] = 0
553                pars['interface%d_pd_n'%k] = 0
554        elif name == 'teubner_strey':
555            pars['scale'] = 1
556            if pars['volfraction_a'] > 0.5:
557                pars['volfraction_a'] = 1.0 - pars['volfraction_a']
558        elif name == 'unified_power_Rg':
559            pars['level'] = int(pars['level'])
560
561def _check_one(name, seed=None):
562    """
563    Generate a random set of parameters for *name*, and check that they can
564    be converted back to SasView 3.x and forward again to sasmodels.  Raises
565    an error if the parameters are changed.
566    """
567    from . import compare
568
569    model_info = load_model_info(name)
570
571    old_name = revert_name(model_info)
572    if old_name is None:
573        return
574
575    pars = compare.get_pars(model_info, use_demo=False)
576    pars = compare.randomize_pars(model_info, pars, seed=seed)
577    if name == "teubner_strey":
578        # T-S model is underconstrained, so fix the assumptions.
579        pars['sld_a'], pars['sld_b'] = 1.0, 0.0
580    compare.constrain_pars(model_info, pars)
581    constrain_new_to_old(model_info, pars)
582    old_pars = revert_pars(model_info, pars)
583    new_name, new_pars = convert_model(old_name, old_pars, use_underscore=True)
584    if 1:
585        print("==== %s in ====="%name)
586        print(str(compare.parlist(model_info, pars, True)))
587        print("==== %s ====="%old_name)
588        for k, v in sorted(old_pars.items()):
589            print(k, v)
590        print("==== %s out ====="%new_name)
591        print(str(compare.parlist(model_info, new_pars, True)))
592    assert name==new_name, "%r != %r"%(name, new_name)
593    for k, v in new_pars.items():
594        assert k in pars, "%s: %r appeared from conversion"%(name, k)
595        if isinstance(v, float):
596            assert abs(v-pars[k])<=abs(1e-12*v), "%s: %r  %s != %s"%(name, k, v, pars[k])
597        else:
598            assert v == pars[k], "%s: %r  %s != %s"%(name, k, v, pars[k])
599    for k, v in pars.items():
600        assert k in pars, "%s: %r not converted"%(name, k)
601
602def test_backward_forward():
603    from .core import list_models
604    for name in list_models('all'):
605        L = lambda: _check_one(name, seed=1)
606        L.description = name
607        yield L
Note: See TracBrowser for help on using the repository browser.