Model.modify_names()

Model.modify_names()#

Model.modify_names(fn)[source]#

Modifies the names of all variables and nodes in the model according to the supplied function.

Examples

>>> import liesel.model as lsl
>>> x1 = lsl.Var.new_obs(1.0, name="x1")
>>> x2 = lsl.Var.new_obs(1.0, name="x2")
>>> m = lsl.Model(x1, x2)
>>> list(m.vars)
['x2', 'x1']
>>> m.modify_names(lambda x: x.replace("x", "y"))
Model(7 nodes, 2 vars)
>>> list(m.vars)
['y1', 'y2']