Skip to content

Commit 69efbbe

Browse files
authored
Merge pull request #1070 from murrayrm/pzdata_sort-25Nov2024
sort loci in PoleZeroData
2 parents 57b5307 + d220068 commit 69efbbe

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

control/pzmap.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ class PoleZeroData:
7979
System name.
8080
sys : StateSpace or TransferFunction
8181
System corresponding to the data.
82+
sort_loci : bool, optional
83+
Set to False to turn off sorting of loci into unique branches.
8284
8385
"""
8486
def __init__(
8587
self, poles, zeros, gains=None, loci=None, dt=None, sysname=None,
86-
sys=None):
88+
sys=None, sort_loci=True):
8789
"""Create a pole/zero map object.
8890
8991
Parameters
@@ -102,10 +104,14 @@ def __init__(
102104
System corresponding to the data.
103105
104106
"""
107+
from .rlocus import _RLSortRoots
105108
self.poles = poles
106109
self.zeros = zeros
107110
self.gains = gains
108-
self.loci = loci
111+
if loci is not None and sort_loci:
112+
self.loci = _RLSortRoots(loci)
113+
else:
114+
self.loci = loci
109115
self.dt = dt
110116
self.sysname = sysname
111117
self.sys = sys
@@ -187,7 +193,7 @@ def pole_zero_plot(
187193
----------
188194
data : List of PoleZeroData objects or LTI systems
189195
List of pole/zero response data objects generated by pzmap_response()
190-
or rootlocus_response() that are to be plotted. If a list of systems
196+
or root_locus_map() that are to be plotted. If a list of systems
191197
is given, the poles and zeros of those systems will be plotted.
192198
grid : bool or str, optional
193199
If `True` plot omega-damping grid, if `False` show imaginary axis

control/rlocus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def root_locus_map(sysdata, gains=None):
8888
root_array = _RLSortRoots(root_array)
8989

9090
responses.append(PoleZeroData(
91-
sys.poles(), sys.zeros(), kvect, root_array,
91+
sys.poles(), sys.zeros(), kvect, root_array, sort_loci=False,
9292
dt=sys.dt, sysname=sys.name, sys=sys))
9393

9494
if isinstance(sysdata, (list, tuple)):

0 commit comments

Comments
 (0)