sfstoolbox/sfs-python

Time domain plots are too sparse

hagenw opened this issue · 3 comments

The example images in master are broken compared compared to v0.5.0.

E.g.

image

vs.

image

fs446 commented

I spent the day to figure out what happens here. I could not 100% trace it, but it seems that matplotlib rendering changed in the meantime between these two versions. One could figure out this exactly, however our SFS processing is not optimum anyway, so we should rather address this first. The problem is that by using a perfect Dirac impuls as excitation the synthesized sound field has very sharp transients and a lot of zeros (in dB we then get -Inf) and the rendering algorithms need somehow align these values to RGB. Success is then highly dependent on the sampling grid, amplitude, time instance and so on, which can be observed, when playing around with different configurations.

So, to solve the problem in the toolbox I would propose to use bandlimited Dirac impulse as excitation, see the branch
https://github.com/sfstoolbox/sfs-python/tree/doc_td_plot_routine
where a simple Kaiser-Bessel windowed FIR lowpass is used with some meaningful parameters for nice plots.

We might consider to write a signal generating function, e.g. create_bandlimited_dirac(number of samples, cut frequency, **kwargs) for user convenience.

Furthermore, I would propose to use the normalization of weights for the points sources, such that we get similar level than for the plane wave case. Normalization for focused source seems to be not correct yet.

Good point, I think we did something similar in Matlab and used a hanning window as Dirac impulse at some point, see https://github.com/sfstoolbox/sfs-matlab/blob/02194f0243d1ead26572f760032c40527718919d/SFS_time_domain/dirac_imp.m#L48-L53

So, to solve the problem in the toolbox I would propose to use bandlimited Dirac impulse as excitation, see the branch
https://github.com/sfstoolbox/sfs-python/tree/doc_td_plot_routine
where a simple Kaiser-Bessel windowed FIR lowpass is used with some meaningful parameters for nice plots.

Seems to work, for me locally the WFS plane wave plot from above now looks like this:

image