finesse.utilities.homs.make_modes

finesse.utilities.homs.make_modes(select=None, maxtem=None)[source]

Construct a 2D numpy.ndarray of HOM indices.

Parameters:
selectsequence, str, optional; default: None

Identifier for the mode indices to generate. This can be:

  • An iterable of mode indices, where each element in the iterable must unpack to two integer convertible values.

  • A string identifying the type of modes to include, must be one of “even”, “odd”, “tangential” (or “x”) or “sagittal” (or “y”).

maxtemint, optional; default: None

Optional maximum mode order, applicable only for when select is a string. This is ignored if select is not a string.

Returns:
modesnumpy.ndarray

An array of mode indices.

Raises:
ValueError

If either of the arguments select, maxtem are invalid or non-unique.

See also

insert_modes

Add modes to an existing mode indices array at the correct positions.

Examples

Modes up to a maximum order of 2:

>>> make_modes(maxtem=2)
array([[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [2, 0]], dtype=int32)

Even modes up to order 4:

>>> make_modes("even", maxtem=4)
array([[0, 0], [0, 2], [0, 4], [2, 0], [2, 2], [4, 0]], dtype=int32)

Sagittal modes up to order 3:

>>> make_modes("y", maxtem=3)
array([[0, 0], [0, 1], [0, 2], [0, 3]], dtype=int32)

Modes from a list of strings:

>>> make_modes(["00", "11", "22"])
array([[0, 0], [1, 1], [2, 2]], dtype=int32)