...
 
Commits (2)
......@@ -4,13 +4,15 @@ import matplotlib.colors as mcolors
import scipy.io as sio
def IsolabilityMatrix(fsm):
"""Compute isolability matrix based on a fault signature matrix"""
nf = fsm.shape[1]
im = np.ones((nf-1, nf-1), dtype=np.int)
im = np.ones((nf, nf), dtype=np.int)
for ri in fsm:
im[np.ix_(ri[1:]>0, ri[1:]==0)] = 0
im[np.ix_(ri>0, ri==0)] = 0
return im
def DiagnosesAndConfusionMatrix(data, residx=None):
"""Compute consistency based diagnoses and corresponding confusion matrix based on a dataset."""
if isinstance(residx, type(None)):
dx = SingleFaultIsolability(data['res'], data['fsm'])
else:
......@@ -26,6 +28,7 @@ def DiagnosesAndConfusionMatrix(data, residx=None):
return dx, C
def SingleFaultIsolability(res, fsm):
"""Compute sinlg fault consistency based diagnoses."""
N = res.shape[0]
nf = fsm.shape[1]
dx = np.zeros((N, nf))
......@@ -120,6 +123,7 @@ summer_cmap = make_colormap([
(1.000, 1.000, 0.400)])
def PlotConfusionMatrix(C):
"""Plot a confusion matrix in a suitable colormap."""
nf = C.shape[0]
plt.imshow(C, cmap=summer_cmap)
for fi in range(nf):
......@@ -136,6 +140,7 @@ def PlotConfusionMatrix(C):
def BoxOff(*argin):
"""Remove (ugly) box around plots."""
if len(argin)>0:
ax=argin[0]
else:
......
This source diff could not be displayed because it is too large. You can view the blob instead.