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

System Identification using Spatial Interpolation #3

Closed
narahahn opened this issue Nov 20, 2017 · 6 comments
Closed

System Identification using Spatial Interpolation #3

narahahn opened this issue Nov 20, 2017 · 6 comments

Comments

@narahahn
Copy link
Contributor


K is the number of impulse responses we want to have at the end. It is not necessary equal to N which is in our example 800 and too many.

Time-varying--MIMO/SISO4.py

Lines 413 to 427 in 7485f3b

#number of subsignals
M = 4
#initializing of impulse_response
impulse_response = np.zeros((M,K-2))
#for each subsignal
for i in range(M):
#Decompose the captured signal into M sub-signals
phi_i = phi[i::M]
s_i = s[i::M]
#interpolation
y_i = spatial_interpolation(s_i, phi_i, phi_target, interp_method)

What does M mean, and why is it 4?
The length of each impulse response has to be N, and impulse_response should have the corresponding size. The for-loop up-to M also does not make sense.
The sub-signal has to be a decimation by a factor of N. phi[i::M] does not gives the sub-signals we need.

Time-varying--MIMO/SISO4.py

Lines 426 to 436 in 7485f3b

#interpolation
y_i = spatial_interpolation(s_i, phi_i, phi_target, interp_method)
#print(y_i)
y_i = y_i[1:len(y_i)-1] #removing of boundary valuse, bc these are nan.
p_i = p[1:len(p) - 1]
phi_target_i = phi_target[1:len(phi_target)-1]
#calculating of impulse_response
impulse_response[i,:] = cross_correlation(y_i, p_i)

y_i = spatial_interpolation(s_i, phi_i, phi_target, interp_method) computes the sound field at time index i for all target angles. Can we use this directly for the impulse response computation?
If you get a nan in your computation, you should fix something not just ignoring it.

@narahahn
Copy link
Contributor Author

narahahn commented Nov 20, 2017

Let's continue our discussion here. I'm quoting your Email:

I have taken the M= N because , when i compute circular cross correlation I need equal lengths ( for computation, i took equal lengths , where in our case N=800) .

sorry, its K=N ,, not M

K is the number of required impulse responses which is independent to N. You can compute as many impulse responses as you need. Of course, you can compute just one. Therefore, the choice of K should not affect the system identification process. If it works only if K=N, something is wrong.

After the spatial interpolation, the impulse response is given as the circular cross-correlation of the sound field and the excitation signal. Yes, you need two signals having the same length N. But the question is, is y_i the sound field at a particular position. Why it does not have length of N but K?

Maybe it will help to look at the overall structure in #1.

@narahahn
Copy link
Contributor Author

@david1412 Please check numpy.interp and see how a periodic signal is interpolated.
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.interp.html

@david1412
Copy link
Owner

I will check and try out this . Thankyou

@narahahn
Copy link
Contributor Author

Time-varying--MIMO/SISO

Lines 328 to 334 in 5cc8744

def spatial_interpolation(s_i, phi_i, phi_target, interp_method):
if phi_i[-1] < phi_target:
phi_i[-1] = phi_target
elif phi_i[0] > phi_target:
phi_i[0] = phi_target
s_i = np.array(s_i)
phi_i = np.array(phi_i)

You are replacing the first (or the last) element of phi_i with phi_target. If you do so, the first (or the last) sample of s_i is considered to be obtained at phi_target which is not true. Probably, the interpolation result will be equal to s_i[0] (or s_i[-1]). The interpolator tries to find the value of s_i corresponding to phi_target which cannot be other than s_i[0] (or s_i[-1]) due to the replacement.

I want to remind you that the polar angle phi_i and the corresponding signal s_i are periodic. If phi_target is smaller than phi_i[0] (or greater than phi_i[-1]), you can take the data from the previous (or the next) period. The additional data should be appended to the original one:

  • original: [phi_i[0], phi_i[1], ..., phi_i[-1]], [s_i[0], s_i[1], ..., s_i[-1]]
  • appended: [phi_i[-1]-2*np.pi, phi_i[0], phi_i[1], ..., phi_i[-1], phi_i[0]+2*np.pi], [s_i[-1], s_i[0], s_i[1], ..., s_i[-1], s_i[0]]

In the above case, only one sample is appended at each end. Notice that both phi_i and s_i have to be appended so that they have the same length. Also, 2*np.pi is subtracted from the left-appended data and added to the right-appended data.

@narahahn
Copy link
Contributor Author

narahahn commented Nov 28, 2017

The spline interpolation still does not works in my computer, how about in yours?
The linear interpolation works fine.

@david1412
Copy link
Owner

I dont have problem with spline interpolation . it is working well and i used Linear interpolation as well. but the issue is kernel will die when i run the code after 3 hours..

@narahahn narahahn closed this as completed Jan 2, 2018
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