lineplot
This commit is contained in:
parent
927a70ab3f
commit
ad6069361e
|
@ -4,3 +4,4 @@ test.png
|
||||||
secrets.json
|
secrets.json
|
||||||
__pycache__
|
__pycache__
|
||||||
push.sh
|
push.sh
|
||||||
|
iruway-data/ChatExport_2023-06-16
|
|
@ -0,0 +1,33 @@
|
||||||
|
"""
|
||||||
|
converts a folder of telegram log files into a csv of router-to-router records with the following format
|
||||||
|
date, test, mbps
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import datetime
|
||||||
|
import csv
|
||||||
|
import re
|
||||||
|
data_path = "/home/notplants/computer/projects/janastu-mesh/cowmesh-network-test/iruway-data/ChatExport_2023-06-16/files"
|
||||||
|
|
||||||
|
csv_output_path = "/home/notplants/computer/projects/janastu-mesh/cowmesh-network-test/iruway-data/results.csv"
|
||||||
|
|
||||||
|
with open(csv_output_path, 'w', newline='') as csvfile:
|
||||||
|
output_writer = csv.writer(csvfile, delimiter=',',
|
||||||
|
quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
for file in os.listdir(data_path):
|
||||||
|
if "router" in file:
|
||||||
|
path = os.path.join(data_path, file)
|
||||||
|
with open(path, "r") as f:
|
||||||
|
match_date = re.match("moonlight-(\d+)-(\d+)-2023.*", file)
|
||||||
|
if match_date:
|
||||||
|
date = datetime.date(month=int(match_date.group(1)), day=int(match_date.group(2)), year=2023)
|
||||||
|
contents = f.readlines()
|
||||||
|
for line in contents:
|
||||||
|
# jaaga -> redcottage: 44.8 mbps
|
||||||
|
match_line = re.match("(\S+) -> (\S+): (\S+) mbps", line)
|
||||||
|
if match_line:
|
||||||
|
a = match_line.group(1)
|
||||||
|
b = match_line.group(2)
|
||||||
|
test = "{}->{}".format(a, b)
|
||||||
|
speed = match_line.group(3)
|
||||||
|
if speed != "None":
|
||||||
|
output_writer.writerow([test, date, speed])
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
||||||
|
import plotly.express as px
|
||||||
|
df = px.data.gapminder().query("continent == 'Oceania'")
|
||||||
|
fig = px.line(df, x='date', y='mbps', color='test', markers=True)
|
||||||
|
fig.show()
|
|
@ -225,7 +225,10 @@ class MoonlightTester:
|
||||||
await self.send_log(bot=bot, log_location=log_location)
|
await self.send_log(bot=bot, log_location=log_location)
|
||||||
|
|
||||||
|
|
||||||
async def start_iperf_servers(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
async def start_iperf_servers_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
|
await self.start_iperf_servers()
|
||||||
|
|
||||||
|
async def start_iperf_servers(self):
|
||||||
|
|
||||||
bot = self.get_bot()
|
bot = self.get_bot()
|
||||||
|
|
||||||
|
@ -242,8 +245,10 @@ class MoonlightTester:
|
||||||
|
|
||||||
await log("++ iperf servers are now running")
|
await log("++ iperf servers are now running")
|
||||||
|
|
||||||
|
async def cleanup_iperf_servers_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
|
await self.cleanup_iperf_servers()
|
||||||
|
|
||||||
async def cleanup_iperf_servers(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
async def cleanup_iperf_servers(self):
|
||||||
|
|
||||||
bot = self.get_bot()
|
bot = self.get_bot()
|
||||||
|
|
||||||
|
@ -279,10 +284,10 @@ class MoonlightTester:
|
||||||
pi_iperf_handler = CommandHandler('pi_iperf', self.pi_iperf)
|
pi_iperf_handler = CommandHandler('pi_iperf', self.pi_iperf)
|
||||||
application.add_handler(pi_iperf_handler)
|
application.add_handler(pi_iperf_handler)
|
||||||
|
|
||||||
start_iperf_servers_handler = CommandHandler('start_iperf_servers', self.start_iperf_servers)
|
start_iperf_servers_handler = CommandHandler('start_iperf_servers', self.start_iperf_servers_command)
|
||||||
application.add_handler(start_iperf_servers_handler)
|
application.add_handler(start_iperf_servers_handler)
|
||||||
|
|
||||||
cleanup_iperf_servers_handler = CommandHandler('cleanup_iperf_servers', self.cleanup_iperf_servers)
|
cleanup_iperf_servers_handler = CommandHandler('cleanup_iperf_servers', self.cleanup_iperf_servers_command)
|
||||||
application.add_handler(cleanup_iperf_servers_handler)
|
application.add_handler(cleanup_iperf_servers_handler)
|
||||||
|
|
||||||
speedtest_handler = CommandHandler('speedtest', self.speedtest)
|
speedtest_handler = CommandHandler('speedtest', self.speedtest)
|
||||||
|
|
Loading…
Reference in New Issue