|
14 | 14 | # |
15 | 15 | # 1. Redistributions of source code must retain the above copyright |
16 | 16 | # notice, this list of conditions and the following disclaimer. |
17 | | -# |
| 17 | +# |
18 | 18 | # 2. Redistributions in binary form must reproduce the above copyright |
19 | 19 | # notice, this list of conditions and the following disclaimer in the |
20 | 20 | # documentation and/or other materials provided with the distribution. |
21 | | -# |
| 21 | +# |
22 | 22 | # 3. Neither the name of the California Institute of Technology nor |
23 | 23 | # the names of its contributors may be used to endorse or promote |
24 | 24 | # products derived from this software without specific prior |
25 | 25 | # written permission. |
26 | | -# |
| 26 | +# |
27 | 27 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
28 | 28 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
29 | 29 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
36 | 36 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
37 | 37 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
38 | 38 | # SUCH DAMAGE. |
39 | | -# |
| 39 | +# |
40 | 40 | # $Id$ |
41 | 41 |
|
42 | 42 | """Control System Library |
|
56 | 56 | lqe linear quadratic estimator |
57 | 57 | """ |
58 | 58 |
|
59 | | -# Import functions from within the control system library |
60 | | -#! Should probably only import the exact functions we use... |
61 | | -from control.bdalg import series, parallel, negate, feedback |
62 | | -from control.delay import pade |
63 | | -from control.dtime import sample_system |
64 | | -from control.freqplot import bode_plot, nyquist_plot, gangof4_plot |
65 | | -from control.freqplot import bode, nyquist, gangof4 |
66 | | -from control.lti import issiso, timebase, timebaseEqual, isdtime, isctime |
67 | | -from control.margins import stability_margins, phase_crossover_frequencies |
68 | | -from control.mateqn import lyap, dlyap, care, dare |
69 | | -from control.modelsimp import hsvd, modred, balred, era, markov |
70 | | -from control.nichols import nichols_plot, nichols |
71 | | -from control.phaseplot import phase_plot, box_grid |
72 | | -from control.rlocus import root_locus |
73 | | -from control.statefbk import place, lqr, ctrb, obsv, gram, acker |
74 | | -from control.statesp import StateSpace |
75 | | -from control.timeresp import forced_response, initial_response, step_response, \ |
76 | | - impulse_response |
77 | | -from control.xferfcn import TransferFunction |
78 | | -from control.ctrlutil import unwrap, issys |
79 | | -from control.frdata import FRD |
80 | | -from control.canonical import canonical_form, reachable_form |
| 59 | +try: |
| 60 | + __CONTROL_SETUP__ |
| 61 | +except NameError: |
| 62 | + __CONTROL_SETUP__ = False |
| 63 | + |
| 64 | +if __CONTROL_SETUP__: |
| 65 | + import sys as _sys |
| 66 | + _sys.stderr.write('Running from control source directory.\n') |
| 67 | + del _sys |
| 68 | +else: |
| 69 | + |
| 70 | + # Import functions from within the control system library |
| 71 | + # Should probably only import the exact functions we use... |
| 72 | + from .bdalg import series, parallel, negate, feedback |
| 73 | + from .delay import pade |
| 74 | + from .dtime import sample_system |
| 75 | + from .freqplot import bode_plot, nyquist_plot, gangof4_plot |
| 76 | + from .freqplot import bode, nyquist, gangof4 |
| 77 | + from .lti import issiso, timebase, timebaseEqual, isdtime, isctime |
| 78 | + from .margins import stability_margins, phase_crossover_frequencies |
| 79 | + from .mateqn import lyap, dlyap, care, dare |
| 80 | + from .modelsimp import hsvd, modred, balred, era, markov |
| 81 | + from .nichols import nichols_plot, nichols |
| 82 | + from .phaseplot import phase_plot, box_grid |
| 83 | + from .rlocus import root_locus |
| 84 | + from .statefbk import place, lqr, ctrb, obsv, gram, acker |
| 85 | + from .statesp import StateSpace |
| 86 | + from .timeresp import forced_response, initial_response, step_response, \ |
| 87 | + impulse_response |
| 88 | + from .xferfcn import TransferFunction |
| 89 | + from .ctrlutil import unwrap, issys |
| 90 | + from .frdata import FRD |
| 91 | + from .canonical import canonical_form, reachable_form |
81 | 92 |
|
82 | | -# Exceptions |
83 | | -from control.exception import * |
| 93 | + # Exceptions |
| 94 | + from .exception import * |
84 | 95 |
|
85 | | -# Import some of the more common (and benign) MATLAB shortcuts |
86 | | -# By default, don't import conflicting commands here |
87 | | -#! TODO (RMM, 4 Nov 2012): remove MATLAB dependencies from __init__.py |
88 | | -#! |
89 | | -#! Eventually, all functionality should be in modules *other* than matlab. |
90 | | -#! This will allow inclusion of the matlab module to set up a different set |
91 | | -#! of defaults from the main package. At that point, the matlab module will |
92 | | -#! allow provide compatibility with MATLAB but no package functionality. |
93 | | -#! |
94 | | -from control.matlab import ss, tf, ss2tf, tf2ss, drss |
95 | | -from control.matlab import pole, zero, evalfr, freqresp, dcgain |
96 | | -from control.matlab import nichols, rlocus, margin |
97 | | - # bode and nyquist come directly from freqplot.py |
98 | | -from control.matlab import step, impulse, initial, lsim |
99 | | -from control.matlab import ssdata, tfdata |
| 96 | + # Import some of the more common (and benign) MATLAB shortcuts |
| 97 | + # By default, don't import conflicting commands here |
| 98 | + #! TODO (RMM, 4 Nov 2012): remove MATLAB dependencies from __init__.py |
| 99 | + #! |
| 100 | + #! Eventually, all functionality should be in modules *other* than matlab. |
| 101 | + #! This will allow inclusion of the matlab module to set up a different set |
| 102 | + #! of defaults from the main package. At that point, the matlab module will |
| 103 | + #! allow provide compatibility with MATLAB but no package functionality. |
| 104 | + #! |
| 105 | + from .matlab import ss, tf, ss2tf, tf2ss, drss |
| 106 | + from .matlab import pole, zero, evalfr, freqresp, dcgain |
| 107 | + from .matlab import nichols, rlocus, margin |
| 108 | + # bode and nyquist come directly from freqplot.py |
| 109 | + from .matlab import step, impulse, initial, lsim |
| 110 | + from .matlab import ssdata, tfdata |
100 | 111 |
|
101 | 112 | # The following is to use Numpy's testing framework |
102 | 113 | # Tests go under directory tests/, benchmarks under directory benchmarks/ |
103 | | -from numpy.testing import Tester |
104 | | -test = Tester().test |
105 | | -bench = Tester().bench |
| 114 | + from numpy.testing import Tester |
| 115 | + test = Tester().test |
| 116 | + bench = Tester().bench |
0 commit comments