Open JanB1 opened 4 weeks ago
Hello @JanB1 , thanks for reporting this.
I made a conscious decision to leave control
out of the basic installation, which only installs the minimal libraries needed to get plotting of symbolic expressions:
However, you can choose to install all dependencies with pip install sympy_plot_backends[all]
, which includes control
:
The main reason behind this choice is that I want to provide lightweight minimum installation option.
Okay, it was just a little bit unexpected, especially as the documentation for the control plots doesn't mention it, but only when you got further to the control module documentation does it mention it in the text.
But I didn't click that far as on the control plots page it said "Refer to Control for a general explanation about the underlying working principles, or if you are interested in a finer customization of what is shown on the plot." and frankly I wasn't really interested in the general explanation about the underlying working principles, it just referred to the doc of the specific plot directly.
Might have been an oversight on my end, or maybe you'd want to put a disclaimer directly on the control plots page that you need an additional package that isn't included?
I just got an exception when I tried to do a nyquist plot.
`RuntimeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 spb.plot_nyquist(tfG)
File c:\Python312\Lib\site-packages\spb\plot_functions\control.py:1197, in plot_nyquist(*systems, kwargs) 1195 series = [] 1196 for s, l in systems: -> 1197 series.extend(nyquist(s, label=l, kwargs.copy())) 1198 kwargs.setdefault("xlabel", "Real axis") 1199 kwargs.setdefault("ylabel", "Imaginary axis")
File c:\Python312\Lib\site-packages\spb\graphics\control.py:1909, in nyquist(system, omega_limits, input, output, label, rendering_kw, m_circles, kwargs) 1744 def nyquist(system, omega_limits=None, input=None, output=None, 1745 label=None, rendering_kw=None, m_circles=False, kwargs): 1746 """Plots a Nyquist plot for the system over a (optional) frequency range. 1747 The curve is computed by evaluating the Nyquist segment along the positive 1748 imaginary axis, with a mirror image generated to reflect the negative (...) 1907 1908 """ -> 1909 control = _check_if_control_is_installed(force_stop=True) 1910 systems = _unpack_mimo_systems( 1911 system, 1912 "" if label is None else label, ... 63 "the evaluation." 64 ) 65 return use_control
RuntimeError: The
control
module is not installed. Can't proceed with the evaluation.`Steps to reproduce:
If instead you install the Python Control Systems Library (https://python-control.readthedocs.io/en/0.10.1/intro.html#installation) and then try to plot again, the plot gets produced as expected.
Note: I would do a pull request myself, but I don't know exactly which version of control you at least need.