86 lines
2.0 KiB
Plaintext
86 lines
2.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from awkward import Record as AwkwardRecord, Array as AwkwardArray\n",
|
|
"import awkward as ak"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"FILENAME = \"export-2024-11-12-16-59-20.parquet\"\n",
|
|
"data = ak.from_parquet(FILENAME)[0]\n",
|
|
"display(data)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from typing import Literal\n",
|
|
"import plotly.graph_objects as go\n",
|
|
"import plotly.express as px\n",
|
|
"import numpy as np\n",
|
|
"\n",
|
|
"\n",
|
|
"def to_scatter(key: str, dev_history: AwkwardArray, plot_key: Literal[\"value\", \"rssi\"] = \"value\") -> go.Scatter:\n",
|
|
" x = ak.to_numpy(dev_history[\"time\"])\n",
|
|
" if plot_key == \"rssi\":\n",
|
|
" y = ak.to_numpy(dev_history[\"rssi\"])\n",
|
|
" elif plot_key == \"value\":\n",
|
|
" y = ak.to_numpy(dev_history[\"value\"])\n",
|
|
" else:\n",
|
|
" raise ValueError(f\"Unknown plot_key: {plot_key}\")\n",
|
|
" return go.Scatter(x=x, y=y, mode=\"lines+markers\", name=key)\n",
|
|
"\n",
|
|
"scatters: list[go.Scatter] = []\n",
|
|
"for k in data.fields:\n",
|
|
" val = data[k]\n",
|
|
" scatters.append(to_scatter(k, val, \"value\"))\n",
|
|
"\n",
|
|
"fig = go.Figure(scatters)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"display(fig)"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.7"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|