-
Notifications
You must be signed in to change notification settings - Fork 0
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
linting is error free #38
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Test the adaptive module.""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Test functions for the lattice module.""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,14 @@ | |
import logging | ||
|
||
import numpy as np | ||
from ssp import levinson | ||
|
||
from ssp import levinson | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def test_glev(): | ||
'''Example 5.3.1, Page 266''' | ||
"""Example 5.3.1, Page 266.""" | ||
r = [4, 2, 1] | ||
b = [9, 6, 12] | ||
|
||
|
@@ -23,7 +23,7 @@ def test_glev(): | |
|
||
|
||
def test_gtor() -> None: | ||
'''Based on example 5.2.6''' | ||
"""Based on example 5.2.6.""" | ||
expected_rx = np.array([2, -1, -1/4, 1/8]) | ||
|
||
gamma = [1/2, 1/2, 1/2] | ||
|
@@ -33,7 +33,7 @@ def test_gtor() -> None: | |
|
||
|
||
def test_atog() -> None: | ||
|
||
"""The m-file for the step-down recursion.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not a matlabl file (m-file), this is a functional test for the step-down recursion. |
||
a = [1, 0.5, -0.1, -0.5] | ||
expected_g = np.array([0.5, 0.2, -0.5]) | ||
|
||
|
@@ -45,6 +45,11 @@ def test_atog() -> None: | |
|
||
|
||
def test_rtog() -> None: | ||
"""Companion m-file. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an m-file. |
||
|
||
Performs mapping from a sequence of | ||
autocorrelations r to the reflection coefficient g. | ||
""" | ||
rx = [2, -1, -1/4, 1/8] | ||
expected_g = np.array([0.5, 0.5, 0.5]) | ||
|
||
|
@@ -56,6 +61,7 @@ def test_rtog() -> None: | |
|
||
|
||
def test_ator() -> None: | ||
"""Finds the autocorrelation sequence from a set of filter coefficients.""" | ||
a = [1, 1, 7/8, 1/2] | ||
epsilon = 2 * (3 / 4)**3 | ||
b = epsilon**2 | ||
|
@@ -69,6 +75,7 @@ def test_ator() -> None: | |
|
||
|
||
def test_gtoa() -> None: | ||
"""The step-up recursion.""" | ||
gamma = [0.5, 0.2, -0.5] | ||
expected_a = np.array([1, 0.5, -0.1, -0.5]) | ||
|
||
|
@@ -79,6 +86,7 @@ def test_gtoa() -> None: | |
assert np.allclose(a, expected_a) | ||
|
||
def test_rtoa() -> None: | ||
"""m-file for the Levinson-Durbin recursion.""" | ||
rx = np.array([2, -1, -1/4, 1/8]) | ||
expected_a = [1, 1, 7/8, 1/2] | ||
expected_eps = 2 * (3 / 4)**3 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,15 @@ | |
import logging | ||
|
||
import numpy as np | ||
import scipy.signal as signal | ||
from ssp import modeling, system | ||
from scipy import signal | ||
|
||
from ssp import modeling, system | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def test_pade() -> None: | ||
"""Pade Approximation.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functional test for the Pade Approximation. |
||
x = [1, 1.5, 0.75, 0.1875, 0.0938] | ||
expected_a = [1, -1.5, 1.5] | ||
expected_b = [1] | ||
|
@@ -39,6 +40,7 @@ def test_pade() -> None: | |
|
||
|
||
def test_prony(): | ||
"""Prony method.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functional test for the... |
||
N = 21 | ||
T = 2 * (N - 1) + 1 | ||
xn = np.ones(T) | ||
|
@@ -49,6 +51,7 @@ def test_prony(): | |
|
||
|
||
def test_shanks(): | ||
"""Shank's method.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functional test for the... |
||
N = 21 | ||
T = 10 * (N - 1) + 1 | ||
xn = np.ones(T) | ||
|
@@ -66,6 +69,7 @@ def test_shanks(): | |
|
||
|
||
def test_spike(): | ||
"""m-file to find the least squares inverse filter.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an m-file. |
||
gn = np.array([-0.2, 0, 1]) | ||
h, err = modeling.spike(gn, 4, 11) | ||
d = np.convolve(h, gn) | ||
|
@@ -74,10 +78,12 @@ def test_spike(): | |
logger.info(f"{d=}, {np.argmax(d)=}") | ||
|
||
|
||
def test_ipf(): ... | ||
def test_ipf(): | ||
"""Iterative prefiltering.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functional test for the... |
||
|
||
|
||
def test_acm(): | ||
"""m-file for the autocorrelation method.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an m-file. Functional test for the... |
||
x = np.ones(20) | ||
x[1::2] = x[1::2] * -1 | ||
logger.info(x) | ||
|
@@ -88,6 +94,7 @@ def test_acm(): | |
|
||
|
||
def test_covm(): | ||
"""Covariance method.""" | ||
x = np.ones(20) | ||
x[1::2] = x[1::2] * -1 | ||
logger.info(x) | ||
|
@@ -98,7 +105,8 @@ def test_covm(): | |
|
||
|
||
def test_durbin(): | ||
N = 64 | ||
"""Durbin's method.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functional test for the... |
||
#N = 64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just delete this line. |
||
ap = [1, 0.7348, 1.882, 0.7057, 0.8851] | ||
|
||
zeros, poles, _ = signal.tf2zpk([1], ap) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
"""""" | ||
"""Test optimal.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test cases for the Optimal module. |
||
|
||
import numpy as np | ||
|
||
from ssp import optimal | ||
|
||
|
||
def test_kalman(): | ||
"""Discrete Kalman filter.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functional test for the... |
||
av = 1 | ||
aw = 0.36 | ||
A = 0.8 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Spectrum.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test cases for the Spectrum module. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
|
||
def test_convm(): | ||
"""Set up a convoluston matrix.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Functional test for the... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spelling correction: "convolution". Functional test for the Convolution matrix. |
||
x = np.array([1, 2, 3]) | ||
p = 4 | ||
|
||
|
@@ -20,6 +21,7 @@ def test_convm(): | |
|
||
|
||
def test_covar(): | ||
"""Form a covariance matrix.""" | ||
x = np.array([1, 2, 3]) | ||
p = 4 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Discrete-time system.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test cases for the Discrete-Time Systems module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, let's phrase it as "Test cases for the Adaptive module."