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

"The sources must be inside the room" #71

Open
albuca09 opened this issue Dec 22, 2024 · 1 comment
Open

"The sources must be inside the room" #71

albuca09 opened this issue Dec 22, 2024 · 1 comment

Comments

@albuca09
Copy link

In the init.py script, the following error message appears:

python
Copiar código
assert not ((pos_src >= room_sz).any() or (pos_src <= 0).any()), "The sources must be inside the room"
assert not ((pos_rcv >= room_sz).any() or (pos_rcv <= 0).any()), "The receivers must be inside the room"
In my simulation, all sources and receivers were correctly positioned inside the room, but the error was still raised. It seems that the simulator is comparing the x-axis positions of the room with the x, y, and z positions of the sources.

Shouldn't the comparison be performed correspondingly, such that the x-axis of the room is compared with the x-axis of the sources, the y-axis of the room with the y-axis of the sources, and the z-axis of the room with the z-axis of the sources?

@DavidDiazGuerra
Copy link
Owner

The pos_src >= room_sz should broadcast room_sz correctly and perform the comparison axis by axis if pos_src and room_sz are numpy arrays of shape (N, 3) and (3,) as indicated in the documentation of the library. Then .any() will return true if any of the axes were True and raise the assert exception.

I tried the following to confirm this:

>> import numpy as np
>> room_sz = np.array([5, 3, 2])
>> room_sz.shape
(3,)
>> pos_src = np.array([[4, 2, 1], [1, 1, 1]])
>> pos_src.shape
(2, 3)
>> pos_src >= room_sz
array([[False, False, False],
       [False, False, False]])
>> pos_src = np.array([[7, 2, 1], [1, 5, 1]])
>> pos_src >= room_sz
array([[ True, False, False],
       [False,  True, False]])

Are you sure you're using numpy arrays with the correct shape?

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

No branches or pull requests

2 participants