In [8]:
import sys, os
import pandas as pd
import numpy as np
from glob import glob
from tqdm import tqdm
In [9]:
house3_c1 = np.loadtxt( 'datasets/REDD/high_freq/house_3/current_1.dat' )
In [7]:
house3_c1.shape
Out[7]:
In [6]:
house3_c1[:,1]
Out[6]:
In [7]:
df_house3_c1 = pd.DataFrame(
data = house3_c1,
columns=['utc_timestamp', 'cycle_count'] + ['wf_value_'+str(i) for i in range(0, 275)]
)
df_house3_c1.head()
Out[7]:
In [8]:
import matplotlib.pyplot as plt
%matplotlib inline
In [9]:
plt.plot(house3_c1[0,2:])
Out[9]:
In [10]:
plt.plot(house3_c1[1,2:])
Out[10]:
In [12]:
!!pip install tqdm
Out[12]:
In [ ]:
xlabels = list(range(0, 275, 5))
for r in tqdm(range(0, house3_c1.shape[0])):
name_fig = 'datasets/REDD/high_freq/{}/{}/wf_{}.png'.format( 'house_3', 'current_1', house3_c1[r,0] )
if not os.path.isfile(name_fig):
fig = plt.figure(figsize=(15,5))
ax = fig.add_axes([0.1,0.1,0.8,0.8])
ax.plot(house3_c1[r,2:])
ax.grid()
ax.set_xticks(xlabels )
ax.set_xticklabels(xlabels, rotation=90)
ax.set_xlim(0, 274)
ax.set_title('Timestamp: {}'.format(house3_c1[r,0]))
fig.savefig(name_fig) # save the figure to file
plt.close(fig) # close the figure
#plt.plot(house3_c1[8,2:])
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: