Skip to content

Commit bc21ec0

Browse files
committed
Fix few docstring things, change name to eigensys_realization
1 parent 614a080 commit bc21ec0

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

control/modelsimp.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,11 @@ def minreal(sys, tol=None, verbose=True):
369369
return sysr
370370

371371

372-
def era(arg, r, m=None, n=None, dt=True, transpose=False):
372+
def eigensys_realization(arg, r, m=None, n=None, dt=True, transpose=False):
373373
r"""era(YY, r)
374374
375-
Calculate an ERA model of order `r` based on the impulse-response data.
375+
Calculate an ERA model of order `r` based on the impulse-response data
376+
`YY`.
376377
377378
This function computes a discrete time system
378379
@@ -394,43 +395,38 @@ def era(arg, r, m=None, n=None, dt=True, transpose=False):
394395
Parameters
395396
----------
396397
YY : array_like
397-
impulse-response data from which the StateSpace model is estimated,
398-
1D or 3D array.
398+
Impulse response from which the StateSpace model is estimated, 1D
399+
or 3D array.
399400
data : TimeResponseData
400-
impulse-response data from which the StateSpace model is estimated.
401+
Impulse response from which the StateSpace model is estimated.
401402
r : integer
402403
Order of model.
403404
m : integer, optional
404-
Number of rows in Hankel matrix.
405-
Default is 2*r.
405+
Number of rows in Hankel matrix. Default is 2*r.
406406
n : integer, optional
407-
Number of columns in Hankel matrix.
408-
Default is 2*r.
407+
Number of columns in Hankel matrix. Default is 2*r.
409408
dt : True or float, optional
410409
True indicates discrete time with unspecified sampling time,
411-
positive number is discrete time with specified sampling time.
412-
It can be used to scale the StateSpace model in order to match
413-
the impulse response of this library.
414-
Default values is True.
410+
positive number is discrete time with specified sampling time. It
411+
can be used to scale the StateSpace model in order to match the
412+
impulse response of this library. Default is True.
415413
transpose : bool, optional
416414
Assume that input data is transposed relative to the standard
417-
:ref:`time-series-convention`. For TimeResponseData this parameter
418-
is ignored.
419-
Default value is False.
415+
:ref:`time-series-convention`. For TimeResponseData this parameter
416+
is ignored. Default is False.
420417
421418
Returns
422419
-------
423420
sys : StateSpace
424421
A reduced order model sys=StateSpace(Ar,Br,Cr,Dr,dt).
425422
S : array
426-
Singular values of Hankel matrix.
427-
Can be used to choose a good r value.
423+
Singular values of Hankel matrix. Can be used to choose a good r
424+
value.
428425
429426
References
430427
----------
431-
.. [1] Samet Oymak and Necmiye Ozay
432-
Non-asymptotic Identification of LTI Systems
433-
from a Single Trajectory.
428+
.. [1] Samet Oymak and Necmiye Ozay, Non-asymptotic Identification of
429+
LTI Systems from a Single Trajectory.
434430
https://arxiv.org/abs/1806.05722
435431
436432
Examples
@@ -444,14 +440,14 @@ def era(arg, r, m=None, n=None, dt=True, transpose=False):
444440
>>> sysd, _ = ct.era(response, r=1)
445441
"""
446442
def block_hankel_matrix(Y, m, n):
447-
443+
"""Create a block hankel matrix from Impulse response"""
448444
q, p, _ = Y.shape
449445
YY = Y.transpose(0,2,1) # transpose for reshape
450446

451447
H = np.zeros((q*m,p*n))
452448

453449
for r in range(m):
454-
# shift and add row to hankel matrix
450+
# shift and add row to Hankel matrix
455451
new_row = YY[:,r:r+n,:]
456452
H[q*r:q*(r+1),:] = new_row.reshape((q,p*n))
457453

@@ -651,3 +647,6 @@ def markov(Y, U, m=None, transpose=False):
651647

652648
# Return the first m Markov parameters
653649
return H if transpose else np.transpose(H)
650+
651+
# Function aliases
652+
era = eigensys_realization

0 commit comments

Comments
 (0)