8000 Merge pull request #1051 from KybernetikJo/improve_style_markov · python-control/python-control@d75082d · GitHub
[go: up one dir, main page]

Skip to content

Commit d75082d

Browse files
authored
Merge pull request #1051 from KybernetikJo/improve_style_markov
Improve code style, markov
2 parents 220ace3 + b70c0ed commit d75082d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

control/modelsimp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,21 +667,21 @@ def markov(*args, m=None, transpose=False, dt=None, truncate=False):
667667

668668
# Set up the full problem
669669
# Create matrix of (shifted) inputs
670-
UUT = np.zeros((p*m,(l)))
670+
UUT = np.zeros((p*m, l))
671671
for i in range(m):
672672
# Shift previous column down and keep zeros at the top
673-
UUT[i*p:(i+1)*p,i:] = Umat[:,:l-i]
673+
UUT[i*p:(i+1)*p, i:] = Umat[:, :l-i]
674674

675675
# Truncate first t=0 or t=m time steps, transpose the problem for lsq
676-
YY = Ymat[:,t:].T
677-
UU = UUT[:,t:].T
676+
YY = Ymat[:, t:].T
677+
UU = UUT[:, t:].T
678678

679679
# Solve for the Markov parameters from YY = UU @ H.T
680680
HT, _, _, _ = np.linalg.lstsq(UU, YY, rcond=None)
681681
H = HT.T/dt # scaling
682682

683-
H = H.reshape(q,m,p) # output, time*input -> output, time, input
684-
H = H.transpose(0,2,1) # output, input, time
683+
H = H.reshape(q, m, p) # output, time*input -> output, time, input
684+
H = H.transpose(0, 2, 1) # output, input, time
685685

686686
# for siso return a 1D array instead of a 3D array
687687
if q == 1 and p == 1:

control/tests/docstrings_test.py

Lines changed: 1 addition & 1 7199 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
control.ss2tf: '48ff25d22d28e7b396e686dd5eb58831',
4040
control.tf: '53a13f4a7f75a31c81800e10c88730ef',
4141
control.tf2ss: '086a3692659b7321c2af126f79f4bc11',
42-
control.markov: '753309de348132ef238e78ac756412c1',
42+
control.markov: 'eda7c4635bbb863ae6659e574285d356',
4343
control.gangof4: '0e52eb6cf7ce024f9a41f3ae3ebf04f7',
4444
}
4545

0 commit comments

Comments
 (0)
0