Check out the Hyperspy Workshop May 13-17, 2024 Online

filter_basis#

DiffractionVectors.filter_basis(basis, distance=0.5, columns=[0, 1], **kwargs)[source]#

Filter vectors to only the set of vectors which is close to a basis set of vectors.

If there is no vector within the distance parameter of the vector np.`nan` will be returned.

Parameters:
  • basis (array-like or BaseSignal) – The set of vectors to be compared. This should have the same number of columns as the length of the columns parameter.

  • distance (float) – The distance between vectors and basis which detemine if the vector is associated with the basis vector. If no vector is inside the distance np.nan will be returned.

  • columns (list) – The columns of the basis to be used for comparison. The default is the first two columns (kx, ky) in most cases.

  • kwargs (dict) – Any other parameters passed to the hyperspy.BaseSignal.Map function.

Returns:

vectors – The filtered list of diffraction vectors. If basis is an instance of hyperspy.Signals.BaseSignal and instance of the DiffractionVectors class will be returned otherwise an instance of the DiffractionVectors2D class will be returned.

Return type:

DiffractionVectors or DiffractionVectors2D