Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
sort loci in PoleZeroData
  • Loading branch information
murrayrm committed Dec 2, 2024
commit 2e63769e84d9773228d7013764cfc6d40523edbe
12 changes: 9 additions & 3 deletions control/pzmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ class PoleZeroData:
System name.
sys : StateSpace or TransferFunction
System corresponding to the data.
sort_loci : bool, optional)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sort_loci : bool, optional)
sort_loci : bool, optional

Set to False to turn off sorting of loci into unique branches.

"""
def __init__(
self, poles, zeros, gains=None, loci=None, dt=None, sysname=None,
sys=None):
sys=None, sort_loci=True):
"""Create a pole/zero map object.

Parameters
Expand All @@ -102,10 +104,14 @@ def __init__(
System corresponding to the data.

"""
from .rlocus import _RLSortRoots
self.poles = poles
self.zeros = zeros
self.gains = gains
self.loci = loci
if loci is not None and sort_loci:
self.loci = _RLSortRoots(loci)
else:
self.loci = loci
self.dt = dt
self.sysname = sysname
self.sys = sys
Expand Down Expand Up @@ -187,7 +193,7 @@ def pole_zero_plot(
----------
data : List of PoleZeroData objects or LTI systems
List of pole/zero response data objects generated by pzmap_response()
or rootlocus_response() that are to be plotted. If a list of systems
or root_locus_map() that are to be plotted. If a list of systems
is given, the poles and zeros of those systems will be plotted.
grid : bool or str, optional
If `True` plot omega-damping grid, if `False` show imaginary axis
Expand Down
2 changes: 1 addition & 1 deletion control/rlocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def root_locus_map(sysdata, gains=None):
root_array = _RLSortRoots(root_array)

responses.append(PoleZeroData(
sys.poles(), sys.zeros(), kvect, root_array,
sys.poles(), sys.zeros(), kvect, root_array, sort_loci=False,
dt=sys.dt, sysname=sys.name, sys=sys))

if isinstance(sysdata, (list, tuple)):
Expand Down