import subprocess

import pandas as pd
import matplotlib.pyplot as plt


# echo "pulling files"
# adb -s "$em" exec-out run-as com.somewearlabs.sw.debug tar c files > realmFiles.tar
# echo "unpacking files"
# tar xopf realmFiles.tar
# f_name=$em"_files"
# rm -rf $f_name
# mv files "$f_name"
# open "$f_name"

# run shell command to pull files from device
# subprocess.run(["adb", "-s", "23221JEGR11141", "exec-out", "run-as", "com.somewearlabs.sw.debug", "tar", "c", "files", ">", "realmFiles.tar"])
# subprocess.run(["echo", "unpacking files"])
# subprocess.run(["tar", "xopf", "realmFiles.tar"])
# subprocess.run(["rm", "-rf", "23221JEGR11141_files"])




# Read the CSV file into a DataFrame
df = pd.read_csv('post_data.txt')

# Assuming your CSV file has columns named 'x' and 'y'
x_values = df['timestamp']
y_values = df['latency']

# format x_values as date times
x_values = pd.to_datetime(x_values)
# Plotting the data
plt.plot(x_values, y_values)

# Adding title and labels
plt.title('Latency vs Time')
plt.xlabel('Time')
plt.ylabel('Seconds')

# Display the plot
plt.show()