From 528d653bdef957121200364aa116aa1587fefa19 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 10 Jan 2019 14:31:20 +0900 Subject: Decoding and comma triggering works --- fw/Scope.ipynb | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'fw/Scope.ipynb') diff --git a/fw/Scope.ipynb b/fw/Scope.ipynb index 966c83c..33596a0 100644 --- a/fw/Scope.ipynb +++ b/fw/Scope.ipynb @@ -2,18 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": 6, + "execution_count": 208, "metadata": {}, "outputs": [], "source": [ "from matplotlib import pyplot as plt\n", "%matplotlib notebook\n", - "import struct" + "import struct\n", + "import math" ] }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 207, "metadata": {}, "outputs": [], "source": [ @@ -22,27 +23,21 @@ " raw_data = f.read()\n", " data = struct.unpack(f'<{len(raw_data)//2}{\"h\" if signed else \"H\"}', raw_data)\n", " \n", - " print(''.join(str(x) for x in data[offx:][:100]))\n", - " fig, axs = plt.subplots(channels, 1, figsize=(10, 5))\n", - " for i, ax in enumerate(axs):\n", - " ax.plot(data[offx:][:end][i::channels])\n", - " ax.grid()" + " fig, axs = plt.subplots(channels, 1, squeeze=False, sharex=True, figsize=(10, 5))\n", + " for i, ax in enumerate(axs.flatten()):\n", + " ax.plot([math.nan if x==-255 else x for x in data[offx:][:end][i::channels]])\n", + " ax.grid()\n", + " \n", + " return data" ] }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 213, "metadata": { "scrolled": false }, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "61515991715159978151599491515997101515997111515991121515994131515997141515991050-5345150-5361250-5358350-5351450-5348550-53616150-53547150-53488150-53549150-5361051599115159912515991351598845159915515988\n" - ] - }, { "data": { "application/javascript": [ @@ -826,7 +821,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -837,7 +832,8 @@ } ], "source": [ - "plot_data(offx=4, signed=True, channels=4)" + "data = plot_data(offx=4, signed=True, channels=1)\n", + "#print(''.join(str(x) for x in data[4:][3::4]))" ] }, { -- cgit