You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
934 B

import pandas as pd
import datetime
import csv
import os
import matplotlib.pyplot as plt
from shutil import copyfile
with open("/home/trackingv2/trackingv2.frac.csv", "r") as f:
reader = csv.reader(f)
next(reader)
with open("/home/trackingv2/trackingv2.approx.csv", "w", newline='') as write:
writer = csv.writer(write)
writer.writerow(["frac_power6", "datetime"])
for row in reader:
per = pow(float(row[0]), 6)
writer.writerow([per, row[1]])
x_axis='datetime'
y_axis='frac_power6'
df = pd.read_csv("/home/trackingv2/trackingv2.approx.csv")
title = "Expected chance that a v2 onion is unreachable"
df.plot(kind="line", x=x_axis, y=y_axis, ylim=([0,1]), title=title, grid=True, rot=20, figsize=(6,5))
plt.savefig("/var/www/data/fraction_power6_plot.png")
copyfile("/home/trackingv2/trackingv2.approx.csv", "/var/www/data/fraction_power6_v2.csv")
print("plotted "+title)