finesse.model.Model.get

Model.get(attr)[source]

Get an attribute of the model using a string path representation like l1.p1.o.q. If a ModelElement, Node, or a Port is given it will try to return the equivalent object in this model.

Parameters
attr[str | ModelElement | Node | Port]

An object to get from the model. Could be a generic string, or

Examples

Parse a simple model and extract the laser power model parameter:

>>> import finesse
>>> kat = finesse.Model()
>>> kat.parse('''
... l l1 P=2
... s s1 l1.p1 m1.p1
... m m1 R=0.5 T=0.5
... pd Pr m1.p1
... pd Pt m1.p2
... ''')
>>> kat.get("l1.P")
<l1.P=2.0 @ 0x11aa56588>