GeezerVison is showing github.com — Clean up imports · python-control/python-control@c2bf84d
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: control/__init__.py +11-23Lines changed: 11 additions & 23 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 45 | 45 | """ | 46 | 46 |
| 47 | 47 | # Import functions from within the control system library | 48 | | -# Should probably only import the exact functions we use... | 49 | | -from .bdalg import series, parallel, negate, feedback | 50 | | -from .delay import pade | | 48 | +# Note: the functions we use are specified as __all__ variables in the modules | | 49 | +from .bdalg import * | | 50 | +from .delay import * | 51 | 51 | from .dtime import * | 52 | | -from .freqplot import bode_plot, nyquist_plot, gangof4_plot | 53 | | -from .freqplot import bode, nyquist, gangof4 | | 52 | +from .freqplot import * | 54 | 53 | from .lti import * | 55 | 54 | from .margins import * | 56 | | -from .mateqn import lyap, dlyap, care, dare | 57 | | -from .modelsimp import hsvd, modred, balred, era, markov, minreal | | 55 | +from .mateqn import * | | 56 | +from .modelsimp import * | 58 | 57 | from .nichols import * | 59 | | -from .phaseplot import phase_plot, box_grid | 60 | | -from .pzmap import pzmap | | 58 | +from .phaseplot import * | | 59 | +from .pzmap import * | 61 | 60 | from .rlocus import * | 62 | | -from .statefbk import place, lqr, ctrb, obsv, gram, acker | | 61 | +from .statefbk import * | 63 | 62 | from .statesp import * | 64 | | -from .timeresp import forced_response, initial_response, step_response, \ | 65 | | - impulse_response | | 63 | +from .timeresp import * | 66 | 64 | from .xferfcn import * | 67 | 65 | from .ctrlutil import * | 68 | 66 | from .frdata import * | 69 | | -from .canonical import canonical_form, reachable_form | | 67 | +from .canonical import * | 70 | 68 |
| 71 | 69 | # Exceptions | 72 | 70 | from .exception import * | | 77 | 75 | except ImportError: | 78 | 76 | __version__ = "dev" | 79 | 77 |
| 80 | | -# Import some of the more common (and benign) MATLAB shortcuts | 81 | | -# By default, don't import conflicting commands here | 82 | | -#! TODO (RMM, 4 Nov 2012): remove MATLAB dependencies from __init__.py | 83 | | -#! | 84 | | -#! Eventually, all functionality should be in modules *other* than matlab. | 85 | | -#! This will allow inclusion of the matlab module to set up a different set | 86 | | -#! of defaults from the main package. At that point, the matlab module will | 87 | | -#! allow provide compatibility with MATLAB but no package functionality. | 88 | | -#! | 89 | | - | 90 | 78 | # The following is to use Numpy's testing framework | 91 | 79 | # Tests go under directory tests/, benchmarks under directory benchmarks/ | 92 | 80 | from numpy.testing import Tester | |
Collapse file Copy file name to clipboardExpand all lines: control/bdalg.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 58 | 58 | from . import statesp as ss | 59 | 59 | from . import frdata as frd | 60 | 60 |
| | 61 | +__all__ = ['series', 'parallel', 'negate', 'feedback', 'append', 'connect'] | | 62 | + | 61 | 63 | def series(sys1, sys2): | 62 | 64 | """Return the series connection sys2 * sys1 for --> sys1 --> sys2 -->. | 63 | 65 |
| |
Collapse file Copy file name to clipboardExpand all lines: control/canonical.py +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | from numpy import zeros, shape, poly | 10 | 10 | from numpy.linalg import inv | 11 | 11 |
| | 12 | +__all__ = ['canonical_form', 'reachable_form'] | 12 | 13 |
| 13 | 14 | def canonical_form(xsys, form='reachable'): | 14 | 15 | """Convert a system into canonical form | |
Collapse file Copy file name to clipboardExpand all lines: control/delay.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 44 | 44 | # Python 3 compatability (needs to go here) | 45 | 45 | from __future__ import print_function | 46 | 46 |
| | 47 | +__all__ = ['pade'] | | 48 | + | 47 | 49 | def pade(T, n=1): | 48 | 50 | """ | 49 | 51 | Create a linear system that approximates a delay. | |
Collapse file Copy file name to clipboardExpand all lines: control/freqplot.py +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 49 | 49 | from .bdalg import feedback | 50 | 50 | from .lti import isdtime, timebaseEqual | 51 | 51 |
| | 52 | +__all__ = ['bode_plot', 'nyquist_plot', 'gangof4_plot', | | 53 | + 'bode', 'nyquist', 'gangof4'] | | 54 | + | 52 | 55 | # | 53 | 56 | # Main plotting functions | 54 | 57 | # | |
Collapse file Copy file name to clipboardExpand all lines: control/mateqn.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 46 | 46 | from scipy.linalg import eigvals, solve_discrete_are | 47 | 47 | from .exception import ControlSlycot, ControlArgument | 48 | 48 |
| | 49 | +__all__ = ['lyap', 'dlyap', 'dare', 'care'] | | 50 | + | 49 | 51 | #### Lyapunov equation solvers lyap and dlyap | 50 | 52 |
| 51 | 53 | def lyap(A,Q,C=None,E=None): | |
Collapse file Copy file name to clipboardExpand all lines: control/matlab/__init__.py +8-13Lines changed: 8 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 50 | 50 |
| 51 | 51 | """ | 52 | 52 |
| 53 | | -# Libraries that we make use of | 54 | | -import scipy as sp # SciPy library (used all over) | 55 | | -import numpy as np # NumPy library | 56 | | -import re # regular expressions | 57 | | - | 58 | 53 | # Import MATLAB-like functions that are defined in other packages | 59 | 54 | from scipy.signal import zpk2ss, ss2zpk, tf2zpk, zpk2tf | 60 | 55 | from numpy import linspace, logspace | | 76 | 71 | from ..xferfcn import * | 77 | 72 | from ..lti import * | 78 | 73 | from ..frdata import * | 79 | | -from ..dtime import sample_system | | 74 | +from ..dtime import * | 80 | 75 | from ..exception import ControlArgument | 81 | 76 |
| 82 | 77 | # Import MATLAB-like functions that can be used as-is | 83 | 78 | from ..ctrlutil import * | 84 | 79 | from ..freqplot import nyquist, gangof4 | 85 | | -from ..nichols import nichols, nichols_grid | 86 | | -from ..bdalg import series, parallel, negate, feedback, append, connect | 87 | | -from ..pzmap import pzmap | 88 | | -from ..statefbk import ctrb, obsv, gram, place, lqr | 89 | | -from ..delay import pade | 90 | | -from ..modelsimp import hsvd, balred, modred, minreal | 91 | | -from ..mateqn import lyap, dlyap, dare, care | | 80 | +from ..nichols import nichols | | 81 | +from ..bdalg import * | | 82 | +from ..pzmap import * | | 83 | +from ..statefbk import * | | 84 | +from ..delay import * | | 85 | +from ..modelsimp import * | | 86 | +from ..mateqn import * | 92 | 87 | from ..margins import margin | 93 | 88 | from ..rlocus import rlocus | 94 | 89 | from ..dtime import c2d | |
Collapse file Copy file name to clipboardExpand all lines: control/modelsimp.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 50 | 50 | from .statesp import StateSpace | 51 | 51 | from .statefbk import gram | 52 | 52 |
| | 53 | +__all__ = ['hsvd', 'balred', 'modred', 'era', 'markov', 'minreal'] | | 54 | + | 53 | 55 | # Hankel Singular Value Decomposition | 54 | 56 | # The following returns the Hankel singular values, which are singular values | 55 | 57 | #of the matrix formed by multiplying the controllability and observability | |
Collapse file Copy file name to clipboardExpand all lines: control/phaseplot.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 43 | 43 | from scipy.integrate import odeint | 44 | 44 | from .exception import ControlNotImplemented | 45 | 45 |
| | 46 | +__all__ = ['phase_plot', 'box_grid'] | | 47 | + | 46 | 48 | def phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None, | 47 | 49 | lingrid=None, lintime=None, logtime=None, timepts=None, | 48 | 50 | parms=(), verbose=True): | |
Collapse file Copy file name to clipboardExpand all lines: control/pzmap.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 40 | 40 | # | 41 | 41 | # $Id:pzmap.py 819 2009-05-29 21:28:07Z murray $ | 42 | 42 |
| 43 | | -import matplotlib.pyplot as plt | 44 | | -#import scipy as sp | 45 | | -#import numpy as np | 46 | 43 | from numpy import real, imag | 47 | 44 | from .lti import LTI | 48 | 45 |
| | 46 | +__all__ = ['pzmap'] | | 47 | + | 49 | 48 | # TODO: Implement more elegant cross-style axes. See: | 50 | 49 | # http://matplotlib.sourceforge.net/examples/axes_grid/demo_axisline_style.html | 51 | 50 | # http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html | @@ -75,6 +74,7 @@ def pzmap(sys, Plot=True, title='Pole Zero Map'): | 75 | 74 | zeros = sys.zero() | 76 | 75 |
| 77 | 76 | if (Plot): | | 77 | + import matplotlib.pyplot as plt | 78 | 78 | # Plot the locations of the poles and zeros | 79 | 79 | if len(poles) > 0: | 80 | 80 | plt.scatter(real(poles), imag(poles), s=50, marker='x') | |
|