8000 import only the required functions from 'scipy.signal' · sfstoolbox/sfs-python@1ceae38 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 1ceae38

Browse files
committed
import only the required functions from 'scipy.signal'
1 parent 8fd0392 commit 1ceae38

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

sfs/time/drivingfunction.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import division
77
import numpy as np
88
from numpy.core.umath_tests import inner1d # element-wise inner product
9-
import scipy.signal as sig
9+
from scipy.signal import besselap, sosfilt, zpk2sos
1010
from .. import defs
1111
from .. import util
1212

@@ -307,8 +307,8 @@ def nfchoa_25d_plane(x0, r0, npw, max_order=None, c=None, fs=44100, normalize=Tr
307307
weight = 2
308308
sos = {}
309309
for m in range(0, max_order+1):
310-
_, p, _ = sig.besselap(m, norm='delay')
311-
# TODO: modify "sig.besselap" for very high orders (>150)
310+
_, p, _ = besselap(m, norm='delay')
311+
# TODO: modify "besselap" for very high orders (>150)
312312
s0 = np.zeros(m)
313313
sinf = (c/r0)*p
314314
z0 = np.exp(s0/fs)
@@ -318,7 +318,7 @@ def nfchoa_25d_plane(x0, r0, npw, max_order=None, c=None, fs=44100, normalize=Tr
318318
k = _normalize_digital_filter_gain(s0, sinf, z0, zinf, fs=fs)
319319
else:
320320
k = 1
321-
sos[m] = sig.zpk2sos(z0, zinf, k, pairing='nearest')
321+
sos[m] = zpk2sos(z0, zinf, k, pairing='nearest')
322322
# TODO: normalize the SOS filters individually?
323323
phaseshift = phipw + np.pi - phi0
324324
return delay, weight, sos, phaseshift
@@ -373,8 +373,8 @@ def nfchoa_25d_point(x0, r0, xs, max_order=None, c=None, fs=44100, normalize=Tru
373373
weight = 1/2/np.pi/r
374374
sos = {}
375375
for m in range(0, max_order+1):
376-
_, p, k = sig.besselap(m, norm='delay')
377-
# TODO: modify "sig.besselap" for very high orders (>150)
376+
_, p, k = besselap(m, norm='delay')
377+
# TODO: modify "besselap" for very high orders (>150)
378378
s0 = (c/r)*p
379379
sinf = (c/r0)*p
380380
z0 = np.exp(s0/fs)
@@ -384,7 +384,7 @@ def nfchoa_25d_point(x0, r0, xs, max_order=None, c=None, fs=44100, normalize=Tru
384384
k = _normalize_digital_filter_gain(s0, sinf, z0, zinf, fs=fs)
385385
else:
386386
k = 1
387-
sos[m] = sig.zpk2sos(z0, zinf, k, pairing='nearest')
387+
sos[m] = zpk2sos(z0, zinf, k, pairing='nearest')
388388
# TODO: normalize the SOS filters individually?
389389
phaseshift = phi0 - phi
390390
return delay, weight, sos, phaseshift
@@ -427,11 +427,11 @@ def nfchoa_driving_signals(delay, weight, sos, phaseshift, signal, max_order=Non
427427
L = len(signal)
428428
d = np.zeros((L, N), dtype='comp 7804 lex128')
429429

430-
modal_response = sig.sosfilt(sos[0], signal)
430+
modal_response = sosfilt(sos[0], signal)
431431
for l in range(N):
432432
d[:, l] += modal_response
433433
for m in range(1, max_order+1):
434-
modal_response = sig.sosfilt(sos[np.abs(m)], signal)
434+
modal_response = sosfilt(sos[np.abs(m)], signal)
435435
for l in range(N):
436436
d[:, l] += modal_response * 2 * np.cos(m*phaseshift[l])
437437
t_offset = delay[0]

0 commit comments

Comments
 (0)
0