code: def createProjectionMatrix(self, dimensions=3):
      
      if dimensions < 3:
        raise ValueError("dimensions value must be 3 or higher")
  
      b1 = np.random.multivariate_normal(mean=np.zeros(dimensions),
                                         cov=np.eye(dimensions))
      b1 /= np.linalg.norm(b1)
  
      # Choose a random vector orthogonal to b1
      while True:
        randomVector = np.random.multivariate_normal(mean=np.zeros(dimensions),
                                                     cov=np.eye(dimensions))
        randomVector /= np.linalg.norm(randomVector)
        projectedToPlane = randomVector - np.dot(randomVector, b1) * b1
  
        # make sure random vector is not parallel to b1 plane
        length = np.linalg.norm(projectedToPlane)
        if length == 0:
          continue
  
        b2 = projectedToPlane / length
  
        # b1 and b2 are two orthogonal vectors on the plane.
        # To get a 2D displacement, you'll dot the n-dimensional displacement with
        # each of these vectors.
        return np.array([b1, b2])
docs: Compute  projection matrix used to convert n-dimensional displacement into
      2D displacement compatible with :class:`ThresholdedGaussian2DLocationModule`
      algorithm. To compute the 2D displacement each module must multiply the
      n-dimensional displacement with the projection matrix for that module.
  
      :param dimensions: Number of dimensions. Must be greater than 2. Default 3.
      :type int dimensions:
  
      :return: The projection matrix
      :rtype: array(2, n)