Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azimuth parameter within doa function doe not work #166

Open
geoffrey136 opened this issue May 11, 2020 · 3 comments
Open

Azimuth parameter within doa function doe not work #166

geoffrey136 opened this issue May 11, 2020 · 3 comments
Labels

Comments

@geoffrey136
Copy link

in the docs this is given:
classpyroomacoustics.doa.doa.DOA(L, fs, nfft, c=343.0, num_src=1, mode='far', r=None, azimuth=None, colatitude=None, n_grid=None, dim=2, *args, **kwargs)
for the doa . But when editing the azimut or colatitude parameter it gives the following error, even when editing it to the default np.linspace(-180.,180.,30)*np.pi/180

self.hull = sp.ConvexHull(self.cartesian.T)

File "qhull.pyx", line 2428, in scipy.spatial.qhull.ConvexHull.init
File "qhull.pyx", line 357, in scipy.spatial.qhull._Qhull.init
scipy.spatial.qhull.QhullError: QH6154 Qhull precision error: Initial simplex is flat (facet 1 is coplanar with the interior point)

While executing: | qhull i Qt
Options selected for Qhull 2019.1.r 2019/06/21:
run-id 1518636660 incidence Qtriangulate _pre-merge _zero-centrum
_max-width 2 Error-roundoff 1.4e-15 _one-merge 9.7e-15
_near-inside 4.9e-14 Visible-distance 2.8e-15 U-max-coplanar 2.8e-15
Width-outside 5.5e-15 _wide-facet 1.7e-14 _maxoutside 1.1e-14

The input to qhull appears to be less than 3 dimensional, or a
computation has overflowed.

Qhull could not construct a clearly convex simplex from points:

  • p7(v4): -0.054 -1 6.1e-17
  • p22(v3): -0.054 1 6.1e-17
  • p14(v2): 0.99 -0.11 6.1e-17
  • p0(v1): -1 -1.2e-16 6.1e-17

The center point is coplanar with a facet, or a vertex is coplanar
with a neighboring facet. The maximum round off error for
computing distances is 1.4e-15. The center point, facets and distances
to the center point are as follows:

center point -0.02853 -0.02703 6.123e-17

facet p22 p14 p0 distance= 0
facet p7 p14 p0 distance= 0
facet p7 p22 p0 distance= 0
facet p7 p22 p14 distance= 0

These points either have a maximum or minimum x-coordinate, or
they maximize the determinant for k coordinates. Trial points
are first selected from points that maximize a coordinate.

The min and max coordinates for each dimension are:
0: -1 0.9941 difference= 1.994
1: -0.9985 0.9985 difference= 1.997
2: 6.123e-17 6.123e-17 difference= 0

If the input should be full dimensional, you have several options that
may determine an initial simplex:

  • use 'QJ' to joggle the input and make it full dimensional
  • use 'QbB' to scale the points to the unit cube
  • use 'QR0' to randomly rotate the input for different maximum points
  • use 'Qs' to search all points for the initial simplex
  • use 'En' to specify a maximum roundoff error less than 1.4e-15.
  • trace execution with 'T3' to see the determinant for each point.

If the input is lower dimensional:

  • use 'QJ' to joggle the input and make it full dimensional
  • use 'Qbk:0Bk:0' to delete coordinate k from the input. You should
    pick the coordinate with the least range. The hull will have the
    correct topology.
  • determine the flat containing the points, rotate the points
    into a coordinate plane, and delete the other coordinates.
  • add one or more points to make the input full dimensional.

Process finished with exit code 1

@fakufaku
Copy link
Collaborator

Sorry to keep you waiting! Thanks for reporting the bug! This problem is something I have been kindof aware of for a while, but do not have a great solution. Although the situation can certainly be improved.

Are you trying to do 3D doa estimation ? If you only need 2D, it might be best to stick to a 2D DOA object. This can be done by passing dim=2 when creating the object.

To go into more details, for 3D localization, with grid-search based methods (MUSIC, SRP, etc), we need to provide a number of points where to evaluate the cost function, and then we pick the maximum. For only one source, this works fine: find the largest grid value, output it, end. However, for two sources and more, we need to do peak finding, on a grid. In this case, we identify peaks by looking at all the neighbors. When all the neighbors are smaller, the value is a peak. But, to identify neighbors in the first place, we run a convex hull algorithms. If you only provide points on the azimuth, then the convex hull algorithm fails, which leads to the error you are seeing.

So, if you are doing things in 3D, it might be best to just use a full grid. But this is also kindof annoying, because with a flat array, we can do 2.5D localization well. So we'd like to have a nice 2.5D grid (i.e., half sphere). But here as well, the convex hull algorithm does not always work if we just throw away half of the points in the sphere...

If you create a 2D DOA object, the sphere becomes a circle and no convex hull algorithm is needed, so this should solve the problem.

@johntcuellar
Copy link

Hi FakuFaku,

Is there a way to extract the 3D pseudo-spectrum data from a DOA object in the case of a 3D DOA simulation as mentioned above? Or, stated another way, is there a way to find the pseudo-spectrum along two axis (in order to find the peaks for both azimuth and colatitude), similar to what was done in your example with NormMusic below?:

https://github.com/LCAV/pyroomacoustics/blob/master/notebooks/norm_music_demo.ipynb

Thanks.

@ErnstSwanepoel
Copy link

Hi FakuFaku,

I'm interested to know if there is a solution yet for the 2.5D problem?

I am looking to beamform an array but the south pole is just pointing to the ground. Hence it would be nice if I could ignore the bottom half of the sphere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants