Skip to content

control.rlocus kwarg klist->gains #324

Closed

Description

@gdmcbain

"control.rlocus(ss[0,0], klist=pl.logspace(-2,1,1000));\n",

raises

TypeError                                 Traceback (most recent call last)
Cell In[29], [line 1](vscode-notebook-cell:?execution_count=29&line=1)
----> [1](vscode-notebook-cell:?execution_count=29&line=1) control.rlocus(ss[0,0], klist=pl.logspace(-2,1,1000));
      [2](vscode-notebook-cell:?execution_count=29&line=2) pl.grid()

File c:\Users\G.McBain\.venv\pymoca\Lib\site-packages\control\rlocus.py:188, in root_locus_plot(sysdata, kvect, grid, plot, **kwargs)
    [185](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/rlocus.py:185)     return responses.loci, responses.gains
    [187](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/rlocus.py:187) # Plot the root loci
--> [188](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/rlocus.py:188) out = responses.plot(grid=grid, **kwargs)
    [190](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/rlocus.py:190) # Legacy processing: return locations of poles and zeros as a tuple
    [191](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/rlocus.py:191) if plot is True:

File c:\Users\G.McBain\.venv\pymoca\Lib\site-packages\control\pzmap.py:127, in PoleZeroData.plot(self, *args, **kwargs)
    [123](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:123)     kwargs = kwargs.copy()
    [124](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:124)     kwargs['grid'] = config._get_param(
    [125](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:125)         'rlocus', 'grid', kwargs.get('grid', None), _rlocus_defaults)
--> [127](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:127) return pole_zero_plot(self, *args, **kwargs)

File c:\Users\G.McBain\.venv\pymoca\Lib\site-packages\control\pzmap.py:261, in pole_zero_plot(data, plot, grid, title, marker_color, marker_size, marker_width, legend_loc, xlim, ylim, interactive, ax, scaling, initial_gain, **kwargs)
    [259](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:259) marker_width = config._get_param('pzmap', 'marker_width', marker_width, 1.5)
    [260](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:260) xlim_user, ylim_user = xlim, ylim
--> [261](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:261) freqplot_rcParams = config._get_param(
    [262](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:262)     'freqplot', 'rcParams', kwargs, _freqplot_defaults,
    [263](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:263)     pop=True, last=True)
    [264](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:264) user_ax = ax
    [266](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/pzmap.py:266) # If argument was a singleton, turn it into a tuple

File c:\Users\G.McBain\.venv\pymoca\Lib\site-packages\control\config.py:204, in _get_param(module, param, argval, defval, pop, last)
    [202](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/config.py:202)     val = argval.pop(param, None) if pop else argval.get(param, None)
    [203](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/config.py:203)     if last and argval:
--> [204](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/config.py:204)         raise TypeError("unrecognized keywords: " + str(argval))
    [205](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/config.py:205)     argval = val
    [207](file:///C:/Users/G.McBain/.venv/pymoca/Lib/site-packages/control/config.py:207) # If we were passed a dict for the defval, get the param value from there

The upstream documentation is inconsistent; see python-control/python-control#998, suggesting that replacing klist with kvect should do the trick. It does.

control.rlocus(ss[0,0], kvect=pl.logspace(-2,1,1000));

image

Activity

  1. bnavigator commented on May 9, 2024

    @bnavigator

    As your own title says, this kvect will be deprecated in favor of gains for the next release.

  2. gdmcbain commented on May 10, 2024

    @gdmcbain
    ContributorAuthor

    Right, yes, sorry, (as noted in python-control/python-control#998) I thought control.rlocus was control.matlab.wrappers.rlocus rather than control.rlocus.rlocus = control.rlocus.root_locus_plot.

  3. added 2 commits that reference this issue on May 28, 2024
    6d56b28
    6b49781
  4. added a commit that references this issue on May 29, 2024
    0902b78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions