Commit 645a67ea authored by Erik Frisk's avatar Erik Frisk

Slight code cleanup

parent 6e9a9aed
......@@ -79,7 +79,7 @@
"metadata": {},
"source": [
"Preprocesses data in two steps\n",
"1. Take absolute values of residuals (absdata)\n",
"1. Take absolute values of residuals\n",
"2. Threshold data (thdata)\n",
"\n",
"The data is normalized so that a threshold at 1 corresponds to probability of false alarm of approximately 1%."
......@@ -91,9 +91,8 @@
"metadata": {},
"outputs": [],
"source": [
"absdata = data.copy()\n",
"absdata['res'] = np.abs(absdata['res'])\n",
"thdata = absdata.copy()\n",
"data['res'] = np.abs(data['res'])\n",
"thdata = data.copy()\n",
"thdata['res'] = thdata['res'] >= 1"
]
},
......@@ -116,17 +115,17 @@
"for ri in range(7):\n",
" for fm in range(nf):\n",
" plt.subplot(7, 8, ri*nf + fm + 1)\n",
" if absdata['fsm'][ri, fm]==0:\n",
" plt.plot(absdata['res'][absdata['mode']==fm, ri], 'b', lw=0.3)\n",
" if data['fsm'][ri, fm]==0:\n",
" plt.plot(data['res'][data['mode']==fm, ri], 'b', lw=0.3)\n",
" else:\n",
" plt.plot(absdata['res'][absdata['mode']==fm, ri], 'r', lw=0.3)\n",
" plt.plot(data['res'][data['mode']==fm, ri], 'r', lw=0.3)\n",
" plt.gca().tick_params(labelsize=6)\n",
" plt.ylim(0, 3)\n",
" BoxOff()\n",
" if fm==0:\n",
" plt.ylabel('res-%d' % (ri+1), fontsize=8)\n",
" if ri==0:\n",
" plt.title(absdata['modes'][fm], fontsize=8)\n",
" plt.title(data['modes'][fm], fontsize=8)\n",
"plt.tight_layout(w_pad=-0.75, h_pad=0)"
]
},
......@@ -146,8 +145,8 @@
"ts = np.zeros((nr, nf))\n",
"for ri in range(nr):\n",
" for fm in range(nf):\n",
" Nfm = np.sum(absdata['mode']==fm)\n",
" Nalarm = np.sum(absdata['res'][absdata['mode']==fm, ri]>=1)\n",
" Nfm = np.sum(data['mode'] == fm)\n",
" Nalarm = np.sum(data['res'][data['mode']==fm, ri] >= 1)\n",
" ts[ri, fm] = Nalarm/Nfm"
]
},
......@@ -288,7 +287,7 @@
" D|f_{i})\\sum_{f_{j}\\in \\tilde{\\mathcal{F}}}|P(f_{j}\\in D|f_{i})-I_{ij}|\\\\\n",
" p_{\\text{FI-max}} &= P(D=F_{f_i}|f_i)\n",
"\\end{align*}\n",
"where $F_{f_i}$ is the set of faults nont structurally isolable from fault $f_i$."
"where $F_{f_i}$ is the set of faults not structurally isolable from fault $f_i$."
]
},
{
......@@ -429,13 +428,6 @@
"\n",
"plt.tight_layout() "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......
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