# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas

dataset = pandas.read_csv("power.csv", header=1,
                         names=['Time', 'Bus', 'Shunt', 'Load', 'Current', 'Power'])

dataset.set_index('Time', inplace=True)

cleanset = dataset[dataset.Current < 7.5]



ax = cleanset.Current.plot(figsize=(14,4), label='Current (mA)')
ax.set_ylabel('Current (mA)')
ax.set_xlabel('Time (ms)')
ax.set_xlim(0, 8000)
ax.annotate("pm_set(0)", xy=(966, 7.1), xytext=(2000, 5.5),
            arrowprops=dict(facecolor='red', arrowstyle='->'))
ax.annotate("RTC alarm", xy=(6020, 1.7), xytext=(6500, 3),
            arrowprops=dict(facecolor='red', arrowstyle='->'))
ax.annotate("", xy=(1150, 3.2), xytext=(6020, 3.2),
            arrowprops=dict(facecolor='red', arrowstyle='|-|'))
ax.annotate('5 sec',
            xy=(3400, 3.4))

ax.savefig('')

cleanset['diff'] = cleanset.Current.diff()

cleanset['dblediff'] = cleanset['diff'].diff()

cleanset['absdiff'] = abs(cleanset.dblediff)

cleanset[cleanset.absdiff > 1]



StarcoderdataJupyterScriptsDedupFiltered