Browse Source

Added plot

main
Max Nuding 6 months ago
parent
commit
92eba78afc
  1. 10
      .nova/Tasks/Graph.json
  2. 2
      .nova/Tasks/Run.json
  3. 8
      data.csv
  4. 37
      graph.py
  5. 1
      load.py
  6. 57
      poetry.lock
  7. 1
      pyproject.toml

10
.nova/Tasks/Graph.json

@ -0,0 +1,10 @@
{
"actions" : {
"run" : {
"enabled" : true,
"script" : "poetry run .\/graph.py"
}
},
"identifier" : "EADBCF2F-F2FC-418C-9C08-EBAE9F98C8BD",
"openLogOnRun" : "fail"
}

2
.nova/Tasks/Run.json

@ -6,7 +6,7 @@
},
"run" : {
"enabled" : true,
"path" : "load.py"
"script" : "poetry run .\/load.py"
}
},
"identifier" : "CDE93FB8-3A2B-475E-8051-FE15A8890631"

8
data.csv

@ -1,4 +1,6 @@
timestamp;tempWarmSide1C;tempWarmSide2C;tempCoolSide1C;tempCoolSide2C
1640943245;27.7778;27.7778;8.33333;-45.0;-145.0
1640943252;27.7778;27.7778;8.33333;-45.0;-145.0
1640943256;27.7778;27.7778;8.33333;-45.0;-145.0
1640946129;27.7778;8.33333;-45.0;-145.0
1640946131;27.7778;8.33333;-45.0;-145.0
1640946133;27.7778;8.33333;-45.0;-145.0
1640946135;27.7778;8.33333;-45.0;-145.0
1640948789;27.7778;8.33333;-45.0;-145.0

Can't render this file because it has a wrong number of fields in line 2.

37
graph.py

@ -0,0 +1,37 @@
#!/usr/bin/env python3
import datetime
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib.dates as md
plt.rcParams["figure.autolayout"] = True
data_frame = pd.read_csv("data.csv", delimiter=';')
# Subplot, to move legend next to plot
# 1 row, 1 col, index: 1
plt.subplot(1,1,1)
# Rotate long date text
plt.xticks(rotation=25)
# pyplot doesn't like timestamps
# convert them to "date-numbers" and format
datenums = md.date2num([datetime.datetime.fromtimestamp(ts) for ts in data_frame.timestamp])
xfmt = md.DateFormatter('%Y-%m-%d %H:%M:%S')
ax=plt.gca()
ax.xaxis.set_major_formatter(xfmt)
ax.set_ylabel('Temperature [°C]')
# Data
plt.plot(datenums, data_frame.tempWarmSide1C, label = 'Warm 1', color = 'orange')
plt.plot(datenums, data_frame.tempWarmSide2C, label = 'Warm 2', color = 'orangered')
plt.plot(datenums, data_frame.tempCoolSide1C, label = 'Cool 1', color = 'blue')
plt.plot(datenums, data_frame.tempCoolSide2C, label = 'Cool 2', color = 'navy')
plt.legend(bbox_to_anchor=(1,1), loc="upper left")
plt.show()

1
load.py

@ -21,7 +21,6 @@ def load_temps() -> str:
cols = [
timestamp,
data['tempWarmSide1C'],
data['tempWarmSide1C'],
data['tempWarmSide2C'],
data['tempCoolSide1C'],
data['tempCoolSide2C']

57
poetry.lock

@ -100,6 +100,22 @@ python-versions = ">=3.6"
[package.dependencies]
pyparsing = ">=2.0.2,<3.0.5 || >3.0.5"
[[package]]
name = "pandas"
version = "1.3.5"
description = "Powerful data structures for data analysis, time series, and statistics"
category = "main"
optional = false
python-versions = ">=3.7.1"
[package.dependencies]
numpy = {version = ">=1.21.0", markers = "python_version >= \"3.10\""}
python-dateutil = ">=2.7.3"
pytz = ">=2017.3"
[package.extras]
test = ["hypothesis (>=3.58)", "pytest (>=6.0)", "pytest-xdist"]
[[package]]
name = "pillow"
version = "8.4.0"
@ -130,6 +146,14 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
[package.dependencies]
six = ">=1.5"
[[package]]
name = "pytz"
version = "2021.3"
description = "World timezone definitions, modern and historical"
category = "main"
optional = false
python-versions = "*"
[[package]]
name = "requests"
version = "2.26.0"
@ -195,7 +219,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[metadata]
lock-version = "1.1"
python-versions = "3.10"
content-hash = "0cb08733ddb359ced7f8ee1bb8fb698231366e3738c43eba603f263dd3024611"
content-hash = "c0ce7394cf45bc3f9a2e973b27fbbbb6b6494a8d066b7d97fa9866c8541d0023"
[metadata.files]
certifi = [
@ -337,6 +361,33 @@ packaging = [
{file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"},
{file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"},
]
pandas = [
{file = "pandas-1.3.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:62d5b5ce965bae78f12c1c0df0d387899dd4211ec0bdc52822373f13a3a022b9"},
{file = "pandas-1.3.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:adfeb11be2d54f275142c8ba9bf67acee771b7186a5745249c7d5a06c670136b"},
{file = "pandas-1.3.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:60a8c055d58873ad81cae290d974d13dd479b82cbb975c3e1fa2cf1920715296"},
{file = "pandas-1.3.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fd541ab09e1f80a2a1760032d665f6e032d8e44055d602d65eeea6e6e85498cb"},
{file = "pandas-1.3.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2651d75b9a167cc8cc572cf787ab512d16e316ae00ba81874b560586fa1325e0"},
{file = "pandas-1.3.5-cp310-cp310-win_amd64.whl", hash = "sha256:aaf183a615ad790801fa3cf2fa450e5b6d23a54684fe386f7e3208f8b9bfbef6"},
{file = "pandas-1.3.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:344295811e67f8200de2390093aeb3c8309f5648951b684d8db7eee7d1c81fb7"},
{file = "pandas-1.3.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:552020bf83b7f9033b57cbae65589c01e7ef1544416122da0c79140c93288f56"},
{file = "pandas-1.3.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5cce0c6bbeb266b0e39e35176ee615ce3585233092f685b6a82362523e59e5b4"},
{file = "pandas-1.3.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7d28a3c65463fd0d0ba8bbb7696b23073efee0510783340a44b08f5e96ffce0c"},
{file = "pandas-1.3.5-cp37-cp37m-win32.whl", hash = "sha256:a62949c626dd0ef7de11de34b44c6475db76995c2064e2d99c6498c3dba7fe58"},
{file = "pandas-1.3.5-cp37-cp37m-win_amd64.whl", hash = "sha256:8025750767e138320b15ca16d70d5cdc1886e8f9cc56652d89735c016cd8aea6"},
{file = "pandas-1.3.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fe95bae4e2d579812865db2212bb733144e34d0c6785c0685329e5b60fcb85dd"},
{file = "pandas-1.3.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f261553a1e9c65b7a310302b9dbac31cf0049a51695c14ebe04e4bfd4a96f02"},
{file = "pandas-1.3.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8b6dbec5f3e6d5dc80dcfee250e0a2a652b3f28663492f7dab9a24416a48ac39"},
{file = "pandas-1.3.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d3bc49af96cd6285030a64779de5b3688633a07eb75c124b0747134a63f4c05f"},
{file = "pandas-1.3.5-cp38-cp38-win32.whl", hash = "sha256:b6b87b2fb39e6383ca28e2829cddef1d9fc9e27e55ad91ca9c435572cdba51bf"},
{file = "pandas-1.3.5-cp38-cp38-win_amd64.whl", hash = "sha256:a395692046fd8ce1edb4c6295c35184ae0c2bbe787ecbe384251da609e27edcb"},
{file = "pandas-1.3.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bd971a3f08b745a75a86c00b97f3007c2ea175951286cdda6abe543e687e5f2f"},
{file = "pandas-1.3.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:37f06b59e5bc05711a518aa10beaec10942188dccb48918bb5ae602ccbc9f1a0"},
{file = "pandas-1.3.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c21778a688d3712d35710501f8001cdbf96eb70a7c587a3d5613573299fdca6"},
{file = "pandas-1.3.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3345343206546545bc26a05b4602b6a24385b5ec7c75cb6059599e3d56831da2"},
{file = "pandas-1.3.5-cp39-cp39-win32.whl", hash = "sha256:c69406a2808ba6cf580c2255bcf260b3f214d2664a3a4197d0e640f573b46fd3"},
{file = "pandas-1.3.5-cp39-cp39-win_amd64.whl", hash = "sha256:32e1a26d5ade11b547721a72f9bfc4bd113396947606e00d5b4a5b79b3dcb006"},
{file = "pandas-1.3.5.tar.gz", hash = "sha256:1e4285f5de1012de20ca46b188ccf33521bff61ba5c5ebd78b4fb28e5416a9f1"},
]
pillow = [
{file = "Pillow-8.4.0-cp310-cp310-macosx_10_10_universal2.whl", hash = "sha256:81f8d5c81e483a9442d72d182e1fb6dcb9723f289a57e8030811bac9ea3fef8d"},
{file = "Pillow-8.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3f97cfb1e5a392d75dd8b9fd274d205404729923840ca94ca45a0af57e13dbe6"},
@ -388,6 +439,10 @@ python-dateutil = [
{file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"},
{file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"},
]
pytz = [
{file = "pytz-2021.3-py2.py3-none-any.whl", hash = "sha256:3672058bc3453457b622aab7a1c3bfd5ab0bdae451512f6cf25f64ed37f5b87c"},
{file = "pytz-2021.3.tar.gz", hash = "sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326"},
]
requests = [
{file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"},
{file = "requests-2.26.0.tar.gz", hash = "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"},

1
pyproject.toml

@ -9,6 +9,7 @@ python = "3.10"
requests = "^2.26.0"
numpy = "1.21.5"
matplotlib = "3.5.1"
pandas = "^1.3.5"
[tool.poetry.dev-dependencies]

Loading…
Cancel
Save