feat: normalize time before plotting
This commit is contained in:
parent
bbd913dff8
commit
9f1a924986
2 changed files with 22 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,3 +5,5 @@ graph/
|
|||
run2.sh run3.sh run.sh
|
||||
venv/
|
||||
.env
|
||||
survey-export.csv
|
||||
survey-results.png
|
||||
|
|
24
plot.py
24
plot.py
|
@ -9,15 +9,31 @@ conn = psycopg2.connect("postgres://postgres:password@localhost:5420/postgres")
|
|||
cur = conn.cursor()
|
||||
|
||||
# Execute a query
|
||||
cur.execute("SELECT difficulty FROM logs ORDER BY difficulty")# LIMIT 100000")
|
||||
cur.execute("SELECT difficulty FROM logs_avg ORDER BY difficulty") # LIMIT 100000")
|
||||
# Retrieve query results
|
||||
difficulty = cur.fetchall()
|
||||
|
||||
cur.execute("SELECT time FROM logs ORDER BY difficulty")# LIMIT 100000")
|
||||
cur.execute("SELECT mean_time FROM logs_avg ORDER BY difficulty") # LIMIT 100000")
|
||||
time = cur.fetchall()
|
||||
|
||||
|
||||
def norm(arr) -> [int]:
|
||||
elements = []
|
||||
d = 10**7
|
||||
for (a,) in arr:
|
||||
p = a / d
|
||||
elements.append(p)
|
||||
|
||||
return elements
|
||||
|
||||
|
||||
time = norm(time)
|
||||
difficulty = norm(difficulty)
|
||||
|
||||
# reproducible sample data as a pandas dataframe
|
||||
#plt.figure(figsize=(4096, 4096))
|
||||
# plt.figure(figsize=(4096, 4096))
|
||||
plt.scatter(difficulty, time)
|
||||
#cursor(hover=True)
|
||||
# cursor(hover=True)
|
||||
plt.xlabel("Difficulty Factor (1e7)")
|
||||
plt.ylabel("Time (1e7 μs)")
|
||||
plt.show()
|
||||
|
|
Reference in a new issue