Home
last modified time | relevance | path

Searched refs:np (Results 1 – 14 of 14) sorted by relevance

/liblc3-3.5.0-3.4.0/test/
Dappendix_c.py21 import numpy as np namespace
24 NBYTES = (32e3 * np.array([ 7.5e-3, 10e-3 ]) / 8).astype(int)
29 X_PCM_10M = np.array([
75 X_PCM_7M5 = np.array([
116 X_10M = np.array([
202 X_7M5 = np.array([
273 X_TILDE_12K8D_10M = np.array([
345 X_TILDE_12K8D_7M5 = np.array([
406 T_CURR_10M = np.array([ 25, 26 ])
407 T_CURR_7M5 = np.array([ 22, 25 ])
[all …]
Dtables.py17 import numpy as np namespace
26 DT_MS = np.array([ 7.5, 10 ])
36 SRATE_KHZ = np.array([ 8, 16, 24, 32, 48 ])
40 NE = [ np.append(NS[dt][:-1], (NS[dt][-1] * 5) // 6) for dt in range(NUM_DT) ]
47 I_10M_8K = np.array([
57 I_10M_16K = np.array([
67 I_10M_24K = np.array([
77 I_10M_32K = np.array([
87 I_10M_48K = np.array([
97 I_7M5_8K = np.array([
[all …]
Dmdct.py17 import numpy as np namespace
35 self.t = np.zeros(2*self.ns)
57 z = t * np.exp(-2j * np.pi * np.arange(n) / (2*n))
59 z = z * np.exp(-2j * np.pi *
60 (n2/2 + 0.5) * (np.arange(n2) + 0.5) / (2 * n2))
61 return np.real(z) * np.sqrt(2/n2)
77 x = np.append(x, -x[::-1])
78 z = x * np.exp(2j * np.pi * (n/2 + 0.5) * np.arange(2*n) / (2*n))
80 z = z * np.exp(2j * np.pi * (np.arange(2*n) + (n/2 + 0.5)) / (4*n))
81 t = np.real(z) * np.sqrt(2/n)
[all …]
Dltpf.py17 import numpy as np namespace
36 self.x = np.zeros(self.w + T.NS[dt][sr])
37 self.u = np.zeros(self.n + 2)
38 self.y = np.zeros(self.n + self.d + history)
64 h = np.zeros(240 + p)
71 k = np.arange(-120, 120 + p, p) - f
72 u[2+i] = p * np.dot( x[e:e+w+1], np.take(h, k) )
93 self.x = np.zeros(n + 5)
96 self.y = np.zeros(self.n + history)
118 self.y[:n] = [ np.dot(x[2*i:2*i+5], h) for i in range(self.n) ]
[all …]
Dsns.py17 import numpy as np namespace
57 scf_i = np.empty(4*len(scf))
71 scf_i = np.append(scf_i[:n2], scf_i[2*n2:])
73 g_sns = np.power(2, [ -scf_i, scf_i ][inv])
77 y = np.empty(len(x))
100 e = np.append(np.empty(n2), e)
106 e_s = np.zeros(len(e))
114 e_p = e_s * (10 ** ((np.arange(64) * g_tilt) / 630))
118 noise_floor = max(np.average(e_p) * (10 ** (-40/10)), 2 ** -32)
119 e_p = np.fmax(e_p, noise_floor * np.ones(len(e)))
[all …]
Denergy.py17 import numpy as np namespace
33 e = [ np.mean(np.square(x[self.I[i]:self.I[i+1]]))
36 e_lo = np.sum(e[:len(e) - [4, 2][self.dt]])
37 e_hi = np.sum(e[len(e) - [4, 2][self.dt]:])
39 return np.append(e, np.zeros(64-len(e))), (e_hi > 30*e_lo)
54 ok = ok and np.amax(np.abs(e_c - e)) < 1e-5 and nn_c == nn
60 ok = ok and np.amax(np.abs(e_c - e)) < 1e-3 and nn_c == nn
70 ok = ok and np.amax(np.abs(1 - e/C.E_B[dt][0])) < 1e-6
73 ok = ok and np.amax(np.abs(1 - e/C.E_B[dt][1])) < 1e-6
79 rng = np.random.default_rng(1234)
Dtns.py17 import numpy as np namespace
71 (0, False, np.array([ 0, 0 ]), np.array([ 0, 0 ]))
109 r = np.append([ 3 ], np.zeros(8))
113 c = [ np.dot(x[S[s]:S[s+1]-k], x[S[s]+k:S[s+1]])
116 r[k] = np.sum( np.array(c) / np.array(e) )
118 r *= np.exp(-0.5 * (0.02 * np.pi * np.arange(9)) ** 2)
123 a = np.ones(len(r))
139 return a * np.power(gamma, np.arange(len(a)))
143 rc = np.zeros(8)
155 delta = np.pi / 17
[all …]
Dattdet.py17 import numpy as np namespace
62 x_att = np.array([ np.sum(x[i*r:(i+1)*r]) for i in range(mf) ])
64 x_hp = np.empty(mf)
75 e_att = np.array([ np.sum(np.square(x_hp[40*i:40*(i+1)]))
78 a_att = np.empty(nb)
79 a_att[0] = np.maximum(0.25 * self.an1, self.en1)
81 a_att[i] = np.maximum(0.25 * a_att[i-1], e_att[i-1])
129 x_c = np.zeros(ns+6)
142 x_c = np.append(x_c[-6:], x)
146 ok = ok and np.amax(np.abs(1 - state_c['en1']/attdet.en1)) < 2
[all …]
Ddecoder.py18 import numpy as np namespace
84 x = np.append(x, np.zeros(self.ns - self.ne))
110 ok = ok and np.max(np.abs(pcm - C.X_HAT_CLIP[dt][i])) < 1
160 pcm_c = np.empty(0).astype(np.int16)
161 pcm_py = np.empty(0).astype(np.int16)
180 pcm_py = np.append(pcm_py,
181 np.clip(np.round(x), -32768, 32767).astype(np.int16))
184 pcm_c = np.append(pcm_c, x_c)
Dbwdet.py17 import numpy as np namespace
60 if np.mean(e[i0:i1+1]) >= TQ[bw]:
72 c = 10 * np.log10(1e-31 + e[i0-l+1:i1-l+2] / e[i0+1:i1+2])
73 if np.amax(c) <= TC[bw0]:
82 1 + np.log2(self.sr).astype(int)
112 e[i0:i1+1] /= (np.mean(e[i0:i1+1]) / TQ[i] + 1e-3)
122 e[i0-l+1:i1+2] /= np.power(10, np.arange(2*l+1) / (1 + drop))
150 rng = np.random.default_rng(1234)
Dspec.py17 import numpy as np namespace
50 xq = np.append(xq[:lastnz], np.zeros(len(xq) - lastnz))
52 i_nf = [ np.all(xq[k-nf_width:min(bw_stop, k+nf_width+1)] == 0)
79 e = [ np.sum(x[4*k:4*(k+1)] ** 2) for k in range(len(x) // 4) ]
80 e = 10 * np.log10(2**-31 + np.array(e))
109 x_max = np.amax(np.abs(x))
111 g_min = 28 * np.log10(x_max / (32768 - 0.375))
112 g_min = np.ceil(g_min).astype(int) - g_off
127 xq = np.where(xg < 0, np.ceil(xg - 0.375), np.floor(xg + 0.375))
129 xq = np.fmin(np.fmax(xq, -32768), 32767)
[all …]
Dencoder.py18 import numpy as np namespace
187 pcm = np.append(pcm, np.zeros(frame_samples - (len(pcm) % frame_samples)))
/liblc3-3.5.0-3.4.0/tables/
Dmktables.py18 import numpy as np namespace
20 LTPF_H12K8 = np.array([
83 LTPF_HI = np.array([
105 kv = -2 * np.pi * np.arange(n // 2) / n
107 print('{{ {:14.7e}, {:14.7e} }},'.format(np.cos(k), np.sin(k)),
114 kv = -2 * np.pi * np.arange(n) / n
118 np.cos(k), np.sin(k), np.cos(2*k), np.sin(2*k)))
127 kv = 2 * np.pi * (np.arange(n // 4) + 1/8) / n
129 print('{{ {:14.7e}, {:14.7e} }},'.format(np.cos(k), np.sin(k)),
136 ns = np.array([ [ 60, 120, 180, 240, 360], [ 80, 160, 240, 320, 480] ])
[all …]
Dfastmath.py18 import numpy as np namespace
24 p = p.astype(np.float32)
25 x = x.astype(np.float32)
29 return np.power(y.astype(np.float32), 16)
33 x = np.arange(-8, 8, step=1e-3)
35 p = np.polyfit(x, ((2 ** (x/16)) - 1) / x, 4)
37 e = np.abs(y - 2**x) / (2 ** x)
41 print('Max relative error: ', np.max(e))
42 print('Max RMS error: ', np.sqrt(np.mean(e ** 2)))
59 p = p.astype(np.float32)
[all …]