Skip to content

Commit aaa2aba

Browse files
committed
fix bug in root_locus_plot identified by @NikolaiVChr in issue #1016
1 parent feeb56a commit aaa2aba

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

control/pzmap.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,19 +496,17 @@ def _find_root_locus_gain(event, sys, ax):
496496
# Get the current axis limits to set various thresholds
497497
xlim, ylim = ax.get_xlim(), ax.get_ylim()
498498

499-
# Catch type error when event click is in the figure but not in an axis
499+
# Catch type error when event click is in the figure but not on curve
500500
try:
501501
s = complex(event.xdata, event.ydata)
502502
K = -1. / sys(s)
503503
K_xlim = -1. / sys(
504504
complex(event.xdata + 0.05 * abs(xlim[1] - xlim[0]), event.ydata))
505505
K_ylim = -1. / sys(
506506
complex(event.xdata, event.ydata + 0.05 * abs(ylim[1] - ylim[0])))
507-
508507
except TypeError:
509-
K = float('inf')
510-
K_xlim = float('inf')
511-
K_ylim = float('inf')
508+
K, s = float('inf'), None
509+
K_xlim = K_ylim = float('inf')
512510

513511
#
514512
# Compute tolerances for deciding if we clicked on the root locus
@@ -526,9 +524,8 @@ def _find_root_locus_gain(event, sys, ax):
526524
if abs(K.real) > 1e-8 and abs(K.imag / K.real) < gain_tolerance and \
527525
event.inaxes == ax.axes and K.real > 0.:
528526
return K.real, s
529-
530527
else:
531-
return None, s
528+
return None, None
532529

533530

534531
# Mark points corresponding to a given gain on root locus plot

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy