# Frenetic Array

## A canvas for logic and imagination.

I was always curious as to what my heart rate would be during an exam, so I decided to test it. Armed with my Apple Watch and a two-hour Differential Equations (DiffEq) final, I tested it.

Here are the results (click to enlarge).

There were four major milestones to bring out.

• Start Exam Well, I start the exam.
• Through Exam I don't generally do entire problems at once, but find a good stopping point, move on, and come back to double check everything.
• Finish Exam I finished all the problems.
• First Review I generally review twice, and this is where I finished the first review.
• Leave Exam I Finished the second review and I'm going back to bed.

The interesting parts were the spikes, and those were generally problems I was either stumped on, or had hoped they would not be on the exam.

The graph was produced via matplotlib. You can find the source code below.

#!/usr/local/bin/python3
#
# plot.py
# Desktop
#
# Created by Illya Starikov on 05/16/17.
#

import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime

import csv

def import_from_csv(filename):
with open(filename, "rt") as csvfile:

date_times = []
values = []

for date_and_time_string, value in csv_parsor:
datetime_object = datetime.strptime(date_and_time_string, '%Y-%m-%d %H:%M:%S')

date_times += [datetime_object]
values += [value]

return (date_times, values)

def main():
# Get the data and the subplots
x, y = import_from_csv('data.csv')
fig, ax = plt.subplots()

# Make the figure wide and draw it
fig.set_size_inches((12, 5))
ax.plot_date(x, y, color='r', marker='x', markersize=6)

# Custom labels, since I have milestones
labels = ["Start Exam", "", "10:15", "", "Through Exam", "10:45", "11:00", "Finish Exam", "", "11:30", "First Review", "Leave Exam", "12:00", "12:15"]

locs = [
mdates.date2num(datetime(2017, 5, 10, 10, 00)),
mdates.date2num(datetime(2017, 5, 10, 10, 00)),
mdates.date2num(datetime(2017, 5, 10, 10, 15)),
mdates.date2num(datetime(2017, 5, 10, 10, 30)),
mdates.date2num(datetime(2017, 5, 10, 10, 30)),
mdates.date2num(datetime(2017, 5, 10, 10, 45)),
mdates.date2num(datetime(2017, 5, 10, 11, 00)),
mdates.date2num(datetime(2017, 5, 10, 11, 13)),
mdates.date2num(datetime(2017, 5, 10, 11, 15)),
mdates.date2num(datetime(2017, 5, 10, 11, 30)),
mdates.date2num(datetime(2017, 5, 10, 11, 35)),
mdates.date2num(datetime(2017, 5, 10, 11, 45)),
mdates.date2num(datetime(2017, 5, 10, 11, 48)),
mdates.date2num(datetime(2017, 5, 10, 12, 00)),
]

# Assign the data, change fonts to Bebas Neue, make titles and labels
ax.set_xticklabels(labels, fontname="Bebas Neue")
ax.set_yticklabels([int(i) for i in ax.get_yticks()], fontname="Bebas Neue")
ax.set_xticks(locs)

ax.set_title("Heart Rate vs. DiffEq Exam", fontsize=22, fontname="Bebas Neue")
ax.set_ylabel("Heart Rate (BPM)", fontsize=14, fontname="Bebas Neue")
ax.set_xlabel("Time", fontsize=14, fontname="Bebas Neue")

# Make nicer x axis
plt.gcf().autofmt_xdate()

# Export that shit
ax.grid()
plt.draw()
plt.savefig("figure.png", format='png', dpi=280)

if __name__ == "__main__":
main()