finesse.utilities.homs.insert_modes

finesse.utilities.homs.insert_modes(modes, new_modes)[source]

Inserts the mode indices in new_modes into the modes array at the correct (sorted) position(s).

Parameters:
modesnumpy.ndarray

An array of HOM indices.

new_modessequence, str

A single mode index pair or an iterable of mode indices. Each element must unpack to two integer convertible values.

Returns:
outnumpy.ndarray

A sorted array of HOM indices consisting of the original contents of modes with the mode indices from new_modes included.

Raises:
ValueError

If new_modes is not a mode index pair or iterable of mode indices.

See also

make_modes

Examples

Make an array of even modes and insert new modes into this:

>>> modes = make_modes("even", 2)
>>> modes
array([[0, 0], [0, 2], [2, 0]], dtype=int32)
>>> insert_modes(modes, ["11", "32"])
array([[0, 0], [0, 2], [1, 1], [2, 0], [3, 2]], dtype=int32)