We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f7cbfa commit 4cedb6cCopy full SHA for 4cedb6c
2 files changed
control/frdata.py
@@ -285,7 +285,6 @@ def __init__(self, *args, **kwargs):
285
if self.squeeze not in (None, True, False):
286
raise ValueError("unknown squeeze value")
287
288
- # Process iosys keywords
289
defaults = {
290
'inputs': self.fresp.shape[1] if not getattr(
291
self, 'input_index', None) else self.input_labels,
@@ -421,10 +420,20 @@ def __repr__(self):
421
420
422
limited for number of data points.
423
"""
424
- return "FrequencyResponseData({d}, {w}{smooth})".format(
+ out = "FrequencyResponseData(\n{d},\n{w}{smooth}".format(
425
d=repr(self.fresp), w=repr(self.omega),
426
smooth=(self._ifunc and ", smooth=True") or "")
427
+ if config.defaults['control.default_dt'] != self.dt:
428
+ out += ",\ndt={dt}".format(
429
+ dt='None' if self.dt is None else self.dt)
430
+
431
+ if len(labels := self._label_repr()) > 0:
432
+ out += ",\n" + labels
433
434
+ out += ")"
435
+ return out
436
437
def __neg__(self):
438
"""Negate a transfer function."""
439
control/tests/frd_test.py
@@ -465,10 +465,12 @@ def test_repr_str(self):
465
[0.1, 1.0, 10.0, 100.0], name='sys0')
466
sys1 = ct.frd(
467
sys0.fresp, sys0.omega, smooth=True, name='sys1')
468
- ref0 = "FrequencyResponseData(" \
469
- "array([[[1. +0.j , 0.9 +0.1j, 0.1 +2.j , 0.05+3.j ]]])," \
470
- " array([ 0.1, 1. , 10. , 100. ]))"
471
- ref1 = ref0[:-1] + ", smooth=True)"
+ ref_common = "FrequencyResponseData(\n" \
+ "array([[[1. +0.j , 0.9 +0.1j, 0.1 +2.j , 0.05+3.j ]]]),\n" \
+ "array([ 0.1, 1. , 10. , 100. ]),"
+ ref0 = ref_common + "\nname='sys0', outputs=1, inputs=1)"
472
+ ref1 = ref_common + " smooth=True," + \
473
+ "\nname='sys1', outputs=1, inputs=1)"
474
sysm = ct.frd(
475
np.matmul(array([[1], [2]]), sys0.fresp), sys0.omega, name='sysm')
476
0 commit comments