Some uploaded project avatars may have broken during the week. If any of your projects seem affected, then you might need to upload new avatars onto them.

Commit 5619803b authored by Erik Frisk's avatar Erik Frisk

Fixed a small bug in isolation matrix computation

parent bf22f1f8
......@@ -4,13 +4,15 @@ import matplotlib.colors as mcolors
import 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),
im = np.ones((nf, nf),
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'])
......@@ -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:
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment