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

libroom does not return image-sources in correct order (ordering = 'order') #169

Open
hrosseel opened this issue May 18, 2020 · 2 comments
Labels

Comments

@hrosseel
Copy link
Contributor

Hello,

First of all, thanks for this amazing library. I've recently noticed that image-sources are not returned in the correct ordering when the ordering is set to 'order' using libroom. However, when setting use_libroom to false, the library outputs the correct order of image-sources.

Can be reproduced using the following code (only tested this in 2D rooms):

import numpy as np
import matplotlib.pyplot as plt
import pyroomacoustics as pra

max_order = 3
room = pra.ShoeBox([9, 7.5], fs=16000, max_order=max_order)
room.add_source([2.5, 3.73])
R = np.array([[6.3], [4.87]])
room.add_microphone_array(pra.MicrophoneArray(R, fs=room.fs))

color_dict = ['g', 'r', 'c', 'm', 'y', 'k']
colors = np.array(['b'])
imgs = 1
for order in range(max_order + 1):
    prev_imgs = imgs
    imgs = imgs + 4 * order
    for i in range(prev_imgs, imgs, 1):
        colors = np.append(colors, color_dict[order])

fig, (ax1, ax2) = plt.subplots(2, sharex=True, sharey=True)

room.image_source_model()
ax1.scatter(room.sources[0].images[0], room.sources[0].images[1], c=colors)
ax1.title.set_text('w/ libroom')
room.image_source_model(use_libroom=False)
ax2.scatter(room.sources[0].images[0], room.sources[0].images[1], c=colors)
ax2.title.set_text('w/o libroom')

plt.show()
@fakufaku
Copy link
Collaborator

Sorry for the late reply! Thanks for pointing out this inconsistency! I have not been playing with this feature for some time, so consistency might have been lost. I'll be taking a look as soon as I can.

@fakufaku fakufaku added the bug label May 31, 2020
@hrosseel
Copy link
Contributor Author

A small update on this problem: it appears my example (see above) is now broken. The function room.image_source_model() does not take parameter use_libroom anymore. However, the return order of image-sources is still broken.

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

2 participants