Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SISO tf() may not work with numpy arrays with numpy.int elements.#158

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@ before_install:
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# conda-build must be installed in the conda root environment
- conda install conda-build
- conda install conda-build=2.1.17
- conda config --add channels python-control
- conda info -a
- conda create -q -n test-environment python="$TRAVIS_PYTHON_VERSION" pip coverage
Expand Down
46 changes: 46 additions & 0 deletionscontrol/tests/tf_input_element_int.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
import unittest

import numpy as np

import control as ctl


class TestTfInputIntElement(unittest.TestCase):
# currently these do not pass
def test_tf_den_with_numpy_int_element(self):
num = 1
den = np.convolve([1, 2, 1], [1, 1, 1])

sys = ctl.tf(num, den)

self.assertAlmostEqual(1.0, ctl.dcgain(sys))

def test_tf_num_with_numpy_int_element(self):
num = np.convolve([1], [1, 1])
den = np.convolve([1, 2, 1], [1, 1, 1])

sys = ctl.tf(num, den)

self.assertAlmostEqual(1.0, ctl.dcgain(sys))

# currently these pass
def test_tf_input_with_int_element_works(self):
num = 1
den = np.convolve([1.0, 2, 1], [1, 1, 1])

sys = ctl.tf(num, den)

self.assertAlmostEqual(1.0, ctl.dcgain(sys))

def test_ss_input_with_int_element(self):
ident = np.matrix(np.identity(2), dtype=int)
a = np.matrix([[0, 1],
[-1, -2]], dtype=int) * ident
b = np.matrix([[0],
[1]], dtype=int)
c = np.matrix([[0, 1]], dtype=int)
d = 0

sys = ctl.ss(a, b, c, d)
sys2 = ctl.ss2tf(sys)
self.assertAlmostEqual(ctl.dcgain(sys), ctl.dcgain(sys2))
2 changes: 1 addition & 1 deletioncontrol/xferfcn.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -135,7 +135,7 @@ def __init__(self, *args):
else:
data[i] = [[array([data[i]])]]
elif (isinstance(data[i], (list, tuple, ndarray)) and
isinstance(data[i][0], (int, float, complex))):
isinstance(data[i][0], (int, float, complex, np.int64))):
# Convert array to list of list of array.
if (isinstance(data[i][0], int)):
# Convert integers to floats at this point
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp