diff --git a/viz.ipynb b/viz.ipynb
index 18c464a..7166bef 100644
--- a/viz.ipynb
+++ b/viz.ipynb
@@ -2,20 +2,21 @@
"cells": [
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"import statistics\n",
"import math\n",
- "import numpy as np\n",
+ "import itertools\n",
"\n",
+ "import numpy as np\n",
"from matplotlib import pyplot as plt"
]
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -24,7 +25,7 @@
},
{
"cell_type": "code",
- "execution_count": 51,
+ "execution_count": 92,
"metadata": {},
"outputs": [],
"source": [
@@ -36,14 +37,16 @@
"# ring upstairs, thr=250\n",
"#capture = [1792, 1890, 2014, 1888, 1770, 1862, 1888, 1857, 1817, 1967, 1714, 1665, 1739, 1714, 1674, 1666, 1651, 1730, 1587, 1681, 1690, 1631, 1729, 1727, 1663, 1663, 1744, 1639, 1729, 1658, 1674, 1710, 1654, 1763, 1651, 1696, 1693, 1662, 1773, 1655, 1646, 1661, 1744, 1667, 1611, 1655, 1680, 1695, 1642, 1716, 1707, 1610, 1594, 1600, 1650, 1605, 1710, 1737, 1621, 1669, 1669, 1771, 1687, 1663, 1629, 1678, 1607, 1675, 1693, 1721, 1551, 1728, 1590, 1650, 1607, 1715, 1771, 1631, 1703, 1626, 1634, 1664, 1691, 1654, 1640, 1691, 1527, 1647, 1740, 1659, 1713, 1630, 1682, 1643, 1613, 1622, 1599, 1555, 1601, 1680, 1613, 1693, 1655, 1635, 1651, 1683, 1673, 1533, 1745, 1684, 1689, 1673, 1647, 1680, 1725, 1663, 1687, 1710, 1711, 1639, 1703, 1677, 1642, 1687, 1617, 1681, 1715, 1651, 1664, 1600, 1584, 1619, 1623, 1715, 1565, 1654, 1594, 1751, 1760, 1646, 1691, 1714, 1726, 1682, 1614, 1659, 1689, 1625, 1627, 1776, 1694, 1699, 1766, 1616, 1680, 1651, 1669, 1747, 1695, 1675, 1567, 1681, 1680, 1648, 1818, 1664, 1658, 1648, 1707, 1678, 1645, 1680, 1687, 1744, 1617, 1677, 1627, 1639, 1680, 1674, 1664, 1680, 1743, 1616, 1675, 1697, 1615, 1779, 1680, 1746, 1662, 1664, 1621, 1552, 1751, 1674, 1745, 1680, 1673, 1633, 1729, 1667, 1666, 1653, 1649, 1707, 1606, 1669, 1747, 1683, 1674, 1685, 1579, 1585, 1669, 1713, 1657, 1651, 1680, 1559, 1680, 1621, 1535, 1649, 1644, 1713, 1651, 1658, 1671, 1648, 1707, 1682, 1641, 1678, 1647, 1735, 1643, 1747, 1745, 1808, 1568, 1655, 1671, 1622, 1581, 1595, 1695, 1686, 1687, 1597, 1749, 1616, 1747, 1638, 1786, 1750, 1680, 1668, 1679, 1617, 1854, 1610, 1702, 1674, 1614, 1661, 1589, 1682, 1595, 1552, 1692, 1711, 1660, 1600, 1663, 1654, 1745, 1601, 1715, 1767, 1643, 1630, 1574, 1598, 1664, 1671, 1643, 1707, 1718, 1591, 1716, 1710, 1704, 1582, 1584, 1664, 1707, 1739, 1709, 1589, 1582, 1651, 1621, 1705, 1717, 1626, 1643, 1734, 1682, 1641, 1680, 1754, 1590, 1709, 1685, 1667, 1647, 1709, 1667, 1744, 1590, 1712, 1722, 1628, 1678, 1646, 1693, 1635, 1662, 1728, 1701, 1626, 1717, 1603, 1529, 1606, 1700, 1733, 1604, 1575, 1654, 1726, 1697, 1595, 1634, 1638, 1667, 1663, 1616, 1709, 1693, 1580, 1725, 1826, 1671, 1653, 1632, 1719, 1698, 1654, 1658, 1693, 1600, 1595, 1649, 1603, 1679, 1637, 1673, 1737, 1648, 1555, 1775, 1685, 1707, 1663, 1686, 1594, 1754, 1805, 1730, 1590, 1745, 1689, 1622, 1638, 1655, 1680, 1583, 1663, 1672, 1679, 1677, 1687, 1601, 1550, 1650, 1647, 1703, 1715, 1712, 1633, 1661, 1673, 1675, 1642, 1616, 1613, 1616, 1667, 1650, 1744, 1668, 1664, 1680, 1655, 1675, 1586, 1584, 1683, 1631, 1631, 1646, 1619, 1635, 1641, 1651, 1621, 1712, 1601, 1661, 1584, 1662, 1719, 1617, 1681, 1793, 1754, 1691, 1728, 1626, 1754, 1681, 1571, 1676, 1712, 1639, 1648, 1727, 1651, 1691, 1617, 1754, 1607, 1712, 1682, 1706, 1637, 1609, 1666, 1664, 1637, 1626, 1669, 1705, 1715, 1675, 1717, 1663, 1531, 1733, 1679, 1722, 1648, 1578, 1603, 1803, 1737, 1651, 1642, 1627, 1680, 1725, 1745, 1620, 1657, 1699, 1685, 1505, 1638, 1742, 1670, 1730, 1676, 1691, 1639, 1637, 1619, 1679, 1771, 1646, 1648, 1744, 1775, 1581, 1651, 1618, 1666, 1665, 1692, 1675, 1680, 1597, 1683, 1711, 1639, 1697, 1655, 1723, 1675, 1594, 1631, 1627, 1664, 1729, 1679, 1706, 1637, 1616, 1712, 1759, 1646, 1694, 1653, 1633, 1710, 1725, 1575, 1621, 1613, 1582, 1590, 1699, 1744, 1680, 1760, 1681, 1704, 1579, 1717, 1712, 1604, 1663, 1665, 1663, 1707, 1641, 1616, 1648, 1635, 1562, 1958, 1669, 1721, 1645, 1743, 1648, 1605, 2006, 1644, 1663, 1701, 1583, 1677, 1659, 1744, 1709, 1728, 1635, 1686, 1570, 1610, 1729, 1667, 1638, 1619, 1664, 1702, 1686, 1643, 1628, 1680, 1603, 1615, 1594, 1600, 1577, 1522, 1727, 1664, 1680, 1611, 1716, 1642, 1629, 1665, 1630, 1678, 1655, 1594, 1552, 1648, 1665, 1675, 1741, 1635, 1649, 1680, 1667, 1584, 1629, 1584, 1597, 1680, 1692, 1655, 1584, 1691, 1614, 1753, 1722, 1637, 1594, 1673, 1649, 1628, 1645, 1786, 1648, 1744, 1591, 1660, 1577, 1666, 1706, 1728, 1709, 1639, 1666, 1673, 1682, 1662, 1649, 1729, 1677, 1638, 1651, 1803, 1731, 1719, 1666, 1648, 1643, 1655, 1725, 1697, 1734, 1614, 1655, 1647, 1731, 1786, 1618, 1706, 1716, 1552, 1648, 1616, 1645, 1755, 1616, 1696, 1723, 1683, 1635, 1683, 1794, 1600, 1692, 1741, 1712, 1690, 1648, 1609, 1663, 1727, 1646, 1725, 1696, 1686, 1617, 1649, 1682, 1680, 1719, 1575, 1659, 1638, 1712, 1593, 1779, 1680, 1722, 1607, 1680, 1699, 1759, 1645, 1661, 1661, 1616, 1668, 1616, 1750, 1761, 1680, 1743, 1697, 1613, 1629, 1682, 1669, 1581, 1643, 1617, 1627, 1712, 1702, 1778, 1630, 1662, 1621, 1680, 1648, 1674, 1514, 1615, 1557, 1639, 1623, 1703, 1664, 1680, 1552, 1696, 1659, 1579, 1617, 1689, 1675, 1531, 1655, 1600, 1728, 1587, 1648, 1575, 1671, 1669, 1602, 1649, 1685, 1639, 1643, 1728, 1682, 1655, 1641, 1600, 1679, 1671, 1503, 1750, 1709, 1721, 1614, 1606, 1709, 1682, 1659, 1785, 1653, 1595, 1547, 1712, 1600, 1578, 1666, 1714, 1670, 1683, 1667, 1631, 1651, 1746, 1658, 1611, 1618, 1669, 1713, 1739, 1681, 1690, 1763, 1674, 1621, 1631, 1593, 1616, 1681, 1637, 1619, 1685, 1589, 1637, 1562, 1674, 1716, 1661, 1626, 1733, 1603, 1634, 1674, 1573, 1649, 1574, 1554, 1645, 1616, 1642, 1659, 1761, 1623, 1743, 1637, 1709, 1618, 1719, 1597, 1704, 1744, 1679, 1697, 1644, 1711, 1638, 1675, 1698, 1739, 1597, 1651, 1674, 1728, 1651, 1743, 1771, 1706, 1893, 1667, 1641, 1662, 1815, 1721, 1665, 1747, 1611, 1677, 1661, 1694, 1709, 1751, 1730, 1680, 1776, 1600, 1739, 1696, 1677, 1581, 1766, 1638, 1761, 1773, 1553, 1562, 1605, 1664, 1725, 1600, 1525, 1631, 1605, 1683, 1738, 1634, 1636, 1675, 1552, 1664, 1707, 1745, 1654, 1727, 1666, 1627, 1734, 1613, 1759, 1731, 1584, 1719, 1687, 1681, 1661, 1686, 1575, 1662, 1703, 1738, 1646, 1552, 1664, 1712, 1547, 1702, 1631, 1761, 1651, 1743, 1647, 1729, 1590, 1731, 1689, 1600, 1605, 1723, 1680, 1660, 1658, 1567, 1712, 1602, 1606, 1651, 1572, 1641, 1584, 1665, 1531, 1633, 1680, 1574, 1735, 1651, 1712, 1712, 1629, 1348, 1600, 1495, 1655, 1695, 1872, 1936, 1958, 1911, 1741, 1747, 1897, 1518, 1454, 1462, 1883, 1719, 1680, 1713, 1825, 1606, 1610, 1489, 1840, 1625, 1651, 1621, 1781, 1488, 1809, 1392, 1350, 1655, 1759, 1509, 1825, 1654, 1567, 1551, 1629, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095]\n",
"# ring upstairs, thr=1000\n",
- "#capture = [4095, 0, 0, 0, 0, 4095, 4095, 4095, 4095, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 1984, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 1952, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4016, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3296, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 2606, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 1855, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 3530, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3184, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 1079, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3152, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 447, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4032, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 1215, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095]\n",
+ "data_upstairs = [4095, 0, 0, 0, 0, 4095, 4095, 4095, 4095, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 1984, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 1952, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4016, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3296, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 2606, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 1855, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 3530, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3184, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 1079, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3152, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 447, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4032, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 1215, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095]\n",
"# ring downstairs, thr=1000\n",
- "captures = [1787, 1953, 1932, 1936, 1898, 1933, 1911, 1872, 1885, 1895, 1749, 1647, 1615, 1706, 1649, 1627, 1674, 1646, 1602, 1632, 1665, 1732, 1647, 1614, 1619, 1744, 1596, 1761, 1569, 1647, 1729, 1649, 1619, 1648, 1694, 1628, 1669, 1653, 1648, 1651, 1707, 1683, 1535, 1641, 1595, 1735, 1711, 1622, 1683, 1691, 1685, 1794, 1650, 1631, 1663, 1687, 1664, 1671, 1697, 1680, 1683, 1769, 1685, 1727, 1705, 1695, 1712, 1725, 1666, 1680, 1679, 1586, 1648, 1605, 1639, 1655, 1631, 1634, 1557, 1610, 1646, 1712, 1643, 1734, 1511, 1694, 1707, 1757, 1659, 1661, 1600, 1669, 1622, 1666, 1646, 1654, 1655, 1698, 1638, 1717, 1616, 1663, 1673, 1623, 1629, 1585, 1718, 1583, 1675, 1648, 1665, 1627, 1528, 1616, 1583, 1637, 1633, 1620, 1579, 1639, 1658, 1644, 1711, 1710, 1419, 1648, 1806, 1679, 1443, 1668, 1771, 1585, 1559, 1745, 1607, 1673, 1623, 1629, 1399, 1639, 1674, 1600, 1534, 1717, 1462, 1579, 1525, 1748, 1662, 1529, 1535, 1866, 1549, 1472, 1683, 1663, 1591, 1519, 1687, 1728, 1530, 1603, 1687, 1598, 1731, 1632, 1647, 1552, 1671, 1692, 1619, 1535, 1614, 1616, 1616, 1611, 1650, 1597, 1648, 1671, 1600, 1563, 1735, 1677, 1619, 1674, 1783, 1648, 1660, 1570, 1655, 1575, 1666, 1648, 1613, 1651, 1771, 1552, 1631, 1584, 1683, 1683, 1725, 1593, 1638, 1643, 1495, 1644, 1562, 1674, 1667, 1700, 1625, 1648, 1642, 1648, 1675, 1628, 1572, 1678, 1691, 1651, 1675, 1611, 1663, 1611, 1676, 1562, 1679, 1607, 1638, 1718, 1664, 1600, 1600, 1669, 1657, 1589, 1670, 1680, 1716, 1711, 1675, 1591, 1570, 1690, 1612, 1680, 1625, 1671, 1718, 1665, 1692, 1557, 1607, 1753, 1635, 1699, 1665, 1675, 1665, 1561, 1637, 1744, 1648, 1900, 1922, 1707, 1641, 1699, 1514, 1781, 1729, 1623, 1643, 1643, 1680, 1786, 1649, 1599, 1695, 1617, 1705, 1734, 1575, 1658, 1530, 1683, 1679, 1520, 1678, 1653, 1586, 1616, 1744, 1638, 1647, 1654, 1614, 1665, 1665, 1653, 1591, 1669, 1654, 1698, 1576, 1623, 1726, 1633, 1699, 1675, 1610, 1711, 1645, 1616, 1713, 1696, 1666, 1624, 1606, 1806, 1516, 1515, 1805, 1611, 1518, 1598, 1921, 1556, 1484, 1711, 1438, 1409, 1623, 1675, 1590, 1486, 1691, 1618, 1520, 1695, 1607, 1646, 1554, 1567, 1510, 1603, 1451, 1747, 1584, 1473, 1589, 1658, 1552, 1474, 1627, 1659, 1557, 4095, 1246, 1578, 1669, 1467, 1411, 1469, 1562, 1616, 1387, 1313, 1573, 1500, 1535, 1488, 1518, 1367, 1569, 1606, 1507, 1565, 1535, 1520, 1486, 1519, 1454, 1494, 1437, 1527, 1527, 1498, 1458, 1535, 1554, 1518, 1511, 1569, 1457, 1584, 1440, 1548, 1553, 1549, 1524, 1526, 1586, 1483, 1519, 1471, 1644, 1504, 1463, 1553, 1521, 1515, 1504, 1526, 1520, 1531, 1558, 1547, 1574, 1616, 1664, 1661, 1593, 1446, 1479, 1458, 1553, 1485, 1569, 1420, 1558, 1493, 1607, 1609, 1623, 1517, 1533, 1552, 1475, 1562, 1510, 1679, 1511, 1550, 1594, 1562, 1584, 1504, 1582, 1456, 1551, 1415, 1473, 1495, 1519, 1574, 1520, 1565, 1435, 1558, 1556, 1533, 1466, 1498, 1523, 1531, 1535, 1557, 1488, 1565, 1463, 1521, 1491, 1471, 1533, 1563, 1534, 1549, 1584, 1552, 1471, 1549, 1571, 1589, 1535, 1531, 1392, 1535, 1558, 1605, 1598, 1555, 1495, 1632, 1555, 1587, 1570, 1455, 1579, 1529, 1485, 1425, 1552, 1505, 1439, 1531, 1510, 1478, 1471, 1577, 1493, 1535, 1552, 1472, 1488, 1600, 1525, 1565, 1489, 1509, 1487, 1517, 1563, 1459, 1599, 1445, 1590, 1552, 1494, 1530, 1566, 1524, 1545, 1345, 1513, 1534, 1518, 1634, 1523, 1454, 1628, 1517, 1505, 1478, 1651, 1616, 1555, 1381, 1581, 1513, 1681, 1481, 1527, 1640, 1492, 1590, 1530, 1488, 1558, 1472, 1526, 1553, 1569, 1515, 1565, 1491, 1535, 1567, 1597, 1584, 1651, 1841, 1554, 1520, 1520, 1511, 1600, 1619, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 415, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3795, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 3203, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3518, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2241, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4090, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4019, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 92, 0, 4095, 0, 4095, 0, 4095, 0, 2639, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 3179, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3936, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 2303, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095], [4095, 0, 0, 0, 0, 0, 0, 0, 4095, 4095, 0, 3259, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 779, 0, 4095, 0, 4095, 0, 4095, 0, 1565, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3130, 0, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 2778, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2096, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2951, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4028, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 2384, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2052, 0, 4095, 0, 4095, 0, 4095, 0, 605, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3920, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 1640, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4039, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4032, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 1488, 0, 4095, 0, 4095, 0, 4095, 0, 981, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3312, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 720, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 919, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 3809, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 1832, 0, 4095, 0, 4095, 0, 4095, 0, 721, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095]"
+ "data_downstairs = [1787, 1953, 1932, 1936, 1898, 1933, 1911, 1872, 1885, 1895, 1749, 1647, 1615, 1706, 1649, 1627, 1674, 1646, 1602, 1632, 1665, 1732, 1647, 1614, 1619, 1744, 1596, 1761, 1569, 1647, 1729, 1649, 1619, 1648, 1694, 1628, 1669, 1653, 1648, 1651, 1707, 1683, 1535, 1641, 1595, 1735, 1711, 1622, 1683, 1691, 1685, 1794, 1650, 1631, 1663, 1687, 1664, 1671, 1697, 1680, 1683, 1769, 1685, 1727, 1705, 1695, 1712, 1725, 1666, 1680, 1679, 1586, 1648, 1605, 1639, 1655, 1631, 1634, 1557, 1610, 1646, 1712, 1643, 1734, 1511, 1694, 1707, 1757, 1659, 1661, 1600, 1669, 1622, 1666, 1646, 1654, 1655, 1698, 1638, 1717, 1616, 1663, 1673, 1623, 1629, 1585, 1718, 1583, 1675, 1648, 1665, 1627, 1528, 1616, 1583, 1637, 1633, 1620, 1579, 1639, 1658, 1644, 1711, 1710, 1419, 1648, 1806, 1679, 1443, 1668, 1771, 1585, 1559, 1745, 1607, 1673, 1623, 1629, 1399, 1639, 1674, 1600, 1534, 1717, 1462, 1579, 1525, 1748, 1662, 1529, 1535, 1866, 1549, 1472, 1683, 1663, 1591, 1519, 1687, 1728, 1530, 1603, 1687, 1598, 1731, 1632, 1647, 1552, 1671, 1692, 1619, 1535, 1614, 1616, 1616, 1611, 1650, 1597, 1648, 1671, 1600, 1563, 1735, 1677, 1619, 1674, 1783, 1648, 1660, 1570, 1655, 1575, 1666, 1648, 1613, 1651, 1771, 1552, 1631, 1584, 1683, 1683, 1725, 1593, 1638, 1643, 1495, 1644, 1562, 1674, 1667, 1700, 1625, 1648, 1642, 1648, 1675, 1628, 1572, 1678, 1691, 1651, 1675, 1611, 1663, 1611, 1676, 1562, 1679, 1607, 1638, 1718, 1664, 1600, 1600, 1669, 1657, 1589, 1670, 1680, 1716, 1711, 1675, 1591, 1570, 1690, 1612, 1680, 1625, 1671, 1718, 1665, 1692, 1557, 1607, 1753, 1635, 1699, 1665, 1675, 1665, 1561, 1637, 1744, 1648, 1900, 1922, 1707, 1641, 1699, 1514, 1781, 1729, 1623, 1643, 1643, 1680, 1786, 1649, 1599, 1695, 1617, 1705, 1734, 1575, 1658, 1530, 1683, 1679, 1520, 1678, 1653, 1586, 1616, 1744, 1638, 1647, 1654, 1614, 1665, 1665, 1653, 1591, 1669, 1654, 1698, 1576, 1623, 1726, 1633, 1699, 1675, 1610, 1711, 1645, 1616, 1713, 1696, 1666, 1624, 1606, 1806, 1516, 1515, 1805, 1611, 1518, 1598, 1921, 1556, 1484, 1711, 1438, 1409, 1623, 1675, 1590, 1486, 1691, 1618, 1520, 1695, 1607, 1646, 1554, 1567, 1510, 1603, 1451, 1747, 1584, 1473, 1589, 1658, 1552, 1474, 1627, 1659, 1557, 4095, 1246, 1578, 1669, 1467, 1411, 1469, 1562, 1616, 1387, 1313, 1573, 1500, 1535, 1488, 1518, 1367, 1569, 1606, 1507, 1565, 1535, 1520, 1486, 1519, 1454, 1494, 1437, 1527, 1527, 1498, 1458, 1535, 1554, 1518, 1511, 1569, 1457, 1584, 1440, 1548, 1553, 1549, 1524, 1526, 1586, 1483, 1519, 1471, 1644, 1504, 1463, 1553, 1521, 1515, 1504, 1526, 1520, 1531, 1558, 1547, 1574, 1616, 1664, 1661, 1593, 1446, 1479, 1458, 1553, 1485, 1569, 1420, 1558, 1493, 1607, 1609, 1623, 1517, 1533, 1552, 1475, 1562, 1510, 1679, 1511, 1550, 1594, 1562, 1584, 1504, 1582, 1456, 1551, 1415, 1473, 1495, 1519, 1574, 1520, 1565, 1435, 1558, 1556, 1533, 1466, 1498, 1523, 1531, 1535, 1557, 1488, 1565, 1463, 1521, 1491, 1471, 1533, 1563, 1534, 1549, 1584, 1552, 1471, 1549, 1571, 1589, 1535, 1531, 1392, 1535, 1558, 1605, 1598, 1555, 1495, 1632, 1555, 1587, 1570, 1455, 1579, 1529, 1485, 1425, 1552, 1505, 1439, 1531, 1510, 1478, 1471, 1577, 1493, 1535, 1552, 1472, 1488, 1600, 1525, 1565, 1489, 1509, 1487, 1517, 1563, 1459, 1599, 1445, 1590, 1552, 1494, 1530, 1566, 1524, 1545, 1345, 1513, 1534, 1518, 1634, 1523, 1454, 1628, 1517, 1505, 1478, 1651, 1616, 1555, 1381, 1581, 1513, 1681, 1481, 1527, 1640, 1492, 1590, 1530, 1488, 1558, 1472, 1526, 1553, 1569, 1515, 1565, 1491, 1535, 1567, 1597, 1584, 1651, 1841, 1554, 1520, 1520, 1511, 1600, 1619, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 415, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3795, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 3203, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3518, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2241, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4090, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4019, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 92, 0, 4095, 0, 4095, 0, 4095, 0, 2639, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 3179, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 3936, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 2303, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095], [4095, 0, 0, 0, 0, 0, 0, 0, 4095, 4095, 0, 3259, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 779, 0, 4095, 0, 4095, 0, 4095, 0, 1565, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3130, 0, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 2778, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2096, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2951, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4028, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 2384, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 2052, 0, 4095, 0, 4095, 0, 4095, 0, 605, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3920, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 1640, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4039, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4032, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 1488, 0, 4095, 0, 4095, 0, 4095, 0, 981, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 3312, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 720, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 4095, 0, 4095, 919, 0, 4095, 0, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 3809, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 0, 0, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 1832, 0, 4095, 0, 4095, 0, 4095, 0, 721, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095, 4095, 0, 4095, 0, 4095, 0, 4095]\n",
+ "# False trigger from jigsaw/drill\n",
+ "#captures = [[1994, 2130, 2175, 2099, 2185, 2182, 2137, 2139, 2101, 2095, 2150, 2097, 1973, 2047, 1987, 1999, 2034, 1961, 1970, 2057, 1815, 1946, 2077, 1978, 2012, 1931, 1935, 2007, 1997, 1971, 2043, 1991, 1970, 1922, 2017, 1979, 2055, 1958, 2054, 2071, 2077, 2020, 2005, 2035, 1979, 1808, 2068, 1901, 2111, 1912, 1826, 1978, 1807, 2096, 2038, 2009, 1922, 1872, 2000, 2117, 1937, 2029, 1967, 2025, 2060, 2027, 2001, 1968, 1987, 1999, 2045, 1987, 1922, 1941, 2044, 1935, 1983, 2062, 1946, 1568, 0, 0, 2909, 2258, 2224, 2199, 2279, 2183, 2179, 0, 0, 0, 4095, 2578, 2609, 2553, 2741, 2634, 2657, 2870, 2960, 2914, 2588, 2617, 2687, 2609, 2758, 2610, 2646, 2651, 2471, 4095, 2626, 2562, 2732, 2543, 2603, 2580, 2624, 2589, 4095, 0, 0, 4095, 3727, 2935, 2976, 2871, 2880, 0, 0, 4095, 2937, 2945, 3029, 2977, 2881, 2991, 3120, 3040, 4095, 4095, 4095, 3113, 2939, 2986, 2960, 3071, 3020, 3027, 4095, 4095, 4095, 3261, 3178, 3170, 3151, 3125, 3170, 831, 3307, 3408, 3029, 3277, 3218, 3285, 3108, 3071, 3171, 3145, 0, 4095, 4095, 4095, 3214, 3227, 3243, 3249, 3280, 3235, 4095, 3274, 3683, 3297, 3245, 3201, 3181, 3213, 3247, 3258, 0, 4095, 4095, 3312, 3355, 3331, 3186, 3277, 3278, 3309, 4095, 3185, 3345, 3215, 4095, 4095, 3151, 3273, 3272, 4095, 4095, 4095, 4095, 3319, 3264, 3317, 3327, 3313, 3410, 3389, 3267, 3397, 3226, 3524, 3381, 3344, 0, 4095, 3318, 3339, 4095, 4095, 4095, 3397, 3399, 3220, 3226, 3284, 3315, 3440, 3427, 3432, 3359, 3376, 3312, 3408, 0, 4095, 3270, 3187, 3409, 3253, 3285, 3281, 3253, 3222, 3325, 3223, 3109, 3206, 4095, 3271, 4095, 4095, 4095, 3330, 3363, 3264, 3287, 3238, 0, 4095, 4095, 3488, 3391, 3290, 3363, 3398, 3469, 3451, 3393, 4095, 3362, 4095, 3281, 3405, 3314, 3296, 3344, 4095, 4095, 4095, 4095, 3489, 3465, 3344, 3334, 3343, 3525, 3346, 3445, 3312, 3325, 3264, 3392, 3347, 3327, 3467, 3469, 3352, 3437, 3312, 3463, 3333, 3207, 3316, 3291, 3344, 3348, 3299, 3263, 3247, 3321, 3304, 3426, 3302, 3373, 3357, 3325, 3275, 3360, 3344, 3280, 3281, 3251, 3270, 3403, 3307, 3248, 3280, 3159, 3207, 3346, 3302, 3392, 3291, 3312, 3403, 3230, 3268, 3269, 3247, 3219, 3238, 3290, 3250, 3134, 3235, 3007, 3209, 3271, 3219, 3166, 3245, 3185, 3268, 3295, 3171, 3198, 3186, 3249, 3098, 3248, 3155, 3231, 3328, 3138, 3233, 3190, 3312, 3229, 3282, 3145, 3216, 3174, 3261, 3141, 3153, 3034, 3216, 3108, 3248, 3283, 3197, 3063, 3141, 3205, 3223, 3171, 3081, 3152, 3151, 3184, 3088, 3055, 3123, 3170, 3139, 3125, 3106, 3057, 3187, 3159, 3258, 3028, 3094, 3047, 3085, 3071, 3094, 3104, 3248, 3039, 3157, 3161, 3118, 3143, 3108, 3159, 3127, 3115, 3040, 3007, 3121, 3103, 3101, 3031, 3071, 2975, 3069, 3055, 3019, 3184, 3117, 3107, 3006, 3027, 3056, 3062, 3081, 3093, 3001, 2995, 2944, 3091, 3083, 2959, 3159, 3035, 3086, 3018, 3059, 3066, 2994, 2943, 2954, 2994, 3014, 2963, 3083, 3111, 3007, 3042, 3007, 2966, 2991, 2975, 2903, 3056, 2859, 3023, 2864, 3087, 2909, 2970, 2991, 2964, 3040, 2906, 2933, 2973, 2960, 2877, 3181, 2914, 2982, 3042, 2990, 2933, 2980, 2898, 2950, 2983, 2899, 2980, 2896, 2965, 2815, 2898, 2971, 2896, 2969, 3058, 2929, 2954, 2875, 2992, 3032, 2924, 2861, 2587, 4095, 2992, 2989, 2935, 2896, 2928, 2935, 2941, 2869, 2856, 2991, 2978, 2981, 2866, 2815, 2835, 2874, 2837, 2901, 2860, 2791, 3010, 2886, 2939, 2946, 2926, 2927, 2943, 2903, 2965, 2800, 2883, 2910, 2841, 2840, 2870, 2918, 2935, 2896, 2905, 2854, 2844, 2928, 2911, 2889, 2872, 2849, 2875, 2815, 2866, 3008, 2854, 2833, 2821, 2810, 2834, 2921, 2912, 2898, 2751, 2925, 2835, 2819, 2792, 2711, 2823, 2853, 2803, 2933, 2872, 2881, 2722, 2736, 2899, 2816, 2840, 2863, 2851, 2779, 2811, 2898, 2890, 2761, 2867, 2765, 2798, 2814, 2796, 2835, 2793, 2847, 2752, 2805, 2781, 2787, 2777, 2846, 2790, 2830, 2780, 2811, 2776, 2760, 2739, 2848, 2749, 2735, 2807, 2709, 2681, 2825, 2870, 2725, 2793, 2803, 2626, 2848, 2705, 2748, 2801, 2763, 2787, 2896, 2763, 2816, 2789, 2802, 2719, 2802, 2705, 2797, 2694, 2767, 2742, 2759, 2707, 2682, 2689, 2779, 2688, 2759, 2732, 2696, 2630, 2634, 2689, 2588, 2646, 2735, 2689, 2698, 2682, 2701, 2721, 2660, 2591, 2709, 2762, 2619, 2523, 2667, 2731, 2656, 2640, 2718, 2682, 2672, 2640, 2686, 2623, 2721, 2667, 2672, 2755, 2726, 2655, 2691, 2587, 2576, 2732, 2679, 2586, 2608, 2721, 2752, 2779, 2582, 2611, 2576, 2690, 2629, 2627, 2573, 2766, 2787, 2783, 2570, 2637, 2684, 2611, 2615, 2576, 2648, 2713, 2575, 2702, 2592, 2682, 2732, 2556, 2659, 2693, 2657, 2539, 2690, 2694, 2647, 2635, 2611, 2618, 2552, 2615, 2655, 2662, 2701, 2588, 2689, 2761, 2595, 2606, 2630, 2636, 2651, 2660, 2635, 2634, 2667, 2621, 2631, 2595, 2636, 2593, 2630, 2593, 2641, 2683, 2529, 2640, 2634, 2527, 2667, 2640, 2512, 2594, 2641, 2624, 2620, 2581, 2499, 2570, 2515, 2627, 2605, 2558, 2573, 2503, 2517, 2450, 2608, 2463, 2544, 2566, 2557, 2477, 2477, 2610, 2524, 2540, 2634, 2480, 2538, 2603, 2579, 2623, 2646, 2539, 2481, 2490, 2608, 2577, 2624, 2399, 2579, 2575, 2652, 2650, 2512, 2527, 2655, 2449, 2713, 2619, 2631, 2512, 2606, 2587, 2531, 2510, 2383, 2538, 2531, 2518, 2431, 2640, 2559, 2447, 2616, 2443, 2503, 2512, 2529, 2605, 2489, 2523, 2608, 2559, 2438, 2547, 2523, 2459, 2426, 2528, 2463, 2478, 2485, 2360, 2488, 2496, 2448, 2371, 2640, 2386, 2528, 2523, 2369, 2528, 2507, 2444, 2457, 2317, 2480, 2481, 2416, 2400, 2512, 2431, 2379, 2332, 2407, 2417, 2585, 2496, 2513, 2480, 2384, 2368, 2460, 2543, 2502, 0, 4095, 3814, 2672, 2694, 2787, 2740, 2694, 2674, 2753, 0, 0, 4095, 4095, 2877, 2919, 2842, 2805, 3021, 2900, 0, 4095, 2994, 3115, 3057, 3120, 3088, 3136, 3055, 3106, 0, 4095, 3105, 3099, 3187, 3152, 3017, 3027, 2976, 3133, 4095, 4095, 4095, 3237, 3227, 3233, 3255, 3273, 3201, 3281, 3182, 4095, 4095, 3205, 3279, 3228, 3178, 3227, 3201, 3191, 0, 4095, 4095, 3218, 3429, 3283, 3407, 3312, 3215, 3328, 4095, 3350, 4095, 4095, 4095, 4095, 3312, 3233, 3254, 3311, 0, 0, 4095, 4095, 3423, 3472, 3311, 3442, 3363, 3251, 3420, 3398, 3313, 3418, 3341, 3352, 3357, 3260, 3430, 3312, 3471, 3264, 3271, 3523, 3364, 3383, 3216, 3365, 3306, 3280, 3296, 3373, 3269, 3273, 3317, 3312, 3264, 3265, 3407, 3475, 3354, 3163, 3210, 3247, 3347, 3344, 3336, 3184, 3392, 3285, 3276, 3248, 3179, 3226], [3283, 3323, 3308, 3291, 3277, 3203, 3183, 3155, 3317, 3247, 3184, 3152, 3343, 3105, 3114, 3175, 3039, 3241, 3190, 3120, 3051, 3080, 3271, 3216, 3184, 3043, 3249, 3082, 3205, 3082, 3244, 3058, 3115, 3140, 3115, 2994, 3136, 3125, 3103, 3051, 3082, 3105, 3166, 3104, 3099, 3053, 3041, 3115, 3059, 3163, 2942, 3151, 3185, 3038, 3180, 3073, 2954, 3019, 3154, 3046, 3009, 2997, 3109, 2939, 3042, 3099, 3046, 3014, 3087, 3024, 3134, 2954, 3062, 2962, 3051, 3035, 3104, 3089, 3057, 3003, 3019, 3007, 3136, 3084, 2960, 3009, 2906, 2931, 3043, 2986, 3039, 2989, 2914, 3071, 3066, 2961, 3046, 2992, 3001, 2928, 3030, 2960, 3006, 3025, 2974, 3010, 2801, 2951, 2944, 2966, 3131, 2949, 3056, 3014, 2959, 3013, 2907, 2943, 2960, 2932, 2938, 3043, 3139, 2835, 2912, 3001, 2993, 2879, 2929, 2941, 2922, 2984, 2838, 2851, 2805, 2961, 2988, 2832, 2868, 2895, 2865, 2965, 2913, 2960, 2842, 2951, 2890, 2807, 2838, 2896, 2887, 2863, 2955, 2871, 3004, 0, 4095, 4095, 3098, 3035, 3089, 3075, 3090, 3029, 2995, 3203, 3049, 3039, 3081, 3054, 3095, 3055, 3003, 3009, 3113, 3091, 3153, 3036, 2997, 2973, 2985, 3078, 2992, 3027, 3045, 3119, 3059, 3055, 3056, 3066, 3027, 3053, 3003, 3041, 3094, 3028, 2973, 3006, 3099, 3139, 3060, 3074, 3120, 2957, 3029, 3027, 3056, 3035, 2997, 2933, 2881, 2965, 2896, 2919, 3142, 3095, 3038, 2962, 2991, 2859, 3056, 3064, 3007, 3017, 3003, 2989, 2950, 2913, 2923, 3024, 3027, 3023, 3026, 0, 0, 3015, 3043, 2894, 2963, 2929, 2915, 2931, 3049, 4095, 4095, 2941, 2991, 2928, 2842, 2912, 2975, 2837, 2954, 4095, 0, 0, 4095, 4095, 3022, 3240, 3169, 3152, 3191, 0, 4095, 4095, 3293, 3176, 3227, 3275, 3157, 3259, 3248, 0, 4095, 4095, 3430, 3330, 3315, 3280, 3307, 3352, 3189, 3360, 0, 4095, 4095, 3418, 3327, 3322, 3280, 3239, 3446, 3119, 4095, 4095, 4095, 3254, 3332, 3173, 3277, 3293, 3312, 0, 4095, 4095, 3231, 3232, 3226, 3344, 3346, 3334, 3249, 4095, 3536, 0, 4095, 4095, 3362, 3459, 3319, 3333, 3302, 0, 0, 4095, 4095, 3839, 3436, 3418, 3399, 3394, 3443, 3345, 0, 4095, 0, 4095, 4095, 3536, 3363, 3327, 3472, 0, 4095, 4095, 3222, 3454, 3327, 3307, 3315, 3343, 3541, 3312, 3258, 3310, 3309, 3278, 3445, 3327, 3395, 3355, 3439, 3292, 3440, 3339, 3460, 3365, 3336, 3367, 3394, 3314, 3401, 3442, 3325, 3264, 3381, 3266, 3293, 3366, 3294, 3441, 3479, 3222, 3364, 3218, 3319, 3418, 3237, 3261, 3280, 3259, 3359, 3311, 3378, 3216, 3184, 3223, 3295, 3156, 3215, 3336, 3290, 3255, 3233, 3135, 3376, 3280, 3314, 3287, 3331, 3280, 3248, 3227, 3233, 3130, 3275, 3242, 3243, 3228, 3255, 3207, 3312, 3193, 3203, 3191, 3282, 3185, 3232, 3169, 3312, 3294, 3216, 3190, 3150, 3154, 3192, 3219, 3115, 3181, 3267, 3115, 3129, 3148, 3169, 3251, 3104, 3211, 3273, 3137, 3125, 3108, 3145, 3094, 3103, 3167, 3280, 3157, 3163, 3226, 3140, 3194, 3140, 3191, 3125, 3059, 3275, 3032, 3064, 3057, 3031, 3111, 3071, 3152, 3158, 3105, 3013, 3107, 3049, 3216, 3054, 2916, 3165, 3103, 3104, 3122, 3056, 3049, 3018, 3165, 3152, 3059, 3174, 3131, 2959, 3008, 3110, 3082, 3067, 3134, 3011, 3120, 3046, 3121, 3019, 3088, 3008, 2992, 2896, 2905, 3102, 3068, 2947, 3040, 3041, 3120, 2975, 3013, 2832, 2928, 2992, 3101, 3110, 3087, 3068, 2899, 3034, 2997, 2985, 3024, 3156, 3022, 2961, 2990, 2959, 3051, 2979, 3120, 3059, 2993, 3015, 3025, 2855, 2987, 2965, 2907, 2937, 3158, 2911, 3088, 2992, 2950, 3049, 3062, 2851, 2992, 2943, 2920, 2985, 2963, 2882, 3030, 2933, 2847, 2975, 2952, 2964, 2903, 2881, 2975, 3011, 2981, 2944, 2958, 2990, 2915, 2929, 2964, 2878, 2912, 2950, 3005, 2961, 2783, 2963, 2901, 2907, 2944, 2787, 2919, 2903, 2837, 2912, 2897, 2958, 2835, 2733, 2890, 2945, 2903, 2852, 2839, 2883, 2960, 2886, 2737, 2864, 2930, 2826, 2807, 2902, 2882, 2862, 2879, 2837, 2802, 2853, 2887, 2863, 2796, 2716, 2864, 2897, 2906, 2914, 2787, 2831, 2892, 2858, 2727, 2862, 2823, 2795, 2861, 2838, 2768, 2801, 2854, 2798, 2767, 2803, 2840, 2773, 2783, 2807, 2768, 2734, 2818, 2787, 2801, 2818, 2880, 2721, 2773, 2789, 2903, 2864, 2830, 2833, 2778, 2880, 2736, 2845, 2690, 2595, 2752, 2880, 2787, 2814, 2773, 2736, 2852, 2790, 2855, 2781, 2787, 2715, 2822, 2766, 2781, 2922, 2755, 2832, 2785, 2832, 2806, 2736, 2783, 2763, 2716, 2692, 2723, 2714, 2667, 2695, 2770, 2667, 2667, 2734, 2767, 2765, 2726, 2786, 2640, 2727, 2735, 2781, 2796, 2693, 2769, 2622, 2647, 2679, 2625, 2741, 2659, 2701, 2791, 2671, 2666, 2800, 2655, 2677, 2741, 2783, 2768, 2656, 2736, 2625, 2763, 2727, 2797, 2636, 2678, 2617, 2637, 2829, 2661, 2591, 2658, 2752, 2683, 2689, 2711, 2704, 2643, 2647, 2768, 2749, 2690, 2639, 2654, 2607, 2606, 2672, 2747, 2551, 2642, 2732, 2704, 2635, 2593, 2671, 2673, 2639, 2591, 2657, 2645, 2581, 2576, 2687, 2693, 2608, 2607, 2654, 2605, 2647, 2677, 2628, 2611, 2623, 2647, 2648, 2640, 2559, 2701, 2582, 2670, 2576, 2623, 2711, 2680, 2596, 2606, 2635, 2642, 2575, 2614, 2591, 2591, 2640, 2551, 2612, 2527, 2543, 2545, 2599, 2639, 2517, 2555, 2589, 2587, 2600, 2559, 2591, 2545, 2626, 2670, 2576, 2659, 2619, 2592, 2608, 2623, 2545, 2462, 2459, 2482, 2681, 2621, 2573, 2653, 2570, 2542, 2523, 2539, 2639, 2557, 2575, 2417, 2513, 2525, 2514, 2603, 2551, 2493, 2480, 2591, 2540, 2539, 2468, 2517, 2504, 2512, 2609, 2579, 2526, 2589, 2432, 2450, 2495, 2395, 2576, 2495, 2500, 2527, 2559, 2544, 2624, 2484, 2450, 2625, 2431, 2494, 2603, 2438, 2384, 2470, 2515, 2416, 2556, 2501, 2547, 2506, 2555, 2416, 2431, 2498, 2528, 2559, 2539, 2413, 2514, 2552, 2512, 2455, 2512, 2455, 2533, 2512, 2464, 2608, 2503, 2434, 2476, 2403, 2401, 2549, 2419, 2527, 2465, 2320, 2437, 2512, 2571, 2465, 2495, 2515, 2503, 2538, 2442, 2474, 2481, 0, 4095, 2778, 2724, 2713, 2672, 2743, 2706, 2543, 2709, 2590, 2733, 2747, 2727, 2672, 2709, 2723, 2703, 2781, 2743, 2656, 2695, 2614, 2496, 2771, 2705, 2658, 2668, 2709, 2624, 2613, 2624, 2709, 2700, 2735, 2611, 2596, 2674, 2704, 2706, 2580, 2642, 2659, 2608, 2576, 2512, 2659, 2606, 2657, 2637, 2703, 2716, 2626, 2650, 2653, 2470, 2587, 2635, 2635, 2656, 2514, 2628, 2634, 2598, 2616, 2613, 2557, 2663, 2598, 2624, 2544, 2587, 2639, 2597, 2696, 2474, 2635, 2631, 2559, 2583, 2656, 2609, 2507, 2615, 2575, 2625, 2564, 2644, 2535, 2727, 2527, 2678, 2521, 2548, 2432, 2512, 2480, 2602, 2583, 2529, 2566]]"
]
},
{
"cell_type": "code",
- "execution_count": 53,
+ "execution_count": 28,
"metadata": {
"scrolled": false
},
@@ -831,7 +834,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -847,7 +850,7 @@
"for ax, (data, title) in zip(axs.flatten(), [\n",
" (data_led_off, 'LED off'),\n",
" (data_keyboard, 'ThinkPad keyboard'),\n",
- " (captures[1], 'Capture'),\n",
+ " (captures[0], 'Capture'),\n",
" ]):\n",
" ax.plot(data)\n",
" ax.set_title(title)\n",
@@ -861,7 +864,7 @@
},
{
"cell_type": "code",
- "execution_count": 69,
+ "execution_count": 25,
"metadata": {},
"outputs": [
{
@@ -1681,10 +1684,10 @@
" 1.184, 1.216, 1.248, 1.28 , 1.312, 1.344, 1.376, 1.408, 1.44 ,\n",
" 1.472, 1.504, 1.536, 1.568, 1.6 , 1.632, 1.664, 1.696, 1.728,\n",
" 1.76 , 1.792, 1.824, 1.856, 1.888, 1.92 , 1.952, 1.984, 2.016]),\n",
- " )"
+ " )"
]
},
- "execution_count": 69,
+ "execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
@@ -1693,6 +1696,834 @@
"fig, ax = plt.subplots()\n",
"ax.specgram(np.array(captures[0] + captures[1]), NFFT=64, noverlap=32, Fs=1000, pad_to=4096)"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 101,
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/javascript": [
+ "/* Put everything inside the global mpl namespace */\n",
+ "window.mpl = {};\n",
+ "\n",
+ "\n",
+ "mpl.get_websocket_type = function() {\n",
+ " if (typeof(WebSocket) !== 'undefined') {\n",
+ " return WebSocket;\n",
+ " } else if (typeof(MozWebSocket) !== 'undefined') {\n",
+ " return MozWebSocket;\n",
+ " } else {\n",
+ " alert('Your browser does not have WebSocket support.' +\n",
+ " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
+ " 'Firefox 4 and 5 are also supported but you ' +\n",
+ " 'have to enable WebSockets in about:config.');\n",
+ " };\n",
+ "}\n",
+ "\n",
+ "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
+ " this.id = figure_id;\n",
+ "\n",
+ " this.ws = websocket;\n",
+ "\n",
+ " this.supports_binary = (this.ws.binaryType != undefined);\n",
+ "\n",
+ " if (!this.supports_binary) {\n",
+ " var warnings = document.getElementById(\"mpl-warnings\");\n",
+ " if (warnings) {\n",
+ " warnings.style.display = 'block';\n",
+ " warnings.textContent = (\n",
+ " \"This browser does not support binary websocket messages. \" +\n",
+ " \"Performance may be slow.\");\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " this.imageObj = new Image();\n",
+ "\n",
+ " this.context = undefined;\n",
+ " this.message = undefined;\n",
+ " this.canvas = undefined;\n",
+ " this.rubberband_canvas = undefined;\n",
+ " this.rubberband_context = undefined;\n",
+ " this.format_dropdown = undefined;\n",
+ "\n",
+ " this.image_mode = 'full';\n",
+ "\n",
+ " this.root = $('');\n",
+ " this._root_extra_style(this.root)\n",
+ " this.root.attr('style', 'display: inline-block');\n",
+ "\n",
+ " $(parent_element).append(this.root);\n",
+ "\n",
+ " this._init_header(this);\n",
+ " this._init_canvas(this);\n",
+ " this._init_toolbar(this);\n",
+ "\n",
+ " var fig = this;\n",
+ "\n",
+ " this.waiting = false;\n",
+ "\n",
+ " this.ws.onopen = function () {\n",
+ " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
+ " fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
+ " fig.send_message(\"refresh\", {});\n",
+ " }\n",
+ "\n",
+ " this.imageObj.onload = function() {\n",
+ " if (fig.image_mode == 'full') {\n",
+ " // Full images could contain transparency (where diff images\n",
+ " // almost always do), so we need to clear the canvas so that\n",
+ " // there is no ghosting.\n",
+ " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
+ " }\n",
+ " fig.context.drawImage(fig.imageObj, 0, 0);\n",
+ " };\n",
+ "\n",
+ " this.imageObj.onunload = function() {\n",
+ " fig.ws.close();\n",
+ " }\n",
+ "\n",
+ " this.ws.onmessage = this._make_on_message_function(this);\n",
+ "\n",
+ " this.ondownload = ondownload;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_header = function() {\n",
+ " var titlebar = $(\n",
+ " '');\n",
+ " var titletext = $(\n",
+ " '');\n",
+ " titlebar.append(titletext)\n",
+ " this.root.append(titlebar);\n",
+ " this.header = titletext[0];\n",
+ "}\n",
+ "\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
+ "\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
+ "\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_canvas = function() {\n",
+ " var fig = this;\n",
+ "\n",
+ " var canvas_div = $('');\n",
+ "\n",
+ " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
+ "\n",
+ " function canvas_keyboard_event(event) {\n",
+ " return fig.key_event(event, event['data']);\n",
+ " }\n",
+ "\n",
+ " canvas_div.keydown('key_press', canvas_keyboard_event);\n",
+ " canvas_div.keyup('key_release', canvas_keyboard_event);\n",
+ " this.canvas_div = canvas_div\n",
+ " this._canvas_extra_style(canvas_div)\n",
+ " this.root.append(canvas_div);\n",
+ "\n",
+ " var canvas = $('');\n",
+ " canvas.addClass('mpl-canvas');\n",
+ " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
+ "\n",
+ " this.canvas = canvas[0];\n",
+ " this.context = canvas[0].getContext(\"2d\");\n",
+ "\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
+ " var rubberband = $('');\n",
+ " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
+ "\n",
+ " var pass_mouse_events = true;\n",
+ "\n",
+ " canvas_div.resizable({\n",
+ " start: function(event, ui) {\n",
+ " pass_mouse_events = false;\n",
+ " },\n",
+ " resize: function(event, ui) {\n",
+ " fig.request_resize(ui.size.width, ui.size.height);\n",
+ " },\n",
+ " stop: function(event, ui) {\n",
+ " pass_mouse_events = true;\n",
+ " fig.request_resize(ui.size.width, ui.size.height);\n",
+ " },\n",
+ " });\n",
+ "\n",
+ " function mouse_event_fn(event) {\n",
+ " if (pass_mouse_events)\n",
+ " return fig.mouse_event(event, event['data']);\n",
+ " }\n",
+ "\n",
+ " rubberband.mousedown('button_press', mouse_event_fn);\n",
+ " rubberband.mouseup('button_release', mouse_event_fn);\n",
+ " // Throttle sequential mouse events to 1 every 20ms.\n",
+ " rubberband.mousemove('motion_notify', mouse_event_fn);\n",
+ "\n",
+ " rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
+ " rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
+ "\n",
+ " canvas_div.on(\"wheel\", function (event) {\n",
+ " event = event.originalEvent;\n",
+ " event['data'] = 'scroll'\n",
+ " if (event.deltaY < 0) {\n",
+ " event.step = 1;\n",
+ " } else {\n",
+ " event.step = -1;\n",
+ " }\n",
+ " mouse_event_fn(event);\n",
+ " });\n",
+ "\n",
+ " canvas_div.append(canvas);\n",
+ " canvas_div.append(rubberband);\n",
+ "\n",
+ " this.rubberband = rubberband;\n",
+ " this.rubberband_canvas = rubberband[0];\n",
+ " this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
+ " this.rubberband_context.strokeStyle = \"#000000\";\n",
+ "\n",
+ " this._resize_canvas = function(width, height) {\n",
+ " // Keep the size of the canvas, canvas container, and rubber band\n",
+ " // canvas in synch.\n",
+ " canvas_div.css('width', width)\n",
+ " canvas_div.css('height', height)\n",
+ "\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
+ "\n",
+ " rubberband.attr('width', width);\n",
+ " rubberband.attr('height', height);\n",
+ " }\n",
+ "\n",
+ " // Set the figure to an initial 600x600px, this will subsequently be updated\n",
+ " // upon first draw.\n",
+ " this._resize_canvas(600, 600);\n",
+ "\n",
+ " // Disable right mouse context menu.\n",
+ " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
+ " return false;\n",
+ " });\n",
+ "\n",
+ " function set_focus () {\n",
+ " canvas.focus();\n",
+ " canvas_div.focus();\n",
+ " }\n",
+ "\n",
+ " window.setTimeout(set_focus, 100);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_toolbar = function() {\n",
+ " var fig = this;\n",
+ "\n",
+ " var nav_element = $('')\n",
+ " nav_element.attr('style', 'width: 100%');\n",
+ " this.root.append(nav_element);\n",
+ "\n",
+ " // Define a callback function for later on.\n",
+ " function toolbar_event(event) {\n",
+ " return fig.toolbar_button_onclick(event['data']);\n",
+ " }\n",
+ " function toolbar_mouse_event(event) {\n",
+ " return fig.toolbar_button_onmouseover(event['data']);\n",
+ " }\n",
+ "\n",
+ " for(var toolbar_ind in mpl.toolbar_items) {\n",
+ " var name = mpl.toolbar_items[toolbar_ind][0];\n",
+ " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
+ " var image = mpl.toolbar_items[toolbar_ind][2];\n",
+ " var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
+ "\n",
+ " if (!name) {\n",
+ " // put a spacer in here.\n",
+ " continue;\n",
+ " }\n",
+ " var button = $('');\n",
+ " button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
+ " 'ui-button-icon-only');\n",
+ " button.attr('role', 'button');\n",
+ " button.attr('aria-disabled', 'false');\n",
+ " button.click(method_name, toolbar_event);\n",
+ " button.mouseover(tooltip, toolbar_mouse_event);\n",
+ "\n",
+ " var icon_img = $('');\n",
+ " icon_img.addClass('ui-button-icon-primary ui-icon');\n",
+ " icon_img.addClass(image);\n",
+ " icon_img.addClass('ui-corner-all');\n",
+ "\n",
+ " var tooltip_span = $('');\n",
+ " tooltip_span.addClass('ui-button-text');\n",
+ " tooltip_span.html(tooltip);\n",
+ "\n",
+ " button.append(icon_img);\n",
+ " button.append(tooltip_span);\n",
+ "\n",
+ " nav_element.append(button);\n",
+ " }\n",
+ "\n",
+ " var fmt_picker_span = $('');\n",
+ "\n",
+ " var fmt_picker = $('');\n",
+ " fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
+ " fmt_picker_span.append(fmt_picker);\n",
+ " nav_element.append(fmt_picker_span);\n",
+ " this.format_dropdown = fmt_picker[0];\n",
+ "\n",
+ " for (var ind in mpl.extensions) {\n",
+ " var fmt = mpl.extensions[ind];\n",
+ " var option = $(\n",
+ " '', {selected: fmt === mpl.default_extension}).html(fmt);\n",
+ " fmt_picker.append(option)\n",
+ " }\n",
+ "\n",
+ " // Add hover states to the ui-buttons\n",
+ " $( \".ui-button\" ).hover(\n",
+ " function() { $(this).addClass(\"ui-state-hover\");},\n",
+ " function() { $(this).removeClass(\"ui-state-hover\");}\n",
+ " );\n",
+ "\n",
+ " var status_bar = $('');\n",
+ " nav_element.append(status_bar);\n",
+ " this.message = status_bar[0];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
+ " // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
+ " // which will in turn request a refresh of the image.\n",
+ " this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.send_message = function(type, properties) {\n",
+ " properties['type'] = type;\n",
+ " properties['figure_id'] = this.id;\n",
+ " this.ws.send(JSON.stringify(properties));\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.send_draw_message = function() {\n",
+ " if (!this.waiting) {\n",
+ " this.waiting = true;\n",
+ " this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
+ " var format_dropdown = fig.format_dropdown;\n",
+ " var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
+ " fig.ondownload(fig, format);\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
+ " var size = msg['size'];\n",
+ " if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
+ " fig._resize_canvas(size[0], size[1]);\n",
+ " fig.send_message(\"refresh\", {});\n",
+ " };\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
+ " x0 = Math.floor(x0) + 0.5;\n",
+ " y0 = Math.floor(y0) + 0.5;\n",
+ " x1 = Math.floor(x1) + 0.5;\n",
+ " y1 = Math.floor(y1) + 0.5;\n",
+ " var min_x = Math.min(x0, x1);\n",
+ " var min_y = Math.min(y0, y1);\n",
+ " var width = Math.abs(x1 - x0);\n",
+ " var height = Math.abs(y1 - y0);\n",
+ "\n",
+ " fig.rubberband_context.clearRect(\n",
+ " 0, 0, fig.canvas.width, fig.canvas.height);\n",
+ "\n",
+ " fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
+ " // Updates the figure title.\n",
+ " fig.header.textContent = msg['label'];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
+ " var cursor = msg['cursor'];\n",
+ " switch(cursor)\n",
+ " {\n",
+ " case 0:\n",
+ " cursor = 'pointer';\n",
+ " break;\n",
+ " case 1:\n",
+ " cursor = 'default';\n",
+ " break;\n",
+ " case 2:\n",
+ " cursor = 'crosshair';\n",
+ " break;\n",
+ " case 3:\n",
+ " cursor = 'move';\n",
+ " break;\n",
+ " }\n",
+ " fig.rubberband_canvas.style.cursor = cursor;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
+ " fig.message.textContent = msg['message'];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
+ " // Request the server to send over a new figure.\n",
+ " fig.send_draw_message();\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
+ " fig.image_mode = msg['mode'];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.updated_canvas_event = function() {\n",
+ " // Called whenever the canvas gets updated.\n",
+ " this.send_message(\"ack\", {});\n",
+ "}\n",
+ "\n",
+ "// A function to construct a web socket function for onmessage handling.\n",
+ "// Called in the figure constructor.\n",
+ "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
+ " return function socket_on_message(evt) {\n",
+ " if (evt.data instanceof Blob) {\n",
+ " /* FIXME: We get \"Resource interpreted as Image but\n",
+ " * transferred with MIME type text/plain:\" errors on\n",
+ " * Chrome. But how to set the MIME type? It doesn't seem\n",
+ " * to be part of the websocket stream */\n",
+ " evt.data.type = \"image/png\";\n",
+ "\n",
+ " /* Free the memory for the previous frames */\n",
+ " if (fig.imageObj.src) {\n",
+ " (window.URL || window.webkitURL).revokeObjectURL(\n",
+ " fig.imageObj.src);\n",
+ " }\n",
+ "\n",
+ " fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
+ " evt.data);\n",
+ " fig.updated_canvas_event();\n",
+ " fig.waiting = false;\n",
+ " return;\n",
+ " }\n",
+ " else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
+ " fig.imageObj.src = evt.data;\n",
+ " fig.updated_canvas_event();\n",
+ " fig.waiting = false;\n",
+ " return;\n",
+ " }\n",
+ "\n",
+ " var msg = JSON.parse(evt.data);\n",
+ " var msg_type = msg['type'];\n",
+ "\n",
+ " // Call the \"handle_{type}\" callback, which takes\n",
+ " // the figure and JSON message as its only arguments.\n",
+ " try {\n",
+ " var callback = fig[\"handle_\" + msg_type];\n",
+ " } catch (e) {\n",
+ " console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
+ " return;\n",
+ " }\n",
+ "\n",
+ " if (callback) {\n",
+ " try {\n",
+ " // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
+ " callback(fig, msg);\n",
+ " } catch (e) {\n",
+ " console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
+ " }\n",
+ " }\n",
+ " };\n",
+ "}\n",
+ "\n",
+ "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
+ "mpl.findpos = function(e) {\n",
+ " //this section is from http://www.quirksmode.org/js/events_properties.html\n",
+ " var targ;\n",
+ " if (!e)\n",
+ " e = window.event;\n",
+ " if (e.target)\n",
+ " targ = e.target;\n",
+ " else if (e.srcElement)\n",
+ " targ = e.srcElement;\n",
+ " if (targ.nodeType == 3) // defeat Safari bug\n",
+ " targ = targ.parentNode;\n",
+ "\n",
+ " // jQuery normalizes the pageX and pageY\n",
+ " // pageX,Y are the mouse positions relative to the document\n",
+ " // offset() returns the position of the element relative to the document\n",
+ " var x = e.pageX - $(targ).offset().left;\n",
+ " var y = e.pageY - $(targ).offset().top;\n",
+ "\n",
+ " return {\"x\": x, \"y\": y};\n",
+ "};\n",
+ "\n",
+ "/*\n",
+ " * return a copy of an object with only non-object keys\n",
+ " * we need this to avoid circular references\n",
+ " * http://stackoverflow.com/a/24161582/3208463\n",
+ " */\n",
+ "function simpleKeys (original) {\n",
+ " return Object.keys(original).reduce(function (obj, key) {\n",
+ " if (typeof original[key] !== 'object')\n",
+ " obj[key] = original[key]\n",
+ " return obj;\n",
+ " }, {});\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.mouse_event = function(event, name) {\n",
+ " var canvas_pos = mpl.findpos(event)\n",
+ "\n",
+ " if (name === 'button_press')\n",
+ " {\n",
+ " this.canvas.focus();\n",
+ " this.canvas_div.focus();\n",
+ " }\n",
+ "\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
+ "\n",
+ " this.send_message(name, {x: x, y: y, button: event.button,\n",
+ " step: event.step,\n",
+ " guiEvent: simpleKeys(event)});\n",
+ "\n",
+ " /* This prevents the web browser from automatically changing to\n",
+ " * the text insertion cursor when the button is pressed. We want\n",
+ " * to control all of the cursor setting manually through the\n",
+ " * 'cursor' event from matplotlib */\n",
+ " event.preventDefault();\n",
+ " return false;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
+ " // Handle any extra behaviour associated with a key event\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.key_event = function(event, name) {\n",
+ "\n",
+ " // Prevent repeat events\n",
+ " if (name == 'key_press')\n",
+ " {\n",
+ " if (event.which === this._key)\n",
+ " return;\n",
+ " else\n",
+ " this._key = event.which;\n",
+ " }\n",
+ " if (name == 'key_release')\n",
+ " this._key = null;\n",
+ "\n",
+ " var value = '';\n",
+ " if (event.ctrlKey && event.which != 17)\n",
+ " value += \"ctrl+\";\n",
+ " if (event.altKey && event.which != 18)\n",
+ " value += \"alt+\";\n",
+ " if (event.shiftKey && event.which != 16)\n",
+ " value += \"shift+\";\n",
+ "\n",
+ " value += 'k';\n",
+ " value += event.which.toString();\n",
+ "\n",
+ " this._key_event_extra(event, name);\n",
+ "\n",
+ " this.send_message(name, {key: value,\n",
+ " guiEvent: simpleKeys(event)});\n",
+ " return false;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
+ " if (name == 'download') {\n",
+ " this.handle_save(this, null);\n",
+ " } else {\n",
+ " this.send_message(\"toolbar_button\", {name: name});\n",
+ " }\n",
+ "};\n",
+ "\n",
+ "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
+ " this.message.textContent = tooltip;\n",
+ "};\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "\n",
+ "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "\n",
+ "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
+ " // Create a \"websocket\"-like object which calls the given IPython comm\n",
+ " // object with the appropriate methods. Currently this is a non binary\n",
+ " // socket, so there is still some room for performance tuning.\n",
+ " var ws = {};\n",
+ "\n",
+ " ws.close = function() {\n",
+ " comm.close()\n",
+ " };\n",
+ " ws.send = function(m) {\n",
+ " //console.log('sending', m);\n",
+ " comm.send(m);\n",
+ " };\n",
+ " // Register the callback with on_msg.\n",
+ " comm.on_msg(function(msg) {\n",
+ " //console.log('receiving', msg['content']['data'], msg);\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
+ " ws.onmessage(msg['content']['data'])\n",
+ " });\n",
+ " return ws;\n",
+ "}\n",
+ "\n",
+ "mpl.mpl_figure_comm = function(comm, msg) {\n",
+ " // This is the function which gets called when the mpl process\n",
+ " // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
+ "\n",
+ " var id = msg.content.data.id;\n",
+ " // Get hold of the div created by the display call when the Comm\n",
+ " // socket was opened in Python.\n",
+ " var element = $(\"#\" + id);\n",
+ " var ws_proxy = comm_websocket_adapter(comm)\n",
+ "\n",
+ " function ondownload(figure, format) {\n",
+ " window.open(figure.imageObj.src);\n",
+ " }\n",
+ "\n",
+ " var fig = new mpl.figure(id, ws_proxy,\n",
+ " ondownload,\n",
+ " element.get(0));\n",
+ "\n",
+ " // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
+ " // web socket which is closed, not our websocket->open comm proxy.\n",
+ " ws_proxy.onopen();\n",
+ "\n",
+ " fig.parent_element = element.get(0);\n",
+ " fig.cell_info = mpl.find_output_cell(\"\");\n",
+ " if (!fig.cell_info) {\n",
+ " console.error(\"Failed to find cell for figure\", id, fig);\n",
+ " return;\n",
+ " }\n",
+ "\n",
+ " var output_index = fig.cell_info[2]\n",
+ " var cell = fig.cell_info[0];\n",
+ "\n",
+ "};\n",
+ "\n",
+ "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
+ " fig.root.unbind('remove')\n",
+ "\n",
+ " // Update the output cell to use the data from the current canvas.\n",
+ " fig.push_to_output();\n",
+ " var dataURL = fig.canvas.toDataURL();\n",
+ " // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
+ " // the notebook keyboard shortcuts fail.\n",
+ " IPython.keyboard_manager.enable()\n",
+ " $(fig.parent_element).html('
');\n",
+ " fig.close_ws(fig, msg);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.close_ws = function(fig, msg){\n",
+ " fig.send_message('closing', msg);\n",
+ " // fig.ws.close()\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
+ " // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
+ " var dataURL = this.canvas.toDataURL();\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.updated_canvas_event = function() {\n",
+ " // Tell IPython that the notebook contents must change.\n",
+ " IPython.notebook.set_dirty(true);\n",
+ " this.send_message(\"ack\", {});\n",
+ " var fig = this;\n",
+ " // Wait a second, then push the new image to the DOM so\n",
+ " // that it is saved nicely (might be nice to debounce this).\n",
+ " setTimeout(function () { fig.push_to_output() }, 1000);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_toolbar = function() {\n",
+ " var fig = this;\n",
+ "\n",
+ " var nav_element = $('')\n",
+ " nav_element.attr('style', 'width: 100%');\n",
+ " this.root.append(nav_element);\n",
+ "\n",
+ " // Define a callback function for later on.\n",
+ " function toolbar_event(event) {\n",
+ " return fig.toolbar_button_onclick(event['data']);\n",
+ " }\n",
+ " function toolbar_mouse_event(event) {\n",
+ " return fig.toolbar_button_onmouseover(event['data']);\n",
+ " }\n",
+ "\n",
+ " for(var toolbar_ind in mpl.toolbar_items){\n",
+ " var name = mpl.toolbar_items[toolbar_ind][0];\n",
+ " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
+ " var image = mpl.toolbar_items[toolbar_ind][2];\n",
+ " var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
+ "\n",
+ " if (!name) { continue; };\n",
+ "\n",
+ " var button = $('');\n",
+ " button.click(method_name, toolbar_event);\n",
+ " button.mouseover(tooltip, toolbar_mouse_event);\n",
+ " nav_element.append(button);\n",
+ " }\n",
+ "\n",
+ " // Add the status bar.\n",
+ " var status_bar = $('');\n",
+ " nav_element.append(status_bar);\n",
+ " this.message = status_bar[0];\n",
+ "\n",
+ " // Add the close button to the window.\n",
+ " var buttongrp = $('');\n",
+ " var button = $('');\n",
+ " button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
+ " button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
+ " buttongrp.append(button);\n",
+ " var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
+ " titlebar.prepend(buttongrp);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._root_extra_style = function(el){\n",
+ " var fig = this\n",
+ " el.on(\"remove\", function(){\n",
+ "\tfig.close_ws(fig, {});\n",
+ " });\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._canvas_extra_style = function(el){\n",
+ " // this is important to make the div 'focusable\n",
+ " el.attr('tabindex', 0)\n",
+ " // reach out to IPython and tell the keyboard manager to turn it's self\n",
+ " // off when our div gets focus\n",
+ "\n",
+ " // location in version 3\n",
+ " if (IPython.notebook.keyboard_manager) {\n",
+ " IPython.notebook.keyboard_manager.register_events(el);\n",
+ " }\n",
+ " else {\n",
+ " // location in version 2\n",
+ " IPython.keyboard_manager.register_events(el);\n",
+ " }\n",
+ "\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
+ " var manager = IPython.notebook.keyboard_manager;\n",
+ " if (!manager)\n",
+ " manager = IPython.keyboard_manager;\n",
+ "\n",
+ " // Check for shift+enter\n",
+ " if (event.shiftKey && event.which == 13) {\n",
+ " this.canvas_div.blur();\n",
+ " event.shiftKey = false;\n",
+ " // Send a \"J\" for go to next cell\n",
+ " event.which = 74;\n",
+ " event.keyCode = 74;\n",
+ " manager.command_mode();\n",
+ " manager.handle_keydown(event);\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
+ " fig.ondownload(fig, null);\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.find_output_cell = function(html_output) {\n",
+ " // Return the cell and output element which can be found *uniquely* in the notebook.\n",
+ " // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
+ " // IPython event is triggered only after the cells have been serialised, which for\n",
+ " // our purposes (turning an active figure into a static one), is too late.\n",
+ " var cells = IPython.notebook.get_cells();\n",
+ " var ncells = cells.length;\n",
+ " for (var i=0; i= 3 moved mimebundle to data attribute of output\n",
+ " data = data.data;\n",
+ " }\n",
+ " if (data['text/html'] == html_output) {\n",
+ " return [cell, data, j];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "// Register the function which deals with the matplotlib target/channel.\n",
+ "// The kernel may be null if the page has been refreshed.\n",
+ "if (IPython.notebook.kernel != null) {\n",
+ " IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
+ "}\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "fig, axs = plt.subplots(2)\n",
+ "\n",
+ "for ax, capture in zip(axs.flatten(), [data_downstairs[0] + data_downstairs[1], data_upstairs]):\n",
+ " cap = np.array(capture)\n",
+ " cap -= np.mean(cap).astype(int)\n",
+ " lens = np.array([ len(g) for g in (list(g) for g_key, g in itertools.groupby(cap, lambda x: 1 if x >= 0 else -1)) for _x in g ])\n",
+ " w = 32\n",
+ " k = 8\n",
+ " lens = np.array(list(sum(xs) for xs in zip(*(lens[i::k] for i in range(w))))) / w\n",
+ " rmss = np.array(list(np.sqrt(np.mean(np.square(xs))) for xs in zip(*(cap[i::k] for i in range(w)))))\n",
+ " ax.plot(lens)\n",
+ " ax2 = ax.twinx()\n",
+ " ax2.plot(rmss, color='red')\n",
+ " ax2.grid()\n",
+ "\n",
+ " both_data = list(zip(lens, rmss))\n",
+ " p, q = 12, 3\n",
+ " for idx, data in enumerate(zip(*(both_data[i*p:] for i in range(q)))):\n",
+ " h_len, h_rms = zip(*data)\n",
+ " if all(x > 1500 for x in h_rms):\n",
+ " if all(1.0 < x < 1.5 for x in h_len[::2]) and \\\n",
+ " all(1.3 < x < 1.8 for x in h_len[1::2]):\n",
+ " ax.axvspan(idx, idx + p*q, color='lightgreen')\n",
+ " elif all(1.4 < x < 1.8 for x in h_len):\n",
+ " ax.axvspan(idx, idx + p*q, color='pink')"
+ ]
}
],
"metadata": {