Ingredients

Libraries

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

Data

In [37]:
data = pd.DataFrame.from_csv('./HackLab_Vol2_Excerpts/HackLab_Vol2_Excerpts/Vol2_P2_Exrpt.csv')
data = data.drop('Time',axis = 1)
In [38]:
data
Out[38]:
p1 p2 p3 p4 p5 p6 m1 m2 m3 m4
Sample
471 1848 1601 1865 1614 2092 1879 1999 2023 1751 1878
472 1855 1587 1866 1605 2084 1880 1994 2014 1763 1880
473 1863 1577 1866 1600 2090 1885 1993 2012 1764 1877
474 1868 1561 1870 1594 2091 1888 1991 2005 1761 1868
475 1874 1556 1874 1587 2086 1894 1993 2060 1750 1863
476 1880 1552 1889 1583 2089 1901 1995 2096 1742 1851
477 1887 1547 1901 1586 2088 1897 1995 2081 1737 1839
478 1886 1543 1915 1578 2085 1896 1995 2089 1720 1854
479 1883 1543 1926 1578 2089 1890 2001 2096 1710 1892
480 1882 1541 1935 1580 2091 1891 1996 2093 1712 1947
481 1881 1537 1941 1580 2086 1888 1990 2077 1699 1960
482 1879 1540 1944 1580 2091 1883 1993 2068 1695 1955
483 1871 1535 1945 1580 2094 1883 2002 2055 1694 1955
484 1865 1533 1939 1583 2092 1882 2011 2044 1686 1991
485 1859 1531 1933 1584 2087 1878 2026 2039 1678 2031
486 1847 1540 1915 1585 2090 1879 2038 2036 1655 2037
487 1838 1571 1904 1581 2085 1877 2045 2019 1638 2014
488 1832 1609 1892 1590 2084 1876 2053 2005 1625 1975
489 1833 1647 1884 1600 2089 1877 2065 1989 1606 1940
490 1830 1686 1875 1604 2082 1876 2065 1968 1596 1916
491 1829 1717 1874 1614 2088 1873 2068 1957 1584 1879
492 1830 1724 1868 1624 2089 1870 2074 1959 1579 1856
493 1827 1734 1872 1632 2080 1872 2078 1961 1578 1848
494 1822 1759 1868 1639 2084 1872 2078 1955 1576 1851
495 1822 1792 1870 1633 2090 1875 2067 1950 1580 1848
496 1830 1828 1869 1627 2081 1874 2052 1950 1579 1859
497 1842 1845 1870 1622 2083 1874 2040 1951 1583 1870
498 1847 1848 1870 1614 2095 1874 2027 1947 1590 1888
499 1844 1845 1870 1603 2081 1870 2015 1939 1587 1931
500 1846 1836 1870 1599 2085 1869 2001 1927 1588 1975
... ... ... ... ... ... ... ... ... ... ...
1842 1715 1650 1902 1657 2103 1888 2013 1859 1822 1949
1843 1711 1663 1906 1670 2110 1893 2014 1849 1788 1918
1844 1716 1681 1915 1674 2107 1901 2014 1845 1772 1889
1845 1718 1694 1925 1683 2111 1906 2007 1837 1754 1880
1846 1726 1712 1927 1681 2111 1912 2007 1835 1753 1881
1847 1733 1721 1938 1676 2098 1912 2007 1836 1753 1874
1848 1744 1724 1941 1675 2105 1906 2005 1836 1742 1856
1849 1758 1734 1947 1672 2126 1904 2009 1829 1720 1839
1850 1764 1734 1954 1669 2100 1903 2009 1823 1704 1838
1851 1772 1722 1960 1664 2118 1896 2012 1824 1705 1851
1852 1786 1706 1954 1662 2118 1894 2013 1825 1698 1843
1853 1797 1694 1947 1660 2098 1894 2013 1821 1692 1840
1854 1806 1666 1933 1654 2112 1888 2010 1821 1678 1835
1855 1817 1637 1919 1645 2128 1888 2012 1817 1670 1827
1856 1830 1616 1909 1640 2121 1884 2017 1823 1668 1845
1857 1843 1602 1902 1636 2123 1878 2030 1825 1665 1862
1858 1858 1597 1893 1626 2117 1875 2048 1826 1672 1870
1859 1862 1591 1887 1616 2102 1874 2069 1827 1675 1879
1860 1866 1596 1887 1605 2115 1875 2081 1821 1681 1888
1861 1868 1595 1884 1595 2127 1876 2085 1816 1687 1893
1862 1868 1595 1878 1599 2103 1875 2091 1810 1688 1890
1863 1862 1598 1877 1596 2117 1874 2092 1799 1683 1894
1864 1862 1600 1873 1592 2121 1870 2103 1793 1691 1886
1865 1859 1600 1871 1588 2098 1871 2105 1783 1696 1875
1866 1856 1596 1872 1588 2103 1865 2098 1773 1700 1867
1867 1843 1598 1877 1595 2102 1865 2083 1762 1700 1860
1868 1827 1599 1878 1596 2089 1862 2068 1750 1709 1851
1869 1815 1600 1890 1604 2083 1865 2059 1728 1694 1845
1870 1805 1599 1898 1612 2091 1866 2048 1724 1684 1836
1871 1793 1601 1908 1621 2084 1865 2040 1717 1668 1844

1401 rows × 10 columns

Preparations

In [41]:
f,ax = plt.subplots(5,2,figsize = (32,20), sharex=True, sharey=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['m1'],color = 'grey')
ax[2,1].plot(data['m2'],color = 'purple')
ax[3,1].plot(data['m3'],color = 'black')
ax[4,1].plot(data['m4'],color = 'black')
Out[41]:
[<matplotlib.lines.Line2D at 0x7f90fd832950>]
In [42]:
%run detect_peaks.py
<matplotlib.figure.Figure at 0x7f90fdfa5450>
In [51]:
detect_peaks(data['p1'],show=True)
detect_peaks(data['p2'],show=True)
detect_peaks(data['p3'],show=True)
detect_peaks(data['p4'],show=True)
detect_peaks(data['p5'],show=True)
detect_peaks(data['p6'],show=True)
Out[51]:
array([   5,    9,   15,   18,   22,   24,   37,   51,   62,   73,   79,
         85,   88,   91,   94,   97,  103,  112,  119,  122,  141,  160,
        162,  167,  177,  191,  200,  202,  204,  211,  213,  216,  229,
        240,  244,  247,  251,  253,  258,  269,  284,  286,  289,  293,
        307,  320,  323,  330,  334,  337,  350,  366,  369,  372,  374,
        385,  400,  404,  415,  432,  439,  441,  445,  448,  450,  470,
        474,  493,  495,  501,  507,  510,  520,  525,  527,  530,  536,
        539,  542,  547,  552,  555,  564,  566,  573,  577,  580,  590,
        603,  608,  610,  613,  617,  619,  622,  625,  632,  634,  640,
        643,  647,  651,  655,  660,  663,  687,  701,  706,  720,  736,
        742,  748,  752,  762,  771,  784,  786,  802,  819,  824,  830,
        839,  841,  850,  857,  860,  863,  867,  869,  876,  885,  887,
        889,  895,  907,  916,  920,  923,  926,  930,  941,  951,  958,
        962,  970,  973,  976,  981,  992,  995,  998, 1006, 1008, 1019,
       1022, 1027, 1029, 1033, 1039, 1042, 1051, 1061, 1075, 1078, 1081,
       1095, 1106, 1110, 1126, 1134, 1137, 1144, 1148, 1156, 1163, 1171,
       1174, 1179, 1187, 1190, 1199, 1203, 1209, 1211, 1215, 1217, 1224,
       1234, 1240, 1243, 1254, 1263, 1271, 1277, 1287, 1299, 1303, 1309,
       1316, 1322, 1325, 1328, 1331, 1334, 1337, 1346, 1350, 1355, 1361,
       1375, 1390, 1394, 1399])