forked from bilgesu13/ISM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_ISM.py
67 lines (47 loc) · 1.47 KB
/
test_ISM.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import numpy as np
from numpy import linalg as LA
from scipy.io import savemat
import matplotlib.cm as cm
import matplotlib.pyplot as plt
c = 340;
Fs = 16000;
Nt = round(Fs/2);
xs = np.array([2,1.5,1]);
rAng = [0,1.04719755119660,2.09439510239320,3.14159265358979,4.18879020478639,5.23598775598299];
locOffset = [2.9, 3.4, 3.3];
# xr = np.tile(locOffset, (6, 1)) + [0.1*np.cos(rAng), 0.1*np.sin(rAng), np.zeros(len(rAng))];
# xr = np.transpose(xr);
xr=np.array([[3,3.4, 3.3] ,[2.95,3.48,3.3],[2.85,3.48,3.3],[2.8,3.4,3.3],[2.85,3.31,3.3],[2.95,3.31,3.3]]);
xr = np.transpose(xr);
L = np.array([6,7,3.5]);
N = np.array([ 0,0,0]);
T60 = 0.6;
Tw = 11;
Fc = 0.9;
Rd = 0.08;
t = np.linspace(0,Nt*1/Fs,Nt);
count = 0;
RIR = np.zeros((8000,6),dtype=object);
#RIR = np.full((256,1,8000,6), 0)
sloc = np.zeros((256, 3));
res = {'field1': RIR, 'field2': sloc};
from ISM import ISM
# while (count < 1):
#
# xs = np.multiply([L[0]-0.4, L[1]-0.4, L[2]-0.4],np.random.rand(3)) + [0.2, 0.2, 0.2];
# if (np.linalg.norm(np.transpose(locOffset)-xs)<1):
# continue
# else:
# print('hello')
# count = count + 1;
# B=ISM(xr, xs, L, T60, N, Nt, Rd, [], Tw, Fc, Fs, c);
# RIR[count-1,0] = B[0];
# sloc[count-1, :] = xs;
# print(count)
B=ISM(xr, xs, L, T60, N, Nt, Rd, [], Tw, Fc, Fs, c);
RIR = B[0];
sloc= xs;
# res['field1'][count-1,:,:] = RIR[count-1,0];
# res['field2'][count-1,:] = sloc[count-1,:];
#plt.plot(RIR[0,0,:,:])
plt.plot(RIR)