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

buffer : numpy.ndarray

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

modes : array-like

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

kwargs : keyword arguments, optional

Additional args to pass to constructor of KnmMatrix.

Returns

kmat : KnmMatrix

The KnmMatrix wrapper around the array buffer.