You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(19) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(11) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
|
Feb
(113) |
Mar
(12) |
Apr
(27) |
May
(2) |
Jun
(16) |
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(3) |
Nov
(9) |
Dec
(2) |
2012 |
Jan
(5) |
Feb
(11) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(7) |
Oct
(18) |
Nov
(18) |
Dec
|
2013 |
Jan
(4) |
Feb
(1) |
Mar
(3) |
Apr
(1) |
May
|
Jun
(33) |
Jul
(2) |
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
|
Mar
(8) |
Apr
|
May
(3) |
Jun
(3) |
Jul
(9) |
Aug
(5) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
2020 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
From: Richard M. <mu...@cd...> - 2013-01-25 17:54:08
|
Oops. Ignore that. Sent to the wrong SourceForge list. -richard On 25 Jan 2013, at 9:53 , Richard Murray <mu...@cd...> wrote: > A reminder that we will meet from 11a - 1 pm to talk about TuliP. > > Ufuk (and others): let us know if you plan to call in. We can set up a conference line (better quality than skype-to-skype). > > -richard > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |
From: Richard M. <mu...@cd...> - 2013-01-25 17:53:21
|
A reminder that we will meet from 11a - 1 pm to talk about TuliP. Ufuk (and others): let us know if you plan to call in. We can set up a conference line (better quality than skype-to-skype). -richard |
From: <mur...@us...> - 2012-11-19 05:28:07
|
Revision: 247 http://sourceforge.net/p/python-control/code/247 Author: murrayrm Date: 2012-11-19 05:28:05 +0000 (Mon, 19 Nov 2012) Log Message: ----------- Set up 'config' module that allows user-defined defaults * Will eventually allow MATLAB defaults if user imports control.matlab first New module 'canonical' for implementing canconical forms. Needed for trajectory generation module (coming soon). Modified Paths: -------------- trunk/ChangeLog trunk/src/__init__.py trunk/src/freqplot.py trunk/src/matlab.py trunk/src/statesp.py trunk/src/xferfcn.py Added Paths: ----------- trunk/src/canonical.py trunk/src/config.py Property Changed: ---------------- trunk/ trunk/src/ trunk/tests/ Property changes on: trunk ___________________________________________________________________ Modified: svn:ignore - MANIFEST* build dist + MANIFEST* build dist __pycache__ Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2012-11-11 22:00:29 UTC (rev 246) +++ trunk/ChangeLog 2012-11-19 05:28:05 UTC (rev 247) @@ -1,3 +1,31 @@ +2012-11-10 Richard Murray <murray@altura.local> + + * src/canonical.py: new module implementing conversions to selected + canonical forms: canonical_form(), reachable_form() implemented + + * src/lti.py (issiso): new function to quickly check if a system is + single input, single output or not + +2012-11-04 Richard Murray <murray@altura.local> + + * src/__init__.py: added action item to separate out matlab module + functionality (eventually) + + * src/matlab.py: added code for setting up MATLAB defaults if matlab + submodule is imported instead of main (control) module. See + comments in __init.py__ for what needs to be done to implement. + + * src/freqplot.py (bode_plot): moved default values of plotting + options to config module to allow easier use override + + * src/config.py: new module to help set package defaults + + * src/xferfcn.py (_convertToTransferFunction): removed extraneous + print statements if slycot is not installed + + * src/statesp.py (StateSpace.__str__): fixed error in printing + timebase when dt is None (python 3) + ---- control-0.6c released ----- 2012-11-03 Richard Murray <murray@altura.local> Property changes on: trunk/src ___________________________________________________________________ Modified: svn:ignore - *.pyc .*.swp + *.pyc .*.swp __pycache__ Modified: trunk/src/__init__.py =================================================================== --- trunk/src/__init__.py 2012-11-11 22:00:29 UTC (rev 246) +++ trunk/src/__init__.py 2012-11-19 05:28:05 UTC (rev 247) @@ -63,7 +63,7 @@ from control.dtime import sample_system from control.freqplot import bode_plot, nyquist_plot, gangof4_plot from control.freqplot import bode, nyquist, gangof4 -from control.lti import timebase, timebaseEqual, isdtime, isctime +from control.lti import issiso, timebase, timebaseEqual, isdtime, isctime from control.margins import stability_margins, phase_crossover_frequencies from control.mateqn import lyap, dlyap, care, dare from control.modelsimp import hsvd, modred, balred, era, markov @@ -77,9 +77,20 @@ from control.xferfcn import TransferFunction from control.ctrlutil import unwrap, issys from control.frdata import FRD +from control.canonical import canonical_form, reachable_form +# Exceptions +from exception import * + # Import some of the more common (and benign) MATLAB shortcuts # By default, don't import conflicting commands here +#! TODO (RMM, 4 Nov 2012): remove MATLAB dependencies from __init__.py +#! +#! Eventually, all functionality should be in modules *other* than matlab. +#! This will allow inclusion of the matlab module to set up a different set +#! of defaults from the main package. At that point, the matlab module will +#! allow provide compatibility with MATLAB but no package functionality. +#! from control.matlab import ss, tf, ss2tf, tf2ss, drss from control.matlab import pole, zero, evalfr, freqresp, dcgain from control.matlab import nichols, rlocus, margin Added: trunk/src/canonical.py =================================================================== --- trunk/src/canonical.py (rev 0) +++ trunk/src/canonical.py 2012-11-19 05:28:05 UTC (rev 247) @@ -0,0 +1,64 @@ +# canonical.py - functions for converting systems to canonical forms +# RMM, 10 Nov 2012 + +import control +from numpy import zeros, shape, poly +from numpy.linalg import inv + +def canonical_form(sys, form): + """Convert a system into canonical form + + Parameters + ---------- + xsys : StateSpace object + System to be transformed, with state 'x' + form : String + Canonical form for transformation. Chosen from: + * 'reachable' - reachable canonical form + * 'observable' - observable canonical form + * 'modal' - modal canonical form [not implemented] + + Outputs + ------- + zsys : StateSpace object + System in desired canonical form, with state 'z' + T : matrix + Coordinate transformation matrix, z = T*x + """ + + # Call the appropriate tranformation function + if form == 'reachable': + return reachable_form(xsys) + else: + raise control.ControlNotImplemented( + "Canonical form '%s' not yet implemented" % form) + +# Reachable canonical form +def reachable_form(xsys): + # Check to make sure we have a SISO system + if not control.issiso(xsys): + raise control.ControlNotImplemented( + "Canonical forms for MIMO systems not yet supported") + + # Create a new system, starting with a copy of the old one + zsys = control.StateSpace(xsys) + + # Generate the system matrices for the desired canonical form + zsys.B = zeros(shape(xsys.B)); zsys.B[0, 0] = 1; + zsys.A = zeros(shape(xsys.A)) + Apoly = poly(xsys.A) # characteristic polynomial + for i in range(0, xsys.states): + zsys.A[0, i] = -Apoly[i+1] / Apoly[0] + if (i+1 < xsys.states): zsys.A[i+1, i] = 1 + + # Compute the reachability matrices for each set of states + Wrx = control.ctrb(xsys.A, xsys.B) + Wrz = control.ctrb(zsys.A, zsys.B) + + # Transformation from one form to another + Tzx = Wrz * inv(Wrx) + + # Finally, compute the output matrix + zsys.C = xsys.C * inv(Tzx) + + return zsys, Tzx Added: trunk/src/config.py =================================================================== --- trunk/src/config.py (rev 0) +++ trunk/src/config.py 2012-11-19 05:28:05 UTC (rev 247) @@ -0,0 +1,27 @@ +# config.py - package defaults +# RMM, 4 Nov 2012 +# +# This file contains default values and utility functions for setting +# variables that control the behavior of the control package. +# Eventually it will be possible to read and write configuration +# files. For now, you can just choose between MATLAB and FBS default +# values. + +# Bode plot defaults +bode_dB = False # Bode plot magnitude units +bode_deg = True # Bode Plot phase units +bode_Hz = False # Bode plot frequency units + +# Set defaults to match MATLAB +def use_matlab_defaults(): + # Bode plot defaults + global bode_dB; bode_dB = True + global bode_deg; bode_deg = True + global bode_Hz; bode_Hz = True + +# Set defaults to match FBS (Astrom and Murray) +def use_fbs_defaults(): + # Bode plot defaults + global bode_dB; bode_dB = False + global bode_deg; bode_deg = True + global bode_Hz; bode_Hz = True Modified: trunk/src/freqplot.py =================================================================== --- trunk/src/freqplot.py 2012-11-11 22:00:29 UTC (rev 246) +++ trunk/src/freqplot.py 2012-11-19 05:28:05 UTC (rev 247) @@ -57,7 +57,7 @@ # # Bode plot -def bode_plot(syslist, omega=None, dB=False, Hz=False, deg=True, +def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None, Plot=True, *args, **kwargs): """Bode plot for a system @@ -105,6 +105,12 @@ >>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.") >>> mag, phase, omega = bode(sys) """ + # Set default values for options + import control.config + if (dB is None): dB = control.config.bode_dB + if (deg is None): deg = control.config.bode_deg + if (Hz is None): Hz = control.config.bode_Hz + # If argument was a singleton, turn it into a list if (not getattr(syslist, '__iter__', False)): syslist = (syslist,) Modified: trunk/src/matlab.py =================================================================== --- trunk/src/matlab.py 2012-11-11 22:00:29 UTC (rev 246) +++ trunk/src/matlab.py 2012-11-19 05:28:05 UTC (rev 247) @@ -69,6 +69,18 @@ from scipy.signal import zpk2ss, ss2zpk, tf2zpk, zpk2tf from numpy import linspace, logspace +# If configuration is not yet set, import and use MATLAB defaults +#! NOTE (RMM, 4 Nov 2012): MATLAB default initialization commented out for now +#! +#! This code will eventually be used so that import control.matlab will +#! automatically use MATLAB defaults, while import control will use package +#! defaults. In order for that to work, we need to make sure that +#! __init__.py does not include anything in the MATLAB module. +# import sys +# if not ('control.config' in sys.modules): +# import control.config +# control.config.use_matlab() + # Control system library import control.ctrlutil as ctrlutil import control.freqplot as freqplot Modified: trunk/src/statesp.py =================================================================== --- trunk/src/statesp.py 2012-11-11 22:00:29 UTC (rev 246) +++ trunk/src/statesp.py 2012-11-19 05:28:05 UTC (rev 247) @@ -138,6 +138,7 @@ # Here we're going to convert inputs to matrices, if the user gave a # non-matrix type. + #! TODO: [A, B, C, D] = map(matrix, [A, B, C, D])? matrices = [A, B, C, D] for i in range(len(matrices)): # Convert to matrix first, if necessary. @@ -215,9 +216,10 @@ str += "B = " + self.B.__str__() + "\n\n" str += "C = " + self.C.__str__() + "\n\n" str += "D = " + self.D.__str__() + "\n" + #! TODO: replace with standard calls to lti functions if (type(self.dt) == bool and self.dt == True): str += "\ndt unspecified\n" - elif (self.dt > 0): + elif (not (self.dt is None) and type(self.dt) != bool and self.dt > 0): str += "\ndt = " + self.dt.__str__() + "\n" return str Modified: trunk/src/xferfcn.py =================================================================== --- trunk/src/xferfcn.py 2012-11-11 22:00:29 UTC (rev 246) +++ trunk/src/xferfcn.py 2012-11-19 05:28:05 UTC (rev 247) @@ -266,6 +266,7 @@ mimo = self.inputs > 1 or self.outputs > 1 if (var == None): + #! TODO: replace with standard calls to lti functions var = 's' if self.dt == None or self.dt == 0 else 'z' outstr = "" @@ -294,6 +295,7 @@ # See if this is a discrete time system with specific sampling time if (not (self.dt is None) and type(self.dt) != bool and self.dt > 0): + #! TODO: replace with standard calls to lti functions outstr += "\ndt = " + self.dt.__str__() + "\n" return outstr @@ -945,8 +947,8 @@ lti_sys = lti(sys.A, sys.B, sys.C, sys.D) num = squeeze(lti_sys.num) den = squeeze(lti_sys.den) - print(num) - print(den) + # print(num) + # print(den) return TransferFunction(num, den, sys.dt) Property changes on: trunk/tests ___________________________________________________________________ Added: svn:ignore + __pycache__ |
From: Richard M. <mu...@cd...> - 2012-11-11 02:54:31
|
Sorry for the cryptic commit message below. I've reconfigured the python-control 'post-commit' script so that it only sends e-mail to the list when there is a commit to trunk. This lets people do work in branches without having to send out lots of e-mail to the list every time they commit some of their branch code. The relevant (trunk) change below is that there is now a function issiso() to see if an LTI system is SISO. This will show up when I commit some additional changes to trunk, probably in a week or two. In the meantime, working on some trajectory generation code that I need for FBS... -richard On 10 Nov 2012, at 18:49 , mur...@us... wrote: > Revision: 241 > http://sourceforge.net/p/python-control/code/241 > Author: murrayrm > Date: 2012-11-11 02:49:33 +0000 (Sun, 11 Nov 2012) > Log Message: > ----------- > Fixed bugs in various calculations and orders of indices. > > Modified Paths: > -------------- > branches/rmm-trajgen/examples/doubleint.py > branches/rmm-trajgen/trajgen/flatsys.py > branches/rmm-trajgen/trajgen/poly.py > trunk/src/lti.py > > Modified: branches/rmm-trajgen/examples/doubleint.py > =================================================================== > --- branches/rmm-trajgen/examples/doubleint.py 2012-11-11 01:28:03 UTC (rev 240) > +++ branches/rmm-trajgen/examples/doubleint.py 2012-11-11 02:49:33 UTC (rev 241) > @@ -17,5 +17,6 @@ > > # Find a trajectory > xd, ud = tg.linear_point_to_point(sys1, x0, xf, 1) > +print(xd) > > # Plot the trajectory > > Modified: branches/rmm-trajgen/trajgen/flatsys.py > =================================================================== > --- branches/rmm-trajgen/trajgen/flatsys.py 2012-11-11 01:28:03 UTC (rev 240) > +++ branches/rmm-trajgen/trajgen/flatsys.py 2012-11-11 02:49:33 UTC (rev 241) > @@ -80,7 +80,7 @@ > # least squares solution for now. > # > #! TODO: need to allow cost and constraints... > - alpha = np.linalg.pinv(M) * np.vstack((zflag_T0, zflag_Tf)) > + alpha = np.dot(np.linalg.pinv(M), np.vstack((zflag_T0, zflag_Tf))) > > # > # Transform the trajectory from flat outputs to states and inputs > > Modified: branches/rmm-trajgen/trajgen/poly.py > =================================================================== > --- branches/rmm-trajgen/trajgen/poly.py 2012-11-11 01:28:03 UTC (rev 240) > +++ branches/rmm-trajgen/trajgen/poly.py 2012-11-11 02:49:33 UTC (rev 241) > @@ -14,4 +14,4 @@ > # Compute the kth derivative of the ith basis function at time t > def eval_deriv(self, i, k, t): > if (i < k): return 0; # higher derivative than power > - return sp.misc.factorial(k) * np.power(t, i-k) > + return sp.misc.factorial(i)/sp.misc.factorial(i-k) * np.power(t, i-k) > > Modified: trunk/src/lti.py > =================================================================== > --- trunk/src/lti.py 2012-11-11 01:28:03 UTC (rev 240) > +++ trunk/src/lti.py 2012-11-11 02:49:33 UTC (rev 241) > @@ -64,6 +64,16 @@ > self.outputs = outputs > self.dt = dt > > +# Test to see if a system is SISO > +def issiso(sys, strict=False): > + if isinstance(sys, (int, float, complex)) and not strict: > + return True > + elif not isinstance(sys, Lti): > + raise ValueError("Object is not an Lti system") > + > + # Done with the tricky stuff... > + return sys.inputs == 1 and sys.outputs == 1 > + > # Return the timebase (with conversion if unspecified) > def timebase(sys, strict=True): > """Return the timebase for an Lti system > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |
From: <mur...@us...> - 2012-11-11 02:49:36
|
Revision: 241 http://sourceforge.net/p/python-control/code/241 Author: murrayrm Date: 2012-11-11 02:49:33 +0000 (Sun, 11 Nov 2012) Log Message: ----------- Fixed bugs in various calculations and orders of indices. Modified Paths: -------------- branches/rmm-trajgen/examples/doubleint.py branches/rmm-trajgen/trajgen/flatsys.py branches/rmm-trajgen/trajgen/poly.py trunk/src/lti.py Modified: branches/rmm-trajgen/examples/doubleint.py =================================================================== --- branches/rmm-trajgen/examples/doubleint.py 2012-11-11 01:28:03 UTC (rev 240) +++ branches/rmm-trajgen/examples/doubleint.py 2012-11-11 02:49:33 UTC (rev 241) @@ -17,5 +17,6 @@ # Find a trajectory xd, ud = tg.linear_point_to_point(sys1, x0, xf, 1) +print(xd) # Plot the trajectory Modified: branches/rmm-trajgen/trajgen/flatsys.py =================================================================== --- branches/rmm-trajgen/trajgen/flatsys.py 2012-11-11 01:28:03 UTC (rev 240) +++ branches/rmm-trajgen/trajgen/flatsys.py 2012-11-11 02:49:33 UTC (rev 241) @@ -80,7 +80,7 @@ # least squares solution for now. # #! TODO: need to allow cost and constraints... - alpha = np.linalg.pinv(M) * np.vstack((zflag_T0, zflag_Tf)) + alpha = np.dot(np.linalg.pinv(M), np.vstack((zflag_T0, zflag_Tf))) # # Transform the trajectory from flat outputs to states and inputs Modified: branches/rmm-trajgen/trajgen/poly.py =================================================================== --- branches/rmm-trajgen/trajgen/poly.py 2012-11-11 01:28:03 UTC (rev 240) +++ branches/rmm-trajgen/trajgen/poly.py 2012-11-11 02:49:33 UTC (rev 241) @@ -14,4 +14,4 @@ # Compute the kth derivative of the ith basis function at time t def eval_deriv(self, i, k, t): if (i < k): return 0; # higher derivative than power - return sp.misc.factorial(k) * np.power(t, i-k) + return sp.misc.factorial(i)/sp.misc.factorial(i-k) * np.power(t, i-k) Modified: trunk/src/lti.py =================================================================== --- trunk/src/lti.py 2012-11-11 01:28:03 UTC (rev 240) +++ trunk/src/lti.py 2012-11-11 02:49:33 UTC (rev 241) @@ -64,6 +64,16 @@ self.outputs = outputs self.dt = dt +# Test to see if a system is SISO +def issiso(sys, strict=False): + if isinstance(sys, (int, float, complex)) and not strict: + return True + elif not isinstance(sys, Lti): + raise ValueError("Object is not an Lti system") + + # Done with the tricky stuff... + return sys.inputs == 1 and sys.outputs == 1 + # Return the timebase (with conversion if unspecified) def timebase(sys, strict=True): """Return the timebase for an Lti system |
From: <mur...@us...> - 2012-11-03 23:02:25
|
Revision: 229 http://sourceforge.net/p/python-control/code/229 Author: murrayrm Date: 2012-11-03 23:02:22 +0000 (Sat, 03 Nov 2012) Log Message: ----------- incrementing release count Modified Paths: -------------- trunk/doc/conf.py trunk/setup.py Modified: trunk/doc/conf.py =================================================================== --- trunk/doc/conf.py 2012-11-03 23:01:31 UTC (rev 228) +++ trunk/doc/conf.py 2012-11-03 23:02:22 UTC (rev 229) @@ -60,7 +60,7 @@ # The short X.Y version. version = '0.6' # The full version, including alpha/beta/rc tags. -release = '0.6c' +release = '0.6d' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. Modified: trunk/setup.py =================================================================== --- trunk/setup.py 2012-11-03 23:01:31 UTC (rev 228) +++ trunk/setup.py 2012-11-03 23:02:22 UTC (rev 229) @@ -4,7 +4,7 @@ from setuptools import setup setup(name = 'control', - version = '0.6c', + version = '0.6d', description = 'Python Control Systems Library', author = 'Richard Murray', author_email = 'mu...@cd...', |
From: <mur...@us...> - 2012-11-03 23:01:33
|
Revision: 228 http://sourceforge.net/p/python-control/code/228 Author: murrayrm Date: 2012-11-03 23:01:31 +0000 (Sat, 03 Nov 2012) Log Message: ----------- missed a file... Added Paths: ----------- tags/control-0.6c/doc/creation.rst trunk/doc/creation.rst Added: tags/control-0.6c/doc/creation.rst =================================================================== --- tags/control-0.6c/doc/creation.rst (rev 0) +++ tags/control-0.6c/doc/creation.rst 2012-11-03 23:01:31 UTC (rev 228) @@ -0,0 +1,33 @@ +Creating System Models +********************** + +Python-control provides a number of methods for creating LTI control +systems. + +.. module:: control +========================== ============================================ +:func:`ss` create state-space (SS) models +:func:`tf` create transfer function (TF) models +========================== ============================================ + +System creation +================ +.. autofunction:: control.StateSpace +.. autofunction:: control.ss +.. autofunction:: control.TransferFunction +.. autofunction:: control.tf + +Utility functions and converstions +================================== +.. autofunction:: control.drss +.. autofunction:: control.isctime +.. autofunction:: control.isdtime +.. autofunction:: control.issys +.. autofunction:: control.pade +.. autofunction:: control.sample_system +.. autofunction:: control.ss2tf +.. autofunction:: control.ssdata +.. autofunction:: control.tf2ss +.. autofunction:: control.tfdata +.. autofunction:: control.timebase +.. autofunction:: control.timebaseEqual Added: trunk/doc/creation.rst =================================================================== --- trunk/doc/creation.rst (rev 0) +++ trunk/doc/creation.rst 2012-11-03 23:01:31 UTC (rev 228) @@ -0,0 +1,33 @@ +Creating System Models +********************** + +Python-control provides a number of methods for creating LTI control +systems. + +.. module:: control +========================== ============================================ +:func:`ss` create state-space (SS) models +:func:`tf` create transfer function (TF) models +========================== ============================================ + +System creation +================ +.. autofunction:: control.StateSpace +.. autofunction:: control.ss +.. autofunction:: control.TransferFunction +.. autofunction:: control.tf + +Utility functions and converstions +================================== +.. autofunction:: control.drss +.. autofunction:: control.isctime +.. autofunction:: control.isdtime +.. autofunction:: control.issys +.. autofunction:: control.pade +.. autofunction:: control.sample_system +.. autofunction:: control.ss2tf +.. autofunction:: control.ssdata +.. autofunction:: control.tf2ss +.. autofunction:: control.tfdata +.. autofunction:: control.timebase +.. autofunction:: control.timebaseEqual |
From: <mur...@us...> - 2012-11-03 23:00:34
|
Revision: 227 http://sourceforge.net/p/python-control/code/227 Author: murrayrm Date: 2012-11-03 23:00:29 +0000 (Sat, 03 Nov 2012) Log Message: ----------- 0.6c release Modified Paths: -------------- trunk/ChangeLog web/manual Added Paths: ----------- tags/control-0.6c/ tags/control-0.6c/ChangeLog tags/control-0.6c/README tags/control-0.6c/doc/analysis.rst tags/control-0.6c/doc/bdalg_strings.rst tags/control-0.6c/doc/class_strings.rst tags/control-0.6c/doc/conf.py tags/control-0.6c/doc/freqplot.rst tags/control-0.6c/doc/index.rst tags/control-0.6c/doc/intro.rst tags/control-0.6c/doc/modsimp_strings.rst tags/control-0.6c/doc/modules.rst tags/control-0.6c/doc/synthesis.rst tags/control-0.6c/doc/timeresp.rst tags/control-0.6c/doc/utilities.rst tags/control-0.6c/examples/pvtol-nested.py tags/control-0.6c/examples/rss-balred.py tags/control-0.6c/setup.py tags/control-0.6c/src/__init__.py tags/control-0.6c/src/bdalg.py tags/control-0.6c/src/exception.py tags/control-0.6c/src/frdata.py tags/control-0.6c/src/lti.py tags/control-0.6c/src/rlocus.py tags/control-0.6c/src/statesp.py tags/control-0.6c/src/xferfcn.py tags/control-0.6c/tests/discrete_test.py tags/control-0.6c/tests/mateqn_test.py tags/control-0.6c/tests/modelsimp_test.py tags/control-0.6c/tests/rlocus_test.py tags/control-0.6c/tests/slycot_convert_test.py tags/control-0.6c/tests/statefbk_test.py tags/control-0.6c/tests/statesp_test.py tags/control-0.6c/tests/test_all.py tags/control-0.6c/tests/test_control_matlab.py Removed Paths: ------------- tags/control-0.6c/ChangeLog tags/control-0.6c/README tags/control-0.6c/doc/analysis.rst tags/control-0.6c/doc/bdalg_strings.rst tags/control-0.6c/doc/class_strings.rst tags/control-0.6c/doc/conf.py tags/control-0.6c/doc/freqplot.rst tags/control-0.6c/doc/index.rst tags/control-0.6c/doc/intro.rst tags/control-0.6c/doc/modsimp_strings.rst tags/control-0.6c/doc/modules.rst tags/control-0.6c/doc/synthesis.rst tags/control-0.6c/doc/timeresp.rst tags/control-0.6c/examples/pvtol-nested.py tags/control-0.6c/examples/rss-balred.py tags/control-0.6c/setup.py tags/control-0.6c/src/__init__.py tags/control-0.6c/src/bdalg.py tags/control-0.6c/src/exception.py tags/control-0.6c/src/frdata.py tags/control-0.6c/src/lti.py tags/control-0.6c/src/rlocus.py tags/control-0.6c/src/statesp.py tags/control-0.6c/src/xferfcn.py tags/control-0.6c/tests/discrete_test.py tags/control-0.6c/tests/mateqn_test.py tags/control-0.6c/tests/modelsimp_test.py tags/control-0.6c/tests/rlocus_test.py tags/control-0.6c/tests/slycot_convert_test.py tags/control-0.6c/tests/statefbk_test.py tags/control-0.6c/tests/statesp_test.py tags/control-0.6c/tests/test_all.py tags/control-0.6c/tests/test_control_matlab.py Deleted: tags/control-0.6c/ChangeLog =================================================================== --- trunk/ChangeLog 2012-11-03 05:13:00 UTC (rev 221) +++ tags/control-0.6c/ChangeLog 2012-11-03 23:00:29 UTC (rev 227) @@ -1,913 +0,0 @@ -2012-11-02 Richard Murray <murray@altura.local> - - * tests/frd_test.py: unit tests for FRD data type - (suite): added suite() function to allow test_all.py to work - - * tests/xferfcn_test.py (TestXferFcn.testMinreal): new unit test - - * src/xferfcn.py (TransferFunction.minreal): new function for - removing cancelling pole/zero pairs, contributed by M.M. (Rene) van - Paassen - - * src/statesp.py (_convertToStateSpace): new functionality for - converting a matrix to a constant system - - * src/modelsimp.py (minreal): removed extraneous code (moved to - xferfcn.py) - - * src/frdata.py: new file implementing FRD data type, contributed by - M.M. (Rene) van Paassen - - * src/xferfcn.py: resolved conflict between versions - ----- control-0.6b released ----- - -2012-11-02 Richard Murray <murray@altura.local> - - * src/xferfcn.py, src/statesp.py, src/lti.py, src/bdalg.py: - constants must now be of type 'int' rather than 'long' (for python 3 - compatibility) - - * tests/statefbk_test.py, tests/slycot_convert_test.py, - tests/convert_test.py: added import __future__ calls for python 3 - compatibility; updated print calls - - * src/modelsimp.py, src/xferfcn.py, src/delay.py, src/phaseplot.py, - src/margins.py, src/statesp.py, src/mateqn.py: added import - __future__ calls for python 3 compatibility - -2012-11-02 Richard Murray <murray@altura.local> - - * src/xferfcn.py, src/timeresp.py, src/statesp.py, src/statefbk.py, - src/robust.py, src/rlocus.py, src/pzmap.py, src/phaseplot.py, - src/nichols.py, src/modelsimp.py, src/matlab.py, src/margins.py, - src/freqplot.py, src/ctrlutil.py, src/bdalg.py: globally referenced - import commands for python 3.x - - * src/__init__.py: changed import commands to be global instead of - local ('from control.bdalg ...' instead of 'from bdalg ...') - -2012-10-31 Richard Murray <murray@altura.local> - - * src/xferfcn.py (TransferFunction._common_den): converted print - statements to python 3 compatible form and included - __future__.print_function - - * src/phaseplot.py: converted print statements to python 3 - compatible form and included __future__.print_function - - * src/mateqn.py (lyap, dlyap): converted except T, E to except T(E) - - * src/margins.py: converted print statements to python 3 - compatible form and included __future__.print_function - - * src/xferfcn.py (TransferFunction.__add__, __mul__, __div__, - feedback): converted raise T, E to raise T(E) for python 3 - - * src/xferfcn.py (TransferFunction.returnScipySignalLti): fixed - raise(T(E)) bug - - * src/statesp.py (_rss_generate): fixed raise(T(E)) bug - - * src/statefbk.py (acker, gram): converted raise T, E to raise T(E) for - python 3 - - * src/modelsimp.py (hsvd, modred, balred): fixed raise(T(E)) bug and - converted raise T, E to raise T(E) for python 3 - - * src/margins.py (stability_margins): fixed raise(T(E)) bug - - * src/statesp.py: converted raise T, E to raise T(E) for python 3 - - * tests/test_all.py: converted print statements to python 3 - compatible form and included __future__.print_function - - * tests/statefbk_test.py (TestStatefbk.setUp): turned off debugging - flag (accidently left on) - ----- control-0.6a released ----- - -2012-10-27 Richard Murray <murray@altura.local> - - * src/statefbk.py (acker): small updates to docstring - - * src/bdalg.py (feedback): fixed up docstring formatting (for sphinx) - - * tests/statefbk_test.py (TestStatefbk.testAcker): skip - ill-conditioned systems and loosened tolerances on acker() testing - - * src/lti.py (timebaseEqual): replaced "type(sys.dt) == NoneType" - with "sys.dt is None", based on feedback from Luke Peterson that - NoneType is deprecated in python 3. - -2012-10-22 Richard Murray <murray@altura.local> - - * examples/genswitch.py (genswitch): updated calls to legend, fixing - problem pointed out by Scott Livingston - -2012-10-19 Richard Murray <mu...@dn...net> - - * src/matlab.py (rlocus): reverted change in default argument - processing for klist. This has some negative consequences: - http://www.deadlybloodyserious.com/2008/05/default-argument-blunders/ - -2012-10-18 Richard Murray <mu...@dn...net> - - * src/freqplot.py (gangof4_plot, nyquist_plot): discrete time - systems supported (through fresp) - - * src/statesp.py (StateSpace.evalfr): added warning if discrete time - evaluation is above Nyquist frequency - - * src/xferfcn.py (TransferFunction.evalfr, freqresp): : added - warning if discrete time evaluation is above Nyquist frequency - - * tests/discrete_test.py (TestDiscrete.test_discrete_bode): - rudimentary unit test for discrete bode plot - - * src/freqplot.py (bode_plot): fixed bug where input frequency list - was being overwritten by default frequency range - - * src/xferfcn.py (TransferFunction.evalfr, freqresp): handles dtime - - * src/statesp.py (StateSpace.evalfr): handles dtime - - * src/lti.py (timebaseEqual): converted function to take systems as - inputs instead of dt as input (also affected functions in statesp.py - and xferfcn.py) - - * src/lti.py (timebase): timebase now returns dt instead of - 'ctime'/'dtime' - -2012-10-13 Richard Murray <mu...@dn...net> - - * src/lti.py (timebase): new function to return timebase. Doesn't - yet handle the case where dt == None. - -2012-10-07 Richard Murray <murray@altura.local> - - * src/matlab.py (c2d): MATLAB compatible function (just calls - sample_system) - - * tests/discrete_test.py (TestDiscrete.test_sample_system): unit - test for sampling - - * src/dtime.py (sample_system, _c2dmatched): new functions, based on - contributiosn from Benjamin White - - * src/dtime.py: added back this file, this time with sampling routes - to convert from continuous to discrete time - - * src/timeresp.py (forced_response): added discrete time simulator, - using dlsim from scipy.signal - -2012-10-07 Richard Murray <murray@altura.local> - - * doc/conf.py: fixed release number (0.6a instead of 0.6c) - - * src/__init__.py: moved timebase functions from dtime to lti - - * src/lti.py: moved isdtime, isctime, timebase, and timebaseEqual - from dtime.py to lti.py. Moved initialization of dt to - Lti.__init__(). - - * src/statesp.py (StateSpace.__init__): Moved dt - initialization to Lti object initialization - - * src/xferfcn.py (TransferFunction.__init__): Moved dt - initialization to Lti object initialization - -2012-10-06 Richard Murray <murray@altura.local> - - * tests/discrete_test.py: added additional tests for dt = True cases - - * src/statesp.py (StateSpace.__str__): show sampling time as - 'unspecified' if dt is a boolean and equal to True - - * src/xferfcn.py (TransferFunction.__str__): don't print sampling - time (dt) if dt = True (discrete time with unspecified time base) - - * src/dtime.py: added code to support dt = True for unspecified - sampling time for a discrete time system - - * src/bdalg.py: much -> must in docstrings - -2012-10-06 Richard Murray <murray@altura.local> - - * src/dtime.py: new module with functions for operating on discrete - time systems - - * src/modelsimp.py: added NotImplementedError for discrete time - * src/freqplot.py: added NotImplementedError for discrete time - - * src/bdalg.py: added documentation about timebases (discrete versus - continuous) - - * src/statesp.py (_mimo2siso): include sampling time - - * src/xferfcn.py (TransferFunction.__str__): added optional var - keyword to allow any symbol to be used - - * src/matlab.py (tf2ss): added code required to keep track of dt - - * src/xferfcn.py (TransferFunction.__str__): added additional string for - discrete time system, plus use 'z' for polynomial variable - (TransferFunction.__neg__): set sampling time for negation - (TransferFunction.__add__): added test for same sampling time - (TransferFunction.__mul__): added test for same sampling time - (TransferFunction.__div__): added test for same sampling time - (TransferFunction.feedback): added test for same sampling time - - * src/statesp.py (StateSpace.__str__): added additional string for - discrete time system - (StateSpace.__add__): added test for same sampling time - (StateSpace.__mul__): added test for same sampling time - (StateSpace.__rmul__): set sampling time for product - (StateSpace.__neg__): set sampling time for negation - (StateSpace.feedback): added test for same sampling time - - * tests/discrete_test.py (TestDiscrete): unit tests for discrete - time systems - - * src/xferfcn.py (TransferFunction.__init__): added dt class - variable for discrete time systems - - * src/statesp.py (StateSpace.__init__): added dt class variable for - discrete time systems - ----- control-0.5c released ----- - -2012-10-03 Richard Murray <murray@altura.local> - - * tests/matlab_test.py (TestMatlab.testSsdata): unit test - - * src/matlab.py (ssdata, tfdata): new functions to return state - space and transfer function object data. For transfer functions, - currenly requires SISO system - - * src/freqplot.py (bode_plot): Adding np.atleast_1d to the - np.squeeze calculations makes it possible to use a single value - frequency list (contributed by Benjamin White) - -2012-09-09 Richard Murray <murray@altura.local> - - * tests/statefbk_test.py (TestStatefbk.testAcker): unit test - - * src/statefbk.py (acker): added acker() from Roberto Bucher. - -2012-08-29 Richard Murray <murray@altura.local> - - * src/xferfcn.py (TransferFunction._common_den): fixed up code for - case where poles have multiplicity > 1. Set end limits of check to - avoid overruning the list + combine complex conjugate pole pairs - from the outside in to prevent small errors from growing. - -2012-08-26 Richard Murray <murray@altura.local> - - * tests/convert_test.py (TestConvert.testConvert): replaced previous - test of transfer function coefficients with a frequency response - test. This is necessary because various degenerate conditions will - generate a situation where the transfer functions are of different - forms but still equal. Eg 0/1 = 1e-17 s + 1e-16 / (s^2 + s + 1). - Still getting errors, but looks like actual problem in conversion. - - * src/statesp.py (_mimo2siso): set default value for warn_conversion - to False - - * tests/convert_test.py (TestConvert.testConvert): Added check to - make sure that we don't create problems with uncontrollable or - unobservable systems. - -2012-08-25 Richard Murray <murray@altura.local> - - * src/xferfcn.py (TransferFunction._common_den): identified bug in - the way that common denominators are computed; see comments in code - regarding complex conjugate pairs. - - * src/statefbk.py (place): repalced nd.size(placed_eigs) with - len(placed_eigs) to fix intermittent problems pointed out by Roberto - Bucher in control-0.3c. - - * tests/rlocus_test.py (TestRootLocus.testRootLocus): added sort() - to test to get rid of problems in which ordering was generating an - error. - - * src/freqplot.py (nyquist_plot): added code from Kevin Davies to - label frequency points in Nyquist plot - - * src/__init__.py: import non-conflicting MATLAB functions by default - - * src/freqplot.py (bode_plot, nyquist_plot): simplified code and - removed unneeded options. To set color, linestyle, etc use keywords - and pass to matplotlib. - -2012-08-24 Richard Murray <murray@altura.local> - - * src/freqplot.py: added in plot enhancements from Kevin Davies - (bode_plot): pass optional arguments and keywords to matplotlib - (get_pow1000): new function for determinine engineering exponent - (gen_prefix): new function to get SI prefix for power of 1000 - - * src/freqplot.py (bode_plot): removed extraneous phase_deg calculation - -2012-01-07 Richard Murray <murray@malabar.local> - - * doc/modules.rst: added new sections for analysis, synthesis, - frequency plots and time response. - - * doc/index.rst (Contents): added modules and examples. - - * src/xferfcn.py (_convertToTransferFunction): added check for - slycot import error. If not present, use signal.lti to perform the - conversion. Only works for SISO. - - * src/statesp.py (_convertToStateSpace): added check for slycot - import error, to allow basic functionality without the presence of - slycot (contributed by Ryan Krauss). - - * tests/slycot_convert_test.py (TestSlycot.testTF): moved slycot - import into test function, so that test script still works even if - time response is not present. - -2011-08-09 Richard Murray <murray@malabar.local> - - * src/timeresp.py: fixed doc reference to time-series-convention - -2011-08-08 Richard Murray <murray@malabar.local> - - * doc/index.rst, doc/modules.rst: Moved MATLAB section into - python-control modules file - -2011-08-07 Richard Murray <murray@malabar.local> - - * doc/conf.py: added autosummary extension - - * doc/timeresp.rst: New file containing listing of functions for - time responses (step, initial, etc) - - * doc/freqplot.rst: New file listing functions for frequency - plots (bode, nyquist, etc) - - * doc/modules.rst: New file that contains a listing of the major - modules in the toolbox - - * doc/index.rst (Contents): Rearranged contents to put modules - documentation in a separate section. Also added examples section - (not quite ready yet). - -2011-08-07 Richard Murray <murray@malabar.local> - - * examples/rss-balred.py: reordered outputs from call to matlab.step - (missed this the first time around) - - * doc/matlab_strings.rst: Matlab -> MATLAB (proper spelling) - - * setup.py, doc/conf.py: updated version to 0.5b - -2011-08-07 Richard Murray <murray@malabar.local> - - * doc/conf.py: Updated version numbers to 0.5a, regenerated - documentation and reposted on web (note that 0.5a tag and source - distribution have this wrong) - ----- control-0.5a released ----- - -2011-08-07 Richard Murray <murray@malabar.local> - - * setup.py: updated version number; next release will be 0.5a since - the changes in function names and argument/return value order (for - time reponses) require small updates in code - - * examples/secord-matlab.py, examples/pvtol-nested-ss.py, - examples/test-response.py, examples/pvtol-nested.py: fixed small bug - in order of output arguments for step command - -2011-08-06 Richard Murray <murray@malabar.local> - - * src/matlab.py (ngrid): copy documentation from nichols_grid - - * src/__init__.py: changed import commands to import specific - functions rather than '*' (better modularity) - - * src/freqplot.py: default function names are now bode_plot, - nyquist_plot and gangof4_plot (still with aliases to non-"_plot" - versions) - - * src/nichols.py (nichols_plot): updated nichols to nichols_plot for - consistency with other python-control plotting functions. Set up - alias for original name - - * src/margins.py: StabilityMargins, PhaseCrossoverFrequencies -> - stability_margins, phase_crossover_frequencies - - * src/phaseplot.py: changed PhasePlot and boxgrid to phase_plot, - box_grid - - * src/timeresp.py: changed ForcedReponse, InitialReponse, - ImpulseReponse and StepResponse to forced_response, - initial_response, impulse_response and step_response. - - * src/rlocus.py: changed RootLocus to root_locus for better - compatability with PEP 8. Also updated unit tests and examples. - -2011-07-25 Richard Murray <murray@malabar.local> - - * tests/phaseplot_test.py: updated unit tests to use new call - signatures - - * examples/phaseplots.py: updated calls to PhasePlot to use new - argument structure - - * src/phaseplot.py (PhasePlot): Updated call signature to be - more pythonic and fixed up documentation. - - * examples/genswitch.py (genswitch): added new example showing - PhasePlot functionality - - * src/phaseplot.py (boxgrid): added function to compute initial - conditions around the edges of a box - -2011-07-24 Richard Murray <murray@malabar.local> - - * tests/margin_test.py: added simple unit tests for margin functions - (initial versions just call functions; some comparisons missing) - - * examples/README: added missing README file - - * examples/phaseplots.py: FBS examples for phaseplot - - * tests/phaseplot_test.py: unit tests for phaseplot - - * src/phaseplot.py: initial cut at phase portrait function, built - from amphaseplot (Feeback Systems [FBS], Astrom and Murray, 2008) - -2011-07-15 Richard Murray <murray@malabar.local> - - * tests/matlab_test.py (TestMatlab): added unittest for margin() - commands (calling format only) - - * src/statesp.py (StateSpace): updated comments - - * tests/margin_test.py: set up unit tests for StabilityMargins() and - PhaseCrossoverFrequencies() - - * src/__init__.py: added margins.py to __init__ - -2011-07-14 Richard Murray <murray@malabar.local> - - * src/margins.py (GainPhaseMargin): moved freqplot.MarginPlot to - margin.StabilityMargins (MarginPlot didn't actually plot anything) - - * src/margins.py (PhaseCrossoverFrequencies): added new function to - compute frequencies that we cross real axis. Contributed by Steffen - Waldherr <wal...@is...> - -2011-07-11 Richard Murray <murray@malabar.local> - - * src/rlocus.py: added real() and imag() to list of functions - imported from numpy - - * src/freqplot.py: renamed plotting functions to BodePlot, - NyquistPlot, GangOf4Plot and MarginPlot. Set up aliases to the more - common names (bode, nyquest, gangof4, margin). Mainly playing - around with idea for the eventual interface to use. - - * tests/matlab_test.py: updated timeresp outputs to match MATLAB - - * src/matlab.py (impulse, initial, lsim, step): switched outputs - from step, impulse, initial, lsim to match MATLAB standard - -2011-07-01 Richard Murray <murray@malabar.local> - - * src/rlocus.py: modified scipy import to only import those - functions that we actually use. This fixes a problem pointed out by - Carsten Knoll (TU Dresden) where control.place could be overwritten - by numpy.place (because of an "from scipy import *" in rlocus.py - - * doc/intro.rst: Added link to scipy web page talking about the - differences between numpy and MATLAB (contributed by Shuo Han). - -2011-06-25 Richard Murray <murray@malabar.local> - - * src/xferfcn.py (TransferFunction._common_den): changed tolerance - for detecting complex valued poles to a user-settable parameter, - with default value 1e-8. This was an attempt to fix errors in the - convert_test.py unittest script (conversion routine was - misclassifying some poles as imaginary when they weren't). - - * src/xferfcn.py (_convertToTransferFunction): converted arguments - to tb04ad to numpy arrays; fixes a unit test error in convert_test.py. - - * src/statefbk.py (gram): convert system matrix passed to sb03md to - numpy array; this fixes a unit test error in modelsimp_test.py. - - * src/matlab.py (impulse): got rid of X0 argument for impulse - response (not implemented in MATLAB). - - * doc/intro.rst: added some quick start information - - * src/matlab.py: added documentation for step, impulse, initial, lsim - - * src/timeresp.py: fixed some MATLAB specific function names in - function doc strings - -2011-06-22 Richard Murray <murray@malabar.local> - - * doc/intro.rst: fixed some small types - - * doc/control.tex: removed (no longer needed) - -2011-06-22 Richard Murray <murray@malabar.local> - - * doc/intro.rst: Added a slightly more general introduction, with a - pointer to the python-control wiki (on sf.net) - - * doc/Makefile: Changed path to sphinx-build to assume it is in the - users path (as opposed to an explicit path) - - * doc/conf.py: Added release information into documentation file - -2011-06-21 Richard Murray <murray@malabar.local> - - * src/statesp.py (_mimo2siso): Moved function from matlab.py. - - * src/timeresp.py: added file documentation + split out and updated - copyright info. Small corrections to documentation. - (InitialResponse): Added missing transpose argument in call to - ForcedResponse - - * src/matlab.py: minor changes to documentation to avoid line wraps - on standard (80 col) terminal window - - * src/matlab.py: removed time-series convention documentation from - matlab.py since current MATLAB version uses standard conventions. - This documentation is currently in timeresp.py. - - * src/*, doc/*: added Eike Welk's documentation modifications - -2011-06-18 Richard Murray <murray@malabar.local> - - * src/timeresp.py, src/matlab.py: moved documentation about time - series convention from matlab.py to timeresp.py - - * examples/pvtol-nested-ss.py: Fixed bug in call to step (wrong - second argument) - - * tests/matlab_test.py: Updated tests to use MATLAB time response - conventions. - - * tests/timeresp_test.py: Created unit tests for timeresp module, - based on matlab_test.py - -2011-06-17 Richard Murray <murray@malabar.local> - - * src/timeresp.py (ForcedResponse): swapped order of input and time - arguments for linear response, following Eike's comment "T must - always be supplied by the user, but U has a useful default value of - 0." - - * src/matlab.py: moved code for lsim, initial, step, and impulse to - timeresp.py and put in new routes that call timeresp.* versions of - the functions with transposeData set to True. - - * src/timesim.py (_check_convert_array): added transpose argument - that will transpose input data before processing it. - - * src/timesim.py: renamed lsim, initial, step, and impulse functions - to ForcedResponse, InitialResponse, StepResponse and - ImpulseResponse. These versions use Eike Welk's input ordering. - - * examples/pvtol-nested.py: calls to step() had screwed up inputs. - Fixed. - -2011-06-17 Richard Murray <murray@malabar.local> - - * src/matlab.py: added MIMO extensions from Eike Welk on 12 Jun - 2011: adds MIMO capabilities for ``lsim``, ``step``, ``impulse``, - ``initial`` - - * src/matlab.py: added changes from Eike Welk on 12 May 2011: - - - An implementation of the four simulation functions ``lsim``, - ``step``, ``initial``, and ``impulse`` of the module ``matlab``. - - - Adds a function ``dcgain`` to the ``matlab`` module, which - computes the gain of a linear system for steady state and - constant input. - - - The patch contains a bug fix for class ``StateSpace``, which - enables it to work properly together with Scipy's ``signal`` - module. - - - The simulation functions' return values are changed (back?) to - arrays, because matrices confuse Matplotlib. - - - New times series convention: see _time-series-convention section - of matlab documentation - - - SISO simulation data are squeezed on output. To turn this off, - pass the option squeeze=False - ----- control-0.4c released ----- - -2011-06-17 Richard Murray <mu...@dh...> - - * examples/tfvis.py: Added tfvis, Simple GUI application for - visualizing how the poles/zeros of the transfer function effects the - bode, nyquist and step response of a SISO system. Contributed by - Vanessa Romero Segovia, Ola Johnsson, Jerker Nordh. - -2011-06-16 Richard Murray <murray@malabar.local> - - * src/matlab.py: import mateqn functions - - * src/__init__.py: import mateqn functions - - * tests/test_all.py: added unit tests for matrix solvers, converting - to standard format along the way. Seems to work even if slycot - routines are not in place, but I'm not sure if this is for the right - reasons... - - * src/mateqn.py: added matrix solvers from LTH (Ola Johnsson, Jerker - Nordh, Bjorn Olofsson, Vanessa Romero). Moved slycot function - checks to the portion of the code where they are used, so that - missing slycot doesn't mess up initialization if proper version of - slycot is not available. - -2011-04-02 Richard Murray <murray@malabar.local> - - * src/xferfcn.py (TransferFunction.__add__): fixed bug when adding a - transfer function to state space system; _convertToTransferFunction - was being called with input/output keywords. Picked up in unit test. - - * tests/matlab_test.py: added calls to all of the functions that are - currently implemented in the library, to make sure there are no - hidden issues. These calls do *not* test functionality, they just - make sure that MATLAB compatibility functions accept the right types - of arguments. - - * examples/secord-matlab.py: added root locus plot to list of - figures that are produced - - * src/__init__.py: added rlocus to list of modules that are imported - by control module - - * src/exception.py (ControlMIMONotImplemented): added exception for - functions that are not yet implemented for MIMO systems - - * src/xferfcn.py (TransferFunction.__init__): convert integer - numerator and denominator objects to floats to eliminate errors when - creating common denominator (also used on pole command). This fixes - and error were tf([1], [1, 2, 1]).pole() would generate an error. - - * src/freqplot.py (bode): Tweaked documentation string to remove 'h' - from mag and phase return arguments - - * src/rlocus.py (RootLocus): removed commands that set figure number - inside of RootLocus command, for consistency with other frequency - plot routines. Added Plot=True argument and updated documentation. - - * src/matlab.py: added rlocus() command (calls RootLocus) - - * MANIFEST.in: Added MANIFEST.in file to include examples and tests - in source distribution - - * README: Updated to include information on how to run unit tests. - - * setup.py: updated version number to 0.4c - ----- control-0.4b released ----- - -2011-04-02 Richard Murray <murray@malabar.local> - - * src/__init__.py: removed import of tests module (moved to tests/) - - * src/matlab.py: Added hsvd, balred, modred to list of functions - that are imported for use as is. Updated documentation string to - indicate that these are implemented, along with a few other - functions (zero, lqr) that weren't properly listed. - - * src/modelsimp.py (balred): Removed extraneous print statements - (modred): Set method to be 'matchdc' by default (to match MATLAB) - - * src/__init__.py: added missing import of modelsimp functions - - * tests/slycot_convert_test.py (TestSlycot.testTF): turned off print - statements in unit test to make it easier to see results. Use - verbose=True to turn back on. - - * tests/convert_test.py (TestConvert.testConvert): got rid of print - statements in unittest; clutters the output so that you can't see - the errors clearly. Use verbose=True to turn back on. - - * src/statesp.py (_convertToStateSpace): removed "buggy" print - statements - - * src/xferfcn.py (_convertToTransferFunction): removed "buggy" print - statements - - * tests/nichols_test.py (TestStateSpace.testNgrid): updated testcode - to turn off grid in initial Nichols chart plot. - - * src/freqplot.py: updated comments at top of file to reflect - nichols chart move - - * src/nichols.py: transferred over changes from v0.3d - - * src/matlab.py (ngrid): moved import to function - -2011-03-31 Richard Murray <murray@malabar.local> - - * examples/pvtol-nested.py: updated stability margin plot to use - proper calling format for bode(). - - * src/statesp.py (_convertToStateSpace): moved slycot import - to the location where it is actually needed (allows running some - commands without slycot installed) - - * src/xferfcn.py (_convertToTransferFunction): moved slycot import - to the location where it is actually needed (allows running some - commands without slycot installed) - - * src/nichols.py: new file for Nichols plot routines; move - nichols(), nichols_grid(), closed_loop_contours(), m_circles(), - n_circles() - - * src/__init__.py, src/freqresp.py, src/matlab.py: updated to match - new file structure for Nichols charts - - * src/nichols.py (nichols): updated processing of freqresp to take - into account the fact that return arguments are now a matrix of - results (even for a SISO system) - -2011-03-30 Richard Murray <murray@malabar.local> - - * tests/: added top level subdirectory, to be used for unit tests. - The idea in putting the code here is that you can do 'setup.py test' - during installation to make sure everything is working correctly. - The test code would normally *not* be callable from the installed - module. - - * tests/*_test.py: moved from src/Test*.py - - * setup.py: updated version number. - -2011-02-13 Richard Murray <murray@sumatra.local> - - * src/*.py: added svn:keywords Id properly - - * src/matlab.py (ngrid): added ngrid() from v0.3d - - * src/freqplot.py (nichols_grid, closed_loop_contours, m_circles, - n_circles): copied over changes from Allan McInnes in v0.3d; ngrid() - functiality + split out some of the nichols chart code into separate - functions - -2011-02-12 Richard Murray <murray@sumatra.local> - - * setup.py: updated version number to 0.4a - -2010-11-05 Richard Murray <murray@sumatra.local> - - * external/yottalab.py: New file containing Roberto Bucher's control - library functions. OK to start pulling these into the main library, - with attribution, but note that they use modifications of the - default library => some rewrites will be needed. - -2010-09-11 Richard Murray <murray@sumatra.local> - - * src/matlab.py (step): Added local step response function that uses - lsim2() instead of signal.step (which can't handle integrators). - This function may not be needed when new scipy step2() function is - available. - (impulse): Added local impulse response function that sets the - initial condition based on the input matrix and then uses the - lsim2() function to compute the response. - - * examples/test-response.py: Added test script for making sure that - time repsonse functions are working as desired - - * src/matlab.py (lsim): Added local version of lsim that calls - signal.lsim2 (actual ODE integrator) - -2010-09-06 Richard Murray <murray@sumatra.local> - - * src/statefbk.py (ctrb): new function for testing controllability - * src/statefbk.py (obsv): new function for testing observabiilty - -2010-09-02 Richard Murray <murray@sumatra.local> - - * src/statefbk.py (place): Use np.size() instead of len() for - finding length of placed_eigs for better compatability with - different python versions [courtesy of Roberto Bucher] - - * src/delay.py (pade): New file for delay-based computations + - initial implementation of pade() [courtesy Sawyer Fuller] - -2010-06-17 Richard Murray <murray@sumatra.local> - - * src/rlocus.py: changed num, den to nump, denp for clarity - * src/rlocus.py: new file with Ryan Krauss's root locus code - -2010-06-06 Richard Murray <murray@sumatra.local> - - * examples/pvtol-lqr.py: Added example to test out LQR routines - - * src/matlab.py (bode): created a wrapper that allows MATLAB style - arguments for bode (eg, bode(sys1, sys2)) - - * src/ctrlutil.py (issys): added new function to check if an object - is a system (state space or transfer function). Will generalize - this latter to look for other compatible classes. - - * src/freqplot.py (bode): Compute frequency range of bode plot based - on poles and zeros - (bode): Allow bode plot to be passed a list (or tuple) as the first - argument, in which case multiple bode plots are generated - - * src/statesp.py (StateSpace.zeros): new function to compute zeros - for a state space system - (StateSpace): defined new functions to compute poles of a state - space system - - * src/xferfcn.py (TransferFunction): defined new functions to - compute poles and zeros of a transfer function. - -2010-05-31 Richard Murray <murray@sumatra.local> - - * src/exception.py (ControlNotImplemented): added new exception, to - be used for functions that are not yet implemented - - * src/statefbk.py (lqr): added lqr function (using slycot). Still - needs to be verified to make sure calculations are correct. - - * ChangeLog: converted to standard GNU formation (old style below) - * setup.py: updated package number to v0.3, changed URL to - sourceforge wiki - ------------------- -31 May 2010, RMM: added place() function using slycot - * New module: statefbk - functions to design state feedback controllers - * Uses Enrico Avventi slycot wrappers (http://github.com/avventi/Slycot) - * Also added some exception types: ControlSlycot and ControlDimension - * Added new example to test slycot interface (directly) - -29 May 2010, RMM: updated function documentation - * Added __doc__ strings for all current functions - * Added __doc__ string to matlab module, listing control toolbox functions - -22 May 2010, RMM: tweaked comments and released v0.3a - * Changed copyright information on modified files to 2010 - * Updated "to do" comments to use "#! TODO:" as prefix - -11 Feb 2010, GR: implemented and tested state space feedback -15 Jan 2010, GR: added new example, improved bode - -4 Jan 2010, GR: updated bode plots - * made bode plot more like matlab - * added options for plotting in dB, Hz - -27 Dec 2009, GR: important bug fix: feedback TFs were being divided by two - -10 Oct 09, RMM: reset matplotlib import in secord-matlab - * Using 'from matplotlib import *' causes error with figures - * On my other computer, got error when trying to import 'matplotlib.pyplot' - * Need to sort out versions and figure out proper import structure - -13 Sep 09, RMM: added basic state space functionality - * Updated StateSpace routines to allow BD algebra with constants - * Updated pvtol-nested example to try to use state space representation - (not completely working yet) - -12 Sep 09, RMM: code restructuring for transfer functions - * Implemented feedback() method in bldalg; partially working - for mixture of TF, SS and numbers (not thoroughly tested yet) - * New feedback method for TransferFunctions - * Updated gangof4 to use new feedback function - -9 Sep 09, RMM: updated pzmap to generate a plot (turn off with Plot=False) - -8 Sep 09, RMM: rewrite of xferfcn to handle type casting better - * Appropriate functions now call convertToTransferFunction - * Restricted transfer function to SISO only - -7 Sep 09, RMM: additional fixes - * Implemented block diagram operations for SISO transfer functions - * Modified frequency response functions for transfer functions - * Added rudimentary pole/zero computations - * Added comments on things that need to be fixed (search for !) - -5 Sep 09, RMM: updates to get standard examples working - * Copied and converted pvtol_nested.py from AM08, Chapter 11 - * Updated freqresp to use poly1d for computing values - * Added outputs to bode plot - return mag and phase subplot handles - -2009-05-24 Richard Murray <murray@kona-2.local> - * ./ Initial creation of package files and ChangeLog - * Using simpler text format since emacs python mode doesn't support - ChangeLog entries anyway - - -Local Variables: -mode:text -End: Copied: tags/control-0.6c/ChangeLog (from rev 226, trunk/ChangeLog) =================================================================== --- tags/control-0.6c/ChangeLog (rev 0) +++ tags/control-0.6c/ChangeLog 2012-11-03 23:00:29 UTC (rev 227) @@ -0,0 +1,975 @@ +2012-11-03 Richard Murray <murray@altura.local> + + * doc/modules.rst: updated documentation format so that items are + broken down by functionality and not internal module name. Still + not complete, but most functions should now show up in documentation. + + * doc/index.rst: got rid of todos from documentation (not formatted + correctly and shouldn't show up in user documentation) + + * src/lti.py: added missing docstrings + + * doc/intro.rst: small tweaks to text, including adding a link to FBS + +2012-11-03 Richard Murray <murray@altura.local> + + * src/rlocus.py (_RLSortRoots): convert output of range() to + explicit list for python 3 compatability + + * tests/modelsimp_test.py, tests/slycot_convert_test.py, + tests/mateqn_test.py, tests/statefbk_test.py: updated test suites to + skip specific tests that require slycot if it is not installed + + * src/exception.py (slycot_check): added a function to check if + slycot is installed + + * README: updated readme to include information about running + nosetests, which works in python3 (unlike the test_all.py script) + + * tests/test_control_matlab.py, tests/test_all.py: set to executable + so that nosetests does not run this file (it already runs all unit + tests in this directory). Add comments at top talking about tests. + + * tests/discrete_test.py (TestDiscrete.test_discrete_bode): + explicitly create a list from map() output for python 3 + + * src/frdata.py: removed long data type from comparisons for + constant systems (not supported in python3) + + * src/xferfcn.py (TransferFunction.freqresp): force frequencies to + be a list (map returns iterator in python3) + + * src/lti.py (isdtime, isctime): updated timebase checking since + python3 won't allow dt to be compared to integer + + * src/__init__.py: updated frdata import to python3 compatible form + + * src/statesp.py (_convertToStateSpace): fixed exception syntax to + be python3 compatible + + * examples/pvtol-nested.py: converted print statements to be python3 + compatible + + * doc/class_strings.rst: added FRD class to list of classes that + show up in the user documentation + + * examples/rss-balred.py: fixed error in output argument order for + call to matlab.impulse + + * ../README: updated readme file as a test of post-commit hook + +2012-11-02 Richard Murray <murray@altura.local> + + * doc/conf.py, setup.py: updated version number to 0.6c + + * tests/frd_test.py: unit tests for FRD data type + (suite): added suite() function to allow test_all.py to work + + * tests/xferfcn_test.py (TestXferFcn.testMinreal): new unit test + + * src/xferfcn.py (TransferFunction.minreal): new function for + removing cancelling pole/zero pairs, contributed by M.M. (Rene) van + Paassen + + * src/statesp.py (_convertToStateSpace): new functionality for + converting a matrix to a constant system + + * src/modelsimp.py (minreal): removed extraneous code (moved to + xferfcn.py) + + * src/frdata.py: new file implementing FRD data type, contributed by + M.M. (Rene) van Paassen + + * src/xferfcn.py: resolved conflict between versions + +---- control-0.6b released ----- + +2012-11-02 Richard Murray <murray@altura.local> + + * src/xferfcn.py, src/statesp.py, src/lti.py, src/bdalg.py: + constants must now be of type 'int' rather than 'long' (for python 3 + compatibility) + + * tests/statefbk_test.py, tests/slycot_convert_test.py, + tests/convert_test.py: added import __future__ calls for python 3 + compatibility; updated print calls + + * src/modelsimp.py, src/xferfcn.py, src/delay.py, src/phaseplot.py, + src/margins.py, src/statesp.py, src/mateqn.py: added import + __future__ calls for python 3 compatibility + +2012-11-02 Richard Murray <murray@altura.local> + + * src/xferfcn.py, src/timeresp.py, src/statesp.py, src/statefbk.py, + src/robust.py, src/rlocus.py, src/pzmap.py, src/phaseplot.py, + src/nichols.py, src/modelsimp.py, src/matlab.py, src/margins.py, + src/freqplot.py, src/ctrlutil.py, src/bdalg.py: globally referenced + import commands for python 3.x + + * src/__init__.py: changed import commands to be global instead of + local ('from control.bdalg ...' instead of 'from bdalg ...') + +2012-10-31 Richard Murray <murray@altura.local> + + * src/xferfcn.py (TransferFunction._common_den): converted print + statements to python 3 compatible form and included + __future__.print_function + + * src/phaseplot.py: converted print statements to python 3 + compatible form and included __future__.print_function + + * src/mateqn.py (lyap, dlyap): converted except T, E to except T(E) + + * src/margins.py: converted print statements to python 3 + compatible form and included __future__.print_function + + * src/xferfcn.py (TransferFunction.__add__, __mul__, __div__, + feedback): converted raise T, E to raise T(E) for python 3 + + * src/xferfcn.py (TransferFunction.returnScipySignalLti): fixed + raise(T(E)) bug + + * src/statesp.py (_rss_generate): fixed raise(T(E)) bug + + * src/statefbk.py (acker, gram): converted raise T, E to raise T(E) for + python 3 + + * src/modelsimp.py (hsvd, modred, balred): fixed raise(T(E)) bug and + converted raise T, E to raise T(E) for python 3 + + * src/margins.py (stability_margins): fixed raise(T(E)) bug + + * src/statesp.py: converted raise T, E to raise T(E) for python 3 + + * tests/test_all.py: converted print statements to python 3 + compatible form and included __future__.print_function + + * tests/statefbk_test.py (TestStatefbk.setUp): turned off debugging + flag (accidently left on) + +---- control-0.6a released ----- + +2012-10-27 Richard Murray <murray@altura.local> + + * src/statefbk.py (acker): small updates to docstring + + * src/bdalg.py (feedback): fixed up docstring formatting (for sphinx) + + * tests/statefbk_test.py (TestStatefbk.testAcker): skip + ill-conditioned systems and loosened tolerances on acker() testing + + * src/lti.py (timebaseEqual): replaced "type(sys.dt) == NoneType" + with "sys.dt is None", based on feedback from Luke Peterson that + NoneType is deprecated in python 3. + +2012-10-22 Richard Murray <murray@altura.local> + + * examples/genswitch.py (genswitch): updated calls to legend, fixing + problem pointed out by Scott Livingston + +2012-10-19 Richard Murray <mu...@dn...net> + + * src/matlab.py (rlocus): reverted change in default argument + processing for klist. This has some negative consequences: + http://www.deadlybloodyserious.com/2008/05/default-argument-blunders/ + +2012-10-18 Richard Murray <mu...@dn...net> + + * src/freqplot.py (gangof4_plot, nyquist_plot): discrete time + systems supported (through fresp) + + * src/statesp.py (StateSpace.evalfr): added warning if discrete time + evaluation is above Nyquist frequency + + * src/xferfcn.py (TransferFunction.evalfr, freqresp): : added + warning if discrete time evaluation is above Nyquist frequency + + * tests/discrete_test.py (TestDiscrete.test_discrete_bode): + rudimentary unit test for discrete bode plot + + * src/freqplot.py (bode_plot): fixed bug where input frequency list + was being overwritten by default frequency range + + * src/xferfcn.py (TransferFunction.evalfr, freqresp): handles dtime + + * src/statesp.py (StateSpace.evalfr): handles dtime + + * src/lti.py (timebaseEqual): converted function to take systems as + inputs instead of dt as input (also affected functions in statesp.py + and xferfcn.py) + + * src/lti.py (timebase): timebase now returns dt instead of + 'ctime'/'dtime' + +2012-10-13 Richard Murray <mu...@dn...net> + + * src/lti.py (timebase): new function to return timebase. Doesn't + yet handle the case where dt == None. + +2012-10-07 Richard Murray <murray@altura.local> + + * src/matlab.py (c2d): MATLAB compatible function (just calls + sample_system) + + * tests/discrete_test.py (TestDiscrete.test_sample_system): unit + test for sampling + + * src/dtime.py (sample_system, _c2dmatched): new functions, based on + contributiosn from Benjamin White + + * src/dtime.py: added back this file, this time with sampling routes + to convert from continuous to discrete time + + * src/timeresp.py (forced_response): added discrete time simulator, + using dlsim from scipy.signal + +2012-10-07 Richard Murray <murray@altura.local> + + * doc/conf.py: fixed release number (0.6a instead of 0.6c) + + * src/__init__.py: moved timebase functions from dtime to lti + + * src/lti.py: moved isdtime, isctime, timebase, and timebaseEqual + from dtime.py to lti.py. Moved initialization of dt to + Lti.__init__(). + + * src/statesp.py (StateSpace.__init__): Moved dt + initialization to Lti object initialization + + * src/xferfcn.py (TransferFunction.__init__): Moved dt + initialization to Lti object initialization + +2012-10-06 Richard Murray <murray@altura.local> + + * tests/discrete_test.py: added additional tests for dt = True cases + + * src/statesp.py (StateSpace.__str__): show sampling time as + 'unspecified' if dt is a boolean and equal to True + + * src/xferfcn.py (TransferFunction.__str__): don't print sampling + time (dt) if dt = True (discrete time with unspecified time base) + + * src/dtime.py: added code to support dt = True for unspecified + sampling time for a discrete time system + + * src/bdalg.py: much -> must in docstrings + +2012-10-06 Richard Murray <murray@altura.local> + + * src/dtime.py: new module with functions for operating on discrete + time systems + + * src/modelsimp.py: added NotImplementedError for discrete time + * src/freqplot.py: added NotImplementedError for discrete time + + * src/bdalg.py: added documentation about timebases (discrete versus + continuous) + + * src/statesp.py (_mimo2siso): include sampling time + + * src/xferfcn.py (TransferFunction.__str__): added optional var + keyword to allow any symbol to be used + + * src/matlab.py (tf2ss): added code required to keep track of dt + + * src/xferfcn.py (TransferFunction.__str__): added additional string for + discrete time system, plus use 'z' for polynomial variable + (TransferFunction.__neg__): set sampling time for negation + (TransferFunction.__add__): added test for same sampling time + (TransferFunction.__mul__): added test for same sampling time + (TransferFunction.__div__): added test for same sampling time + (TransferFunction.feedback): added test for same sampling time + + * src/statesp.py (StateSpace.__str__): added additional string for + discrete time system + (StateSpace.__add__): added test for same sampling time + (StateSpace.__mul__): added test for same sampling time + (StateSpace.__rmul__): set sampling time for product + (StateSpace.__neg__): set sampling time for negation + (StateSpace.feedback): added test for same sampling time + + * tests/discrete_test.py (TestDiscrete): unit tests for discrete + time systems + + * src/xferfcn.py (TransferFunction.__init__): added dt class + variable for discrete time systems + + * src/statesp.py (StateSpace.__init__): added dt class variable for + discrete time systems + +---- control-0.5c released ----- + +2012-10-03 Richard Murray <murray@altura.local> + + * tests/matlab_test.py (TestMatlab.testSsdata): unit test + + * src/matlab.py (ssdata, tfdata): new functions to return state + space and transfer function object data. For transfer functions, + currenly requires SISO system + + * src/freqplot.py (bode_plot): Adding np.atleast_1d to the + np.squeeze calculations makes it possible to use a single value + frequency list (contributed by Benjamin White) + +2012-09-09 Richard Murray <murray@altura.local> + + * tests/statefbk_test.py (TestStatefbk.testAcker): unit test + + * src/statefbk.py (acker): added acker() from Roberto Bucher. + +2012-08-29 Richard Murray <murray@altura.local> + + * src/xferfcn.py (TransferFunction._common_den): fixed up code for + case where poles have multiplicity > 1. Set end limits of check to + avoid overruning the list + combine complex conjugate pole pairs + from the outside in to prevent small errors from growing. + +2012-08-26 Richard Murray <murray@altura.local> + + * tests/convert_test.py (TestConvert.testConvert): replaced previous + test of transfer function coefficients with a frequency response + test. This is necessary because various degenerate conditions will + generate a situation where the transfer functions are of different + forms but still equal. Eg 0/1 = 1e-17 s + 1e-16 / (s^2 + s + 1). + Still getting errors, but looks like actual problem in conversion. + + * src/statesp.py (_mimo2siso): set default value for warn_conversion + to False + + * tests/convert_test.py (TestConvert.testConvert): Added check to + make sure that we don't create problems with uncontrollable or + unobservable systems. + +2012-08-25 Richard Murray <murray@altura.local> + + * src/xferfcn.py (TransferFunction._common_den): identified bug in + the way that common denominators are computed; see comments in code + regarding complex conjugate pairs. + + * src/statefbk.py (place): repalced nd.size(placed_eigs) with + len(placed_eigs) to fix intermittent problems pointed out by Roberto + Bucher in control-0.3c. + + * tests/rlocus_test.py (TestRootLocus.testRootLocus): added sort() + to test to get rid of problems in which ordering was generating an + error. + + * src/freqplot.py (nyquist_plot): added code from Kevin Davies to + label frequency points in Nyquist plot + + * src/__init__.py: import non-conflicting MATLAB functions by default + + * src/freqplot.py (bode_plot, nyquist_plot): simplified code and + removed unneeded options. To set color, linestyle, etc use keywords + and pass to matplotlib. + +2012-08-24 Richard Murray <murray@altura.local> + + * src/freqplot.py: added in plot enhancements from Kevin Davies + (bode_plot): pass optional arguments and keywords to matplotlib + (get_pow1000): new function for determinine engineering exponent + (gen_prefix): new function to get SI prefix for power of 1000 + + * src/freqplot.py (bode_plot): removed extraneous phase_deg calculation + +2012-01-07 Richard Murray <murray@malabar.local> + + * doc/modules.rst: added new sections for analysis, synthesis, + frequency plots and time response. + + * doc/index.rst (Contents): added modules and examples. + + * src/xferfcn.py (_convertToTransferFunction): added check for + slycot import error. If not present, use signal.lti to perform the + conversion. Only works for SISO. + + * src/statesp.py (_convertToStateSpace): added check for slycot + import error, to allow basic functionality without the presence of + slycot (contributed by Ryan Krauss). + + * tests/slycot_convert_test.py (TestSlycot.testTF): moved slycot + import into test function, so that test script still works even if + time response is not present. + +2011-08-09 Richard Murray <murray@malabar.local> + + * src/timeresp.py: fixed doc reference to time-series-convention + +2011-08-08 Richard Murray <murray@malabar.local> + + * doc/index.rst, doc/modules.rst: Moved MATLAB section into + python-control modules file + +2011-08-07 Richard Murray <murray@malabar.local> + + * doc/conf.py: added autosummary extension + + * doc/timeresp.rst: New file containing listing of functions for + time responses (step, initial, etc) + + * doc/freqplot.rst: New file listing functions for frequency + plots (bode, nyquist, etc) + + * doc/modules.rst: New file that contains a listing of the major + modules in the toolbox + + * doc/index.rst (Contents): Rearranged contents to put modules + documentation in a separate section. Also added examples section + (not quite ready yet). + +2011-08-07 Richard Murray <murray@malabar.local> + + * examples/rss-balred.py: reordered outputs from call to matlab.step + (missed this the first time around) + + * doc/matlab_strings.rst: Matlab -> MATLAB (proper spelling) + + * setup.py, doc/conf.py: updated version to 0.5b + +2011-08-07 Richard Murray <murray@malabar.local> + + * doc/conf.py: Updated version numbers to 0.5a, regenerated + documentation and reposted on web (note that 0.5a tag and source + distribution have this wrong) + +---- control-0.5a released ----- + +2011-08-07 Richard Murray <murray@malabar.local> + + * setup.py: updated version number; next release will be 0.5a since + the changes in function names and argument/return value order (for + time reponses) require small updates in code + + * examples/secord-matlab.py, examples/pvtol-nested-ss.py, + examples/test-response.py, examples/pvtol-nested.py: fixed small bug + in order of output arguments for step command + +2011-08-06 Richard Murray <murray@malabar.local> + + * src/matlab.py (ngrid): copy documentation from nichols_grid + + * src/__init__.py: changed import commands to import specific + functions rather than '*' (better modularity) + + * src/freqplot.py: default function names are now bode_plot, + nyquist_plot and gangof4_plot (still with aliases to non-"_plot" + versions) + + * src/nichols.py (nichols_plot): updated nichols to nichols_plot for + consistency with other python-control plotting functions. Set up + alias for original name + + * src/margins.py: StabilityMargins, PhaseCrossoverFrequencies -> + stability_margins, phase_crossover_frequencies + + * src/phaseplot.py: changed PhasePlot and boxgrid to phase_plot, + box_grid + + * src/timeresp.py: changed ForcedReponse, InitialReponse, + ImpulseReponse and StepResponse to forced_response, + initial_response, impulse_response and step_response. + + * src/rlocus.py: changed RootLocus to root_locus for better + compatability with PEP 8. Also updated unit tests and examples. + +2011-07-25 Richard Murray <murray@malabar.local> + + * tests/phaseplot_test.py: updated unit tests to use new call + signatures + + * examples/phaseplots.py: updated calls to PhasePlot to use new + argument structure + + * src/phaseplot.py (PhasePlot): Updated call signature to be + more pythonic and fixed up documentation. + + * examples/genswitch.py (genswitch): added new example showing + PhasePlot functionality + + * src/phaseplot.py (boxgrid): added function to compute initial + conditions around the edges of a box + +2011-07-24 Richard Murray <murray@malabar.local> + + * tests/margin_test.py: added simple unit tests for margin functions + (initial versions just call functions; some comparisons missing) + + * examples/README: added missing README file + + * examples/phaseplots.py: FBS examples for phaseplot + + * tests/phaseplot_test.py: unit tests for phaseplot + + * src/phaseplot.py: initial cut at phase portrait function, built + from amphaseplot (Feeback Systems [FBS], Astrom and Murray, 2008) + +2011-07-15 Richard Murray <murray@malabar.local> + + * tests/matlab_test.py (TestMatlab): added unittest for margin() + commands (calling format only) + + * src/statesp.py (StateSpace): updated comments + + * tests/margin_test.py: set up unit tests for StabilityMargins() and + PhaseCrossoverFrequencies() + + * src/__init__.py: added margins.py to __init__ + +2011-07-14 Richard Murray <murray@malabar.local> + + * src/margins.py (GainPhaseMargin): moved freqplot.MarginPlot to + margin.StabilityMargins (MarginPlot didn't actually plot anything) + + * src/margins.py (PhaseCrossoverFrequencies): added new function to + compute frequencies that we cross real axis. Contributed by Steffen + Waldherr <wal...@is...> + +2011-07-11 Richard Murray <murray@malabar.local> + + * src/rlocus.py: added real() and imag() to list of functions + imported from numpy + + * src/freqplot.py: renamed plotting functions to BodePlot, + NyquistPlot, GangOf4Plot and MarginPlot. Set up aliases to the more + common names (bode, nyquest, gangof4, margin). Mainly playing + around with idea for the eventual interface to use. + + * tests/matlab_test.py: updated timeresp outputs to match MATLAB + + * src/matlab.py (impulse, initial, lsim, step): switched outputs + from step, impulse, initial, lsim to match MATLAB standard + +2011-07-01 Richard Murray <murray@malabar.local> + + * src/rlocus.py: modified scipy import to only import those + functions that we actually use. This fixes a problem pointed out by + Carsten Knoll (TU Dresden) where control.place could be overwritten + by numpy.place (because of an "from scipy import *" in rlocus.py + + * doc/intro.rst: Added link to scipy web page talking about the + differences between numpy and MATLAB (contributed by Shuo Han). + +2011-06-25 Richard Murray <murray@malabar.local> + + * src/xferfcn.py (TransferFunction._common_den): changed tolerance + for detecting complex valued poles to a user-settable parameter, + with default value 1e-8. This was an attempt to fix errors in the + convert_test.py unittest script (conversion routine was + misclassifying some poles as imaginary when they weren't). + + * src/xferfcn.py (_convertToTransferFunction): converted arguments + to tb04ad to numpy arrays; fixes a unit test error in convert_test.py. + + * src/statefbk.py (gram): convert system matrix passed to sb03md to + numpy array; this fixes a unit test error in modelsimp_test.py. + + * src/matlab.py (impulse): got rid of X0 argument for impulse + response (not implemented in MATLAB). + + * doc/intro.rst: added some quick start information + + * src/matlab.py: added documentation for step, impulse, initial, lsim + + * src/timeresp.py: fixed some MATLAB specific function names in + function doc strings + +2011-06-22 Richard Murray <murray@malabar.local> + + * doc/intro.rst: fixed some small types + + * doc/control.tex: removed (no longer needed) + +2011-06-22 Richard Murray <murray@malabar.local> + + * doc/intro.rst: Added a slightly more general introduction, with a + pointer to the python-control wiki (on sf.net) + + * doc/Makefile: Changed path to sphinx-build to assume it is in the + users path (as opposed to an explicit path) + + * doc/conf.py: Added release information into documentation file + +2011-06-21 Richard Murray <murray@malabar.local> + + * src/statesp.py (_mimo2siso): Moved function from matlab.py. + + * src/timeresp.py: added file documentation + split out and updated + copyright info. Small corrections to documentation. + (InitialResponse): Added missing transpose argument in call to + ForcedResponse + + * src/matlab.py: minor changes to documentation to avoid line wraps + on standard (80 col) terminal window + + * src/matlab.py: removed time-series convention documentation from + matlab.py since current MATLAB version uses standard conventions. + This documenta... [truncated message content] |
From: <mur...@us...> - 2012-11-03 22:51:30
|
Revision: 226 http://sourceforge.net/p/python-control/code/226 Author: murrayrm Date: 2012-11-03 22:51:28 +0000 (Sat, 03 Nov 2012) Log Message: ----------- updated documentation for 0.6c release Modified Paths: -------------- trunk/ChangeLog trunk/doc/analysis.rst trunk/doc/bdalg_strings.rst trunk/doc/class_strings.rst trunk/doc/freqplot.rst trunk/doc/index.rst trunk/doc/intro.rst trunk/doc/modsimp_strings.rst trunk/doc/modules.rst trunk/doc/synthesis.rst trunk/doc/timeresp.rst trunk/src/bdalg.py trunk/src/lti.py trunk/src/statesp.py Added Paths: ----------- trunk/doc/utilities.rst Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/ChangeLog 2012-11-03 22:51:28 UTC (rev 226) @@ -1,5 +1,18 @@ 2012-11-03 Richard Murray <murray@altura.local> + * doc/modules.rst: updated documentation format so that items are + broken down by functionality and not internal module name. Still + not complete, but most functions should now show up in documentation. + + * doc/index.rst: got rid of todos from documentation (not formatted + correctly and shouldn't show up in user documentation) + + * src/lti.py: added missing docstrings + + * doc/intro.rst: small tweaks to text, including adding a link to FBS + +2012-11-03 Richard Murray <murray@altura.local> + * src/rlocus.py (_RLSortRoots): convert output of range() to explicit list for python 3 compatability Modified: trunk/doc/analysis.rst =================================================================== --- trunk/doc/analysis.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/analysis.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -1,2 +1,22 @@ Control System Analysis -*********************** \ No newline at end of file +*********************** + +.. autofunction:: control.acker +.. autofunction:: control.ctrb +.. autofunction:: control.care +.. autofunction:: control.dare +.. autofunction:: control.dlyap +.. autofunction:: control.dcgain +.. autofunction:: control.evalfr +.. autofunction:: control.gram +.. autofunction:: control.lyap +.. autofunction:: control.freqresp +.. autofunction:: control.margin +.. autofunction:: control.markov +.. autofunction:: control.obsv +.. autofunction:: control.phase_crossover_frequencies +.. autofunction:: control.pole +.. autofunction:: control.root_locus +.. autofunction:: control.stability_margins +.. autofunction:: control.zero + Modified: trunk/doc/bdalg_strings.rst =================================================================== --- trunk/doc/bdalg_strings.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/bdalg_strings.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -3,5 +3,7 @@ .. toctree:: -.. automodule:: bdalg - :members: +.. autofunction:: control.feedback +.. autofunction:: control.negate +.. autofunction:: control.parallel +.. autofunction:: control.series Modified: trunk/doc/class_strings.rst =================================================================== --- trunk/doc/class_strings.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/class_strings.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -1,6 +1,11 @@ Python-Control Classes ********************** +LTI System Class +================ +.. automodule:: lti + :members: + State Space Class ================= .. automodule:: statesp Modified: trunk/doc/freqplot.rst =================================================================== --- trunk/doc/freqplot.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/freqplot.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -5,10 +5,10 @@ Plotting routines ================= -.. autofunction:: freqplot.bode_plot -.. autofunction:: freqplot.nyquist_plot -.. autofunction:: freqplot.gangof4_plot -.. autofunction:: nichols.nichols_plot +.. autofunction:: control.bode_plot +.. autofunction:: control.nyquist_plot +.. autofunction:: control.gangof4_plot +.. autofunction:: control.nichols_plot Utility functions ================= Modified: trunk/doc/index.rst =================================================================== --- trunk/doc/index.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/index.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -17,17 +17,13 @@ :maxdepth: 2 intro - class_strings modules + class_strings + matlab_strings examples Indices and tables ================== * :ref:`genindex` -* :ref:`modindex` * :ref:`search` - ----------------------------------- - -.. todolist:: Modified: trunk/doc/intro.rst =================================================================== --- trunk/doc/intro.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/intro.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -10,14 +10,14 @@ Overview of the Toolbox ----------------------- -The python-control package is a set of python classes and functions -that implement common operations for the analysis and design of -feedback control systems. The initial goal is to implement all of the -functionality required to work through the examples in the textbook -Feedback Systems by Astrom and Murray. A MATLAB compatibility package -(control.matlab) is available that provides many of the common -functions corresponding to commands available in the MATLAB Control -Systems Toolbox. +The python-control package is a set of python classes and functions that +implement common operations for the analysis and design of feedback control +systems. The initial goal is to implement all of the functionality required +to work through the examples in the textbook `Feedback Systems +<http://www.cds.caltech.edu/~murray/FBSwiki>`_ by Astrom and Murray. A +MATLAB compatibility package (control.matlab) is available that provides +many of the common functions corresponding to commands available in the +MATLAB Control Systems Toolbox. In addition to the documentation here, there is a project wiki that contains some additional information about how to use the package @@ -37,10 +37,9 @@ * You must include commas in vectors. So [1 2 3] must be [1, 2, 3]. * Functions that return multiple arguments use tuples -* Can't use braces for collections; use tuples instead -* Transfer functions are only implemented for SISO systems (due to - limitations in the underlying signals.lti class); use state space - representations for MIMO systems. +* You cannot use braces for collections; use tuples instead +* Transfer functions are currently only implemented for SISO systems; use + state space representations for MIMO systems. Getting Started --------------- @@ -52,15 +51,16 @@ 3. To see if things are working correctly, run ipython -pylab and run the script 'examples/secord-matlab.py'. This should generate a step response, Bode plot and Nyquist plot for a simple second order - system. + system. (For more detailed tests, run nosetests in the main directory.) 4. To see the commands that are available, run the following commands in ipython:: >>> import control - >>> ?control.matlab + >>> ?control 5. If you want to have a MATLAB-like environment for running the control toolbox, use:: >>> from control.matlab import * + >>> ?control.matlab Modified: trunk/doc/modsimp_strings.rst =================================================================== --- trunk/doc/modsimp_strings.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/modsimp_strings.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -1,5 +1,6 @@ Model Simplification Tools ************************** -.. automodule:: modelsimp - :members: +.. autofunction:: control.balred +.. autofunction:: control.hsvd +.. autofunction:: control.modred Modified: trunk/doc/modules.rst =================================================================== --- trunk/doc/modules.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/modules.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -1,12 +1,13 @@ -Python-Control Modules -********************** +Python-Control Functions +************************ .. toctree:: + creation bdalg_strings analysis freqplot timeresp synthesis modsimp_strings - matlab_strings + utilities Modified: trunk/doc/synthesis.rst =================================================================== --- trunk/doc/synthesis.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/synthesis.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -1,2 +1,5 @@ Control System Synthesis -************************ \ No newline at end of file +************************ + +.. autofunction:: control.lqr +.. autofunction:: control.place Modified: trunk/doc/timeresp.rst =================================================================== --- trunk/doc/timeresp.rst 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/doc/timeresp.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -1,8 +1,13 @@ Time Domain Simulation ********************** -.. automodule:: timeresp - :members: +Time responses +============== +.. autofunction:: control.forced_response +.. autofunction:: control.initial_response +.. autofunction:: control.step_response +Phase portraits +=============== .. autofunction:: phaseplot.phase_plot .. autofunction:: phaseplot.box_grid Added: trunk/doc/utilities.rst =================================================================== --- trunk/doc/utilities.rst (rev 0) +++ trunk/doc/utilities.rst 2012-11-03 22:51:28 UTC (rev 226) @@ -0,0 +1,4 @@ +Utility Functions +***************** + +.. autofunction:: control.unwrap Modified: trunk/src/bdalg.py =================================================================== --- trunk/src/bdalg.py 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/src/bdalg.py 2012-11-03 22:51:28 UTC (rev 226) @@ -204,7 +204,7 @@ parallel Notes - ---- + ----- This function is a wrapper for the feedback function in the StateSpace and TransferFunction classes. It calls TransferFunction.feedback if `sys1` is a TransferFunction object, and StateSpace.feedback if `sys1` is a StateSpace Modified: trunk/src/lti.py =================================================================== --- trunk/src/lti.py 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/src/lti.py 2012-11-03 22:51:28 UTC (rev 226) @@ -1,7 +1,7 @@ """lti.py -The lti module contains the Lti parent class to the child classes StateSpace and -TransferFunction. It is designed for use in the python-control library. +The Lti module contains the Lti parent class to the child classes StateSpace +and TransferFunction. It is designed for use in the python-control library. Routines in this module: @@ -13,7 +13,6 @@ """ class Lti: - """Lti is a parent class to linear time invariant control (LTI) objects. Lti is the parent to the StateSpace and TransferFunction child @@ -90,7 +89,16 @@ # Check to see if two timebases are equal def timebaseEqual(sys1, sys2): - # TODO: add docstring + """Check to see if two systems have the same timebase + + timebaseEqual(sys1, sys2) + + returns True if the timebases for the two systems are compatible. By + default, systems with timebase 'None' are compatible with either + discrete or continuous timebase systems. If two systems have a discrete + timebase (dt > 0) then their timebases must be equal. + """ + if (type(sys1.dt) == bool or type(sys2.dt) == bool): # Make sure both are unspecified discrete timebases return type(sys1.dt) == type(sys2.dt) and sys1.dt == sys2.dt @@ -102,7 +110,17 @@ # Check to see if a system is a discrete time system def isdtime(sys, strict=False): - # TODO: add docstring + """ + Check to see if a system is a discrete time system + + Parameters + ---------- + sys : LTI system + System to be checked + strict: bool (default = False) + If strict is True, make sure that timebase is not None + """ + # Check to see if this is a constant if isinstance(sys, (int, float, complex)): # OK as long as strict checking is off @@ -122,7 +140,17 @@ # Check to see if a system is a continuous time system def isctime(sys, strict=False): - # TODO: add docstring + """ + Check to see if a system is a continuous time system + + Parameters + ---------- + sys : LTI system + System to be checked + strict: bool (default = False) + If strict is True, make sure that timebase is not None + """ + # Check to see if this is a constant if isinstance(sys, (int, float, complex)): # OK as long as strict checking is off Modified: trunk/src/statesp.py =================================================================== --- trunk/src/statesp.py 2012-11-03 21:03:39 UTC (rev 225) +++ trunk/src/statesp.py 2012-11-03 22:51:28 UTC (rev 226) @@ -1,11 +1,10 @@ -# -*- coding: utf-8 -*- -"""stateSpace.py +"""statesp.py State space representation and functions. -This file contains the StateSpace class, which is used to represent -linear systems in state space. This is the primary representation -for the python-control library. +This file contains the StateSpace class, which is used to represent linear +systems in state space. This is the primary representation for the +python-control library. Routines in this module: @@ -73,7 +72,6 @@ Revised: Kevin K. Chen, Dec 10 $Id$ - """ from numpy import all, angle, any, array, asarray, concatenate, cos, delete, \ @@ -88,7 +86,6 @@ from control.lti import Lti, timebaseEqual, isdtime class StateSpace(Lti): - """The StateSpace class represents state space instances and functions. The StateSpace class is used throughout the python-control library to |
From: <mur...@us...> - 2012-11-03 21:03:42
|
Revision: 225 http://sourceforge.net/p/python-control/code/225 Author: murrayrm Date: 2012-11-03 21:03:39 +0000 (Sat, 03 Nov 2012) Log Message: ----------- Many small updates to make compatible with python 3.x: * Updated unit tests to skip certain tests if slycot is not installed * Fixed some problems with timebase (dt) to avoid comparing None to int * Fixed exception syntax in a few more spots (E, T to E(T)) * Fixed print syntax in a few more spots (backward compatible with 2.6+) * Updated FRD to include python 3.x fixes installed in other modules * tests/test_*.py scripts not working in 3.x, but individual tests OK * Current version works with nosetests in py2.7, py3.2 ( |
From: <mur...@us...> - 2012-11-03 17:38:06
|
Revision: 224 http://sourceforge.net/p/python-control/code/224 Author: murrayrm Date: 2012-11-03 17:38:02 +0000 (Sat, 03 Nov 2012) Log Message: ----------- Modified ChangeLog and README file to test out post-commit hooks. If things are set up correctly, this message should go to the python-control-discuss mailing list. Modified Paths: -------------- README trunk/ChangeLog Modified: README =================================================================== --- README 2012-11-03 05:28:38 UTC (rev 223) +++ README 2012-11-03 17:38:02 UTC (rev 224) @@ -2,10 +2,10 @@ RMM, 23 May 09 This directory contains the top level directory for the Python Control -Systems Library (python-control). This library is still under -development, but is intended to serve as a wrapper for standard -control system algorithms in the python programming environment. +Systems Library (python-control). - trunk/ latest code; still under development + branches/ various branches of the code, as needed tags/ releases and other stable copies - branches/ various branches of the code, as needed + trunk/ latest code + web/ project website pages + Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2012-11-03 05:28:38 UTC (rev 223) +++ trunk/ChangeLog 2012-11-03 17:38:02 UTC (rev 224) @@ -1,3 +1,7 @@ +2012-11-03 Richard Murray <murray@altura.local> + + * ../README: updated readme file as a test of post-commit hook + 2012-11-02 Richard Murray <murray@altura.local> * doc/conf.py, setup.py: updated version number to 0.6c |
From: Richard M. <mu...@cd...> - 2012-11-03 05:27:47
|
Rene: I've re-integrated your FRD branch into trunk. Unit tests seem to be working. Version number is now 0.6c. This is all sitting on top of the changes that I made for to try to help with python 3 testing. Unit tests all run. See ChangeLog for small changes I made when integrating. I left your branch in place for now. There was a scratch directory that I wasn't sure if you needed or not. If everything looks OK to you in the merge, OK to delete the branch and we can do future tweaking in trunk. FRD class header attached below so that others can see what is implemented. Thanks for the great contribution! -richard """The FRD class represents (measured?) frequency response TF instances and functions. The FRD class is derived from the Lti parent class. It is used throughout the python-control library to represent systems in frequency response data form. The main data members are 'omega' and 'frdata'. omega is a single array with the frequency points of the response. frdata is a list of arrays containing frequency points (in rad/s) and gain data as a complex number. For example, >>> frdata[2][5] = numpy.array([1., 0.8-0.2j, 0.2-0.8j]) means that the frequency response from the 6th input to the 3rd output at the frequencies defined in omega is set to the array above, i.e. the rows represent the outputs and the columns represent the inputs. |
From: Richard M. <mu...@cd...> - 2012-11-03 05:22:47
|
Luke: I've made a bunch of small changes that make things more compatible with python 3.x. I did some (limited) testing with python 3.2 and I am able to run individual unit tests (the test_all.py function isn't working yet). I didn't need to run 2to3; it runs native. Haven't tested examples, etc. I tagged the pre-python 3 version as v0.6a and the post python 3 version as v0.6b. I've also integrated Rene's FRD branch into trunk (will send a separate note on that right after this). -richard On 31 Oct 2012, at 21:06 , Richard Murray <mu...@cd...> wrote: > Great references. I read them briefly and there are some clear things to try. If understand it right, one fix is what Scott suggested (most the imports inside the functions), but there are other things to try. It looks like part of the problem is that 2to3 creates relative imports, but not sure. In any case, I know have a good starting point. I think what I'll need to do is get python 3.x running so that I can definitively test that things are working. > > Won't have time to look at this until Friday, earliest. For sure over the weekend. > > -richard > > On 31 Oct 2012, at 21:01 , Dale Lukas Peterson <haz...@gm...> wrote: > >> I just Googled "python package import best practices" and found this: >> >> http://docs.python.org/3.4/faq/programming.html#what-are-the-best-practices-for-using-import-in-a-module >> >> I don't know that there are any differences between the >> recommendations for Python 3.x vs. 2.x, but for what it is worth here >> is the same page but for Python 2.7.3 (they might be identical, I'm >> not sure): >> >> http://docs.python.org/2.7/faq/programming.html#what-are-the-best-practices-for-using-import-in-a-module >> >> In particular they give the advice "Never use relative package >> imports". There is also good information there regarding how to avoid >> circular dependencies, which is exactly the issue with the current >> code. >> >> Luke >> >> On Wed, Oct 31, 2012 at 11:28 AM, Dale Lukas Peterson >> <haz...@gm...> wrote: >>>> import loops: if you have a chance, Luke, can you try out Scott's change >>>> and see if it works on python 3. I'll try to install it over the weekend >>>> and try it myself, but would be good to get another check. >>> >>> I applied Scott's change to revision 211, then ran: >>> $ find . -name "*.py" -exec 2to3 -w {} \; >>> >>> Then I built and installed it and when I import it, it gives me this error: >>> 11:17:33 ~$ python >>> Python 3.2.3 (default, Sep 30 2012, 09:06:04) >>> [GCC 4.6.3] on linux2 >>> Type "help", "copyright", "credits" or "license" for more information. >>>>>> import control >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File >>> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py", >>> line 60, in <module> >>> from .bdalg import series, parallel, negate, feedback >>> File >>> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py", >>> line 55, in <module> >>> from . import xferfcn as tf >>> File >>> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py", >>> line 84, in <module> >>> from .statesp import StateSpace >>> File >>> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py", >>> line 85, in <module> >>> from .xferfcn import TransferFunction >>> ImportError: cannot import name TransferFunction >>>>>> >>> >>> So 2to3 is converting "from xferfcn import TransferFunction" to "from >>> .xferfcn import TransferFunction", which for some reason does not work. I >>> think the reason it does not work has to do with the __init__.py file as >>> well as the __all__ variable not being set in each module (i.e., statesp.py >>> and xferfcn.py). >>> >>>>> Is anyone ensuring that running the 2to3 tool is sufficient for use of >>>>> python-control with Python 3, or otherwise working on a script that makes >>>>> necessary changes? >>> >>> I have apparently verified that it isn't. Sympy uses a script called >>> "use2to3" which runs 2to3 on most (but not all) of the source python files >>> and generates a new source tree in a folder called "py3k-sympy" that >>> contains the converted files. You then build and install sympy from that >>> folder using python3. You can see how they do it here: >>> >>> https://github.com/sympy/sympy/blob/master/bin/use2to3 >>> >>>>> While that design pattern is nice, it may not yet be warranted for >>>>> python-control, which is contained entirely in a single directory with no >>>>> subpackages. The simplest change I see to avoid the import error you found >>>>> is below (given as diff output). >>> >>> True. I'm not certain what the "best" way to do this is either, I just know >>> what has worked for me in another project across many different versions of >>> Python. >>> >>> Luke >> >> >> >> -- >> “People call me a perfectionist, but I'm not. I'm a rightist. I do >> something until it's right, and then I move on to the next thing.” >> ― James Cameron >> >> ------------------------------------------------------------------------------ >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_sfd2d_oct >> _______________________________________________ >> python-control-discuss mailing list >> pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |
From: Richard M. <mu...@cd...> - 2012-11-02 16:29:03
|
Great! In that case, if you have time, why don't you go ahead and merge your changes into trunk now (since they are largely orthogonal), then I can spend some time this weekend integrating my new (python 3) changes. -richard On 2 Nov 2012, at 9:26 , Rene van Paassen <ren...@gm...> wrote: > I already did a trial merge on a trunk I checked out, and that worked without a glitch > > On 2 November 2012 17:25, Richard Murray <mu...@cd...> wrote: > Hi Rene. Let me try to have a quick look at the branch today or tomorrow, then I can send you a note and we can work on the merge. > > There have been some changes since 0.5c (we are now at 0.6a) that may make the integration a little bit "interesting". The main one is the "timebase" class variable 'dt', used to distinguish discrete and continuous time systems. In addition, I have been doing small changes throughout to try to make things more compatible with python 3. > > Also (for everyone on the list): I'm going to re-establish the commit-hooks so that e-mail goes to this list when changes get committed to the repository. > > I'll send you an e-mail after I have had a look. > > -richard > > On 2 Nov 2012, at 5:03 , Rene van Paassen <ren...@gm...> wrote: > > > Hello, > > > > I think I have got a workable frequency response data object added. I also added a test file in the tests directory. > > > > For now, the frequency vectors of different FRD objects need to match; no interpolation / clipping yet. > > > > I also modified both StateSpace and TransferFunction to be combinable with matrix-like objects in feedback, multiplication, etcetera, so now something like > > > > sys.feedback([[0.1, 0.3],[0.0, 1.0]]) > > > > will work, given an 2 input 2 output system. > > > > Shall I merge into the trunk, or does anyone want to check first? The frd branch (based on 0.5c) is located at > > > > svn+ssh://svn.code.sf.net/p/python-control/code/branches/add-frd > > > > -- > > René van Paassen | ______o____/_| Ren...@gm... > > <[___\_\_-----< t: +31 15 2628685 > > | o' mobile: +31 6 39846891 > > > > > > ------------------------------------------------------------------------------ > > LogMeIn Central: Instant, anywhere, Remote PC access and management. > > Stay in control, update software, and manage PCs from one command center > > Diagnose problems and improve visibility into emerging IT issues > > Automate, monitor and manage. Do more in less time with Central > > http://p.sf.net/sfu/logmein12331_d2d_______________________________________________ > > python-control-discuss mailing list > > pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > > ------------------------------------------------------------------------------ > LogMeIn Central: Instant, anywhere, Remote PC access and management. > Stay in control, update software, and manage PCs from one command center > Diagnose problems and improve visibility into emerging IT issues > Automate, monitor and manage. Do more in less time with Central > http://p.sf.net/sfu/logmein12331_d2d > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > > > -- > René van Paassen | ______o____/_| Ren...@gm... > <[___\_\_-----< t: +31 15 2628685 > | o' mobile: +31 6 39846891 > > > ------------------------------------------------------------------------------ > LogMeIn Central: Instant, anywhere, Remote PC access and management. > Stay in control, update software, and manage PCs from one command center > Diagnose problems and improve visibility into emerging IT issues > Automate, monitor and manage. Do more in less time with Central > http://p.sf.net/sfu/logmein12331_d2d_______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |
From: Rene v. P. <ren...@gm...> - 2012-11-02 16:26:45
|
I already did a trial merge on a trunk I checked out, and that worked without a glitch On 2 November 2012 17:25, Richard Murray <mu...@cd...> wrote: > Hi Rene. Let me try to have a quick look at the branch today or tomorrow, > then I can send you a note and we can work on the merge. > > There have been some changes since 0.5c (we are now at 0.6a) that may make > the integration a little bit "interesting". The main one is the "timebase" > class variable 'dt', used to distinguish discrete and continuous time > systems. In addition, I have been doing small changes throughout to try to > make things more compatible with python 3. > > Also (for everyone on the list): I'm going to re-establish the > commit-hooks so that e-mail goes to this list when changes get committed to > the repository. > > I'll send you an e-mail after I have had a look. > > -richard > > On 2 Nov 2012, at 5:03 , Rene van Paassen <ren...@gm...> > wrote: > > > Hello, > > > > I think I have got a workable frequency response data object added. I > also added a test file in the tests directory. > > > > For now, the frequency vectors of different FRD objects need to match; > no interpolation / clipping yet. > > > > I also modified both StateSpace and TransferFunction to be combinable > with matrix-like objects in feedback, multiplication, etcetera, so now > something like > > > > sys.feedback([[0.1, 0.3],[0.0, 1.0]]) > > > > will work, given an 2 input 2 output system. > > > > Shall I merge into the trunk, or does anyone want to check first? The > frd branch (based on 0.5c) is located at > > > > svn+ssh://svn.code.sf.net/p/python-control/code/branches/add-frd > > > > -- > > René van Paassen | ______o____/_| Ren...@gm... > > <[___\_\_-----< t: +31 15 2628685 > > | o' mobile: +31 6 39846891 > > > > > > > ------------------------------------------------------------------------------ > > LogMeIn Central: Instant, anywhere, Remote PC access and management. > > Stay in control, update software, and manage PCs from one command center > > Diagnose problems and improve visibility into emerging IT issues > > Automate, monitor and manage. Do more in less time with Central > > > http://p.sf.net/sfu/logmein12331_d2d_______________________________________________ > > python-control-discuss mailing list > > pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > > > ------------------------------------------------------------------------------ > LogMeIn Central: Instant, anywhere, Remote PC access and management. > Stay in control, update software, and manage PCs from one command center > Diagnose problems and improve visibility into emerging IT issues > Automate, monitor and manage. Do more in less time with Central > http://p.sf.net/sfu/logmein12331_d2d > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss > -- René van Paassen | ______o____/_| Ren...@gm... <[___\_\_-----< t: +31 15 2628685 | o' mobile: +31 6 39846891 |
From: Rene v. P. <ren...@gm...> - 2012-11-02 16:25:33
|
As an extra, I also implemented minreal for TransferFunction On 2 November 2012 13:03, Rene van Paassen <ren...@gm...>wrote: > Hello, > > I think I have got a workable frequency response data object added. I also > added a test file in the tests directory. > > For now, the frequency vectors of different FRD objects need to match; no > interpolation / clipping yet. > > I also modified both StateSpace and TransferFunction to be combinable with > matrix-like objects in feedback, multiplication, etcetera, so now something > like > > sys.feedback([[0.1, 0.3],[0.0, 1.0]]) > > will work, given an 2 input 2 output system. > > Shall I merge into the trunk, or does anyone want to check first? The frd > branch (based on 0.5c) is located at > > svn+ssh://svn.code.sf.net/p/python-control/code/branches/add-frd > > -- > René van Paassen | ______o____/_| Ren...@gm... > <[___\_\_-----< t: +31 15 2628685 > | o' mobile: +31 6 39846891 > > > -- René van Paassen | ______o____/_| Ren...@gm... <[___\_\_-----< t: +31 15 2628685 | o' mobile: +31 6 39846891 |
From: Richard M. <mu...@cd...> - 2012-11-02 16:25:24
|
Hi Rene. Let me try to have a quick look at the branch today or tomorrow, then I can send you a note and we can work on the merge. There have been some changes since 0.5c (we are now at 0.6a) that may make the integration a little bit "interesting". The main one is the "timebase" class variable 'dt', used to distinguish discrete and continuous time systems. In addition, I have been doing small changes throughout to try to make things more compatible with python 3. Also (for everyone on the list): I'm going to re-establish the commit-hooks so that e-mail goes to this list when changes get committed to the repository. I'll send you an e-mail after I have had a look. -richard On 2 Nov 2012, at 5:03 , Rene van Paassen <ren...@gm...> wrote: > Hello, > > I think I have got a workable frequency response data object added. I also added a test file in the tests directory. > > For now, the frequency vectors of different FRD objects need to match; no interpolation / clipping yet. > > I also modified both StateSpace and TransferFunction to be combinable with matrix-like objects in feedback, multiplication, etcetera, so now something like > > sys.feedback([[0.1, 0.3],[0.0, 1.0]]) > > will work, given an 2 input 2 output system. > > Shall I merge into the trunk, or does anyone want to check first? The frd branch (based on 0.5c) is located at > > svn+ssh://svn.code.sf.net/p/python-control/code/branches/add-frd > > -- > René van Paassen | ______o____/_| Ren...@gm... > <[___\_\_-----< t: +31 15 2628685 > | o' mobile: +31 6 39846891 > > > ------------------------------------------------------------------------------ > LogMeIn Central: Instant, anywhere, Remote PC access and management. > Stay in control, update software, and manage PCs from one command center > Diagnose problems and improve visibility into emerging IT issues > Automate, monitor and manage. Do more in less time with Central > http://p.sf.net/sfu/logmein12331_d2d_______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |
From: Rene v. P. <ren...@gm...> - 2012-11-02 12:03:19
|
Hello, I think I have got a workable frequency response data object added. I also added a test file in the tests directory. For now, the frequency vectors of different FRD objects need to match; no interpolation / clipping yet. I also modified both StateSpace and TransferFunction to be combinable with matrix-like objects in feedback, multiplication, etcetera, so now something like sys.feedback([[0.1, 0.3],[0.0, 1.0]]) will work, given an 2 input 2 output system. Shall I merge into the trunk, or does anyone want to check first? The frd branch (based on 0.5c) is located at svn+ssh://svn.code.sf.net/p/python-control/code/branches/add-frd -- René van Paassen | ______o____/_| Ren...@gm... <[___\_\_-----< t: +31 15 2628685 | o' mobile: +31 6 39846891 |
From: Richard M. <mu...@cd...> - 2012-11-01 04:06:33
|
Great references. I read them briefly and there are some clear things to try. If understand it right, one fix is what Scott suggested (most the imports inside the functions), but there are other things to try. It looks like part of the problem is that 2to3 creates relative imports, but not sure. In any case, I know have a good starting point. I think what I'll need to do is get python 3.x running so that I can definitively test that things are working. Won't have time to look at this until Friday, earliest. For sure over the weekend. -richard On 31 Oct 2012, at 21:01 , Dale Lukas Peterson <haz...@gm...> wrote: > I just Googled "python package import best practices" and found this: > > http://docs.python.org/3.4/faq/programming.html#what-are-the-best-practices-for-using-import-in-a-module > > I don't know that there are any differences between the > recommendations for Python 3.x vs. 2.x, but for what it is worth here > is the same page but for Python 2.7.3 (they might be identical, I'm > not sure): > > http://docs.python.org/2.7/faq/programming.html#what-are-the-best-practices-for-using-import-in-a-module > > In particular they give the advice "Never use relative package > imports". There is also good information there regarding how to avoid > circular dependencies, which is exactly the issue with the current > code. > > Luke > > On Wed, Oct 31, 2012 at 11:28 AM, Dale Lukas Peterson > <haz...@gm...> wrote: >>> import loops: if you have a chance, Luke, can you try out Scott's change >>> and see if it works on python 3. I'll try to install it over the weekend >>> and try it myself, but would be good to get another check. >> >> I applied Scott's change to revision 211, then ran: >> $ find . -name "*.py" -exec 2to3 -w {} \; >> >> Then I built and installed it and when I import it, it gives me this error: >> 11:17:33 ~$ python >> Python 3.2.3 (default, Sep 30 2012, 09:06:04) >> [GCC 4.6.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> import control >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File >> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py", >> line 60, in <module> >> from .bdalg import series, parallel, negate, feedback >> File >> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py", >> line 55, in <module> >> from . import xferfcn as tf >> File >> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py", >> line 84, in <module> >> from .statesp import StateSpace >> File >> "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py", >> line 85, in <module> >> from .xferfcn import TransferFunction >> ImportError: cannot import name TransferFunction >>>>> >> >> So 2to3 is converting "from xferfcn import TransferFunction" to "from >> .xferfcn import TransferFunction", which for some reason does not work. I >> think the reason it does not work has to do with the __init__.py file as >> well as the __all__ variable not being set in each module (i.e., statesp.py >> and xferfcn.py). >> >>>> Is anyone ensuring that running the 2to3 tool is sufficient for use of >>>> python-control with Python 3, or otherwise working on a script that makes >>>> necessary changes? >> >> I have apparently verified that it isn't. Sympy uses a script called >> "use2to3" which runs 2to3 on most (but not all) of the source python files >> and generates a new source tree in a folder called "py3k-sympy" that >> contains the converted files. You then build and install sympy from that >> folder using python3. You can see how they do it here: >> >> https://github.com/sympy/sympy/blob/master/bin/use2to3 >> >>>> While that design pattern is nice, it may not yet be warranted for >>>> python-control, which is contained entirely in a single directory with no >>>> subpackages. The simplest change I see to avoid the import error you found >>>> is below (given as diff output). >> >> True. I'm not certain what the "best" way to do this is either, I just know >> what has worked for me in another project across many different versions of >> Python. >> >> Luke > > > > -- > “People call me a perfectionist, but I'm not. I'm a rightist. I do > something until it's right, and then I move on to the next thing.” > ― James Cameron > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |
From: Dale L. P. <haz...@gm...> - 2012-11-01 04:01:50
|
I just Googled "python package import best practices" and found this: http://docs.python.org/3.4/faq/programming.html#what-are-the-best-practices-for-using-import-in-a-module I don't know that there are any differences between the recommendations for Python 3.x vs. 2.x, but for what it is worth here is the same page but for Python 2.7.3 (they might be identical, I'm not sure): http://docs.python.org/2.7/faq/programming.html#what-are-the-best-practices-for-using-import-in-a-module In particular they give the advice "Never use relative package imports". There is also good information there regarding how to avoid circular dependencies, which is exactly the issue with the current code. Luke On Wed, Oct 31, 2012 at 11:28 AM, Dale Lukas Peterson <haz...@gm...> wrote: >> import loops: if you have a chance, Luke, can you try out Scott's change >> and see if it works on python 3. I'll try to install it over the weekend >> and try it myself, but would be good to get another check. > > I applied Scott's change to revision 211, then ran: > $ find . -name "*.py" -exec 2to3 -w {} \; > > Then I built and installed it and when I import it, it gives me this error: > 11:17:33 ~$ python > Python 3.2.3 (default, Sep 30 2012, 09:06:04) > [GCC 4.6.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import control > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File > "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py", > line 60, in <module> > from .bdalg import series, parallel, negate, feedback > File > "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py", > line 55, in <module> > from . import xferfcn as tf > File > "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py", > line 84, in <module> > from .statesp import StateSpace > File > "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py", > line 85, in <module> > from .xferfcn import TransferFunction > ImportError: cannot import name TransferFunction >>>> > > So 2to3 is converting "from xferfcn import TransferFunction" to "from > .xferfcn import TransferFunction", which for some reason does not work. I > think the reason it does not work has to do with the __init__.py file as > well as the __all__ variable not being set in each module (i.e., statesp.py > and xferfcn.py). > >> > Is anyone ensuring that running the 2to3 tool is sufficient for use of >> > python-control with Python 3, or otherwise working on a script that makes >> > necessary changes? > > I have apparently verified that it isn't. Sympy uses a script called > "use2to3" which runs 2to3 on most (but not all) of the source python files > and generates a new source tree in a folder called "py3k-sympy" that > contains the converted files. You then build and install sympy from that > folder using python3. You can see how they do it here: > > https://github.com/sympy/sympy/blob/master/bin/use2to3 > >> > While that design pattern is nice, it may not yet be warranted for >> > python-control, which is contained entirely in a single directory with no >> > subpackages. The simplest change I see to avoid the import error you found >> > is below (given as diff output). > > True. I'm not certain what the "best" way to do this is either, I just know > what has worked for me in another project across many different versions of > Python. > > Luke -- “People call me a perfectionist, but I'm not. I'm a rightist. I do something until it's right, and then I move on to the next thing.” ― James Cameron |
From: Dale L. P. <haz...@gm...> - 2012-10-31 18:29:05
|
> import loops: if you have a chance, Luke, can you try out Scott's change and see if it works on python 3. I'll try to install it over the weekend and try it myself, but would be good to get another check. I applied Scott's change to revision 211, then ran: $ find . -name "*.py" -exec 2to3 -w {} \; Then I built and installed it and when I import it, it gives me this error: 11:17:33 ~$ python Python 3.2.3 (default, Sep 30 2012, 09:06:04) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import control Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py", line 60, in <module> from .bdalg import series, parallel, negate, feedback File "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py", line 55, in <module> from . import xferfcn as tf File "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py", line 84, in <module> from .statesp import StateSpace File "/home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py", line 85, in <module> from .xferfcn import TransferFunction ImportError: cannot import name TransferFunction >>> So 2to3 is converting "from xferfcn import TransferFunction" to "from .xferfcn import TransferFunction", which for some reason does not work. I think the reason it does not work has to do with the __init__.py file as well as the __all__ variable not being set in each module (i.e., statesp.py and xferfcn.py). > > Is anyone ensuring that running the 2to3 tool is sufficient for use of python-control with Python 3, or otherwise working on a script that makes necessary changes? I have apparently verified that it isn't. Sympy uses a script called "use2to3" which runs 2to3 on most (but not all) of the source python files and generates a new source tree in a folder called "py3k-sympy" that contains the converted files. You then build and install sympy from that folder using python3. You can see how they do it here: https://github.com/sympy/sympy/blob/master/bin/use2to3 > > While that design pattern is nice, it may not yet be warranted for python-control, which is contained entirely in a single directory with no subpackages. The simplest change I see to avoid the import error you found is below (given as diff output). True. I'm not certain what the "best" way to do this is either, I just know what has worked for me in another project across many different versions of Python. Luke |
From: Scott C. L. <sli...@ca...> - 2012-10-31 17:41:25
|
On 31 Oct 2012, at 10:27, Richard Murray wrote: > import loops: if you have a chance, Luke, can you try out Scott's change and see if it works on python 3. I'll try to install it over the weekend and try it myself, but would be good to get another check. To be clear, my patch applies to the code as-is in trunk. Thus, testing it with Python 3 means apply the patch and then run 2to3 (as you have been doing). N.B., I have only tried to correct the import error while ensuring python-control works in Python 2.7. I do *not* claim to have python-control working in Python 3. Also, the last line "knoxville:python-control-py3% " is my terminal prompt, which I accidentally included in my email. Sorry. ~Scott |
From: Richard M. <mu...@cd...> - 2012-10-31 17:27:39
|
2to3: does anyone have experience in making packages compatible with both python 2 and python 3? It would be great to have the code do all of the work. import loops: if you have a chance, Luke, can you try out Scott's change and see if it works on python 3. I'll try to install it over the weekend and try it myself, but would be good to get another check. -richard On 31 Oct 2012, at 7:22 , Scott C.Livingston <sli...@ca...> wrote: > Howdy Luke, > > On 29 Oct 2012, at 13:53, Dale Lukas Peterson wrote: > >> Richard, >> I am running Python 3.2. In order to run python control, I have to >> use the 2to3 tool to convert on each .py file. It fixes things like >> print "x" by changing it to print("x"). For some reason, it is > > Is anyone ensuring that running the 2to3 tool is sufficient for use of python-control with Python 3, or otherwise working on a script that makes necessary changes? > >> >> I think this may stem from how src/__init__.py and each of the modules >> in src/ are importing each others functionality. The design patterned >> that I have been following and have used with no issues in the sympy >> project can be seen in these two files: >> https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/__init__.py >> https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/particle.py >> >> Basically, in each module, we set the __all__ list to include the >> names of the publicly available class and functions. Within each >> module, we never do relative imports, we always use the absolute >> import syntax. The __init__.py file is heavily commented so you >> should be able to see how we make those symbols available when people >> import the module or sub-package. > > While that design pattern is nice, it may not yet be warranted for python-control, which is contained entirely in a single directory with no subpackages. The simplest change I see to avoid the import error you found is below (given as diff output). > > ~Scott > > > Index: src/statesp.py > =================================================================== > --- src/statesp.py (revision 211) > +++ src/statesp.py (working copy) > @@ -82,7 +82,6 @@ > from scipy.signal import lti > import warnings > from lti import Lti, timebaseEqual, isdtime > -import xferfcn > > class StateSpace(Lti): > > @@ -511,7 +510,7 @@ > [1., 1., 1.]]. > > """ > - > + from xferfcn import TransferFunction > if isinstance(sys, StateSpace): > if len(kw): > raise TypeError("If sys is a StateSpace, _convertToStateSpace \ > @@ -519,7 +518,7 @@ > > # Already a state space system; just return it > return sys > - elif isinstance(sys, xferfcn.TransferFunction): > + elif isinstance(sys, TransferFunction): > try: > from slycot import td04ad > if len(kw): > Index: src/xferfcn.py > =================================================================== > --- src/xferfcn.py (revision 211) > +++ src/xferfcn.py (working copy) > @@ -81,7 +81,7 @@ > from copy import deepcopy > from lti import Lti, timebaseEqual, timebase, isdtime > from warnings import warn > -import statesp > +from statesp import StateSpace > > class TransferFunction(Lti): > > @@ -308,7 +308,7 @@ > """Add two LTI objects (parallel connection).""" > > # Convert the second argument to a transfer function. > - if (isinstance(other, statesp.StateSpace)): > + if (isinstance(other, StateSpace)): > other = _convertToTransferFunction(other) > elif not isinstance(other, TransferFunction): > other = _convertToTransferFunction(other, inputs=self.inputs, > @@ -868,7 +868,7 @@ > "_convertToTransferFunction cannot take keywords.") > > return sys > - elif isinstance(sys, statesp.StateSpace): > + elif isinstance(sys, StateSpace): > try: > from slycot import tb04ad > if len(kw): > knoxville:python-control-py3% > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |
From: Scott C. L. <sli...@ca...> - 2012-10-31 14:22:48
|
Howdy Luke, On 29 Oct 2012, at 13:53, Dale Lukas Peterson wrote: > Richard, > I am running Python 3.2. In order to run python control, I have to > use the 2to3 tool to convert on each .py file. It fixes things like > print "x" by changing it to print("x"). For some reason, it is Is anyone ensuring that running the 2to3 tool is sufficient for use of python-control with Python 3, or otherwise working on a script that makes necessary changes? > > I think this may stem from how src/__init__.py and each of the modules > in src/ are importing each others functionality. The design patterned > that I have been following and have used with no issues in the sympy > project can be seen in these two files: > https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/__init__.py > https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/particle.py > > Basically, in each module, we set the __all__ list to include the > names of the publicly available class and functions. Within each > module, we never do relative imports, we always use the absolute > import syntax. The __init__.py file is heavily commented so you > should be able to see how we make those symbols available when people > import the module or sub-package. While that design pattern is nice, it may not yet be warranted for python-control, which is contained entirely in a single directory with no subpackages. The simplest change I see to avoid the import error you found is below (given as diff output). ~Scott Index: src/statesp.py =================================================================== --- src/statesp.py (revision 211) +++ src/statesp.py (working copy) @@ -82,7 +82,6 @@ from scipy.signal import lti import warnings from lti import Lti, timebaseEqual, isdtime -import xferfcn class StateSpace(Lti): @@ -511,7 +510,7 @@ [1., 1., 1.]]. """ - + from xferfcn import TransferFunction if isinstance(sys, StateSpace): if len(kw): raise TypeError("If sys is a StateSpace, _convertToStateSpace \ @@ -519,7 +518,7 @@ # Already a state space system; just return it return sys - elif isinstance(sys, xferfcn.TransferFunction): + elif isinstance(sys, TransferFunction): try: from slycot import td04ad if len(kw): Index: src/xferfcn.py =================================================================== --- src/xferfcn.py (revision 211) +++ src/xferfcn.py (working copy) @@ -81,7 +81,7 @@ from copy import deepcopy from lti import Lti, timebaseEqual, timebase, isdtime from warnings import warn -import statesp +from statesp import StateSpace class TransferFunction(Lti): @@ -308,7 +308,7 @@ """Add two LTI objects (parallel connection).""" # Convert the second argument to a transfer function. - if (isinstance(other, statesp.StateSpace)): + if (isinstance(other, StateSpace)): other = _convertToTransferFunction(other) elif not isinstance(other, TransferFunction): other = _convertToTransferFunction(other, inputs=self.inputs, @@ -868,7 +868,7 @@ "_convertToTransferFunction cannot take keywords.") return sys - elif isinstance(sys, statesp.StateSpace): + elif isinstance(sys, StateSpace): try: from slycot import tb04ad if len(kw): knoxville:python-control-py3% |
From: Richard M. <mu...@cd...> - 2012-10-30 04:46:37
|
Thanks for the extra info. I'll see if I can implement this (and install python3 so that I can test locally). Will take until this weekend or possibly early next week (unless someone else wants to take a cut at it -:). -richard On 29 Oct 2012, at 13:53 , Dale Lukas Peterson <haz...@gm...> wrote: > Richard, > I am running Python 3.2. In order to run python control, I have to > use the 2to3 tool to convert on each .py file. It fixes things like > print "x" by changing it to print("x"). For some reason, it is > changing the import statements in both xferfcn.py and statesp.py from: > > import statesp > import xferfcn > > to: > > from . import statesp > from . import xferfcn > > Then when try to import control, I get the same error as before: > --------------------------------------------------------------------------- > ImportError Traceback (most recent call last) > <ipython-input-1-4964879682bf> in <module>() > ----> 1 import control > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py > in <module>() > 58 # Import functions from within the control system library > 59 #! Should probably only import the exact functions we use... > ---> 60 from .bdalg import series, parallel, negate, feedback > 61 from .delay import pade > 62 from .dtime import sample_system > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py > in <module>() > 53 > 54 import scipy as sp > ---> 55 from . import xferfcn as tf > 56 from . import statesp as ss > 57 > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py > in <module>() > 82 from .lti import Lti, timebaseEqual, timebase, isdtime > 83 from warnings import warn > ---> 84 from . import statesp > 85 > 86 class TransferFunction(Lti): > > /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py > in <module>() > 83 import warnings > 84 from .lti import Lti, timebaseEqual, isdtime > ---> 85 from . import xferfcn > 86 > 87 class StateSpace(Lti): > > ImportError: cannot import name xferfcn > > I think this may stem from how src/__init__.py and each of the modules > in src/ are importing each others functionality. The design patterned > that I have been following and have used with no issues in the sympy > project can be seen in these two files: > https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/__init__.py > https://github.com/hazelnusse/sympy/blob/master/sympy/physics/mechanics/particle.py > > Basically, in each module, we set the __all__ list to include the > names of the publicly available class and functions. Within each > module, we never do relative imports, we always use the absolute > import syntax. The __init__.py file is heavily commented so you > should be able to see how we make those symbols available when people > import the module or sub-package. > > Luke > > > > On Sat, Oct 27, 2012 at 4:54 PM, Richard Murray <mu...@cd...> wrote: >> Both of these issues should now be fixed in the latest version of trunk. Let me know if you continue to have problems. >> >> -richard >> >> On 25 Oct 2012, at 23:58 , Dale Lukas Peterson <haz...@gm...> wrote: >> >>> In src/lti.py, NoneType is being imported and used in the Lti class in >>> two locations. Is there a reason this can't be just None? NoneType >>> is deprecated in Python3 and this is causing issues for me. >>> >>> Also, I am getting this import error when I import control: >>> --------------------------------------------------------------------------- >>> ImportError Traceback (most recent call last) >>> <ipython-input-1-4964879682bf> in <module>() >>> ----> 1 import control >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/__init__.py >>> in <module>() >>> 58 # Import functions from within the control system library >>> 59 #! Should probably only import the exact functions we use... >>> ---> 60 from .bdalg import series, parallel, negate, feedback >>> 61 from .delay import pade >>> 62 from .dtime import sample_system >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/bdalg.py >>> in <module>() >>> 53 >>> 54 import scipy as sp >>> ---> 55 from . import xferfcn as tf >>> 56 from . import statesp as ss >>> 57 >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/xferfcn.py >>> in <module>() >>> 82 from .lti import Lti, timebaseEqual, timebase, isdtime >>> 83 from warnings import warn >>> ---> 84 from . import statesp >>> 85 >>> 86 class TransferFunction(Lti): >>> >>> /home/hazelnusse/usr/lib64/python3.2/site-packages/control-0.6a-py3.2.egg/control/statesp.py >>> in <module>() >>> 83 import warnings >>> 84 from .lti import Lti, timebaseEqual, isdtime >>> ---> 85 from . import xferfcn >>> 86 >>> 87 class StateSpace(Lti): >>> >>> ImportError: cannot import name xferfcn >>> >>> I noticed that xferfcn.py has: >>> from . import statesp >>> >>> and that statesp.py has: >>> from . import xferfcn >>> >>> I am guessing is a circular dependency issue. From what I can tell, >>> each of these modules only imports these to do some type checking of >>> arguments. >>> >>> Luke >>> >>> >>> -- >>> “People call me a perfectionist, but I'm not. I'm a rightist. I do >>> something until it's right, and then I move on to the next thing.” >>> ― James Cameron >>> >>> ------------------------------------------------------------------------------ >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://p.sf.net/sfu/appdyn_sfd2d_oct >>> _______________________________________________ >>> python-control-discuss mailing list >>> pyt...@li... >>> https://lists.sourceforge.net/lists/listinfo/python-control-discuss >> >> >> ------------------------------------------------------------------------------ >> WINDOWS 8 is here. >> Millions of people. Your app in 30 days. >> Visit The Windows 8 Center at Sourceforge for all your go to resources. >> http://windows8center.sourceforge.net/ >> join-generation-app-and-make-money-coding-fast/ >> _______________________________________________ >> python-control-discuss mailing list >> pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > > > -- > “People call me a perfectionist, but I'm not. I'm a rightist. I do > something until it's right, and then I move on to the next thing.” > ― James Cameron > > ------------------------------------------------------------------------------ > The Windows 8 Center - In partnership with Sourceforge > Your idea - your app - 30 days. > Get started! > http://windows8center.sourceforge.net/ > what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/ > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss |