fix rlocus timeout due to inefficient _default_wn calculation #527
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an obscure bug that got pointed out to me a year ago in e-mail from a colleague in Costa Rica:
Turns out that the problem was that he had a very unusual pole/zero pattern in which the algorithm for computing the default natural frequencies to use in plotting the grid was introduced in PR #138. The code essentially used the x-axis major ticks as the starting point for the natural frequencies and then added additional ticks to "complete" the frequencies on the y axis. The problem was that if the x-axis had tick marks that were orders of magnitude different that the y-axis, this could generate a lot of additional natural frequencies (which were subsequently removed a later point in the code).
I didn't want to spend a lot of time on this fix, so I basically put in a check to see when you might end up generating an excessive number of ticks based on this heuristic and switched things so that if that happens, you use the y-axis ticks as the starting point. There's a unit test to make sure it is working right (that also covers the new code).