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
- modes
numpy.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.
- modes
- Returns
- out
numpy.ndarray
A sorted array of HOM indices consisting of the original contents of modes with the mode indices from new_modes included.
- out
- Raises
- ValueError
If new_modes is not a mode index pair or iterable of mode indices.
See also
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)