finesse.model.Model.chain

Model.chain(*args, start=None, port=None)[source]

Utility function for connecting multiple connectable objects in a sequential list together. Between each item the connection details can be specified, such as length or refractive index. This function also adds the elements to the model and returns those as a tuple to for the user to store if required.

Parameters

start: component, optional

This is the component to start the chain from. If None, then a completely new chain of components is generated.

port: int, optional (required if `start` defined)

The port number at the start component provided to start the chain from. This must be a free unconnected port at the start component or an exception will be thrown.

Returns

tuple

A tuple containing the objects added. The start component is never returned.

Examples

Make a quick 1m cavity and store the added components into variables:

l1, m1, m2 = ifo.chain(Laser('l1'), Mirror('m1'), 1, Mirror('m2'))

Or be more specific about connection parameters by providing a dictionary. This dictionary is passed to the Model.connect() method as kwargs so see there for which options you can specify. For optical connections we can set lengths and refractive index of the space:

ifo.chain(
    Laser('l1'),
    Mirror('AR'),
    {'L':1e-2, 'nr':1.45},
    Mirror('HR')
)

A pre-constructed Space, Wire or Joint can also be used:

ifo.chain(
    Laser('l1'),
    Mirror('AR'),
    Space('scav', L=1e-2, nr=1.45),
    Mirror('HR')
)

The starting point of the chain can be specfied for more complicated setups like a Michelson:

ifo = Model()
ifo.chain(Laser('lsr'), Beamsplitter('bs'))

# connecting YARM to BS
ifo.chain(
    1,
    Mirror('itmy'),
    1,
    Mirror('etmy'),
    start=ifo.bs,
    port=2,
)

# connecting XARM to BS
ifo.chain(
    1,
    Mirror('itmx'),
    1,
    Mirror('etmx'),
    start=ifo.bs,
    port=3,
)