Ingredients

Libraries

In [22]:
import numpy as np, scipy, matplotlib.pyplot as plt, pandas as pd, seaborn as sns
sns.set(style='whitegrid')
plt.rcParams['figure.figsize'] = (20.0, 10.0)
import IPython.display as ipd
%run detect_peaks.py
plt.rcParams['figure.figsize'] = [10, 5]
%matplotlib inline

Data

In [36]:
data = pd.DataFrame.from_csv('./HackLab_Vol1_Excerpts/HackLab_Vol1_Excerpts/Vol1_P2_1_Exrpt.csv')
data = data.drop('Sample',axis=1)
In [85]:
samples = pd.DataFrame.from_csv('./HackLab_Vol1_Excerpts/HackLab_Vol1_Excerpts/Vol1_P2_1_Exrpt.csv')
samples = samples['Sample']
In [37]:
data.plot(figsize = (16,10))
Out[37]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f8f3fece690>

Preparations

In [26]:
from scipy import signal
In [40]:
sig = data['P1']
In [41]:
len(sig)
Out[41]:
901
In [42]:
f,ax = plt.subplots(5,2,figsize = (32,20), sharex=True)
ax[0,0].plot(data['P1'],color = 'red')
ax[1,0].plot(data['P2'],color = 'orange')
ax[2,0].plot(data['P3'],color = 'yellow')
ax[3,0].plot(data['P4'],color = 'green')
ax[4,0].plot(data['P5'],color = 'brown')
ax[0,1].plot(data['P6'],color = 'blue')
ax[1,1].plot(data['P7'],color = 'grey')
ax[2,1].plot(data['P8'],color = 'purple')
ax[3,1].plot(data['P9'],color = 'black')
Out[42]:
[<matplotlib.lines.Line2D at 0x7f8f3ff89990>]
In [46]:
data.hist(figsize=(16,10))
Out[46]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3f003c50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3eff73d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3efbc110>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3ef4fc50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3eec9650>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3ee85610>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3ee500d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3ee1f110>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3eddfb90>]],
      dtype=object)
In [63]:
from pandas.plotting import scatter_matrix
scatter_matrix(data, alpha=0.2, figsize=(16, 16), diagonal='kde')
Out[63]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3ca17f10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3ceeb790>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c9a9ad0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c80ae10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c87d750>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c971690>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c93b150>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c885190>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c7c7c10>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c8e3c10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3d5109d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3da5fc50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c7440d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c70d190>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c73e590>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c68d050>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c6a96d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c61b590>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c697dd0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c5a2290>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c56e2d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c539390>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c4fae10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c4b8550>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c4614d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c3c7b10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c3965d0>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c34fa10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c37a510>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c2dffd0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c2aba90>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c288410>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c232890>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c1832d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c142d50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c10ed90>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c0ccad0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c098510>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c056f90>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3c022fd0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37fdcb90>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37faf5d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37f7d090>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37ecb0d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37ed43d0>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37e47890>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37e12350>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37ddf390>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37d9ed90>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37d5b9d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37d2c410>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37cca3d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37cba7d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37cca5d0>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37bc27d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37b90290>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37b50c10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37b1dcd0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37ad9a10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37aa64d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37a64ed0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37a32f90>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f379e9ad0>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f379bd510>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3797bf90>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f378c8fd0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f378e2210>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f378557d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37822190>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37822e10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f377b1650>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3776ba10>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f8f377374d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37685490>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37648f10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f376ec390>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f375cd710>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3759e0d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f3755eb50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f37529b10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f8f374e5ad0>]],
      dtype=object)