diff --git a/bite/telemetry/migrations/0001_initial.py b/bite/telemetry/migrations/0001_initial.py index 8ff1ba3..9a6222a 100644 --- a/bite/telemetry/migrations/0001_initial.py +++ b/bite/telemetry/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.3 on 2021-03-19 08:08 +# Generated by Django 3.1.7 on 2021-03-25 10:55 import django.core.validators from django.db import migrations, models @@ -18,7 +18,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Telemetry', fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('time', models.DateTimeField(auto_now_add=True, db_index=True)), ('transport', models.CharField(choices=[('http', 'http'), ('mqtt', 'mqtt')], default='http', max_length=4)), ('clock', models.IntegerField(null=True, validators=[django.core.validators.MinValueValidator(0)])), @@ -28,6 +28,7 @@ class Migration(migrations.Migration): options={ 'verbose_name_plural': 'Telemetry', 'ordering': ['-time', 'device'], + 'unique_together': {('time', 'device')}, }, ), ] diff --git a/bite/telemetry/migrations/0002_timescale.py b/bite/telemetry/migrations/0002_timescale.py new file mode 100644 index 0000000..5ef9fb3 --- /dev/null +++ b/bite/telemetry/migrations/0002_timescale.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.7 on 2021-03-25 10:55 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('telemetry', '0001_initial'), + ] + + # Timescale requires an hyperscale table to have the field used for the + # partitioning ('time') to be in the any UNIQUE constraint. + # Because of that we have a unique_together on 'time' and 'device', + # however Django always adds an 'id' as PRIMARY_KEY. + # Django's 'id' isn't used as a foreign key, so we are dropping + # the contraint and simply adding an index to the 'id' column. + # We can now create the hypertable. + operations = [ + migrations.RunSQL( + "ALTER TABLE telemetry_telemetry DROP CONSTRAINT telemetry_telemetry_pkey ;" # noqa: E501 + "CREATE INDEX telemetry_telemetry_id_idx ON telemetry_telemetry(id);" # noqa: E501 + "SELECT create_hypertable('telemetry_telemetry', 'time');"), + ] diff --git a/bite/telemetry/models.py b/bite/telemetry/models.py index 0feff60..09906f4 100644 --- a/bite/telemetry/models.py +++ b/bite/telemetry/models.py @@ -30,7 +30,6 @@ def telemetry_validation(value): class Telemetry(models.Model): - id = models.AutoField(primary_key=True) device = models.ForeignKey(Device, on_delete=models.CASCADE) time = models.DateTimeField(db_index=True, auto_now_add=True) transport = models.CharField(max_length=4, @@ -43,6 +42,7 @@ class Telemetry(models.Model): class Meta: ordering = ['-time', 'device'] + unique_together = ['time', 'device'] verbose_name_plural = "Telemetry" def __str__(self): diff --git a/bite/telemetry/views.py b/bite/telemetry/views.py index d487e1c..7899900 100644 --- a/bite/telemetry/views.py +++ b/bite/telemetry/views.py @@ -17,9 +17,10 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from datetime import datetime from django.http import Http404 from django.utils import timezone -from django.utils.dateparse import parse_datetime +from django.utils.dateparse import parse_date, parse_datetime from rest_framework.views import APIView from rest_framework.viewsets import ModelViewSet @@ -69,12 +70,16 @@ class TelemetryRange(ModelViewSet): lookup_field = 'device' @staticmethod - def datetime_validation(datetime): - parsed_datetime = parse_datetime(datetime) + def datetime_validation(time): + parsed_datetime = parse_datetime(time) if parsed_datetime is None: - raise ParseError({ - datetime: 'Invalid date format' - }) + parsed_datetime = parse_date(time) + if parsed_datetime is None: + raise ParseError({ + datetime: 'Invalid date format' + }) + parsed_datetime = datetime.combine( + parsed_datetime, datetime.min.time()) return timezone.make_aware(parsed_datetime) def list(self, request, device, time_from, time_to=None): diff --git a/esp32/notebook/ESP32_1 RSSI-HALL.ipynb b/esp32/notebook/ESP32_1 RSSI-HALL.ipynb index d1b5ee0..df5aa22 100644 --- a/esp32/notebook/ESP32_1 RSSI-HALL.ipynb +++ b/esp32/notebook/ESP32_1 RSSI-HALL.ipynb @@ -2,53 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, - "id": "running-darwin", + "execution_count": null, + "id": "endless-short", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "fc9c348988ec4ce0874decc937da8078", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Text(value='esp32_1', description='Serial:', placeholder='Type something')" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "fcc822c898014962804e2fa52d397b5e", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "DatePicker(value=datetime.date(2021, 3, 25), description='From Date')" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "fe9cfdeb23104476a3bbc9afaeaf9838", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "DatePicker(value=datetime.date(2021, 3, 26), description='To Date')" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# -*- coding: utf-8 -*-\n", "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n", @@ -74,10 +31,17 @@ "import ipywidgets as widgets\n", "import plotly.graph_objects as go\n", "\n", - "from IPython.display import display\n", - "\n", - "from datetime import date, timedelta\n", - "\n", + "from datetime import date, datetime\n", + "from IPython.display import display" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "running-darwin", + "metadata": {}, + "outputs": [], + "source": [ "serial = widgets.Text(\n", " value='esp32_1',\n", " placeholder='Type something',\n", @@ -92,7 +56,7 @@ "date_to = widgets.DatePicker(\n", " description='To Date',\n", " disabled=False,\n", - " value=date.today() + timedelta(days=1)\n", + " value=date.today()\n", ")\n", "display(serial)\n", "display(date_from)\n", @@ -101,1887 +65,48 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "designing-milwaukee", "metadata": {}, "outputs": [], "source": [ + "date_from = datetime.combine(date_from.value, datetime.min.time())\n", + "date_to = datetime.combine(date_to.value, datetime.max.time())\n", + "\n", "try:\n", " r = requests.get(\"http://localhost/telemetry/{serial}/{date_from}/{date_to}/\".format(\n", " serial=serial.value,\n", - " date_from=date_from.value,\n", - " date_to=date_to.value\n", + " date_from=date_from,\n", + " date_to=date_to\n", " ))\n", - " data = r.json()\n", + " \n", "except requests.exceptions.RequestException as e:\n", " raise SystemExit(e)\n", "\n", - "df = pd.json_normalize(data)\n", - "index = pd.to_datetime(df['time'])\n", - "df = df.set_index(index)\n", - "df = df.resample('5min').agg(['min', 'max', 'mean'])" + "r.raise_for_status()\n", + "\n", + "df = pd.json_normalize(r.json())\n", + "if 'time' in df:\n", + " index = pd.to_datetime(df['time'])\n", + " df = df.set_index(index)\n", + " df = df.resample('5min').agg(['min', 'max', 'mean'])\n", + "else:\n", + " print('No data to compute')" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "related-place", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - " \n", - " " - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "showlegend": false, - "type": "scatter", - "x": [ - "2021-03-24T17:15:00+00:00", - "2021-03-24T17:20:00+00:00", - "2021-03-24T17:25:00+00:00", - "2021-03-24T17:30:00+00:00", - "2021-03-24T17:35:00+00:00", - "2021-03-24T17:40:00+00:00", - "2021-03-24T17:45:00+00:00", - "2021-03-24T17:50:00+00:00", - "2021-03-24T17:55:00+00:00", - "2021-03-24T18:00:00+00:00", - "2021-03-24T18:05:00+00:00", - "2021-03-24T18:10:00+00:00", - "2021-03-24T18:15:00+00:00", - "2021-03-24T18:20:00+00:00", - "2021-03-24T18:25:00+00:00", - "2021-03-24T18:30:00+00:00", - "2021-03-24T18:35:00+00:00", - "2021-03-24T18:40:00+00:00", - "2021-03-24T18:45:00+00:00", - "2021-03-24T18:50:00+00:00", - "2021-03-24T18:55:00+00:00", - "2021-03-24T19:00:00+00:00", - "2021-03-24T19:05:00+00:00", - "2021-03-24T19:10:00+00:00", - "2021-03-24T19:15:00+00:00", - "2021-03-24T19:20:00+00:00", - "2021-03-24T19:25:00+00:00", - "2021-03-24T19:30:00+00:00", - "2021-03-24T19:35:00+00:00", - "2021-03-24T19:40:00+00:00", - "2021-03-24T19:45:00+00:00", - "2021-03-24T19:50:00+00:00", - "2021-03-24T19:55:00+00:00", - "2021-03-24T20:00:00+00:00", - "2021-03-24T20:05:00+00:00", - "2021-03-24T20:10:00+00:00", - "2021-03-24T20:15:00+00:00", - "2021-03-24T20:20:00+00:00", - "2021-03-24T20:25:00+00:00", - "2021-03-24T20:30:00+00:00", - "2021-03-24T20:35:00+00:00", - "2021-03-24T20:40:00+00:00", - "2021-03-24T20:45:00+00:00", - "2021-03-24T20:50:00+00:00", - "2021-03-24T20:55:00+00:00", - "2021-03-24T21:00:00+00:00", - "2021-03-24T21:05:00+00:00", - "2021-03-24T21:10:00+00:00", - "2021-03-24T21:15:00+00:00", - "2021-03-24T21:20:00+00:00", - "2021-03-24T21:25:00+00:00", - "2021-03-24T21:30:00+00:00", - "2021-03-24T21:35:00+00:00", - "2021-03-24T21:40:00+00:00", - "2021-03-24T21:45:00+00:00", - "2021-03-24T21:50:00+00:00", - "2021-03-24T21:55:00+00:00", - "2021-03-24T22:00:00+00:00", - "2021-03-24T22:05:00+00:00", - "2021-03-24T22:10:00+00:00", - "2021-03-24T22:15:00+00:00", - "2021-03-24T22:20:00+00:00", - "2021-03-24T22:25:00+00:00", - "2021-03-24T22:30:00+00:00", - "2021-03-24T22:35:00+00:00", - "2021-03-24T22:40:00+00:00", - "2021-03-24T22:45:00+00:00", - "2021-03-24T22:50:00+00:00", - "2021-03-24T22:55:00+00:00", - "2021-03-24T23:00:00+00:00", - "2021-03-24T23:05:00+00:00", - "2021-03-24T23:10:00+00:00" - ], - "y": [ - -23, - -25, - -31, - -32, - -32, - -32, - -32, - -26, - -18, - -18, - -21, - -21, - -19, - -19, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -18, - -18, - -18, - -14, - -12, - -47, - -49, - -50, - -42, - -49, - -51, - -56, - -55, - -50, - -49, - -49, - -49, - -48, - -45, - -45, - -44, - -44, - -44, - -44, - -43, - -52, - -51, - -50, - -51, - -50, - -50, - -49 - ] - }, - { - "fill": "tonexty", - "name": "WiFI RSSI", - "type": "scatter", - "x": [ - "2021-03-24T17:15:00+00:00", - "2021-03-24T17:20:00+00:00", - "2021-03-24T17:25:00+00:00", - "2021-03-24T17:30:00+00:00", - "2021-03-24T17:35:00+00:00", - "2021-03-24T17:40:00+00:00", - "2021-03-24T17:45:00+00:00", - "2021-03-24T17:50:00+00:00", - "2021-03-24T17:55:00+00:00", - "2021-03-24T18:00:00+00:00", - "2021-03-24T18:05:00+00:00", - "2021-03-24T18:10:00+00:00", - "2021-03-24T18:15:00+00:00", - "2021-03-24T18:20:00+00:00", - "2021-03-24T18:25:00+00:00", - "2021-03-24T18:30:00+00:00", - "2021-03-24T18:35:00+00:00", - "2021-03-24T18:40:00+00:00", - "2021-03-24T18:45:00+00:00", - "2021-03-24T18:50:00+00:00", - "2021-03-24T18:55:00+00:00", - "2021-03-24T19:00:00+00:00", - "2021-03-24T19:05:00+00:00", - "2021-03-24T19:10:00+00:00", - "2021-03-24T19:15:00+00:00", - "2021-03-24T19:20:00+00:00", - "2021-03-24T19:25:00+00:00", - "2021-03-24T19:30:00+00:00", - "2021-03-24T19:35:00+00:00", - "2021-03-24T19:40:00+00:00", - "2021-03-24T19:45:00+00:00", - "2021-03-24T19:50:00+00:00", - "2021-03-24T19:55:00+00:00", - "2021-03-24T20:00:00+00:00", - "2021-03-24T20:05:00+00:00", - "2021-03-24T20:10:00+00:00", - "2021-03-24T20:15:00+00:00", - "2021-03-24T20:20:00+00:00", - "2021-03-24T20:25:00+00:00", - "2021-03-24T20:30:00+00:00", - "2021-03-24T20:35:00+00:00", - "2021-03-24T20:40:00+00:00", - "2021-03-24T20:45:00+00:00", - "2021-03-24T20:50:00+00:00", - "2021-03-24T20:55:00+00:00", - "2021-03-24T21:00:00+00:00", - "2021-03-24T21:05:00+00:00", - "2021-03-24T21:10:00+00:00", - "2021-03-24T21:15:00+00:00", - "2021-03-24T21:20:00+00:00", - "2021-03-24T21:25:00+00:00", - "2021-03-24T21:30:00+00:00", - "2021-03-24T21:35:00+00:00", - "2021-03-24T21:40:00+00:00", - "2021-03-24T21:45:00+00:00", - "2021-03-24T21:50:00+00:00", - "2021-03-24T21:55:00+00:00", - "2021-03-24T22:00:00+00:00", - "2021-03-24T22:05:00+00:00", - "2021-03-24T22:10:00+00:00", - "2021-03-24T22:15:00+00:00", - "2021-03-24T22:20:00+00:00", - "2021-03-24T22:25:00+00:00", - "2021-03-24T22:30:00+00:00", - "2021-03-24T22:35:00+00:00", - "2021-03-24T22:40:00+00:00", - "2021-03-24T22:45:00+00:00", - "2021-03-24T22:50:00+00:00", - "2021-03-24T22:55:00+00:00", - "2021-03-24T23:00:00+00:00", - "2021-03-24T23:05:00+00:00", - "2021-03-24T23:10:00+00:00" - ], - "y": [ - -24.85185185185185, - -29.8, - -31.5, - -32.1, - -32.06666666666667, - -32.03333333333333, - -32.233333333333334, - -31.866666666666667, - -20.833333333333332, - -20.833333333333332, - -23.066666666666666, - -22.866666666666667, - -21.466666666666665, - -19.966666666666665, - -20.033333333333335, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20.033333333333335, - -20.1, - -20, - -20, - -20, - -19.533333333333335, - -18.966666666666665, - -19.1, - -17.9, - -46.233333333333334, - -50.93333333333333, - -51.46666666666667, - -51, - -49.83870967741935, - -54.53333333333333, - -61.06666666666667, - -62.58620689655172, - -61.93333333333333, - -54.4, - -51.333333333333336, - -50, - -50.166666666666664, - -49.63333333333333, - -47.46666666666667, - -48.233333333333334, - -45.1, - -45.53333333333333, - -45.5, - -45.03333333333333, - -45.8, - -55.266666666666666, - -55.166666666666664, - -52.96666666666667, - -53.93333333333333, - -51.766666666666666, - -50.733333333333334, - -50.5 - ] - }, - { - "fill": "tonexty", - "showlegend": false, - "type": "scatter", - "x": [ - "2021-03-24T17:15:00+00:00", - "2021-03-24T17:20:00+00:00", - "2021-03-24T17:25:00+00:00", - "2021-03-24T17:30:00+00:00", - "2021-03-24T17:35:00+00:00", - "2021-03-24T17:40:00+00:00", - "2021-03-24T17:45:00+00:00", - "2021-03-24T17:50:00+00:00", - "2021-03-24T17:55:00+00:00", - "2021-03-24T18:00:00+00:00", - "2021-03-24T18:05:00+00:00", - "2021-03-24T18:10:00+00:00", - "2021-03-24T18:15:00+00:00", - "2021-03-24T18:20:00+00:00", - "2021-03-24T18:25:00+00:00", - "2021-03-24T18:30:00+00:00", - "2021-03-24T18:35:00+00:00", - "2021-03-24T18:40:00+00:00", - "2021-03-24T18:45:00+00:00", - "2021-03-24T18:50:00+00:00", - "2021-03-24T18:55:00+00:00", - "2021-03-24T19:00:00+00:00", - "2021-03-24T19:05:00+00:00", - "2021-03-24T19:10:00+00:00", - "2021-03-24T19:15:00+00:00", - "2021-03-24T19:20:00+00:00", - "2021-03-24T19:25:00+00:00", - "2021-03-24T19:30:00+00:00", - "2021-03-24T19:35:00+00:00", - "2021-03-24T19:40:00+00:00", - "2021-03-24T19:45:00+00:00", - "2021-03-24T19:50:00+00:00", - "2021-03-24T19:55:00+00:00", - "2021-03-24T20:00:00+00:00", - "2021-03-24T20:05:00+00:00", - "2021-03-24T20:10:00+00:00", - "2021-03-24T20:15:00+00:00", - "2021-03-24T20:20:00+00:00", - "2021-03-24T20:25:00+00:00", - "2021-03-24T20:30:00+00:00", - "2021-03-24T20:35:00+00:00", - "2021-03-24T20:40:00+00:00", - "2021-03-24T20:45:00+00:00", - "2021-03-24T20:50:00+00:00", - "2021-03-24T20:55:00+00:00", - "2021-03-24T21:00:00+00:00", - "2021-03-24T21:05:00+00:00", - "2021-03-24T21:10:00+00:00", - "2021-03-24T21:15:00+00:00", - "2021-03-24T21:20:00+00:00", - "2021-03-24T21:25:00+00:00", - "2021-03-24T21:30:00+00:00", - "2021-03-24T21:35:00+00:00", - "2021-03-24T21:40:00+00:00", - "2021-03-24T21:45:00+00:00", - "2021-03-24T21:50:00+00:00", - "2021-03-24T21:55:00+00:00", - "2021-03-24T22:00:00+00:00", - "2021-03-24T22:05:00+00:00", - "2021-03-24T22:10:00+00:00", - "2021-03-24T22:15:00+00:00", - "2021-03-24T22:20:00+00:00", - "2021-03-24T22:25:00+00:00", - "2021-03-24T22:30:00+00:00", - "2021-03-24T22:35:00+00:00", - "2021-03-24T22:40:00+00:00", - "2021-03-24T22:45:00+00:00", - "2021-03-24T22:50:00+00:00", - "2021-03-24T22:55:00+00:00", - "2021-03-24T23:00:00+00:00", - "2021-03-24T23:05:00+00:00", - "2021-03-24T23:10:00+00:00" - ], - "y": [ - -26, - -31, - -34, - -33, - -33, - -33, - -33, - -33, - -30, - -26, - -27, - -27, - -26, - -20, - -21, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -20, - -21, - -21, - -20, - -20, - -20, - -20, - -20, - -20, - -21, - -57, - -56, - -54, - -52, - -59, - -68, - -70, - -67, - -69, - -63, - -56, - -51, - -56, - -53, - -51, - -50, - -46, - -48, - -49, - -46, - -61, - -61, - -63, - -61, - -56, - -55, - -54, - -51 - ] - }, - { - "showlegend": false, - "type": "scatter", - "x": [ - "2021-03-24T17:15:00+00:00", - "2021-03-24T17:20:00+00:00", - "2021-03-24T17:25:00+00:00", - "2021-03-24T17:30:00+00:00", - "2021-03-24T17:35:00+00:00", - "2021-03-24T17:40:00+00:00", - "2021-03-24T17:45:00+00:00", - "2021-03-24T17:50:00+00:00", - "2021-03-24T17:55:00+00:00", - "2021-03-24T18:00:00+00:00", - "2021-03-24T18:05:00+00:00", - "2021-03-24T18:10:00+00:00", - "2021-03-24T18:15:00+00:00", - "2021-03-24T18:20:00+00:00", - "2021-03-24T18:25:00+00:00", - "2021-03-24T18:30:00+00:00", - "2021-03-24T18:35:00+00:00", - "2021-03-24T18:40:00+00:00", - "2021-03-24T18:45:00+00:00", - "2021-03-24T18:50:00+00:00", - "2021-03-24T18:55:00+00:00", - "2021-03-24T19:00:00+00:00", - "2021-03-24T19:05:00+00:00", - "2021-03-24T19:10:00+00:00", - "2021-03-24T19:15:00+00:00", - "2021-03-24T19:20:00+00:00", - "2021-03-24T19:25:00+00:00", - "2021-03-24T19:30:00+00:00", - "2021-03-24T19:35:00+00:00", - "2021-03-24T19:40:00+00:00", - "2021-03-24T19:45:00+00:00", - "2021-03-24T19:50:00+00:00", - "2021-03-24T19:55:00+00:00", - "2021-03-24T20:00:00+00:00", - "2021-03-24T20:05:00+00:00", - "2021-03-24T20:10:00+00:00", - "2021-03-24T20:15:00+00:00", - "2021-03-24T20:20:00+00:00", - "2021-03-24T20:25:00+00:00", - "2021-03-24T20:30:00+00:00", - "2021-03-24T20:35:00+00:00", - "2021-03-24T20:40:00+00:00", - "2021-03-24T20:45:00+00:00", - "2021-03-24T20:50:00+00:00", - "2021-03-24T20:55:00+00:00", - "2021-03-24T21:00:00+00:00", - "2021-03-24T21:05:00+00:00", - "2021-03-24T21:10:00+00:00", - "2021-03-24T21:15:00+00:00", - "2021-03-24T21:20:00+00:00", - "2021-03-24T21:25:00+00:00", - "2021-03-24T21:30:00+00:00", - "2021-03-24T21:35:00+00:00", - "2021-03-24T21:40:00+00:00", - "2021-03-24T21:45:00+00:00", - "2021-03-24T21:50:00+00:00", - "2021-03-24T21:55:00+00:00", - "2021-03-24T22:00:00+00:00", - "2021-03-24T22:05:00+00:00", - "2021-03-24T22:10:00+00:00", - "2021-03-24T22:15:00+00:00", - "2021-03-24T22:20:00+00:00", - "2021-03-24T22:25:00+00:00", - "2021-03-24T22:30:00+00:00", - "2021-03-24T22:35:00+00:00", - "2021-03-24T22:40:00+00:00", - "2021-03-24T22:45:00+00:00", - "2021-03-24T22:50:00+00:00", - "2021-03-24T22:55:00+00:00", - "2021-03-24T23:00:00+00:00", - "2021-03-24T23:05:00+00:00", - "2021-03-24T23:10:00+00:00" - ], - "y": [ - 21, - 22, - 22, - 21, - 20, - 21, - 22, - 20, - 22, - 21, - 22, - 20, - 22, - 23, - 21, - 22, - 23, - 21, - 23, - 23, - 24, - 20, - 21, - 24, - 22, - 19, - 23, - 20, - 23, - 20, - 23, - 21, - 23, - 21, - 24, - 42, - 20, - 20, - 23, - 20, - 21, - 22, - 21, - 22, - 20, - 18, - 19, - 21, - 22, - 19, - 19, - 19, - 19, - 20, - 20, - 22, - 20, - 18, - 20, - 19, - 20, - 19, - 19, - 19, - 18, - 19, - 21, - 20, - 20, - 18, - 18, - 20 - ] - }, - { - "fill": "tonexty", - "name": "Hall effect", - "type": "scatter", - "x": [ - "2021-03-24T17:15:00+00:00", - "2021-03-24T17:20:00+00:00", - "2021-03-24T17:25:00+00:00", - "2021-03-24T17:30:00+00:00", - "2021-03-24T17:35:00+00:00", - "2021-03-24T17:40:00+00:00", - "2021-03-24T17:45:00+00:00", - "2021-03-24T17:50:00+00:00", - "2021-03-24T17:55:00+00:00", - "2021-03-24T18:00:00+00:00", - "2021-03-24T18:05:00+00:00", - "2021-03-24T18:10:00+00:00", - "2021-03-24T18:15:00+00:00", - "2021-03-24T18:20:00+00:00", - "2021-03-24T18:25:00+00:00", - "2021-03-24T18:30:00+00:00", - "2021-03-24T18:35:00+00:00", - "2021-03-24T18:40:00+00:00", - "2021-03-24T18:45:00+00:00", - "2021-03-24T18:50:00+00:00", - "2021-03-24T18:55:00+00:00", - "2021-03-24T19:00:00+00:00", - "2021-03-24T19:05:00+00:00", - "2021-03-24T19:10:00+00:00", - "2021-03-24T19:15:00+00:00", - "2021-03-24T19:20:00+00:00", - "2021-03-24T19:25:00+00:00", - "2021-03-24T19:30:00+00:00", - "2021-03-24T19:35:00+00:00", - "2021-03-24T19:40:00+00:00", - "2021-03-24T19:45:00+00:00", - "2021-03-24T19:50:00+00:00", - "2021-03-24T19:55:00+00:00", - "2021-03-24T20:00:00+00:00", - "2021-03-24T20:05:00+00:00", - "2021-03-24T20:10:00+00:00", - "2021-03-24T20:15:00+00:00", - "2021-03-24T20:20:00+00:00", - "2021-03-24T20:25:00+00:00", - "2021-03-24T20:30:00+00:00", - "2021-03-24T20:35:00+00:00", - "2021-03-24T20:40:00+00:00", - "2021-03-24T20:45:00+00:00", - "2021-03-24T20:50:00+00:00", - "2021-03-24T20:55:00+00:00", - "2021-03-24T21:00:00+00:00", - "2021-03-24T21:05:00+00:00", - "2021-03-24T21:10:00+00:00", - "2021-03-24T21:15:00+00:00", - "2021-03-24T21:20:00+00:00", - "2021-03-24T21:25:00+00:00", - "2021-03-24T21:30:00+00:00", - "2021-03-24T21:35:00+00:00", - "2021-03-24T21:40:00+00:00", - "2021-03-24T21:45:00+00:00", - "2021-03-24T21:50:00+00:00", - "2021-03-24T21:55:00+00:00", - "2021-03-24T22:00:00+00:00", - "2021-03-24T22:05:00+00:00", - "2021-03-24T22:10:00+00:00", - "2021-03-24T22:15:00+00:00", - "2021-03-24T22:20:00+00:00", - "2021-03-24T22:25:00+00:00", - "2021-03-24T22:30:00+00:00", - "2021-03-24T22:35:00+00:00", - "2021-03-24T22:40:00+00:00", - "2021-03-24T22:45:00+00:00", - "2021-03-24T22:50:00+00:00", - "2021-03-24T22:55:00+00:00", - "2021-03-24T23:00:00+00:00", - "2021-03-24T23:05:00+00:00", - "2021-03-24T23:10:00+00:00" - ], - "y": [ - 16.11111111111111, - 15.533333333333333, - 15.933333333333334, - 16.366666666666667, - 15.966666666666667, - 15.866666666666667, - 16.133333333333333, - 16.166666666666668, - 16.5, - 16.166666666666668, - 16.933333333333334, - 15.433333333333334, - 15.566666666666666, - 16.366666666666667, - 16.133333333333333, - 15.466666666666667, - 15.766666666666667, - 16.1, - 16.166666666666668, - 16.533333333333335, - 16.620689655172413, - 15.866666666666667, - 15.1, - 15.666666666666666, - 15.7, - 16.233333333333334, - 15.733333333333333, - 16.066666666666666, - 16.5, - 16.3, - 15.733333333333333, - 16.066666666666666, - 15.966666666666667, - 16.066666666666666, - 17.033333333333335, - 16.733333333333334, - 15.733333333333333, - 15.433333333333334, - 15.766666666666667, - 16.1, - 16.7, - 16.833333333333332, - 15.7, - 15.8, - 15.4, - 15.633333333333333, - 14.9, - 15.366666666666667, - 15.870967741935484, - 15.8, - 15.366666666666667, - 15.172413793103448, - 16.033333333333335, - 15.833333333333334, - 15.366666666666667, - 16.033333333333335, - 15.466666666666667, - 14.566666666666666, - 15.333333333333334, - 15.5, - 15.8, - 15.366666666666667, - 15.666666666666666, - 16, - 15.466666666666667, - 15.666666666666666, - 15.166666666666666, - 15.7, - 15.333333333333334, - 15.3, - 15.4, - 16.03846153846154 - ] - }, - { - "fill": "tonexty", - "showlegend": false, - "type": "scatter", - "x": [ - "2021-03-24T17:15:00+00:00", - "2021-03-24T17:20:00+00:00", - "2021-03-24T17:25:00+00:00", - "2021-03-24T17:30:00+00:00", - "2021-03-24T17:35:00+00:00", - "2021-03-24T17:40:00+00:00", - "2021-03-24T17:45:00+00:00", - "2021-03-24T17:50:00+00:00", - "2021-03-24T17:55:00+00:00", - "2021-03-24T18:00:00+00:00", - "2021-03-24T18:05:00+00:00", - "2021-03-24T18:10:00+00:00", - "2021-03-24T18:15:00+00:00", - "2021-03-24T18:20:00+00:00", - "2021-03-24T18:25:00+00:00", - "2021-03-24T18:30:00+00:00", - "2021-03-24T18:35:00+00:00", - "2021-03-24T18:40:00+00:00", - "2021-03-24T18:45:00+00:00", - "2021-03-24T18:50:00+00:00", - "2021-03-24T18:55:00+00:00", - "2021-03-24T19:00:00+00:00", - "2021-03-24T19:05:00+00:00", - "2021-03-24T19:10:00+00:00", - "2021-03-24T19:15:00+00:00", - "2021-03-24T19:20:00+00:00", - "2021-03-24T19:25:00+00:00", - "2021-03-24T19:30:00+00:00", - "2021-03-24T19:35:00+00:00", - "2021-03-24T19:40:00+00:00", - "2021-03-24T19:45:00+00:00", - "2021-03-24T19:50:00+00:00", - "2021-03-24T19:55:00+00:00", - "2021-03-24T20:00:00+00:00", - "2021-03-24T20:05:00+00:00", - "2021-03-24T20:10:00+00:00", - "2021-03-24T20:15:00+00:00", - "2021-03-24T20:20:00+00:00", - "2021-03-24T20:25:00+00:00", - "2021-03-24T20:30:00+00:00", - "2021-03-24T20:35:00+00:00", - "2021-03-24T20:40:00+00:00", - "2021-03-24T20:45:00+00:00", - "2021-03-24T20:50:00+00:00", - "2021-03-24T20:55:00+00:00", - "2021-03-24T21:00:00+00:00", - "2021-03-24T21:05:00+00:00", - "2021-03-24T21:10:00+00:00", - "2021-03-24T21:15:00+00:00", - "2021-03-24T21:20:00+00:00", - "2021-03-24T21:25:00+00:00", - "2021-03-24T21:30:00+00:00", - "2021-03-24T21:35:00+00:00", - "2021-03-24T21:40:00+00:00", - "2021-03-24T21:45:00+00:00", - "2021-03-24T21:50:00+00:00", - "2021-03-24T21:55:00+00:00", - "2021-03-24T22:00:00+00:00", - "2021-03-24T22:05:00+00:00", - "2021-03-24T22:10:00+00:00", - "2021-03-24T22:15:00+00:00", - "2021-03-24T22:20:00+00:00", - "2021-03-24T22:25:00+00:00", - "2021-03-24T22:30:00+00:00", - "2021-03-24T22:35:00+00:00", - "2021-03-24T22:40:00+00:00", - "2021-03-24T22:45:00+00:00", - "2021-03-24T22:50:00+00:00", - "2021-03-24T22:55:00+00:00", - "2021-03-24T23:00:00+00:00", - "2021-03-24T23:05:00+00:00", - "2021-03-24T23:10:00+00:00" - ], - "y": [ - 7, - 8, - 11, - 12, - 12, - 11, - 10, - 11, - 13, - 7, - 12, - 11, - 12, - 12, - 9, - 12, - 12, - 13, - 12, - 13, - 13, - 12, - 11, - 12, - 12, - 10, - 11, - 12, - 11, - 13, - 12, - 12, - 11, - 8, - 12, - 11, - 9, - 11, - 11, - 12, - 12, - 12, - 9, - 12, - 12, - 13, - 11, - 11, - 13, - 12, - 11, - 13, - 12, - 12, - 10, - 12, - 11, - 10, - 12, - 12, - 13, - 12, - 13, - 13, - 12, - 13, - 10, - 13, - 10, - 11, - 10, - 13 - ] - } - ], - "layout": { - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - } - } - }, - "text/html": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "fig = go.Figure([go.Scatter(x=df.index, y=df['payload.wifi-rssi']['max'], showlegend=False),\n", - " go.Scatter(x=df.index, y=df['payload.wifi-rssi']['mean'], fill=\"tonexty\", name=\"WiFI RSSI\"),\n", - " go.Scatter(x=df.index, y=df['payload.wifi-rssi']['min'], fill=\"tonexty\", showlegend=False),\n", + " go.Scatter(x=df.index, y=df['payload.wifi-rssi']['mean'], name=\"WiFI RSSI\"),\n", + " go.Scatter(x=df.index, y=df['payload.wifi-rssi']['min'], showlegend=False),\n", " go.Scatter(x=df.index, y=df['payload.hall']['max'], showlegend=False),\n", - " go.Scatter(x=df.index, y=df['payload.hall']['mean'],fill=\"tonexty\", name=\"Hall effect\"),\n", - " go.Scatter(x=df.index, y=df['payload.hall']['min'], fill=\"tonexty\", showlegend=False)])\n", + " go.Scatter(x=df.index, y=df['payload.hall']['mean'], name=\"Hall effect\"),\n", + " go.Scatter(x=df.index, y=df['payload.hall']['min'], showlegend=False)])\n", "fig.show()" ] },