Skip to content

Commit a7fd763

Browse files
committed
change num/den and _num/_den to num/den_{list,array}
1 parent 9f8ff40 commit a7fd763

4 files changed

Lines changed: 111 additions & 75 deletions

File tree

control/bdalg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@ def combine_tf(tf_array):
600600
f"row {row_index}."
601601
)
602602
for j_in in range(col.ninputs):
603-
num_row.append(col._num[j_out, j_in])
604-
den_row.append(col._den[j_out, j_in])
603+
num_row.append(col.num_array[j_out, j_in])
604+
den_row.append(col.den_array[j_out, j_in])
605605
num.append(num_row)
606606
den.append(den_row)
607607
for row_index, row in enumerate(num):
@@ -657,8 +657,8 @@ def split_tf(transfer_function):
657657
for i_in in range(transfer_function.ninputs):
658658
row.append(
659659
tf.TransferFunction(
660-
transfer_function._num[i_out, i_in],
661-
transfer_function._den[i_out, i_in],
660+
transfer_function.num_array[i_out, i_in],
661+
transfer_function.den_array[i_out, i_in],
662662
dt=transfer_function.dt,
663663
)
664664
)

control/tests/bdalg_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,15 +903,15 @@ def _tf_close_coeff(tf_a, tf_b, rtol=1e-5, atol=1e-8):
903903
for i in range(tf_a.noutputs):
904904
for j in range(tf_a.ninputs):
905905
if not np.allclose(
906-
tf_a._num[i, j],
907-
tf_b._num[i, j],
906+
tf_a.num_array[i, j],
907+
tf_b.num_array[i, j],
908908
rtol=rtol,
909909
atol=atol,
910910
):
911911
return False
912912
if not np.allclose(
913-
tf_a._den[i, j],
914-
tf_b._den[i, j],
913+
tf_a.den_array[i, j],
914+
tf_b.den_array[i, j],
915915
rtol=rtol,
916916
atol=atol,
917917
):

control/tests/xferfcn_test.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ def test_reverse_sign_mimo(self):
191191

192192
for i in range(sys3.noutputs):
193193
for j in range(sys3.ninputs):
194-
np.testing.assert_allclose(sys2._num[i, j], sys3._num[i, j])
195-
np.testing.assert_allclose(sys2._den[i, j], sys3._den[i, j])
194+
np.testing.assert_allclose(
195+
sys2.num_array[i, j], sys3.num_array[i, j])
196+
np.testing.assert_allclose(
197+
sys2.den_array[i, j], sys3.den_array[i, j])
196198

197199
# Tests for TransferFunction.__add__
198200

@@ -237,8 +239,8 @@ def test_add_mimo(self):
237239

238240
for i in range(sys3.noutputs):
239241
for j in range(sys3.ninputs):
240-
np.testing.assert_allclose(sys3._num[i, j], num3[i][j])
241-
np.testing.assert_allclose(sys3._den[i, j], den3[i][j])
242+
np.testing.assert_allclose(sys3.num_array[i, j], num3[i][j])
243+
np.testing.assert_allclose(sys3.den_array[i, j], den3[i][j])
242244

243245
# Tests for TransferFunction.__sub__
244246

@@ -285,8 +287,8 @@ def test_subtract_mimo(self):
285287

286288
for i in range(sys3.noutputs):
287289
for j in range(sys3.ninputs):
288-
np.testing.assert_allclose(sys3._num[i, j], num3[i][j])
289-
np.testing.assert_allclose(sys3._den[i, j], den3[i][j])
290+
np.testing.assert_allclose(sys3.num_array[i, j], num3[i][j])
291+
np.testing.assert_allclose(sys3.den_array[i, j], den3[i][j])
290292

291293
# Tests for TransferFunction.__mul__
292294

@@ -341,8 +343,8 @@ def test_multiply_mimo(self):
341343

342344
for i in range(sys3.noutputs):
343345
for j in range(sys3.ninputs):
344-
np.testing.assert_allclose(sys3._num[i, j], num3[i][j])
345-
np.testing.assert_allclose(sys3._den[i, j], den3[i][j])
346+
np.testing.assert_allclose(sys3.num_array[i, j], num3[i][j])
347+
np.testing.assert_allclose(sys3.den_array[i, j], den3[i][j])
346348

347349
# Tests for TransferFunction.__div__
348350

@@ -664,9 +666,9 @@ def test_convert_to_transfer_function(self):
664666
for i in range(sys.noutputs):
665667
for j in range(sys.ninputs):
666668
np.testing.assert_array_almost_equal(
667-
tfsys._num[i, j], num[i][j])
669+
tfsys.num_array[i, j], num[i][j])
668670
np.testing.assert_array_almost_equal(
669-
tfsys._den[i, j], den[i][j])
671+
tfsys.den_array[i, j], den[i][j])
670672

671673
def test_minreal(self):
672674
"""Try the minreal function, and also test easy entry by creation
@@ -1123,9 +1125,9 @@ def test_repr(self, Hargs, ref):
11231125
for p in range(len(H.num)):
11241126
for m in range(len(H.num[0])):
11251127
np.testing.assert_array_almost_equal(
1126-
H._num[p, m], H2._num[p, m])
1128+
H.num_array[p, m], H2.num_array[p, m])
11271129
np.testing.assert_array_almost_equal(
1128-
H._den[p, m], H2._den[p, m])
1130+
H.den_array[p, m], H2.den_array[p, m])
11291131
assert H.dt == H2.dt
11301132

11311133
def test_sample_named_signals(self):
@@ -1183,8 +1185,10 @@ def test_returnScipySignalLTI(self, mimotf):
11831185
sslti = mimotf.returnScipySignalLTI(strict=False)
11841186
for i in range(2):
11851187
for j in range(3):
1186-
np.testing.assert_allclose(sslti[i][j].num, mimotf._num[i, j])
1187-
np.testing.assert_allclose(sslti[i][j].den, mimotf._den[i, j])
1188+
np.testing.assert_allclose(
1189+
sslti[i][j].num, mimotf.num_array[i, j])
1190+
np.testing.assert_allclose(
1191+
sslti[i][j].den, mimotf.den_array[i, j])
11881192
if mimotf.dt == 0:
11891193
assert sslti[i][j].dt is None
11901194
else:

0 commit comments

Comments
 (0)