Add DuckTrack as initial annotation tool; Initial multimodal test

This commit is contained in:
Timothyxxx
2023-11-27 00:34:57 +08:00
parent 8c0525c20e
commit 8272e93953
53 changed files with 1705 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import csv
import matplotlib.pyplot as plt
def plot_from_csv(filename, save_plot=False):
durations = []
sleep_errors = []
busy_sleep_errors = []
with open(filename, 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
durations.append(float(row['duration']))
sleep_errors.append(float(row['sleep_error']))
busy_sleep_errors.append(float(row['busy_sleep_error']))
plt.figure(figsize=(10, 5))
plt.plot(durations, sleep_errors, label='time.sleep()', marker='o')
plt.plot(durations, busy_sleep_errors, label='busy_sleep()', marker='x')
plt.xlabel('Desired Delay (ms)')
plt.ylabel('Average Error (ms)')
plt.title('Sleep Accuracy: time.sleep() vs Busy-Wait Loop (macOS)')
plt.legend()
plt.grid(True)
if save_plot:
plt.savefig('sleep_accuracy_plot.png', dpi=300)
print("Plot saved as sleep_accuracy_plot.png")
plt.show()
plot_from_csv('sleep_data.csv', save_plot=True)