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

Cannot calculate colatitude_recon #380

Closed
QHenry1990 opened this issue Nov 19, 2024 · 2 comments · Fixed by #386
Closed

Cannot calculate colatitude_recon #380

QHenry1990 opened this issue Nov 19, 2024 · 2 comments · Fixed by #386
Assignees
Labels

Comments

@QHenry1990
Copy link

error info:
self.hull = sp.ConvexHull(self.cartesian.T)

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "_qhull.pyx", line 2431, in scipy.spatial._qhull.ConvexHull.init

File "_qhull.pyx", line 353, in scipy.spatial._qhull._Qhull.init

scipy.spatial._qhull.QhullError: QH6421 qhull internal error (qh_maxsimplex): qh.MAXwidth required for qh_maxsimplex. Used to estimate determinate

While executing: | qhull i Qt

Options selected for Qhull 2019.1.r 2019/06/21:

run-id 332354054 incidence Qtriangulate _pre-merge _zero-centrum

_max-width 0 Error-roundoff 0 _one-merge 0 _near-inside 0

Visible-distance 0 U-max-coplanar 0 Width-outside 0 _wide-facet 0

_maxoutside 0

A Qhull internal error has occurred. Please send the input and output to

qhull_bug@qhull.org. If you can duplicate the error with logging ('T4z'), please

include the log file.

python code:

import argparse

import numpy as np

import pyroomacoustics as pra

methods = ["MUSIC", "FRIDA", "WAVES", "TOPS", "CSSM", "SRP", "NormMUSIC"]

if name == "main":
parser = argparse.ArgumentParser(
description="Estimates the direction of arrival of a sound source."
)
parser.add_argument(
"--method",
"-m",
choices=methods,
default=methods[0],
help="DOA method to use",
)
args = parser.parse_args()

# we use a white noise signal for the source
nfft = 256
fs = 16000
x = np.random.randn((nfft // 2 + 1) * nfft)

# create anechoic room
room = pra.AnechoicRoom(fs=fs)

# place the source at a 90 degree angle and 5 meters distance from origin
azimuth_true = np.pi / 2
colatitude_true = 30/180*np.pi
room.add_source([5 * np.cos(azimuth_true)*np.sin(colatitude_true), 5 * np.sin(azimuth_true)*np.sin(colatitude_true), np.cos(colatitude_true)], signal=x)

# place the microphone array
mic_locs = np.c_[
    [0.1, 0.1, 0],
    [-0.1, 0.1, 0],
    [-0.1, -0.1, 0],
    [0.1, -0.1, 0],
]
room.add_microphone_array(mic_locs)

# run the simulation
room.simulate()

# create frequency-domain input for DOA algorithms
X = pra.transform.stft.analysis(
    room.mic_array.signals.T, nfft, nfft // 2, win=np.hanning(nfft)
)
X = np.swapaxes(X, 2, 0)

# perform DOA estimation
doa = pra.doa.algorithms[args.method](mic_locs, fs, nfft, num_src=1, max_four=4, dim=3)
doa.locate_sources(X)
# for i in dir(doa):
#     print(i)

# evaluate result
print("Source is estimated at:", doa.azimuth_recon/np.pi*180)
print(doa.colatitude_recon)
print("Real source is at:", azimuth_true/np.pi*180)
print("Error:", pra.doa.circ_dist(azimuth_true, doa.azimuth_recon))
@fakufaku fakufaku self-assigned this Dec 7, 2024
@fakufaku fakufaku added the bug label Dec 7, 2024
@fakufaku
Copy link
Collaborator

fakufaku commented Dec 7, 2024

Thanks for finding this bug. I am writing a fix.

fakufaku added a commit that referenced this issue Dec 7, 2024
…roperly when creating the object with the number of desired point as the single parameter (issue #380).
fakufaku added a commit that referenced this issue Dec 7, 2024
…roperly when creating the object with the number of desired point as the single parameter (issue #380). (#386)
@QHenry1990
Copy link
Author

thank you very much

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

Successfully merging a pull request may close this issue.

2 participants