Selecting the modes to model¶

Models in Finesse are, by default, created as plane-wave representations of the underlying configuration. This can be switched to a modal basis by specifying the mode indices that should be modelled by the system. There are a few key ways in which this can be done, as outlined in the sections below.

Maximum TEM order¶

Set a value for the maximum TEM (termed maxtem for short) order. Users of previous version of Finesse will be familiar with this option. By setting a value for finesse.model.Model.maxtem, all of the modes up to and including this order will be included in the model. See an example below:

import finesse

model = finesse.Model()
# set maximum mode order (n+m) to 3
model.maxtem = 3

print(model.homs)

[[0 0]
[0 1]
[0 2]
[0 3]
[1 0]
[1 1]
[1 2]
[2 0]
[2 1]
[3 0]]


Note that setting maxtem to zero will also switch the model to a modal basis, where the only mode being modelled then is the TEM00 mode.

You can switch a model back to a plane wave representation by setting the maxtem attribute to None or "off".

Selection method¶

One of the main new features of modelling HOMs in Finesse 3 is the ability to select the modes you want to model rather than including all modes up to a specific order with maxtem. This can be achieved via the finesse.model.Model.select_modes() method. The documentation for this function explains how to use it, so here are a few examples of it in practice.

Selecting even modes up to order 4:

model.select_modes("even", 4)
print(model.homs)

[[0 0]
[0 2]
[0 4]
[2 0]
[2 2]
[4 0]]


Odd modes up to order 3:

model.select_modes("odd", 3)
print(model.homs)

[[0 0]
[0 1]
[0 3]
[1 0]
[1 1]
[3 0]]


Tangential (x) modes up to order 5:

model.select_modes("x", 5)
print(model.homs)

[[0 0]
[1 0]
[2 0]
[3 0]
[4 0]
[5 0]]


Sagittal (y) modes up to the current maxtem value (5 from previous case):

# maxtem will take on current value if not specified
model.select_modes("y")
print(model.homs)

[[0 0]
[0 1]
[0 2]
[0 3]
[0 4]
[0 5]]


Assigning to modes property¶

The finesse.model.Model.homs property that we have seen plenty of times on this page returns a copy of the underlying mode indices array in the model. This property also has a corresponding setter which can be used to set the modes to include directly. Under the hood, this setter simply delegates the set value out to finesse.model.Model.select_modes() - so refer to the API documentation of this function for usage details. A couple of examples of using this setter are shown below.

Add specific modes to the model via a list of strings:

model.homs = ["00", "11", "22"]
print(model.homs)

[[0 0]
[1 1]
[2 2]]


Or a list of tuples (any iterable of length two iterables will work):

model.homs = [(0, 0), (2, 1), (1, 3)]
print(model.homs)

[[0 0]
[1 3]
[2 1]]


The model class also provides a finesse.model.Model.include_modes() method for inserting additional modes (at the correct, sorted position of the mode indices array) into the existing modes.

For example, one could select even modes up to order 2 but also include the 11 mode with:

model.select_modes("even", 2)
model.include_modes("11")
print(model.homs)

[[0 0]
[0 2]
[1 1]
[2 0]]


Note

Mode index uniqueness is guaranteed in a model. If you accidentally (or on purpose to try to break stuff) pass repeated modes to a model, then these repeats will be ignored. For example:

# deviously try to repeat first two modes...
model.homs = ["00", "11", "22", "11", "00"]
# ... but this is taken care of
print(model.homs)

[[0 0]
[1 1]
[2 2]]