Skip to content

Commit 56f98b5

Browse files
committed
initial set of devleoper guidelines
1 parent b4fd879 commit 56f98b5

File tree

7 files changed

+637
-21
lines changed

7 files changed

+637
-21
lines changed

control/config.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,37 @@ def use_legacy_defaults(version):
376376
return (major, minor, patch)
377377

378378

379-
#
380-
# Utility function for processing legacy keywords
381-
#
382-
# Use this function to handle a legacy keyword that has been renamed. This
383-
# function pops the old keyword off of the kwargs dictionary and issues a
384-
# warning. If both the old and new keyword are present, a ControlArgument
385-
# exception is raised.
386-
#
387379
def _process_legacy_keyword(kwargs, oldkey, newkey, newval, warn_oldkey=True):
380+
"""Utility function for processing legacy keywords.
381+
382+
Use this function to handle a legacy keyword that has been renamed.
383+
This function pops the old keyword off of the kwargs dictionary and
384+
issues a warning. If both the old and new keyword are present, a
385+
ControlArgument exception is raised.
386+
387+
Parameters
388+
----------
389+
kwargs : dict
390+
Dictionary of keword arguments (from function call).
391+
oldkey : str
392+
Old (legacy) parameter name.
393+
newkey : str
394+
Current name of the parameter.
395+
newval : object
396+
Value of the current parameter (from the function signature).
397+
warn_oldkey : bool
398+
If set to `False`, suppress generation of a warning about using a
399+
legacy keyword. This is useful if you have two versions of a
400+
keyword and you want to allow either to be used (see the `cost` and
401+
`trajectory_cost` keywords in `flatsys.point_to_point` for an
402+
example of this).
403+
404+
Returns
405+
-------
406+
val : object
407+
Value of the (new) keyword.
408+
409+
"""
388410
if oldkey in kwargs:
389411
if warn_oldkey:
390412
warnings.warn(

control/xferfcn.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,28 +1439,31 @@ def _convert_to_transfer_function(
14391439
sys, inputs=1, outputs=1, use_prefix_suffix=False):
14401440
"""Convert a system to transfer function form (if needed).
14411441
1442-
If sys is already a transfer function, then it is returned. If sys is a
1443-
state space object, then it is converted to a transfer function and
1444-
returned. If sys is a scalar, then the number of inputs and outputs can be
1445-
specified manually, as in:
1442+
If `sys` is already a transfer function, then it is returned. If `sys`
1443+
is a state space object, then it is converted to a transfer function
1444+
and returned. If `sys` is a scalar, then the number of inputs and
1445+
outputs can be specified manually, as in::
14461446
1447-
>>> sys = _convert_to_transfer_function(3.) # Assumes inputs = outputs = 1
1448-
>>> sys = _convert_to_transfer_function(1., inputs=3, outputs=2)
1447+
sys = _convert_to_transfer_function(3.) # Assumes inputs = outputs = 1
1448+
sys = _convert_to_transfer_function(1., inputs=3, outputs=2)
14491449
1450-
In the latter example, sys's matrix transfer function is [[1., 1., 1.]
1451-
[1., 1., 1.]].
1450+
In the latter example, the matrix transfer function for `sys` is::
14521451
1453-
If sys is an array-like type, then it is converted to a constant-gain
1452+
[[1., 1., 1.]
1453+
[1., 1., 1.]].
1454+
1455+
If `sys` is an array-like type, then it is converted to a constant-gain
14541456
transfer function.
14551457
14561458
Note: no renaming of inputs and outputs is performed; this should be done
14571459
by the calling function.
14581460
1459-
>>> sys = _convert_to_transfer_function([[1., 0.], [2., 3.]])
1461+
Arrays can also be passed as an argument. For example::
1462+
1463+
sys = _convert_to_transfer_function([[1., 0.], [2., 3.]])
14601464
1461-
In this example, the numerator matrix will be
1462-
[[[1.0], [0.0]], [[2.0], [3.0]]]
1463-
and the denominator matrix [[[1.0], [1.0]], [[1.0], [1.0]]]
1465+
will give a system with numerator matrix `[[[1.0], [0.0]], [[2.0],
1466+
[3.0]]]` and denominator matrix `[[[1.0], [1.0]], [[1.0], [1.0]]]`.
14641467
14651468
"""
14661469
from .statesp import StateSpace

doc/config.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ System display parameters
151151
* 'eval' : system specific, loadable representation
152152
* 'latex' : latex representation of the object
153153

154+
.. py:data:: iosys.repr_show_count
155+
:type: bool
156+
:value: True
157+
158+
If `True`, show the input, output, and state count when using
159+
`iosys_repr()` and the 'eval' format. Otherwise, the input,
160+
output, and state values are repressed from the output unless
161+
non-generic signal names are present.
162+
154163
.. py:data:: xferfcn.display_format
155164
:type: str
156165
:value: 'poly'

0 commit comments

Comments
 (0)