pyroomacoustics.experimental.point_cloud module

Point Clouds

Contains PointCloud class.

Given a number of points and their relative distances, this class aims at reconstructing their relative coordinates.

class pyroomacoustics.experimental.point_cloud.PointCloud(m=1, dim=3, diameter=0.0, X=None, labels=None, EDM=None)

Bases: object

EDM()

Computes the EDM corresponding to the marker set

align(marker, axis)

Rotate the marker set around the given axis until it is aligned onto the given marker

Parameters:
  • marker (int or str) – the index or label of the marker onto which to align the set

  • axis (int) – the axis around which the rotation happens

center(marker)

Translate the marker set so that the argument is the origin.

classical_mds(D)

Classical multidimensional scaling

Parameters:

D (square 2D ndarray) – Euclidean Distance Matrix (matrix containing squared distances between points

copy()

Return a deep copy of this marker set object

correct(corr_dic)

correct a marker location by a given vector

doa(receiver, source)

Computes the direction of arrival wrt a source and receiver

flatten(ind)

Transform the set of points so that the subset of markers given as argument is as close as flat (wrt z-axis) as possible.

Parameters:

ind (list of bools) – Lists of marker indices that should be all in the same subspace

fromEDM(D, labels=None, method='mds')

Compute the position of markers from their Euclidean Distance Matrix

Parameters:
  • D (square 2D ndarray) – Euclidean Distance Matrix (matrix containing squared distances between points

  • labels (list, optional) – A list of human friendly labels for the markers (e.g. ‘east’, ‘west’, etc)

  • method (str, optional) – The method to use * ‘mds’ for multidimensional scaling (default) * ‘tri’ for trilateration

key2ind(ref)

Get the index location from a label

normalize(refs=None)

Reposition points such that x0 is at origin, x1 lies on c-axis and x2 lies above x-axis, keeping the relative position to each other. The z-axis is defined according to right hand rule by default.

Parameters:
  • refs (list of 3 ints or str) – The index or label of three markers used to define (origin, x-axis, y-axis)

  • left_hand (bool, optional (default False)) – Normally the z-axis is defined using right-hand rule, this flag allows to override this behavior

plot(axes=None, show_labels=True, **kwargs)
trilateration(D)

Find the location of points based on their distance matrix using trilateration

Parameters:

D (square 2D ndarray) – Euclidean Distance Matrix (matrix containing squared distances between points

trilateration_single_point(c, Dx, Dy)

Given x at origin (0,0) and y at (0,c) the distances from a point at unknown location Dx, Dy to x, y, respectively, finds the position of the point.