summaryrefslogtreecommitdiff
path: root/viz.ipynb
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2020-01-26 22:04:20 +0100
committerjaseg <git@jaseg.net>2020-01-26 22:04:20 +0100
commit38bc146d95d769d812f9157329b75dd622c8b35c (patch)
tree1927c5bbfa77a1b0b4b5a58dc255c45ee3f2911d /viz.ipynb
parentf1c53460b0e1c95bc2e34ea3a88db79df19db53e (diff)
downloadiot-sensor-38bc146d95d769d812f9157329b75dd622c8b35c.tar.gz
iot-sensor-38bc146d95d769d812f9157329b75dd622c8b35c.tar.bz2
iot-sensor-38bc146d95d769d812f9157329b75dd622c8b35c.zip
Make detection algorithm prototype slightly easier to implement
Diffstat (limited to 'viz.ipynb')
-rw-r--r--viz.ipynb10
1 files changed, 5 insertions, 5 deletions
diff --git a/viz.ipynb b/viz.ipynb
index 7166bef..04a185d 100644
--- a/viz.ipynb
+++ b/viz.ipynb
@@ -1699,7 +1699,7 @@
},
{
"cell_type": "code",
- "execution_count": 101,
+ "execution_count": 103,
"metadata": {
"scrolled": false
},
@@ -2503,7 +2503,7 @@
"for ax, capture in zip(axs.flatten(), [data_downstairs[0] + data_downstairs[1], data_upstairs]):\n",
" cap = np.array(capture)\n",
" cap -= np.mean(cap).astype(int)\n",
- " lens = np.array([ len(g) for g in (list(g) for g_key, g in itertools.groupby(cap, lambda x: 1 if x >= 0 else -1)) for _x in g ])\n",
+ " lens = np.array([ x for g in (list(g) for g_key, g in itertools.groupby(cap, lambda x: 1 if x >= 0 else -1)) for x in range(len(g)) ])\n",
" w = 32\n",
" k = 8\n",
" lens = np.array(list(sum(xs) for xs in zip(*(lens[i::k] for i in range(w))))) / w\n",
@@ -2518,10 +2518,10 @@
" for idx, data in enumerate(zip(*(both_data[i*p:] for i in range(q)))):\n",
" h_len, h_rms = zip(*data)\n",
" if all(x > 1500 for x in h_rms):\n",
- " if all(1.0 < x < 1.5 for x in h_len[::2]) and \\\n",
- " all(1.3 < x < 1.8 for x in h_len[1::2]):\n",
+ " if all(0.1 < x < 0.25 for x in h_len[::2]) and \\\n",
+ " all(0.25 < x < 0.4 for x in h_len[1::2]):\n",
" ax.axvspan(idx, idx + p*q, color='lightgreen')\n",
- " elif all(1.4 < x < 1.8 for x in h_len):\n",
+ " elif all(0.25 < x < 0.4 for x in h_len):\n",
" ax.axvspan(idx, idx + p*q, color='pink')"
]
}