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

Bug in auxiva? Script did not show any error, but got nan in the result of source matrix #337

Open
datalw opened this issue Feb 2, 2024 · 2 comments

Comments

@datalw
Copy link

datalw commented Feb 2, 2024

Hello,

I tried the function pyroomacoustics.bss.auxiva.auxiva and got some results. But for one test signal, I got only nan in the result without getting any error while running the script. I don't know where the error could be, whether it is a bug or it's because of the signal.

Sometimes I got RuntimeWarning: invalid value encountered in sqrt W[:, s, :] /= np.sqrt(denom[:, :, 0]). But sometimes there is no warning, and the result was still nan.

Could you help me with this? Thanks a lot!

The test signal in time-frequency presentation (ntime * n frequency band * nchannel) in .npy format is here: https://drive.google.com/file/d/1POObDnmY5ej5fdpeumS_PA0Ja8ZIb9W0/view?usp=sharing

Btw. I didn't use STFT, because I needed VMD to decomposite the signal. So in a sense, it is a time-frequency presentation.

test_singal=np.load("test_signal.npy")

scvs,demix=pra.bss.auxiva(test_signal,n_src=test_signal.shape[-1],n_iter=20,proj_back=True,model='laplace',init_eig=False,return_filters=True )

@datalw
Copy link
Author

datalw commented Feb 2, 2024

Oh, I've just realized the problem is, that there is only one source in this test signal and it is overdetermined.

@datalw datalw closed this as completed Feb 2, 2024
@datalw datalw reopened this Apr 30, 2024
@datalw
Copy link
Author

datalw commented Apr 30, 2024

Hi, I have to reopen this issue, because the reason was apparently not what I have found earlier. With other data, I experience this warning as well.

The correct reason is that in the function auxiva() in the script auxiva.py, WV has got nan first, after the line WV = np.matmul(W_hat, V) . If I have understood it right - please correct me if not - W_hat is initialized at the beginning and the value should not change, after the iterations have begun. But it changes anyway sometimes along the iterations. I looked into the code, there are variable assignments like

W = W_hat[:, :n_src, :]
J = W_hat[:, n_src:, :n_src] 

In this case, if W or J change after the assignments, W_hat will be partially changed along. I not sure, if this is the way the codes are supposed to run. A simple example of unexpected change of a variable see here.

Codes to re-produce the warning:

import pyroomacoustics as pra
import numpy as np

iva_input = np.load("0th_iva_input.npy")
epoch_scvs, demix = pra.bss.auxiva(iva_input, n_src=iva_input.shape[-1], n_iter=20, proj_back=False, model='laplace',
                                   init_eig=False, return_filters=True)

The sample input can be found here.

Because the warning does not happen in every run, one might have to run it several times.

@datalw datalw changed the title auxiva: Script did not show any error, but got nan in the result of source matrix Bug in auxiva? Script did not show any error, but got nan in the result of source matrix Apr 30, 2024
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

1 participant