{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<module 'mpes.base' from '/home/metis/venv/conda3/lib/python3.7/site-packages/mpes/base.py'>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from mpes import fprocessing as fp, analysis as aly, visualization as vis, base as b\n",
    "from symmetrize import sym, tps, pointops as po\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "from imp import reload\n",
    "reload(aly)\n",
    "reload(fp)\n",
    "reload(b)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.1 Correction of symmetry distortion using thin plate spline\n",
    "#### 3.1.0 Retrieve experimental data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fdir = r'../data/data_114_parts'\n",
    "parp = fp.parallelHDF5Processor(folder=fdir + r'/splits')\n",
    "parp.gather(identifier=r'/*.h5', file_sorting=True)\n",
    "len(parp.files)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(null);\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.3.4.min.js\"];\n",
       "  var css_urls = [];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    function(Bokeh) {} // ensure no trailing comma for IE\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(null)).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(null);\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.3.4.min.js\"];\n  var css_urls = [];\n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    \n    function(Bokeh) {\n      \n    },\n    function(Bokeh) {} // ensure no trailing comma for IE\n  ];\n\n  function run_inline_js() {\n    \n    if ((root.Bokeh !== undefined) || (force === true)) {\n      for (var i = 0; i < inline_js.length; i++) {\n        inline_js[i].call(root, root.Bokeh);\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(null)).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"4fe221c4-ae3d-48d4-8794-56523afea9cd\" data-root-id=\"1178\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"9969c467-1957-491b-a56d-1d810a9d3b7d\":{\"roots\":{\"references\":[{\"attributes\":{\"children\":[{\"id\":\"1177\",\"type\":\"ToolbarBox\"},{\"id\":\"1175\",\"type\":\"GridBox\"}]},\"id\":\"1178\",\"type\":\"Column\"},{\"attributes\":{\"background_fill_color\":{\"value\":\"white\"},\"below\":[{\"id\":\"1058\",\"type\":\"LinearAxis\"}],\"center\":[{\"id\":\"1062\",\"type\":\"Grid\"},{\"id\":\"1067\",\"type\":\"Grid\"},{\"id\":\"1095\",\"type\":\"Legend\"}],\"left\":[{\"id\":\"1063\",\"type\":\"LinearAxis\"}],\"plot_height\":224,\"plot_width\":420,\"renderers\":[{\"id\":\"1086\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1089\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1075\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1050\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1054\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1052\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1056\",\"type\":\"LinearScale\"}},\"id\":\"1049\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"callback\":null},\"id\":\"1002\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1102\",\"type\":\"LinearScale\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1037\",\"type\":\"Quad\"},{\"attributes\":{},\"id\":\"1104\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1069\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1141\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1107\",\"type\":\"BasicTicker\"}},\"id\":\"1106\",\"type\":\"LinearAxis\"},{\"attributes\":{\"overlay\":{\"id\":\"1094\",\"type\":\"BoxAnnotation\"}},\"id\":\"1070\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1107\",\"type\":\"BasicTicker\"},{\"attributes\":{\"callback\":null,\"start\":0},\"id\":\"1100\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1071\",\"type\":\"SaveTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1142\",\"type\":\"BoxAnnotation\"}},\"id\":\"1118\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1091\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1072\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1119\",\"type\":\"SaveTool\"},{\"attributes\":{\"background_fill_color\":{\"value\":\"white\"},\"below\":[{\"id\":\"1010\",\"type\":\"LinearAxis\"}],\"center\":[{\"id\":\"1014\",\"type\":\"Grid\"},{\"id\":\"1019\",\"type\":\"Grid\"},{\"id\":\"1047\",\"type\":\"Legend\"}],\"left\":[{\"id\":\"1015\",\"type\":\"LinearAxis\"}],\"plot_height\":224,\"plot_width\":420,\"renderers\":[{\"id\":\"1038\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1041\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1027\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1002\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1006\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1004\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1008\",\"type\":\"LinearScale\"}},\"id\":\"1001\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1116\",\"type\":\"PanTool\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1089\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"LinearScale\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1133\",\"type\":\"Quad\"},{\"attributes\":{},\"id\":\"1117\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1073\",\"type\":\"HelpTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1068\",\"type\":\"PanTool\"},{\"id\":\"1069\",\"type\":\"WheelZoomTool\"},{\"id\":\"1070\",\"type\":\"BoxZoomTool\"},{\"id\":\"1071\",\"type\":\"SaveTool\"},{\"id\":\"1072\",\"type\":\"ResetTool\"},{\"id\":\"1073\",\"type\":\"HelpTool\"},{\"id\":\"1074\",\"type\":\"HoverTool\"}]},\"id\":\"1075\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1112\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1046\",\"type\":\"BoxAnnotation\"}},\"id\":\"1022\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1068\",\"type\":\"PanTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1083\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1084\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1085\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1087\",\"type\":\"CDSView\"}},\"id\":\"1086\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"(x, y)\",\"($x, $y)\"]]},\"id\":\"1074\",\"type\":\"HoverTool\"},{\"attributes\":{\"source\":{\"id\":\"1083\",\"type\":\"ColumnDataSource\"}},\"id\":\"1087\",\"type\":\"CDSView\"},{\"attributes\":{\"formatter\":{\"id\":\"1139\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1112\",\"type\":\"BasicTicker\"}},\"id\":\"1111\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1120\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1121\",\"type\":\"HelpTool\"},{\"attributes\":{\"callback\":null,\"data\":{\"left\":{\"__ndarray__\":\"AABIQwAAWEMAAGhDAAB4QwAAhEMAAIxDAACUQwAAnEMAAKRDAACsQwAAtEMAALxDAADEQwAAzEMAANRDAADcQwAA5EMAAOxDAAD0QwAA/EMAAAJEAAAGRAAACkQAAA5EAAASRAAAFkQAABpEAAAeRAAAIkQAACZEAAAqRAAALkQAADJEAAA2RAAAOkQAAD5EAABCRAAARkQAAEpEAABORAAAUkQAAFZEAABaRAAAXkQAAGJEAABmRAAAakQAAG5EAAByRAAAdkQAAHpEAAB+RAAAgUQAAINEAACFRAAAh0QAAIlEAACLRAAAjUQAAI9EAACRRAAAk0QAAJVEAACXRAAAmUQAAJtEAACdRAAAn0QAAKFEAACjRAAApUQAAKdEAACpRAAAq0QAAK1EAACvRAAAsUQAALNEAAC1RAAAt0QAALlEAAC7RAAAvUQAAL9EAADBRAAAw0QAAMVEAADHRAAAyUQAAMtEAADNRAAAz0QAANFEAADTRAAA1UQAANdEAADZRAAA20QAAN1EAADfRA==\",\"dtype\":\"float32\",\"shape\":[100]},\"right\":{\"__ndarray__\":\"AABYQwAAaEMAAHhDAACEQwAAjEMAAJRDAACcQwAApEMAAKxDAAC0QwAAvEMAAMRDAADMQwAA1EMAANxDAADkQwAA7EMAAPRDAAD8QwAAAkQAAAZEAAAKRAAADkQAABJEAAAWRAAAGkQAAB5EAAAiRAAAJkQAACpEAAAuRAAAMkQAADZEAAA6RAAAPkQAAEJEAABGRAAASkQAAE5EAABSRAAAVkQAAFpEAABeRAAAYkQAAGZEAABqRAAAbkQAAHJEAAB2RAAAekQAAH5EAACBRAAAg0QAAIVEAACHRAAAiUQAAItEAACNRAAAj0QAAJFEAACTRAAAlUQAAJdEAACZRAAAm0QAAJ1EAACfRAAAoUQAAKNEAAClRAAAp0QAAKlEAACrRAAArUQAAK9EAACxRAAAs0QAALVEAAC3RAAAuUQAALtEAAC9RAAAv0QAAMFEAADDRAAAxUQAAMdEAADJRAAAy0QAAM1EAADPRAAA0UQAANNEAADVRAAA10QAANlEAADbRAAA3UQAAN9EAADhRA==\",\"dtype\":\"float32\",\"shape\":[100]},\"top\":[1878,1867,1877,1870,1852,1969,1943,2486,2996,3514,3741,4187,4944,5810,7194,8792,10376,12449,14770,17255,20945,24855,29530,35456,42764,50144,58992,68585,77082,89592,101563,111731,126630,140766,154140,171944,187854,200615,217896,228772,238521,254642,268186,281092,300876,312102,323756,343843,357633,358830,374593,383681,391389,416245,428562,430710,443672,451202,441323,443759,444157,438800,437480,427303,403852,387480,370284,347862,337451,319421,300618,292782,277488,257866,239255,216028,191891,172504,150588,127801,109443,91440,72011,57781,43966,32692,23397,15290,10058,6439,4686,3785,3483,3201,2687,1982,1644,1650,1727,1835]},\"selected\":{\"id\":\"1163\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1162\",\"type\":\"UnionRenderers\"}},\"id\":\"1083\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"white\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1132\",\"type\":\"Quad\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1064\",\"type\":\"BasicTicker\"}},\"id\":\"1067\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1020\",\"type\":\"PanTool\"},{\"attributes\":{\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1107\",\"type\":\"BasicTicker\"}},\"id\":\"1110\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"1045\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1011\",\"type\":\"BasicTicker\"}},\"id\":\"1010\",\"type\":\"LinearAxis\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1112\",\"type\":\"BasicTicker\"}},\"id\":\"1115\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"(x, y)\",\"($x, $y)\"]]},\"id\":\"1122\",\"type\":\"HoverTool\"},{\"attributes\":{\"callback\":null,\"data\":{\"left\":{\"__ndarray__\":\"AACWQwCAnUMAAKVDAICsQwAAtEMAgLtDAADDQwCAykMAANJDAIDZQwAA4UMAgOhDAADwQwCA90MAAP9DAEADRAAAB0QAwApEAIAORABAEkQAABZEAMAZRACAHUQAQCFEAAAlRADAKEQAgCxEAEAwRAAANEQAwDdEAIA7RABAP0QAAENEAMBGRACASkQAQE5EAABSRADAVUQAgFlEAEBdRAAAYUQAwGREAIBoRABAbEQAAHBEAMBzRACAd0QAQHtEAAB/RABggUQAQINEACCFRAAAh0QA4IhEAMCKRACgjEQAgI5EAGCQRABAkkQAIJREAACWRADgl0QAwJlEAKCbRACAnUQAYJ9EAEChRAAgo0QAAKVEAOCmRADAqEQAoKpEAICsRABgrkQAQLBEACCyRAAAtEQA4LVEAMC3RACguUQAgLtEAGC9RABAv0QAIMFEAADDRADgxEQAwMZEAKDIRACAykQAYMxEAEDORAAg0EQAANJEAODTRADA1UQAoNdEAIDZRABg20QAQN1EACDfRA==\",\"dtype\":\"float32\",\"shape\":[100]},\"right\":{\"__ndarray__\":\"AICdQwAApUMAgKxDAAC0QwCAu0MAAMNDAIDKQwAA0kMAgNlDAADhQwCA6EMAAPBDAID3QwAA/0MAQANEAAAHRADACkQAgA5EAEASRAAAFkQAwBlEAIAdRABAIUQAACVEAMAoRACALEQAQDBEAAA0RADAN0QAgDtEAEA/RAAAQ0QAwEZEAIBKRABATkQAAFJEAMBVRACAWUQAQF1EAABhRADAZEQAgGhEAEBsRAAAcEQAwHNEAIB3RABAe0QAAH9EAGCBRABAg0QAIIVEAACHRADgiEQAwIpEAKCMRACAjkQAYJBEAECSRAAglEQAAJZEAOCXRADAmUQAoJtEAICdRABgn0QAQKFEACCjRAAApUQA4KZEAMCoRACgqkQAgKxEAGCuRABAsEQAILJEAAC0RADgtUQAwLdEAKC5RACAu0QAYL1EAEC/RAAgwUQAAMNEAODERADAxkQAoMhEAIDKRABgzEQAQM5EACDQRAAA0kQA4NNEAMDVRACg10QAgNlEAGDbRABA3UQAIN9EAADhRA==\",\"dtype\":\"float32\",\"shape\":[100]},\"top\":[2279,2352,2492,4064,14998,21430,28163,34593,41485,51657,61930,75444,89193,103824,118138,131479,142682,154352,166333,183093,205692,226290,246939,263361,284355,299256,312626,325714,335175,339616,346826,352159,360394,353449,350483,345067,333668,331081,328485,322292,321201,314627,312278,311856,309958,310723,304288,309292,307191,300892,298123,287572,275067,260476,245191,234046,217403,203366,193841,180757,173886,165352,159326,153046,147438,148261,146577,145450,145620,143281,143660,140773,136509,133612,124403,115803,103961,91244,80121,67834,58394,46740,34986,24643,15357,8337,5417,4842,4643,4385,4279,4067,3792,3695,3637,3326,3047,2488,1845,1757]},\"selected\":{\"id\":\"1153\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1152\",\"type\":\"UnionRenderers\"}},\"id\":\"1035\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1085\",\"type\":\"Quad\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1116\",\"type\":\"PanTool\"},{\"id\":\"1117\",\"type\":\"WheelZoomTool\"},{\"id\":\"1118\",\"type\":\"BoxZoomTool\"},{\"id\":\"1119\",\"type\":\"SaveTool\"},{\"id\":\"1120\",\"type\":\"ResetTool\"},{\"id\":\"1121\",\"type\":\"HelpTool\"},{\"id\":\"1122\",\"type\":\"HoverTool\"}]},\"id\":\"1123\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null},\"id\":\"1098\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1093\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1043\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"1131\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1132\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1133\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1135\",\"type\":\"CDSView\"}},\"id\":\"1134\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1016\",\"type\":\"BasicTicker\"},{\"attributes\":{\"source\":{\"id\":\"1131\",\"type\":\"ColumnDataSource\"}},\"id\":\"1135\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"1035\",\"type\":\"ColumnDataSource\"}},\"id\":\"1039\",\"type\":\"CDSView\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1137\",\"type\":\"Title\"},{\"attributes\":{\"items\":[{\"id\":\"1048\",\"type\":\"LegendItem\"}]},\"id\":\"1047\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1139\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1011\",\"type\":\"BasicTicker\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1041\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1141\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1142\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"background_fill_color\":{\"value\":\"white\"},\"below\":[{\"id\":\"1106\",\"type\":\"LinearAxis\"}],\"center\":[{\"id\":\"1110\",\"type\":\"Grid\"},{\"id\":\"1115\",\"type\":\"Grid\"},{\"id\":\"1143\",\"type\":\"Legend\"}],\"left\":[{\"id\":\"1111\",\"type\":\"LinearAxis\"}],\"plot_height\":224,\"plot_width\":420,\"renderers\":[{\"id\":\"1134\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1137\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1123\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1098\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1102\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1100\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1104\",\"type\":\"LinearScale\"}},\"id\":\"1097\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"children\":[[{\"id\":\"1001\",\"subtype\":\"Figure\",\"type\":\"Plot\"},0,0],[{\"id\":\"1049\",\"subtype\":\"Figure\",\"type\":\"Plot\"},0,1],[{\"id\":\"1097\",\"subtype\":\"Figure\",\"type\":\"Plot\"},1,0]]},\"id\":\"1175\",\"type\":\"GridBox\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"ResetTool\"},{\"attributes\":{\"items\":[{\"id\":\"1144\",\"type\":\"LegendItem\"}]},\"id\":\"1143\",\"type\":\"Legend\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"white\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1084\",\"type\":\"Quad\"},{\"attributes\":{},\"id\":\"1056\",\"type\":\"LinearScale\"},{\"attributes\":{\"label\":{\"value\":\"t\"},\"renderers\":[{\"id\":\"1134\",\"type\":\"GlyphRenderer\"}]},\"id\":\"1144\",\"type\":\"LegendItem\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"white\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1036\",\"type\":\"Quad\"},{\"attributes\":{},\"id\":\"1153\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1162\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1163\",\"type\":\"Selection\"},{\"attributes\":{\"formatter\":{\"id\":\"1093\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1059\",\"type\":\"BasicTicker\"}},\"id\":\"1058\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1172\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"items\":[{\"id\":\"1096\",\"type\":\"LegendItem\"}]},\"id\":\"1095\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1173\",\"type\":\"Selection\"},{\"attributes\":{\"tools\":[{\"id\":\"1020\",\"type\":\"PanTool\"},{\"id\":\"1021\",\"type\":\"WheelZoomTool\"},{\"id\":\"1022\",\"type\":\"BoxZoomTool\"},{\"id\":\"1023\",\"type\":\"SaveTool\"},{\"id\":\"1024\",\"type\":\"ResetTool\"},{\"id\":\"1025\",\"type\":\"HelpTool\"},{\"id\":\"1026\",\"type\":\"HoverTool\"},{\"id\":\"1068\",\"type\":\"PanTool\"},{\"id\":\"1069\",\"type\":\"WheelZoomTool\"},{\"id\":\"1070\",\"type\":\"BoxZoomTool\"},{\"id\":\"1071\",\"type\":\"SaveTool\"},{\"id\":\"1072\",\"type\":\"ResetTool\"},{\"id\":\"1073\",\"type\":\"HelpTool\"},{\"id\":\"1074\",\"type\":\"HoverTool\"},{\"id\":\"1116\",\"type\":\"PanTool\"},{\"id\":\"1117\",\"type\":\"WheelZoomTool\"},{\"id\":\"1118\",\"type\":\"BoxZoomTool\"},{\"id\":\"1119\",\"type\":\"SaveTool\"},{\"id\":\"1120\",\"type\":\"ResetTool\"},{\"id\":\"1121\",\"type\":\"HelpTool\"},{\"id\":\"1122\",\"type\":\"HoverTool\"}]},\"id\":\"1176\",\"type\":\"ProxyToolbar\"},{\"attributes\":{},\"id\":\"1059\",\"type\":\"BasicTicker\"},{\"attributes\":{\"toolbar\":{\"id\":\"1176\",\"type\":\"ProxyToolbar\"},\"toolbar_location\":\"above\"},\"id\":\"1177\",\"type\":\"ToolbarBox\"},{\"attributes\":{\"label\":{\"value\":\"Y\"},\"renderers\":[{\"id\":\"1086\",\"type\":\"GlyphRenderer\"}]},\"id\":\"1096\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1064\",\"type\":\"BasicTicker\"},{\"attributes\":{\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1059\",\"type\":\"BasicTicker\"}},\"id\":\"1062\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"1035\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1036\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1037\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1039\",\"type\":\"CDSView\"}},\"id\":\"1038\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"1043\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1016\",\"type\":\"BasicTicker\"}},\"id\":\"1015\",\"type\":\"LinearAxis\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1046\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"label\":{\"value\":\"X\"},\"renderers\":[{\"id\":\"1038\",\"type\":\"GlyphRenderer\"}]},\"id\":\"1048\",\"type\":\"LegendItem\"},{\"attributes\":{\"callback\":null,\"start\":0},\"id\":\"1052\",\"type\":\"DataRange1d\"},{\"attributes\":{\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1011\",\"type\":\"BasicTicker\"}},\"id\":\"1014\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1054\",\"type\":\"LinearScale\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1016\",\"type\":\"BasicTicker\"}},\"id\":\"1019\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"1091\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1064\",\"type\":\"BasicTicker\"}},\"id\":\"1063\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"HelpTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1094\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1020\",\"type\":\"PanTool\"},{\"id\":\"1021\",\"type\":\"WheelZoomTool\"},{\"id\":\"1022\",\"type\":\"BoxZoomTool\"},{\"id\":\"1023\",\"type\":\"SaveTool\"},{\"id\":\"1024\",\"type\":\"ResetTool\"},{\"id\":\"1025\",\"type\":\"HelpTool\"},{\"id\":\"1026\",\"type\":\"HoverTool\"}]},\"id\":\"1027\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"data\":{\"left\":{\"__ndarray__\":\"AAAAAACa8EAAAAAAwJ3wQAAAAACAofBAAAAAAECl8EAAAAAAAKnwQAAAAADArPBAAAAAAICw8EAAAAAAQLTwQAAAAAAAuPBAAAAAAMC78EAAAAAAgL/wQAAAAABAw/BAAAAAAADH8EAAAAAAwMrwQAAAAACAzvBAAAAAAEDS8EAAAAAAANbwQAAAAADA2fBAAAAAAIDd8EAAAAAAQOHwQAAAAAAA5fBAAAAAAMDo8EAAAAAAgOzwQAAAAABA8PBAAAAAAAD08EAAAAAAwPfwQAAAAACA+/BAAAAAAED/8EAAAAAAAAPxQAAAAADABvFAAAAAAIAK8UAAAAAAQA7xQAAAAAAAEvFAAAAAAMAV8UAAAAAAgBnxQAAAAABAHfFAAAAAAAAh8UAAAAAAwCTxQAAAAACAKPFAAAAAAEAs8UAAAAAAADDxQAAAAADAM/FAAAAAAIA38UAAAAAAQDvxQAAAAAAAP/FAAAAAAMBC8UAAAAAAgEbxQAAAAABASvFAAAAAAABO8UAAAAAAwFHxQAAAAACAVfFAAAAAAEBZ8UAAAAAAAF3xQAAAAADAYPFAAAAAAIBk8UAAAAAAQGjxQAAAAAAAbPFAAAAAAMBv8UAAAAAAgHPxQAAAAABAd/FAAAAAAAB78UAAAAAAwH7xQAAAAACAgvFAAAAAAECG8UAAAAAAAIrxQAAAAADAjfFAAAAAAICR8UAAAAAAQJXxQAAAAAAAmfFAAAAAAMCc8UAAAAAAgKDxQAAAAABApPFAAAAAAACo8UAAAAAAwKvxQAAAAACAr/FAAAAAAECz8UAAAAAAALfxQAAAAADAuvFAAAAAAIC+8UAAAAAAQMLxQAAAAAAAxvFAAAAAAMDJ8UAAAAAAgM3xQAAAAABA0fFAAAAAAADV8UAAAAAAwNjxQAAAAACA3PFAAAAAAEDg8UAAAAAAAOTxQAAAAADA5/FAAAAAAIDr8UAAAAAAQO/xQAAAAAAA8/FAAAAAAMD28UAAAAAAgPrxQAAAAABA/vFAAAAAAAAC8kAAAAAAwAXyQAAAAACACfJAAAAAAEAN8kA=\",\"dtype\":\"float64\",\"shape\":[100]},\"right\":{\"__ndarray__\":\"AAAAAMCd8EAAAAAAgKHwQAAAAABApfBAAAAAAACp8EAAAAAAwKzwQAAAAACAsPBAAAAAAEC08EAAAAAAALjwQAAAAADAu/BAAAAAAIC/8EAAAAAAQMPwQAAAAAAAx/BAAAAAAMDK8EAAAAAAgM7wQAAAAABA0vBAAAAAAADW8EAAAAAAwNnwQAAAAACA3fBAAAAAAEDh8EAAAAAAAOXwQAAAAADA6PBAAAAAAIDs8EAAAAAAQPDwQAAAAAAA9PBAAAAAAMD38EAAAAAAgPvwQAAAAABA//BAAAAAAAAD8UAAAAAAwAbxQAAAAACACvFAAAAAAEAO8UAAAAAAABLxQAAAAADAFfFAAAAAAIAZ8UAAAAAAQB3xQAAAAAAAIfFAAAAAAMAk8UAAAAAAgCjxQAAAAABALPFAAAAAAAAw8UAAAAAAwDPxQAAAAACAN/FAAAAAAEA78UAAAAAAAD/xQAAAAADAQvFAAAAAAIBG8UAAAAAAQErxQAAAAAAATvFAAAAAAMBR8UAAAAAAgFXxQAAAAABAWfFAAAAAAABd8UAAAAAAwGDxQAAAAACAZPFAAAAAAEBo8UAAAAAAAGzxQAAAAADAb/FAAAAAAIBz8UAAAAAAQHfxQAAAAAAAe/FAAAAAAMB+8UAAAAAAgILxQAAAAABAhvFAAAAAAACK8UAAAAAAwI3xQAAAAACAkfFAAAAAAECV8UAAAAAAAJnxQAAAAADAnPFAAAAAAICg8UAAAAAAQKTxQAAAAAAAqPFAAAAAAMCr8UAAAAAAgK/xQAAAAABAs/FAAAAAAAC38UAAAAAAwLrxQAAAAACAvvFAAAAAAEDC8UAAAAAAAMbxQAAAAADAyfFAAAAAAIDN8UAAAAAAQNHxQAAAAAAA1fFAAAAAAMDY8UAAAAAAgNzxQAAAAABA4PFAAAAAAADk8UAAAAAAwOfxQAAAAACA6/FAAAAAAEDv8UAAAAAAAPPxQAAAAADA9vFAAAAAAID68UAAAAAAQP7xQAAAAAAAAvJAAAAAAMAF8kAAAAAAgAnyQAAAAABADfJAAAAAAAAR8kA=\",\"dtype\":\"float64\",\"shape\":[100]},\"top\":[1,0,2,2,4,3,2,2,6,32,127,243,118,46,19,22,22,19,19,25,50,201,1124,5141,13198,22450,34803,53163,80942,115133,153815,179411,187152,190052,185553,165202,130546,103937,93521,94541,100394,106238,112511,120634,130998,142883,153793,163264,168606,168811,157786,135250,108919,88082,77661,76330,78660,83278,87028,89707,90887,89735,87968,85910,83740,83051,83069,84348,88883,93549,99307,103706,106244,105351,100382,94537,87764,82329,77818,76020,74500,74005,74675,76245,77499,78403,78104,78416,77023,76133,74537,72666,70902,68364,66127,63320,60684,58642,56093,54629]},\"selected\":{\"id\":\"1173\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1172\",\"type\":\"UnionRenderers\"}},\"id\":\"1131\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"start\":0},\"id\":\"1004\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1152\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"callback\":null},\"id\":\"1050\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"(x, y)\",\"($x, $y)\"]]},\"id\":\"1026\",\"type\":\"HoverTool\"}],\"root_ids\":[\"1178\"]},\"title\":\"Bokeh Application\",\"version\":\"1.3.4\"}};\n",
       "  var render_items = [{\"docid\":\"9969c467-1957-491b-a56d-1d810a9d3b7d\",\"roots\":{\"1178\":\"4fe221c4-ae3d-48d4-8794-56523afea9cd\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        embed_document(root);\n",
       "        clearInterval(timer);\n",
       "      }\n",
       "      attempts++;\n",
       "      if (attempts > 100) {\n",
       "        console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        clearInterval(timer);\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1178"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "axes = ['X', 'Y', 't']\n",
    "bins = [100, 100, 100]\n",
    "ranges = [(300, 1800), (200, 1800), (68000, 74000)]\n",
    "parp.viewEventHistogram(fid=0, ncol=2, axes=axes, bins=bins, ranges=ranges, backend='bokeh')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 3/3 [01:00<00:00, 20.24s/it]\n"
     ]
    }
   ],
   "source": [
    "axes = ['X', 'Y', 't']\n",
    "bins = [512, 512, 50]\n",
    "# IMPORTANT: Keep the bin ranges of the whole detector in X/Y (0,2047)\n",
    "ranges = [(0, 2047), (0, 2047), (69000, 70000)]\n",
    "parp.parallelBinning(axes=axes, nbins=bins, ranges=ranges, scheduler='threads', ret=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(512, 512, 50)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "V = parp.combinedresult['binned']\n",
    "V.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7fe0dadb3278>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 20224 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#%matplotlib inline\n",
    "Eslice = V[:, :, 0:22].sum(axis=(2))\n",
    "plt.imshow(Eslice, origin='lower', cmap='terrain_r')\n",
    "#%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3.1.1 Calculate coordinate deformation from selected or detected landmarks and their symmetric correspondences"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "mc = aly.MomentumCorrector(V[ :, :, :], rotsym=6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20764 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mc.selectSlice2D(selector=slice(0, 22), axis=2)\n",
    "mc.featureExtract(image=mc.slice, method='daofind', sigma=10, fwhm=20)\n",
    "mc.view(image=mc.slice, annotated=True, points=mc.features)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# potential scale adjustments for tetragonal lattices\n",
    "mc.ascale = np.array([1, 1, 1, 1, 1, 1, 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18104 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mc.splineWarpEstimate(image=mc.slice, landmarks=mc.pouter_ord, include_center=True, fixed_center=True,\n",
    "                      iterative=False, interp_order=1, update=True)\n",
    "mc.view(image=mc.slice_transformed, annotated=True, points={'feats':mc.ptargs})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 21536 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mc.view(image=mc.slice, annotated=True, points={'feats':mc.ptargs})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7fdfd0516fd0>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 10724 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "subs = 20\n",
    "plt.scatter(mc.cdeform_field[::subs,::subs].ravel(), mc.rdeform_field[::subs,::subs].ravel(), c='b')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3.1.2 Pose adjustment\n",
    "Options to adjust scaling, rotation and translation, if needed. When the transform is desired, set `keep=True`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18688 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mc.coordinateTransform(image=mc.slice_transformed, type='scaling', xscale=1.15, yscale=1.15, keep=True)\n",
    "mc.view(image=mc.slice_transformed)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 17660 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mc.coordinateTransform(image=mc.slice_transformed, type='rotation', angle=-10, center=(270, 270), keep=True)\n",
    "mc.view(image=mc.slice_transformed)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 17768 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mc.coordinateTransform(image=mc.slice_transformed, type='translation', xtrans=-10, ytrans=5, keep=True)\n",
    "mc.view(image=mc.slice_transformed)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20128 characters]\n",
      "text/plain": [
       "<Figure size 288x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Recalculate corrected image\n",
    "import scipy.ndimage as ndi\n",
    "mc.slice_transformed = ndi.map_coordinates(mc.slice, [mc.rdeform_field,mc.cdeform_field], order=1)\n",
    "mc.view(image=mc.slice_transformed)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7fdfd02fb5c0>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 11088 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "subs = 20\n",
    "plt.scatter(mc.cdeform_field[::subs,::subs].ravel(), mc.rdeform_field[::subs,::subs].ravel(), c='b')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3.1.3 Bin in converted grid"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "dfp = fp.dataframeProcessor(datafolder=fdir + r'/splits')\n",
    "dfp.read(source='folder', ftype='h5')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Calculating inverse Deformation Field, might take a moment...\n"
     ]
    }
   ],
   "source": [
    "# Apply the correction to the data frame\n",
    "dfp.applyKCorrection(type='tps_matrix', rdeform_field = mc.rdeform_field, cdeform_field = mc.cdeform_field, X='X', Y='Y', newX='Xm', newY='Ym')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7fdfd03aa470>"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 12724 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# The inverse displacement field is stored in dfp.dfield\n",
    "dfield = dfp.dfield\n",
    "subs =70\n",
    "plt.scatter(dfield[0,::subs,::subs].ravel(), dfield[1,::subs,::subs].ravel(), c='b')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Once you have calculated the inverse dfield, you can also call the applyKCorrection with that dfield directly, which is much quicker\n",
    "# The x/y/newX/newY parameters can be ommited, then the defaults are taken (see above)\n",
    "dfp = fp.dataframeProcessor(datafolder=fdir + r'/splits')\n",
    "dfp.read(source='folder', ftype='h5')\n",
    "dfp.applyKCorrection(type='tps_matrix', dfield = dfield)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 3/3 [01:19<00:00, 26.61s/it]\n"
     ]
    }
   ],
   "source": [
    "# same binning ranges without jittering for comparison\n",
    "axes = ['Xm', 'Ym', 't']\n",
    "bins = [512, 512, 50]\n",
    "ranges = [(0, 2047), (0, 2047), (69000, 70000)]\n",
    "dfp.distributedBinning(axes=axes, nbins=bins, ranges=ranges, scheduler='threads', ret=False, jittered=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7fdf5042c470>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 47780 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "Eslice_rebinned = dfp.histdict['binned'][:, :, 0:22].sum(axis=(2))\n",
    "plt.figure(figsize=(10, 6))\n",
    "plt.subplot(1,2,1)\n",
    "plt.imshow(Eslice_rebinned, cmap='terrain_r')\n",
    "plt.subplot(1,2,2)\n",
    "plt.imshow(mc.slice_transformed, cmap='terrain_r')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(null);\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.3.4.min.js\"];\n",
       "  var css_urls = [];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    function(Bokeh) {} // ensure no trailing comma for IE\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((root.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i].call(root, root.Bokeh);\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(null)).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(null);\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-1.3.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-1.3.4.min.js\"];\n  var css_urls = [];\n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    \n    function(Bokeh) {\n      \n    },\n    function(Bokeh) {} // ensure no trailing comma for IE\n  ];\n\n  function run_inline_js() {\n    \n    if ((root.Bokeh !== undefined) || (force === true)) {\n      for (var i = 0; i < inline_js.length; i++) {\n        inline_js[i].call(root, root.Bokeh);\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(null)).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"dd133199-9973-48ac-bfbf-e4fabbefeaf5\" data-root-id=\"1545\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"31ace352-dfc8-4247-abb2-c780ec8a75a0\":{\"roots\":{\"references\":[{\"attributes\":{\"children\":[{\"id\":\"1544\",\"type\":\"ToolbarBox\"},{\"id\":\"1542\",\"type\":\"GridBox\"}]},\"id\":\"1545\",\"type\":\"Column\"},{\"attributes\":{\"children\":[[{\"id\":\"1368\",\"subtype\":\"Figure\",\"type\":\"Plot\"},0,0],[{\"id\":\"1416\",\"subtype\":\"Figure\",\"type\":\"Plot\"},0,1],[{\"id\":\"1464\",\"subtype\":\"Figure\",\"type\":\"Plot\"},1,0]]},\"id\":\"1542\",\"type\":\"GridBox\"},{\"attributes\":{\"callback\":null},\"id\":\"1369\",\"type\":\"DataRange1d\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1435\",\"type\":\"PanTool\"},{\"id\":\"1436\",\"type\":\"WheelZoomTool\"},{\"id\":\"1437\",\"type\":\"BoxZoomTool\"},{\"id\":\"1438\",\"type\":\"SaveTool\"},{\"id\":\"1439\",\"type\":\"ResetTool\"},{\"id\":\"1440\",\"type\":\"HelpTool\"},{\"id\":\"1441\",\"type\":\"HoverTool\"}]},\"id\":\"1442\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"data\":{\"left\":{\"__ndarray__\":\"AAAAAADAckAAAAAAALBzQAAAAAAAoHRAAAAAAACQdUAAAAAAAIB2QAAAAAAAcHdAAAAAAABgeEAAAAAAAFB5QAAAAAAAQHpAAAAAAAAwe0AAAAAAACB8QAAAAAAAEH1AAAAAAAAAfkAAAAAAAPB+QAAAAAAA4H9AAAAAAABogEAAAAAAAOCAQAAAAAAAWIFAAAAAAADQgUAAAAAAAEiCQAAAAAAAwIJAAAAAAAA4g0AAAAAAALCDQAAAAAAAKIRAAAAAAACghEAAAAAAABiFQAAAAAAAkIVAAAAAAAAIhkAAAAAAAICGQAAAAAAA+IZAAAAAAABwh0AAAAAAAOiHQAAAAAAAYIhAAAAAAADYiEAAAAAAAFCJQAAAAAAAyIlAAAAAAABAikAAAAAAALiKQAAAAAAAMItAAAAAAACoi0AAAAAAACCMQAAAAAAAmIxAAAAAAAAQjUAAAAAAAIiNQAAAAAAAAI5AAAAAAAB4jkAAAAAAAPCOQAAAAAAAaI9AAAAAAADgj0AAAAAAACyQQAAAAAAAaJBAAAAAAACkkEAAAAAAAOCQQAAAAAAAHJFAAAAAAABYkUAAAAAAAJSRQAAAAAAA0JFAAAAAAAAMkkAAAAAAAEiSQAAAAAAAhJJAAAAAAADAkkAAAAAAAPySQAAAAAAAOJNAAAAAAAB0k0AAAAAAALCTQAAAAAAA7JNAAAAAAAAolEAAAAAAAGSUQAAAAAAAoJRAAAAAAADclEAAAAAAABiVQAAAAAAAVJVAAAAAAACQlUAAAAAAAMyVQAAAAAAACJZAAAAAAABElkAAAAAAAICWQAAAAAAAvJZAAAAAAAD4lkAAAAAAADSXQAAAAAAAcJdAAAAAAACsl0AAAAAAAOiXQAAAAAAAJJhAAAAAAABgmEAAAAAAAJyYQAAAAAAA2JhAAAAAAAAUmUAAAAAAAFCZQAAAAAAAjJlAAAAAAADImUAAAAAAAASaQAAAAAAAQJpAAAAAAAB8mkAAAAAAALiaQAAAAAAA9JpAAAAAAAAwm0AAAAAAAGybQAAAAAAAqJtAAAAAAADkm0A=\",\"dtype\":\"float64\",\"shape\":[100]},\"right\":{\"__ndarray__\":\"AAAAAACwc0AAAAAAAKB0QAAAAAAAkHVAAAAAAACAdkAAAAAAAHB3QAAAAAAAYHhAAAAAAABQeUAAAAAAAEB6QAAAAAAAMHtAAAAAAAAgfEAAAAAAABB9QAAAAAAAAH5AAAAAAADwfkAAAAAAAOB/QAAAAAAAaIBAAAAAAADggEAAAAAAAFiBQAAAAAAA0IFAAAAAAABIgkAAAAAAAMCCQAAAAAAAOINAAAAAAACwg0AAAAAAACiEQAAAAAAAoIRAAAAAAAAYhUAAAAAAAJCFQAAAAAAACIZAAAAAAACAhkAAAAAAAPiGQAAAAAAAcIdAAAAAAADoh0AAAAAAAGCIQAAAAAAA2IhAAAAAAABQiUAAAAAAAMiJQAAAAAAAQIpAAAAAAAC4ikAAAAAAADCLQAAAAAAAqItAAAAAAAAgjEAAAAAAAJiMQAAAAAAAEI1AAAAAAACIjUAAAAAAAACOQAAAAAAAeI5AAAAAAADwjkAAAAAAAGiPQAAAAAAA4I9AAAAAAAAskEAAAAAAAGiQQAAAAAAApJBAAAAAAADgkEAAAAAAAByRQAAAAAAAWJFAAAAAAACUkUAAAAAAANCRQAAAAAAADJJAAAAAAABIkkAAAAAAAISSQAAAAAAAwJJAAAAAAAD8kkAAAAAAADiTQAAAAAAAdJNAAAAAAACwk0AAAAAAAOyTQAAAAAAAKJRAAAAAAABklEAAAAAAAKCUQAAAAAAA3JRAAAAAAAAYlUAAAAAAAFSVQAAAAAAAkJVAAAAAAADMlUAAAAAAAAiWQAAAAAAARJZAAAAAAACAlkAAAAAAALyWQAAAAAAA+JZAAAAAAAA0l0AAAAAAAHCXQAAAAAAArJdAAAAAAADol0AAAAAAACSYQAAAAAAAYJhAAAAAAACcmEAAAAAAANiYQAAAAAAAFJlAAAAAAABQmUAAAAAAAIyZQAAAAAAAyJlAAAAAAAAEmkAAAAAAAECaQAAAAAAAfJpAAAAAAAC4mkAAAAAAAPSaQAAAAAAAMJtAAAAAAABsm0AAAAAAAKibQAAAAAAA5JtAAAAAAAAgnEA=\",\"dtype\":\"float64\",\"shape\":[100]},\"top\":[1827,1846,1902,1913,2039,2539,8468,14890,19805,24612,29516,34671,40754,48639,56952,65802,74838,85164,94028,101705,109842,118296,127997,140662,155376,173130,191090,207328,223904,238712,251803,265893,277703,286653,296497,303505,308496,311856,316409,318027,318705,315957,315915,310078,306321,303173,301413,303727,305667,303941,301789,300736,299690,301030,300348,301541,300097,295261,287716,280281,269735,258384,244148,230978,215433,201723,188548,176180,167286,160958,155122,149383,145752,143405,141351,143609,144383,145802,146610,145900,142452,134868,126466,115923,105067,94096,83272,72187,60360,48146,36213,24998,16102,9399,5892,4783,4494,4351,4337,4057]},\"selected\":{\"id\":\"1520\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1519\",\"type\":\"UnionRenderers\"}},\"id\":\"1402\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"white\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1403\",\"type\":\"Quad\"},{\"attributes\":{\"background_fill_color\":{\"value\":\"white\"},\"below\":[{\"id\":\"1425\",\"type\":\"LinearAxis\"}],\"center\":[{\"id\":\"1429\",\"type\":\"Grid\"},{\"id\":\"1434\",\"type\":\"Grid\"},{\"id\":\"1462\",\"type\":\"Legend\"}],\"left\":[{\"id\":\"1430\",\"type\":\"LinearAxis\"}],\"plot_height\":224,\"plot_width\":420,\"renderers\":[{\"id\":\"1453\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1456\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1442\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1417\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1421\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1419\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1423\",\"type\":\"LinearScale\"}},\"id\":\"1416\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"background_fill_color\":{\"value\":\"white\"},\"below\":[{\"id\":\"1377\",\"type\":\"LinearAxis\"}],\"center\":[{\"id\":\"1381\",\"type\":\"Grid\"},{\"id\":\"1386\",\"type\":\"Grid\"},{\"id\":\"1414\",\"type\":\"Legend\"}],\"left\":[{\"id\":\"1382\",\"type\":\"LinearAxis\"}],\"plot_height\":224,\"plot_width\":420,\"renderers\":[{\"id\":\"1405\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1408\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1394\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1369\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1373\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1371\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1375\",\"type\":\"LinearScale\"}},\"id\":\"1368\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1519\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1375\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1373\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"1508\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1474\",\"type\":\"BasicTicker\"}},\"id\":\"1473\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1383\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1461\",\"type\":\"BoxAnnotation\"}},\"id\":\"1437\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1474\",\"type\":\"BasicTicker\"},{\"attributes\":{\"items\":[{\"id\":\"1415\",\"type\":\"LegendItem\"}]},\"id\":\"1414\",\"type\":\"Legend\"},{\"attributes\":{\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1474\",\"type\":\"BasicTicker\"}},\"id\":\"1477\",\"type\":\"Grid\"},{\"attributes\":{\"label\":{\"value\":\"Ym\"},\"renderers\":[{\"id\":\"1453\",\"type\":\"GlyphRenderer\"}]},\"id\":\"1463\",\"type\":\"LegendItem\"},{\"attributes\":{\"source\":{\"id\":\"1402\",\"type\":\"ColumnDataSource\"}},\"id\":\"1406\",\"type\":\"CDSView\"},{\"attributes\":{\"formatter\":{\"id\":\"1506\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1479\",\"type\":\"BasicTicker\"}},\"id\":\"1478\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1539\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1383\",\"type\":\"BasicTicker\"}},\"id\":\"1386\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1540\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1439\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1390\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1435\",\"type\":\"PanTool\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1479\",\"type\":\"BasicTicker\"}},\"id\":\"1482\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1387\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"data\":{\"left\":{\"__ndarray__\":\"AAAAAACa8EAAAAAAwJ3wQAAAAACAofBAAAAAAECl8EAAAAAAAKnwQAAAAADArPBAAAAAAICw8EAAAAAAQLTwQAAAAAAAuPBAAAAAAMC78EAAAAAAgL/wQAAAAABAw/BAAAAAAADH8EAAAAAAwMrwQAAAAACAzvBAAAAAAEDS8EAAAAAAANbwQAAAAADA2fBAAAAAAIDd8EAAAAAAQOHwQAAAAAAA5fBAAAAAAMDo8EAAAAAAgOzwQAAAAABA8PBAAAAAAAD08EAAAAAAwPfwQAAAAACA+/BAAAAAAED/8EAAAAAAAAPxQAAAAADABvFAAAAAAIAK8UAAAAAAQA7xQAAAAAAAEvFAAAAAAMAV8UAAAAAAgBnxQAAAAABAHfFAAAAAAAAh8UAAAAAAwCTxQAAAAACAKPFAAAAAAEAs8UAAAAAAADDxQAAAAADAM/FAAAAAAIA38UAAAAAAQDvxQAAAAAAAP/FAAAAAAMBC8UAAAAAAgEbxQAAAAABASvFAAAAAAABO8UAAAAAAwFHxQAAAAACAVfFAAAAAAEBZ8UAAAAAAAF3xQAAAAADAYPFAAAAAAIBk8UAAAAAAQGjxQAAAAAAAbPFAAAAAAMBv8UAAAAAAgHPxQAAAAABAd/FAAAAAAAB78UAAAAAAwH7xQAAAAACAgvFAAAAAAECG8UAAAAAAAIrxQAAAAADAjfFAAAAAAICR8UAAAAAAQJXxQAAAAAAAmfFAAAAAAMCc8UAAAAAAgKDxQAAAAABApPFAAAAAAACo8UAAAAAAwKvxQAAAAACAr/FAAAAAAECz8UAAAAAAALfxQAAAAADAuvFAAAAAAIC+8UAAAAAAQMLxQAAAAAAAxvFAAAAAAMDJ8UAAAAAAgM3xQAAAAABA0fFAAAAAAADV8UAAAAAAwNjxQAAAAACA3PFAAAAAAEDg8UAAAAAAAOTxQAAAAADA5/FAAAAAAIDr8UAAAAAAQO/xQAAAAAAA8/FAAAAAAMD28UAAAAAAgPrxQAAAAABA/vFAAAAAAAAC8kAAAAAAwAXyQAAAAACACfJAAAAAAEAN8kA=\",\"dtype\":\"float64\",\"shape\":[100]},\"right\":{\"__ndarray__\":\"AAAAAMCd8EAAAAAAgKHwQAAAAABApfBAAAAAAACp8EAAAAAAwKzwQAAAAACAsPBAAAAAAEC08EAAAAAAALjwQAAAAADAu/BAAAAAAIC/8EAAAAAAQMPwQAAAAAAAx/BAAAAAAMDK8EAAAAAAgM7wQAAAAABA0vBAAAAAAADW8EAAAAAAwNnwQAAAAACA3fBAAAAAAEDh8EAAAAAAAOXwQAAAAADA6PBAAAAAAIDs8EAAAAAAQPDwQAAAAAAA9PBAAAAAAMD38EAAAAAAgPvwQAAAAABA//BAAAAAAAAD8UAAAAAAwAbxQAAAAACACvFAAAAAAEAO8UAAAAAAABLxQAAAAADAFfFAAAAAAIAZ8UAAAAAAQB3xQAAAAAAAIfFAAAAAAMAk8UAAAAAAgCjxQAAAAABALPFAAAAAAAAw8UAAAAAAwDPxQAAAAACAN/FAAAAAAEA78UAAAAAAAD/xQAAAAADAQvFAAAAAAIBG8UAAAAAAQErxQAAAAAAATvFAAAAAAMBR8UAAAAAAgFXxQAAAAABAWfFAAAAAAABd8UAAAAAAwGDxQAAAAACAZPFAAAAAAEBo8UAAAAAAAGzxQAAAAADAb/FAAAAAAIBz8UAAAAAAQHfxQAAAAAAAe/FAAAAAAMB+8UAAAAAAgILxQAAAAABAhvFAAAAAAACK8UAAAAAAwI3xQAAAAACAkfFAAAAAAECV8UAAAAAAAJnxQAAAAADAnPFAAAAAAICg8UAAAAAAQKTxQAAAAAAAqPFAAAAAAMCr8UAAAAAAgK/xQAAAAABAs/FAAAAAAAC38UAAAAAAwLrxQAAAAACAvvFAAAAAAEDC8UAAAAAAAMbxQAAAAADAyfFAAAAAAIDN8UAAAAAAQNHxQAAAAAAA1fFAAAAAAMDY8UAAAAAAgNzxQAAAAABA4PFAAAAAAADk8UAAAAAAwOfxQAAAAACA6/FAAAAAAEDv8UAAAAAAAPPxQAAAAADA9vFAAAAAAID68UAAAAAAQP7xQAAAAAAAAvJAAAAAAMAF8kAAAAAAgAnyQAAAAABADfJAAAAAAAAR8kA=\",\"dtype\":\"float64\",\"shape\":[100]},\"top\":[1,0,2,2,4,3,2,2,6,32,127,243,118,46,19,22,22,19,19,25,50,201,1124,5141,13198,22450,34803,53163,80942,115133,153815,179411,187152,190052,185553,165202,130546,103937,93521,94541,100394,106238,112511,120634,130998,142883,153793,163264,168606,168811,157786,135250,108919,88082,77661,76330,78660,83278,87028,89707,90887,89735,87968,85910,83740,83051,83069,84348,88883,93549,99307,103706,106244,105351,100382,94537,87764,82329,77818,76020,74500,74005,74675,76245,77499,78403,78104,78416,77023,76133,74537,72666,70902,68364,66127,63320,60684,58642,56093,54629]},\"selected\":{\"id\":\"1540\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1539\",\"type\":\"UnionRenderers\"}},\"id\":\"1498\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1479\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1413\",\"type\":\"BoxAnnotation\"}},\"id\":\"1389\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"callback\":null},\"id\":\"1465\",\"type\":\"DataRange1d\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1500\",\"type\":\"Quad\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"white\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1499\",\"type\":\"Quad\"},{\"attributes\":{},\"id\":\"1391\",\"type\":\"ResetTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1483\",\"type\":\"PanTool\"},{\"id\":\"1484\",\"type\":\"WheelZoomTool\"},{\"id\":\"1485\",\"type\":\"BoxZoomTool\"},{\"id\":\"1486\",\"type\":\"SaveTool\"},{\"id\":\"1487\",\"type\":\"ResetTool\"},{\"id\":\"1488\",\"type\":\"HelpTool\"},{\"id\":\"1489\",\"type\":\"HoverTool\"}]},\"id\":\"1490\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1436\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1387\",\"type\":\"PanTool\"},{\"id\":\"1388\",\"type\":\"WheelZoomTool\"},{\"id\":\"1389\",\"type\":\"BoxZoomTool\"},{\"id\":\"1390\",\"type\":\"SaveTool\"},{\"id\":\"1391\",\"type\":\"ResetTool\"},{\"id\":\"1392\",\"type\":\"HelpTool\"},{\"id\":\"1393\",\"type\":\"HoverTool\"}]},\"id\":\"1394\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1438\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1483\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1423\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1378\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1484\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1452\",\"type\":\"Quad\"},{\"attributes\":{},\"id\":\"1431\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1509\",\"type\":\"BoxAnnotation\"}},\"id\":\"1485\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1486\",\"type\":\"SaveTool\"},{\"attributes\":{\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1426\",\"type\":\"BasicTicker\"}},\"id\":\"1429\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1487\",\"type\":\"ResetTool\"},{\"attributes\":{\"label\":{\"value\":\"Xm\"},\"renderers\":[{\"id\":\"1405\",\"type\":\"GlyphRenderer\"}]},\"id\":\"1415\",\"type\":\"LegendItem\"},{\"attributes\":{\"formatter\":{\"id\":\"1410\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1383\",\"type\":\"BasicTicker\"}},\"id\":\"1382\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1388\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1421\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1488\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1426\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1450\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1451\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1452\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1454\",\"type\":\"CDSView\"}},\"id\":\"1453\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1404\",\"type\":\"Quad\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"(x, y)\",\"($x, $y)\"]]},\"id\":\"1489\",\"type\":\"HoverTool\"},{\"attributes\":{\"items\":[{\"id\":\"1463\",\"type\":\"LegendItem\"}]},\"id\":\"1462\",\"type\":\"Legend\"},{\"attributes\":{\"data_source\":{\"id\":\"1498\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1499\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1500\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1502\",\"type\":\"CDSView\"}},\"id\":\"1501\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"tools\":[{\"id\":\"1387\",\"type\":\"PanTool\"},{\"id\":\"1388\",\"type\":\"WheelZoomTool\"},{\"id\":\"1389\",\"type\":\"BoxZoomTool\"},{\"id\":\"1390\",\"type\":\"SaveTool\"},{\"id\":\"1391\",\"type\":\"ResetTool\"},{\"id\":\"1392\",\"type\":\"HelpTool\"},{\"id\":\"1393\",\"type\":\"HoverTool\"},{\"id\":\"1435\",\"type\":\"PanTool\"},{\"id\":\"1436\",\"type\":\"WheelZoomTool\"},{\"id\":\"1437\",\"type\":\"BoxZoomTool\"},{\"id\":\"1438\",\"type\":\"SaveTool\"},{\"id\":\"1439\",\"type\":\"ResetTool\"},{\"id\":\"1440\",\"type\":\"HelpTool\"},{\"id\":\"1441\",\"type\":\"HoverTool\"},{\"id\":\"1483\",\"type\":\"PanTool\"},{\"id\":\"1484\",\"type\":\"WheelZoomTool\"},{\"id\":\"1485\",\"type\":\"BoxZoomTool\"},{\"id\":\"1486\",\"type\":\"SaveTool\"},{\"id\":\"1487\",\"type\":\"ResetTool\"},{\"id\":\"1488\",\"type\":\"HelpTool\"},{\"id\":\"1489\",\"type\":\"HoverTool\"}]},\"id\":\"1543\",\"type\":\"ProxyToolbar\"},{\"attributes\":{\"bottom\":{\"value\":0},\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#1f77b4\"},\"left\":{\"field\":\"left\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"white\"},\"right\":{\"field\":\"right\"},\"top\":{\"field\":\"top\"}},\"id\":\"1451\",\"type\":\"Quad\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1431\",\"type\":\"BasicTicker\"}},\"id\":\"1434\",\"type\":\"Grid\"},{\"attributes\":{\"toolbar\":{\"id\":\"1543\",\"type\":\"ProxyToolbar\"},\"toolbar_location\":\"above\"},\"id\":\"1544\",\"type\":\"ToolbarBox\"},{\"attributes\":{\"formatter\":{\"id\":\"1460\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1426\",\"type\":\"BasicTicker\"}},\"id\":\"1425\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1498\",\"type\":\"ColumnDataSource\"}},\"id\":\"1502\",\"type\":\"CDSView\"},{\"attributes\":{\"formatter\":{\"id\":\"1412\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1378\",\"type\":\"BasicTicker\"}},\"id\":\"1377\",\"type\":\"LinearAxis\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1504\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null,\"start\":0},\"id\":\"1467\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"1402\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1403\",\"type\":\"Quad\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1404\",\"type\":\"Quad\"},\"selection_glyph\":null,\"view\":{\"id\":\"1406\",\"type\":\"CDSView\"}},\"id\":\"1405\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1469\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1506\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"background_fill_color\":{\"value\":\"white\"},\"below\":[{\"id\":\"1473\",\"type\":\"LinearAxis\"}],\"center\":[{\"id\":\"1477\",\"type\":\"Grid\"},{\"id\":\"1482\",\"type\":\"Grid\"},{\"id\":\"1510\",\"type\":\"Legend\"}],\"left\":[{\"id\":\"1478\",\"type\":\"LinearAxis\"}],\"plot_height\":224,\"plot_width\":420,\"renderers\":[{\"id\":\"1501\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1504\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"1490\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1465\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"1469\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"1467\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"1471\",\"type\":\"LinearScale\"}},\"id\":\"1464\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1410\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1508\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1392\",\"type\":\"HelpTool\"},{\"attributes\":{\"grid_line_color\":\"lightgrey\",\"ticker\":{\"id\":\"1378\",\"type\":\"BasicTicker\"}},\"id\":\"1381\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"start\":0},\"id\":\"1419\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null,\"data\":{\"left\":{\"__ndarray__\":\"AAAAAAAAaUAAAAAAAABrQAAAAAAAAG1AAAAAAAAAb0AAAAAAAIBwQAAAAAAAgHFAAAAAAACAckAAAAAAAIBzQAAAAAAAgHRAAAAAAACAdUAAAAAAAIB2QAAAAAAAgHdAAAAAAACAeEAAAAAAAIB5QAAAAAAAgHpAAAAAAACAe0AAAAAAAIB8QAAAAAAAgH1AAAAAAACAfkAAAAAAAIB/QAAAAAAAQIBAAAAAAADAgEAAAAAAAECBQAAAAAAAwIFAAAAAAABAgkAAAAAAAMCCQAAAAAAAQINAAAAAAADAg0AAAAAAAECEQAAAAAAAwIRAAAAAAABAhUAAAAAAAMCFQAAAAAAAQIZAAAAAAADAhkAAAAAAAECHQAAAAAAAwIdAAAAAAABAiEAAAAAAAMCIQAAAAAAAQIlAAAAAAADAiUAAAAAAAECKQAAAAAAAwIpAAAAAAABAi0AAAAAAAMCLQAAAAAAAQIxAAAAAAADAjEAAAAAAAECNQAAAAAAAwI1AAAAAAABAjkAAAAAAAMCOQAAAAAAAQI9AAAAAAADAj0AAAAAAACCQQAAAAAAAYJBAAAAAAACgkEAAAAAAAOCQQAAAAAAAIJFAAAAAAABgkUAAAAAAAKCRQAAAAAAA4JFAAAAAAAAgkkAAAAAAAGCSQAAAAAAAoJJAAAAAAADgkkAAAAAAACCTQAAAAAAAYJNAAAAAAACgk0AAAAAAAOCTQAAAAAAAIJRAAAAAAABglEAAAAAAAKCUQAAAAAAA4JRAAAAAAAAglUAAAAAAAGCVQAAAAAAAoJVAAAAAAADglUAAAAAAACCWQAAAAAAAYJZAAAAAAACglkAAAAAAAOCWQAAAAAAAIJdAAAAAAABgl0AAAAAAAKCXQAAAAAAA4JdAAAAAAAAgmEAAAAAAAGCYQAAAAAAAoJhAAAAAAADgmEAAAAAAACCZQAAAAAAAYJlAAAAAAACgmUAAAAAAAOCZQAAAAAAAIJpAAAAAAABgmkAAAAAAAKCaQAAAAAAA4JpAAAAAAAAgm0AAAAAAAGCbQAAAAAAAoJtAAAAAAADgm0A=\",\"dtype\":\"float64\",\"shape\":[100]},\"right\":{\"__ndarray__\":\"AAAAAAAAa0AAAAAAAABtQAAAAAAAAG9AAAAAAACAcEAAAAAAAIBxQAAAAAAAgHJAAAAAAACAc0AAAAAAAIB0QAAAAAAAgHVAAAAAAACAdkAAAAAAAIB3QAAAAAAAgHhAAAAAAACAeUAAAAAAAIB6QAAAAAAAgHtAAAAAAACAfEAAAAAAAIB9QAAAAAAAgH5AAAAAAACAf0AAAAAAAECAQAAAAAAAwIBAAAAAAABAgUAAAAAAAMCBQAAAAAAAQIJAAAAAAADAgkAAAAAAAECDQAAAAAAAwINAAAAAAABAhEAAAAAAAMCEQAAAAAAAQIVAAAAAAADAhUAAAAAAAECGQAAAAAAAwIZAAAAAAABAh0AAAAAAAMCHQAAAAAAAQIhAAAAAAADAiEAAAAAAAECJQAAAAAAAwIlAAAAAAABAikAAAAAAAMCKQAAAAAAAQItAAAAAAADAi0AAAAAAAECMQAAAAAAAwIxAAAAAAABAjUAAAAAAAMCNQAAAAAAAQI5AAAAAAADAjkAAAAAAAECPQAAAAAAAwI9AAAAAAAAgkEAAAAAAAGCQQAAAAAAAoJBAAAAAAADgkEAAAAAAACCRQAAAAAAAYJFAAAAAAACgkUAAAAAAAOCRQAAAAAAAIJJAAAAAAABgkkAAAAAAAKCSQAAAAAAA4JJAAAAAAAAgk0AAAAAAAGCTQAAAAAAAoJNAAAAAAADgk0AAAAAAACCUQAAAAAAAYJRAAAAAAACglEAAAAAAAOCUQAAAAAAAIJVAAAAAAABglUAAAAAAAKCVQAAAAAAA4JVAAAAAAAAglkAAAAAAAGCWQAAAAAAAoJZAAAAAAADglkAAAAAAACCXQAAAAAAAYJdAAAAAAACgl0AAAAAAAOCXQAAAAAAAIJhAAAAAAABgmEAAAAAAAKCYQAAAAAAA4JhAAAAAAAAgmUAAAAAAAGCZQAAAAAAAoJlAAAAAAADgmUAAAAAAACCaQAAAAAAAYJpAAAAAAACgmkAAAAAAAOCaQAAAAAAAIJtAAAAAAABgm0AAAAAAAKCbQAAAAAAA4JtAAAAAAAAgnEA=\",\"dtype\":\"float64\",\"shape\":[100]},\"top\":[1531,1553,1629,1584,1648,1689,1670,1656,1662,1781,1722,2033,2580,3056,3418,3707,4335,5090,6056,7506,8917,10532,12499,14701,17402,20519,24277,28612,33909,40234,47557,55044,63637,71831,82019,93051,103219,114748,128118,141552,154812,168867,183215,195167,206639,217625,229942,241184,254261,271131,285414,297835,311611,325414,339618,350021,353400,367998,379151,391095,408391,422785,432127,440480,444205,441611,442240,443806,443945,436466,419311,400508,379900,359632,342187,325987,308138,294691,282838,264363,245267,224429,203239,180862,159231,136616,116584,97715,79449,63362,49031,37370,27089,18502,12415,8066,5252,3978,3486,3175]},\"selected\":{\"id\":\"1530\",\"type\":\"Selection\"},\"selection_policy\":{\"id\":\"1529\",\"type\":\"UnionRenderers\"}},\"id\":\"1450\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1509\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"formatter\":{\"id\":\"1458\",\"type\":\"BasicTickFormatter\"},\"ticker\":{\"id\":\"1431\",\"type\":\"BasicTicker\"}},\"id\":\"1430\",\"type\":\"LinearAxis\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1413\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"callback\":null},\"id\":\"1417\",\"type\":\"DataRange1d\"},{\"attributes\":{\"items\":[{\"id\":\"1511\",\"type\":\"LegendItem\"}]},\"id\":\"1510\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1440\",\"type\":\"HelpTool\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"(x, y)\",\"($x, $y)\"]]},\"id\":\"1393\",\"type\":\"HoverTool\"},{\"attributes\":{\"label\":{\"value\":\"t\"},\"renderers\":[{\"id\":\"1501\",\"type\":\"GlyphRenderer\"}]},\"id\":\"1511\",\"type\":\"LegendItem\"},{\"attributes\":{\"callback\":null,\"tooltips\":[[\"(x, y)\",\"($x, $y)\"]]},\"id\":\"1441\",\"type\":\"HoverTool\"},{\"attributes\":{\"source\":{\"id\":\"1450\",\"type\":\"ColumnDataSource\"}},\"id\":\"1454\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1529\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1520\",\"type\":\"Selection\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1408\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null,\"start\":0},\"id\":\"1371\",\"type\":\"DataRange1d\"},{\"attributes\":{\"text\":\"\"},\"id\":\"1456\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1530\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1471\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1458\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1412\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1460\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1461\",\"type\":\"BoxAnnotation\"}],\"root_ids\":[\"1545\"]},\"title\":\"Bokeh Application\",\"version\":\"1.3.4\"}};\n",
       "  var render_items = [{\"docid\":\"31ace352-dfc8-4247-abb2-c780ec8a75a0\",\"roots\":{\"1545\":\"dd133199-9973-48ac-bfbf-e4fabbefeaf5\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        embed_document(root);\n",
       "        clearInterval(timer);\n",
       "      }\n",
       "      attempts++;\n",
       "      if (attempts > 100) {\n",
       "        console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        clearInterval(timer);\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1545"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# new Histogram function that can also look at the transformed columns\n",
    "axes = ['Xm', 'Ym', 't']\n",
    "bins = [100, 100, 100]\n",
    "ranges = [(300, 1800), (200, 1800), (68000, 74000)]\n",
    "dfp.viewEventHistogram(dfpid=0, ncol=2, axes=axes, bins=bins, ranges=ranges, backend='bokeh')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 3/3 [01:19<00:00, 26.36s/it]\n"
     ]
    }
   ],
   "source": [
    "# reasonable binning ranges, with jittering\n",
    "axes = ['Xm', 'Ym', 't']\n",
    "bins = [300, 300, 500]\n",
    "ranges = [(300, 1800), (300, 1800), (69000, 75000)]\n",
    "dfp.distributedBinning(axes=axes, nbins=bins, ranges=ranges, scheduler='threads', ret=False, jittered=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 1478656 characters]\n",
      "text/plain": [
       "<Figure size 3600x1440 with 10 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "sliceid = [30, 40, 50, 65, 75, 90, 100, 120, 140, 180]\n",
    "vis.sliceview3d(dfp.histdict['binned'][...,sliceid], axis=2, ncol=5, colormap='terrain_r', numsize=50);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
