Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import sqlite3 as sql
import matplotlib.pyplot as plt
from time import sleep
def connect():
conn = sql.connect("C:\\Users\\P\\AppData\\LocalLow\\Statespace\\aimlab_tb\\klutch.bytes")
return conn.cursor()
def getStats(cursor):
return cursor.execute("""
createDate, taskName, flicking,tracking,speed,precision,perception,cognition, compositeScore
from SkillData
where createDate != 'NULL'
def formatOutput():
return getStats(connect())
def check(x):
if x > 2:
return x
#def getLastElement():
# cursor.execute("""
# SELECT flicking, tracking, speed, precision, perception, cognition, compositeScore from SkillData ORDER BY ID DESC LIMIT 1
# """)
def makePlot(data):
flicking = [check(x[2]) for x in data]
tracking = [check(x[3]) for x in data]
speed = [check(x[4]) for x in data]
precision = [check(x[5]) for x in data]
perception = [check(x[6]) for x in data]
cognition = [check(x[7]) for x in data]
compliteScore = [check(round(x[8], 2)) for x in data]
taskName = [x[1] for x in data]
date = [x[0] for x in data]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.set_title(f"AimLab Stats\nScore: {round(compliteScore[-1:][0],2)}"
f"\nFlicking: {round(flicking[-1:][0], 2)}"
f"\nTracking: {round(tracking[-1:][0], 2)}"
f"\nSpeed: {round(speed[-1:][0], 2)}"
f"\nPrecisio: {round(precision[-1:][0], 2)}"
f"\nPerception: {round(perception[-1:][0], 2)}"
f"\nCognition: {round(cognition[-1:][0], 2)}")
ax.set_yticks([x for x in range(0, 110, 5)])
ax.plot(flicking, label='Flicking')
ax.plot(tracking, label='Tracking')
ax.plot(speed, label='speed')
ax.plot(precision, label='precision')
ax.plot(perception, label='perception')
ax.plot(cognition, label='cognition')
if __name__ == '__main__':
while True:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.