pyroomacoustics icon indicating copy to clipboard operation
pyroomacoustics copied to clipboard

How to retrieve the wall sequece

Open Chutlhu opened this issue 4 years ago • 2 comments

Dear Fakufaku,

https://github.com/LCAV/pyroomacoustics/blob/faafedf45c9792586d1a4a46c796e044fbccbda3/pyroomacoustics/soundsource.py#L269

I was trying to retrieve the wall sequence generating a give image source and I found that you already coded it. amazing! However, it seems that the function is looping forever. Maybe because you changed the direct path 'wall' code from NaN to -1 ?

This seems working

    def wall_sequence(self,i):
        '''
        Print the wall sequence for the image source indexed by i
        '''
        p = self.generators[i]
        if p == -1:   # before: np.isnan(p)
            return [-1] # before: []. The generator of the dp is the dp itself
        w = [self.walls[i]]
        while not p == -1:  # before: np.isnan(p)
            w.append(self.walls[p])
            p = self.generators[p]
        return w

Chutlhu avatar Apr 28 '20 08:04 Chutlhu

Thanks for pointing this out! I have not been using this code for a while! In which branch is the bug happening ? It would be great if you want to do a PR with this bug fix!

Also, I don't think that works for shoebox rooms anymore because one source may have more than one parent due to overlapping image sources. So it might be best to have a check in this function that the room is not a shoebox.

fakufaku avatar Apr 29 '20 13:04 fakufaku

Thank you @fakufaku . It was in the :master branch. I going to do a PR for this. You are right actually about the behavior of the shoebox.

Chutlhu avatar May 04 '20 07:05 Chutlhu