GeezerVison is showing github.com — Merge pull request #52 from cwrowley/conda-build · nrlearn/python-control@15fd5c1
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: .gitignore +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | dist/ | 4 | 4 | .ropeproject/ | 5 | 5 | MANIFEST | 6 | | -control/version.py | | 6 | +control/_version.py | | 7 | +__conda_*.txt | | 8 | +record.txt | 7 | 9 | build.log | 8 | 10 | *.egg-info/ | 9 | 11 | .coverage | |
Collapse file Copy file name to clipboardExpand all lines: .travis.yml +5-4Lines changed: 5 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | before_install: | 9 | 9 | - export DISPLAY=:99.0 | 10 | 10 | - sh -e /etc/init.d/xvfb start | 11 | | - - sudo apt-get update --fix-missing -qq | 12 | | - - sudo apt-get install gfortran liblapack-dev | 13 | 11 | # use miniconda to install numpy/scipy, to avoid lengthy build from source | 14 | 12 | - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then | 15 | 13 | wget http://repo.continuum.io/miniconda/Miniconda-3.4.2-Linux-x86_64.sh -O miniconda.sh; | @@ -21,13 +19,16 @@ before_install: | 21 | 19 | - hash -r | 22 | 20 | - conda config --set always_yes yes --set changeps1 no | 23 | 21 | - conda update -q conda | | 22 | + - conda install --yes python=$TRAVIS_PYTHON_VERSION conda-build pip coverage | | 23 | + - conda config --add channels http://conda.binstar.org/cwrowley | 24 | 24 | - conda info -a | 25 | 25 |
| 26 | 26 | # Install packages | 27 | 27 | install: | 28 | | - - conda install --yes python=$TRAVIS_PYTHON_VERSION coverage nose numpy scipy matplotlib pip | | 28 | + - conda build conda-recipe | | 29 | + - conda install control --use-local | | 30 | + - conda install slycot | 29 | 31 | - pip install coveralls | 30 | | - - pip install slycot | 31 | 32 |
| 32 | 33 | # command to run tests | 33 | 34 | script: | |
Collapse file Copy file name to clipboard +71-40Lines changed: 71 additions & 40 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -Python Control System Library | 2 | | -============================= | 3 | | - | 4 | 1 | .. image:: https://travis-ci.org/python-control/python-control.svg?branch=master | 5 | | - :target: https://travis-ci.org/python-control/python-control | | 2 | + :target: https://travis-ci.org/python-control/python-control | 6 | 3 | .. image:: https://coveralls.io/repos/python-control/python-control/badge.png | 7 | | - :target: https://coveralls.io/r/python-control/python-control | | 4 | + :target: https://coveralls.io/r/python-control/python-control | | 5 | + | | 6 | +Python Control Systems Library | | 7 | +============================== | | 8 | + | | 9 | +The Python Control Systems Library is a Python module that implements basic | | 10 | +operations for analysis and design of feedback control systems. | | 11 | + | | 12 | +Features | | 13 | +-------- | | 14 | + | | 15 | +- Linear input/output systems in state-space and frequency domain | | 16 | +- Block diagram algebra: serial, parallel, and feedback interconnections | | 17 | +- Time response: initial, step, impulse | | 18 | +- Frequency response: Bode and Nyquist plots | | 19 | +- Control analysis: stability, reachability, observability, stability margins | | 20 | +- Control design: eigenvalue placement, linear quadratic regulator | | 21 | +- Estimator design: linear quadratic estimator (Kalman filter) | | 22 | + | | 23 | + | | 24 | +Links | | 25 | +===== | | 26 | + | | 27 | +- Project home page: http://python-control.sourceforge.net | | 28 | +- Source code repository: https://github.com/python-control/python-control | | 29 | +- Documentation: http://python-control.readthedocs.org/ | | 30 | +- Issue tracker: https://github.com/python-control/python-control/issues | | 31 | +- Mailing list: http://sourceforge.net/p/python-control/mailman/ | | 32 | + | | 33 | + | | 34 | +Dependencies | | 35 | +============ | 8 | 36 |
| 9 | | -RMM, 23 May 09 | | 37 | +The package requires numpy, scipy, and matplotlib. In addition, some routines | | 38 | +use a module called slycot, that is a Python wrapper around some FORTRAN | | 39 | +routines. Many parts of python-control will work without slycot, but some | | 40 | +functionality is limited or absent, and installation of slycot is recommended | | 41 | +(see below). Note that in order to install slycot, you will need a FORTRAN | | 42 | +compiler on your machine. The Slycot wrapper can be found at: | 10 | 43 |
| 11 | | -This directory contains the source code for the Python Control Systems | 12 | | -Library (python-control). This package provides a library of standard | 13 | | -control system algorithms in the python programming environment. | | 44 | +https://github.com/jgoppert/Slycot | 14 | 45 |
| 15 | 46 | Installation | 16 | | ------------- | | 47 | +============ | | 48 | + | | 49 | +The package may be installed using pip or distutils. | | 50 | + | | 51 | +Pip | | 52 | +--- | | 53 | + | | 54 | +To install using pip:: | 17 | 55 |
| 18 | | -Using pip | 19 | | -~~~~~~~~~~~ | | 56 | + pip install slycot # optional | | 57 | + pip install control | 20 | 58 |
| 21 | | -Pip is a python packaging system. It can be installed on debian based | 22 | | -linux distros with the command:: | | 59 | +Distutils | | 60 | +--------- | 23 | 61 |
| 24 | | - sudo apt-get install pip | | 62 | +To install in your home directory, use:: | 25 | 63 |
| 26 | | -Pip can then be used to install python-control:: | | 64 | + python setup.py install --user | 27 | 65 |
| 28 | | - sudo pip install control | | 66 | +To install for all users (on Linux or Mac OS):: | 29 | 67 |
| | 68 | + python setup.py build | | 69 | + sudo python setup.py install | 30 | 70 |
| 31 | | -From Source | 32 | | -~~~~~~~~~~~ | 33 | 71 |
| 34 | | -Standard python package installation:: | | 72 | +Development | | 73 | +=========== | 35 | 74 |
| 36 | | - python setup.py install | | 75 | +Code | | 76 | +---- | 37 | 77 |
| 38 | | -To see if things are working, you can run the script | 39 | | -examples/secord-matlab.py (using ipython -pylab). It should generate a step | 40 | | -response, Bode plot and Nyquist plot for a simple second order linear | 41 | | -system. | | 78 | +You can check out the latest version of the source code with the command:: | | 79 | + | | 80 | + git clone https://github.com/python-control/python-control.git | 42 | 81 |
| 43 | 82 | Testing | 44 | 83 | ------- | 45 | 84 |
| 46 | | -You can also run a set of unit tests to make sure that everything is working | | 85 | +You can run a set of unit tests to make sure that everything is working | 47 | 86 | correctly. After installation, run:: | 48 | 87 |
| 49 | | - python runtests.py | 50 | | - | 51 | | -Slycot | 52 | | ------- | 53 | | - | 54 | | -Routines from the Slycot wrapper are used for providing the | 55 | | -functionality of several routines for state-space, transfer functions | 56 | | -and robust control. Many parts of python-control will still work | 57 | | -without slycot, but some functionality is limited or absent, and | 58 | | -installation of Slycot is definitely recommended. The Slycot wrapper | 59 | | -can be found at: | | 88 | + python setup.py test | 60 | 89 |
| 61 | | -https://github.com/jgoppert/Slycot | | 90 | +Contributing | | 91 | +------------ | 62 | 92 |
| 63 | | -and can be installed with:: | | 93 | +Your contributions are welcome! Simply fork the GitHub repository and send a | | 94 | +`pull request`_. | 64 | 95 |
| 65 | | - sudo pip install slycot | | 96 | +.. _pull request: https://github.com/python-control/python-control/pulls |
Collapse file Copy file name to clipboard +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +cd %RECIPE_DIR%\.. | | 2 | +%PYTHON% make_version.py | | 3 | +%PYTHON% setup.py install --single-version-externally-managed --record=record.txt |
Collapse file Copy file name to clipboard +32Lines changed: 32 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +package: | | 2 | + name: control | | 3 | + | | 4 | +build: | | 5 | + script: | | 6 | + - cd $RECIPE_DIR/.. | | 7 | + - $PYTHON make_version.py | | 8 | + - $PYTHON setup.py install --single-version-externally-managed --record=record.txt | | 9 | + | | 10 | +requirements: | | 11 | + build: | | 12 | + - python | | 13 | + - nose | | 14 | + | | 15 | + run: | | 16 | + - python | | 17 | + - numpy | | 18 | + - scipy | | 19 | + - matplotlib | | 20 | + | | 21 | +test: | | 22 | + imports: | | 23 | + - control | | 24 | + | | 25 | +about: | | 26 | + home: http://python-control.sourceforge.net | | 27 | + license: BSD License | | 28 | + summary: 'Python control systems library' | | 29 | + | | 30 | +# See | | 31 | +# http://docs.continuum.io/conda/build.html for | | 32 | +# more information about meta.yaml |
Collapse file Copy file name to clipboardExpand all lines: control/__init__.py +47-56Lines changed: 47 additions & 56 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 56 | 56 | lqe linear quadratic estimator | 57 | 57 | """ | 58 | 58 |
| 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: | | 59 | +# Import functions from within the control system library | | 60 | +# Should probably only import the exact functions we use... | | 61 | +from .bdalg import series, parallel, negate, feedback | | 62 | +from .delay import pade | | 63 | +from .dtime import sample_system | | 64 | +from .freqplot import bode_plot, nyquist_plot, gangof4_plot | | 65 | +from .freqplot import bode, nyquist, gangof4 | | 66 | +from .lti import issiso, timebase, timebaseEqual, isdtime, isctime | | 67 | +from .margins import stability_margins, phase_crossover_frequencies | | 68 | +from .mateqn import lyap, dlyap, care, dare | | 69 | +from .modelsimp import hsvd, modred, balred, era, markov | | 70 | +from .nichols import nichols_plot, nichols | | 71 | +from .phaseplot import phase_plot, box_grid | | 72 | +from .rlocus import root_locus | | 73 | +from .statefbk import place, lqr, ctrb, obsv, gram, acker | | 74 | +from .statesp import StateSpace | | 75 | +from .timeresp import forced_response, initial_response, step_response, \ | | 76 | + impulse_response | | 77 | +from .xferfcn import TransferFunction | | 78 | +from .ctrlutil import unwrap, issys | | 79 | +from .frdata import FRD | | 80 | +from .canonical import canonical_form, reachable_form | 69 | 81 |
| 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 | | 82 | +# Exceptions | | 83 | +from .exception import * | 92 | 84 |
| 93 | | - # Exceptions | 94 | | - from .exception import * | 95 | | - | 96 | | - # Version information | 97 | | - from control.version import full_version as __version__ | 98 | | - from control.version import git_revision as __git_revision__ | | 85 | +# Version information | | 86 | +try: | | 87 | + from ._version import __version__, __commit__ | | 88 | +except ImportError: | | 89 | + __version__ = "dev" | 99 | 90 |
| 100 | | - # Import some of the more common (and benign) MATLAB shortcuts | 101 | | - # By default, don't import conflicting commands here | 102 | | - #! TODO (RMM, 4 Nov 2012): remove MATLAB dependencies from __init__.py | 103 | | - #! | 104 | | - #! Eventually, all functionality should be in modules *other* than matlab. | 105 | | - #! This will allow inclusion of the matlab module to set up a different set | 106 | | - #! of defaults from the main package. At that point, the matlab module will | 107 | | - #! allow provide compatibility with MATLAB but no package functionality. | 108 | | - #! | 109 | | - from .matlab import ss, tf, ss2tf, tf2ss, drss | 110 | | - from .matlab import pole, zero, evalfr, freqresp, dcgain | 111 | | - from .matlab import nichols, rlocus, margin | 112 | | - # bode and nyquist come directly from freqplot.py | 113 | | - from .matlab import step, impulse, initial, lsim | 114 | | - from .matlab import ssdata, tfdata | | 91 | +# Import some of the more common (and benign) MATLAB shortcuts | | 92 | +# By default, don't import conflicting commands here | | 93 | +#! TODO (RMM, 4 Nov 2012): remove MATLAB dependencies from __init__.py | | 94 | +#! | | 95 | +#! Eventually, all functionality should be in modules *other* than matlab. | | 96 | +#! This will allow inclusion of the matlab module to set up a different set | | 97 | +#! of defaults from the main package. At that point, the matlab module will | | 98 | +#! allow provide compatibility with MATLAB but no package functionality. | | 99 | +#! | | 100 | +from .matlab import ss, tf, ss2tf, tf2ss, drss | | 101 | +from .matlab import pole, zero, evalfr, freqresp, dcgain | | 102 | +from .matlab import nichols, rlocus, margin | | 103 | + # bode and nyquist come directly from freqplot.py | | 104 | +from .matlab import step, impulse, initial, lsim | | 105 | +from .matlab import ssdata, tfdata | 115 | 106 |
| 116 | 107 | # The following is to use Numpy's testing framework | 117 | 108 | # Tests go under directory tests/, benchmarks under directory benchmarks/ | 118 | | - from numpy.testing import Tester | 119 | | - test = Tester().test | 120 | | - bench = Tester().bench | | 109 | +from numpy.testing import Tester | | 110 | +test = Tester().test | | 111 | +bench = Tester().bench |
Collapse file Copy file name to clipboardExpand all lines: control/tests/freqresp.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 40 | 40 | systf = tf(sys) | 41 | 41 | tfMIMO = tf(sysMIMO) | 42 | 42 |
| 43 | | -print systf.pole() | | 43 | +print(systf.pole()) | 44 | 44 | #print tfMIMO.pole() # - should throw not implemented exception | 45 | 45 | #print tfMIMO.zero() # - should throw not implemented exception | 46 | 46 |
| |
Collapse file Copy file name to clipboard +40Lines changed: 40 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +from subprocess import check_output | | 2 | +import os | | 3 | + | | 4 | +def main(): | | 5 | + cmd = 'git describe --always --long' | | 6 | + output = check_output(cmd.split()).decode('utf-8').strip().split('-') | | 7 | + if len(output) == 3: | | 8 | + version, build, commit = output | | 9 | + else: | | 10 | + raise Exception("Could not git describe, (got %s)" % output) | | 11 | + | | 12 | + print("Version: %s" % version) | | 13 | + print("Build: %s" % build) | | 14 | + print("Commit: %s\n" % commit) | | 15 | + | | 16 | + filename = "control/_version.py" | | 17 | + print("Writing %s" % filename) | | 18 | + with open(filename, 'w') as fd: | | 19 | + if build == '0': | | 20 | + fd.write('__version__ = "%s"\n' % (version)) | | 21 | + else: | | 22 | + fd.write('__version__ = "%s.post%s"\n' % (version, build)) | | 23 | + fd.write('__commit__ = "%s"\n' % (commit)) | | 24 | + | | 25 | + # Write files for conda version number | | 26 | + SRC_DIR = os.environ.get('SRC_DIR', '.') | | 27 | + conda_version_path = os.path.join(SRC_DIR, '__conda_version__.txt') | | 28 | + print("Writing %s" % conda_version_path) | | 29 | + with open(conda_version_path, 'w') as conda_version: | | 30 | + conda_version.write(version) | | 31 | + | | 32 | + conda_buildnum_path = os.path.join(SRC_DIR, '__conda_buildnum__.txt') | | 33 | + print("Writing %s" % conda_buildnum_path) | | 34 | + | | 35 | + with open(conda_buildnum_path, 'w') as conda_buildnum: | | 36 | + conda_buildnum.write(build) | | 37 | + | | 38 | + | | 39 | +if __name__ == '__main__': | | 40 | + main() |
|