-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_fatrop.py
26 lines (20 loc) · 1.07 KB
/
debug_fatrop.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import casadi as ca
import pylab as plt
actual = ca.Sparsity.from_file("debug_fatrop_actual.mtx")
A = ca.Sparsity.from_file("debug_fatrop_A.mtx")
B = ca.Sparsity.from_file("debug_fatrop_B.mtx")
C = ca.Sparsity.from_file("debug_fatrop_C.mtx")
D = ca.Sparsity.from_file("debug_fatrop_D.mtx")
I = ca.Sparsity.from_file("debug_fatrop_I.mtx")
errors = ca.Sparsity.from_file("debug_fatrop_errors.mtx").row()
plt.figure()
plt.spy(A,marker='o',color='r',markersize=5,label="expected A",markerfacecolor="white")
plt.spy(B,marker='o',color='b',markersize=5,label="expected B",markerfacecolor="white")
plt.spy(C,marker='o',color='g',markersize=5,label="expected C",markerfacecolor="white")
plt.spy(D,marker='o',color='y',markersize=5,label="expected D",markerfacecolor="white")
plt.spy(I,marker='o',color='k',markersize=5,label="expected I",markerfacecolor="white")
plt.spy(actual,marker='o',color='k',markersize=2,label="actual")
plt.hlines(errors, 0, A.shape[1],color='gray', linestyle='-',label="offending rows")
plt.title("Debug view of fatrop interface structure detection")
plt.legend()
plt.show()