finesse.knm.matrix.KnmMatrix.from_buffer

static KnmMatrix.from_buffer(ndarray buffer, const int[:, ::1] modes, **kwargs)

Construct a KnmMatrix object from a pre-existing 2D array buffer.

This method is useful for creating KnmMatrix objects from scattering matrix data which have been computed elsewhere. One of the most common use-cases is when using KnmDetector objects in “matrix-mode”; see the documentation of this class for an example.

Parameters:
buffernumpy.ndarray

A 2D array of complex values corresponding to the underlying buffer of scattering matrix data.

modesarray-like

A 2D array, or memory-view to the array, of the mode indices associated with the scattering matrix.

kwargskeyword arguments, optional

Additional args to pass to constructor of KnmMatrix.

Returns:
kmatKnmMatrix

The KnmMatrix wrapper around the array buffer.