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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "48ce90a9-d947-4b5c-8121-f75b3d53e4da",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"data": {
|
| 11 |
+
"text/html": [
|
| 12 |
+
"<script type=\"esms-options\">{\"shimMode\": true}</script><style>*[data-root-id],\n",
|
| 13 |
+
"*[data-root-id] > * {\n",
|
| 14 |
+
" box-sizing: border-box;\n",
|
| 15 |
+
" font-family: var(--jp-ui-font-family);\n",
|
| 16 |
+
" font-size: var(--jp-ui-font-size1);\n",
|
| 17 |
+
" color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
|
| 18 |
+
"}\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"/* Override VSCode background color */\n",
|
| 21 |
+
".cell-output-ipywidget-background:has(\n",
|
| 22 |
+
" > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
|
| 23 |
+
" ),\n",
|
| 24 |
+
".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
|
| 25 |
+
" background-color: transparent !important;\n",
|
| 26 |
+
"}\n",
|
| 27 |
+
"</style>"
|
| 28 |
+
]
|
| 29 |
+
},
|
| 30 |
+
"metadata": {},
|
| 31 |
+
"output_type": "display_data"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"data": {
|
| 35 |
+
"application/javascript": [
|
| 36 |
+
"(function(root) {\n",
|
| 37 |
+
" function now() {\n",
|
| 38 |
+
" return new Date();\n",
|
| 39 |
+
" }\n",
|
| 40 |
+
"\n",
|
| 41 |
+
" const force = true;\n",
|
| 42 |
+
" const py_version = '3.7.3'.replace('rc', '-rc.').replace('.dev', '-dev.');\n",
|
| 43 |
+
" const reloading = false;\n",
|
| 44 |
+
" const Bokeh = root.Bokeh;\n",
|
| 45 |
+
"\n",
|
| 46 |
+
" // Set a timeout for this load but only if we are not already initializing\n",
|
| 47 |
+
" if (typeof (root._bokeh_timeout) === \"undefined\" || (force || !root._bokeh_is_initializing)) {\n",
|
| 48 |
+
" root._bokeh_timeout = Date.now() + 5000;\n",
|
| 49 |
+
" root._bokeh_failed_load = false;\n",
|
| 50 |
+
" }\n",
|
| 51 |
+
"\n",
|
| 52 |
+
" function run_callbacks() {\n",
|
| 53 |
+
" try {\n",
|
| 54 |
+
" root._bokeh_onload_callbacks.forEach(function(callback) {\n",
|
| 55 |
+
" if (callback != null)\n",
|
| 56 |
+
" callback();\n",
|
| 57 |
+
" });\n",
|
| 58 |
+
" } finally {\n",
|
| 59 |
+
" delete root._bokeh_onload_callbacks;\n",
|
| 60 |
+
" }\n",
|
| 61 |
+
" console.debug(\"Bokeh: all callbacks have finished\");\n",
|
| 62 |
+
" }\n",
|
| 63 |
+
"\n",
|
| 64 |
+
" function load_libs(css_urls, js_urls, js_modules, js_exports, callback) {\n",
|
| 65 |
+
" if (css_urls == null) css_urls = [];\n",
|
| 66 |
+
" if (js_urls == null) js_urls = [];\n",
|
| 67 |
+
" if (js_modules == null) js_modules = [];\n",
|
| 68 |
+
" if (js_exports == null) js_exports = {};\n",
|
| 69 |
+
"\n",
|
| 70 |
+
" root._bokeh_onload_callbacks.push(callback);\n",
|
| 71 |
+
"\n",
|
| 72 |
+
" if (root._bokeh_is_loading > 0) {\n",
|
| 73 |
+
" // Don't load bokeh if it is still initializing\n",
|
| 74 |
+
" console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
|
| 75 |
+
" return null;\n",
|
| 76 |
+
" } else if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n",
|
| 77 |
+
" // There is nothing to load\n",
|
| 78 |
+
" run_callbacks();\n",
|
| 79 |
+
" return null;\n",
|
| 80 |
+
" }\n",
|
| 81 |
+
"\n",
|
| 82 |
+
" function on_load() {\n",
|
| 83 |
+
" root._bokeh_is_loading--;\n",
|
| 84 |
+
" if (root._bokeh_is_loading === 0) {\n",
|
| 85 |
+
" console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
|
| 86 |
+
" run_callbacks()\n",
|
| 87 |
+
" }\n",
|
| 88 |
+
" }\n",
|
| 89 |
+
" window._bokeh_on_load = on_load\n",
|
| 90 |
+
"\n",
|
| 91 |
+
" function on_error(e) {\n",
|
| 92 |
+
" const src_el = e.srcElement\n",
|
| 93 |
+
" console.error(\"failed to load \" + (src_el.href || src_el.src));\n",
|
| 94 |
+
" }\n",
|
| 95 |
+
"\n",
|
| 96 |
+
" const skip = [];\n",
|
| 97 |
+
" if (window.requirejs) {\n",
|
| 98 |
+
" window.requirejs.config({'packages': {}, 'paths': {}, 'shim': {}});\n",
|
| 99 |
+
" root._bokeh_is_loading = css_urls.length + 0;\n",
|
| 100 |
+
" } else {\n",
|
| 101 |
+
" root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n",
|
| 102 |
+
" }\n",
|
| 103 |
+
"\n",
|
| 104 |
+
" const existing_stylesheets = []\n",
|
| 105 |
+
" const links = document.getElementsByTagName('link')\n",
|
| 106 |
+
" for (let i = 0; i < links.length; i++) {\n",
|
| 107 |
+
" const link = links[i]\n",
|
| 108 |
+
" if (link.href != null) {\n",
|
| 109 |
+
" existing_stylesheets.push(link.href)\n",
|
| 110 |
+
" }\n",
|
| 111 |
+
" }\n",
|
| 112 |
+
" for (let i = 0; i < css_urls.length; i++) {\n",
|
| 113 |
+
" const url = css_urls[i];\n",
|
| 114 |
+
" const escaped = encodeURI(url)\n",
|
| 115 |
+
" if (existing_stylesheets.indexOf(escaped) !== -1) {\n",
|
| 116 |
+
" on_load()\n",
|
| 117 |
+
" continue;\n",
|
| 118 |
+
" }\n",
|
| 119 |
+
" const element = document.createElement(\"link\");\n",
|
| 120 |
+
" element.onload = on_load;\n",
|
| 121 |
+
" element.onerror = on_error;\n",
|
| 122 |
+
" element.rel = \"stylesheet\";\n",
|
| 123 |
+
" element.type = \"text/css\";\n",
|
| 124 |
+
" element.href = url;\n",
|
| 125 |
+
" console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
|
| 126 |
+
" document.body.appendChild(element);\n",
|
| 127 |
+
" } var existing_scripts = []\n",
|
| 128 |
+
" const scripts = document.getElementsByTagName('script')\n",
|
| 129 |
+
" for (let i = 0; i < scripts.length; i++) {\n",
|
| 130 |
+
" var script = scripts[i]\n",
|
| 131 |
+
" if (script.src != null) {\n",
|
| 132 |
+
" existing_scripts.push(script.src)\n",
|
| 133 |
+
" }\n",
|
| 134 |
+
" }\n",
|
| 135 |
+
" for (let i = 0; i < js_urls.length; i++) {\n",
|
| 136 |
+
" const url = js_urls[i];\n",
|
| 137 |
+
" const escaped = encodeURI(url)\n",
|
| 138 |
+
" if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n",
|
| 139 |
+
" if (!window.requirejs) {\n",
|
| 140 |
+
" on_load();\n",
|
| 141 |
+
" }\n",
|
| 142 |
+
" continue;\n",
|
| 143 |
+
" }\n",
|
| 144 |
+
" const element = document.createElement('script');\n",
|
| 145 |
+
" element.onload = on_load;\n",
|
| 146 |
+
" element.onerror = on_error;\n",
|
| 147 |
+
" element.async = false;\n",
|
| 148 |
+
" element.src = url;\n",
|
| 149 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 150 |
+
" document.head.appendChild(element);\n",
|
| 151 |
+
" }\n",
|
| 152 |
+
" for (let i = 0; i < js_modules.length; i++) {\n",
|
| 153 |
+
" const url = js_modules[i];\n",
|
| 154 |
+
" const escaped = encodeURI(url)\n",
|
| 155 |
+
" if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n",
|
| 156 |
+
" if (!window.requirejs) {\n",
|
| 157 |
+
" on_load();\n",
|
| 158 |
+
" }\n",
|
| 159 |
+
" continue;\n",
|
| 160 |
+
" }\n",
|
| 161 |
+
" var element = document.createElement('script');\n",
|
| 162 |
+
" element.onload = on_load;\n",
|
| 163 |
+
" element.onerror = on_error;\n",
|
| 164 |
+
" element.async = false;\n",
|
| 165 |
+
" element.src = url;\n",
|
| 166 |
+
" element.type = \"module\";\n",
|
| 167 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 168 |
+
" document.head.appendChild(element);\n",
|
| 169 |
+
" }\n",
|
| 170 |
+
" for (const name in js_exports) {\n",
|
| 171 |
+
" const url = js_exports[name];\n",
|
| 172 |
+
" const escaped = encodeURI(url)\n",
|
| 173 |
+
" if (skip.indexOf(escaped) >= 0 || root[name] != null) {\n",
|
| 174 |
+
" if (!window.requirejs) {\n",
|
| 175 |
+
" on_load();\n",
|
| 176 |
+
" }\n",
|
| 177 |
+
" continue;\n",
|
| 178 |
+
" }\n",
|
| 179 |
+
" var element = document.createElement('script');\n",
|
| 180 |
+
" element.onerror = on_error;\n",
|
| 181 |
+
" element.async = false;\n",
|
| 182 |
+
" element.type = \"module\";\n",
|
| 183 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 184 |
+
" element.textContent = `\n",
|
| 185 |
+
" import ${name} from \"${url}\"\n",
|
| 186 |
+
" window.${name} = ${name}\n",
|
| 187 |
+
" window._bokeh_on_load()\n",
|
| 188 |
+
" `\n",
|
| 189 |
+
" document.head.appendChild(element);\n",
|
| 190 |
+
" }\n",
|
| 191 |
+
" if (!js_urls.length && !js_modules.length) {\n",
|
| 192 |
+
" on_load()\n",
|
| 193 |
+
" }\n",
|
| 194 |
+
" };\n",
|
| 195 |
+
"\n",
|
| 196 |
+
" function inject_raw_css(css) {\n",
|
| 197 |
+
" const element = document.createElement(\"style\");\n",
|
| 198 |
+
" element.appendChild(document.createTextNode(css));\n",
|
| 199 |
+
" document.body.appendChild(element);\n",
|
| 200 |
+
" }\n",
|
| 201 |
+
"\n",
|
| 202 |
+
" const js_urls = [\"https://cdn.holoviz.org/panel/1.7.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.7.3.min.js\", \"https://cdn.holoviz.org/panel/1.7.0/dist/panel.min.js\"];\n",
|
| 203 |
+
" const js_modules = [];\n",
|
| 204 |
+
" const js_exports = {};\n",
|
| 205 |
+
" const css_urls = [];\n",
|
| 206 |
+
" const inline_js = [ function(Bokeh) {\n",
|
| 207 |
+
" Bokeh.set_log_level(\"info\");\n",
|
| 208 |
+
" },\n",
|
| 209 |
+
"function(Bokeh) {} // ensure no trailing comma for IE\n",
|
| 210 |
+
" ];\n",
|
| 211 |
+
"\n",
|
| 212 |
+
" function run_inline_js() {\n",
|
| 213 |
+
" if ((root.Bokeh !== undefined) || (force === true)) {\n",
|
| 214 |
+
" for (let i = 0; i < inline_js.length; i++) {\n",
|
| 215 |
+
" try {\n",
|
| 216 |
+
" inline_js[i].call(root, root.Bokeh);\n",
|
| 217 |
+
" } catch(e) {\n",
|
| 218 |
+
" if (!reloading) {\n",
|
| 219 |
+
" throw e;\n",
|
| 220 |
+
" }\n",
|
| 221 |
+
" }\n",
|
| 222 |
+
" }\n",
|
| 223 |
+
" // Cache old bokeh versions\n",
|
| 224 |
+
" if (Bokeh != undefined && !reloading) {\n",
|
| 225 |
+
" var NewBokeh = root.Bokeh;\n",
|
| 226 |
+
" if (Bokeh.versions === undefined) {\n",
|
| 227 |
+
" Bokeh.versions = new Map();\n",
|
| 228 |
+
" }\n",
|
| 229 |
+
" if (NewBokeh.version !== Bokeh.version) {\n",
|
| 230 |
+
" Bokeh.versions.set(NewBokeh.version, NewBokeh)\n",
|
| 231 |
+
" }\n",
|
| 232 |
+
" root.Bokeh = Bokeh;\n",
|
| 233 |
+
" }\n",
|
| 234 |
+
" } else if (Date.now() < root._bokeh_timeout) {\n",
|
| 235 |
+
" setTimeout(run_inline_js, 100);\n",
|
| 236 |
+
" } else if (!root._bokeh_failed_load) {\n",
|
| 237 |
+
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
|
| 238 |
+
" root._bokeh_failed_load = true;\n",
|
| 239 |
+
" }\n",
|
| 240 |
+
" root._bokeh_is_initializing = false\n",
|
| 241 |
+
" }\n",
|
| 242 |
+
"\n",
|
| 243 |
+
" function load_or_wait() {\n",
|
| 244 |
+
" // Implement a backoff loop that tries to ensure we do not load multiple\n",
|
| 245 |
+
" // versions of Bokeh and its dependencies at the same time.\n",
|
| 246 |
+
" // In recent versions we use the root._bokeh_is_initializing flag\n",
|
| 247 |
+
" // to determine whether there is an ongoing attempt to initialize\n",
|
| 248 |
+
" // bokeh, however for backward compatibility we also try to ensure\n",
|
| 249 |
+
" // that we do not start loading a newer (Panel>=1.0 and Bokeh>3) version\n",
|
| 250 |
+
" // before older versions are fully initialized.\n",
|
| 251 |
+
" if (root._bokeh_is_initializing && Date.now() > root._bokeh_timeout) {\n",
|
| 252 |
+
" // If the timeout and bokeh was not successfully loaded we reset\n",
|
| 253 |
+
" // everything and try loading again\n",
|
| 254 |
+
" root._bokeh_timeout = Date.now() + 5000;\n",
|
| 255 |
+
" root._bokeh_is_initializing = false;\n",
|
| 256 |
+
" root._bokeh_onload_callbacks = undefined;\n",
|
| 257 |
+
" root._bokeh_is_loading = 0\n",
|
| 258 |
+
" console.log(\"Bokeh: BokehJS was loaded multiple times but one version failed to initialize.\");\n",
|
| 259 |
+
" load_or_wait();\n",
|
| 260 |
+
" } else if (root._bokeh_is_initializing || (typeof root._bokeh_is_initializing === \"undefined\" && root._bokeh_onload_callbacks !== undefined)) {\n",
|
| 261 |
+
" setTimeout(load_or_wait, 100);\n",
|
| 262 |
+
" } else {\n",
|
| 263 |
+
" root._bokeh_is_initializing = true\n",
|
| 264 |
+
" root._bokeh_onload_callbacks = []\n",
|
| 265 |
+
" const bokeh_loaded = root.Bokeh != null && (root.Bokeh.version === py_version || (root.Bokeh.versions !== undefined && root.Bokeh.versions.has(py_version)));\n",
|
| 266 |
+
" if (!reloading && !bokeh_loaded) {\n",
|
| 267 |
+
" if (root.Bokeh) {\n",
|
| 268 |
+
" root.Bokeh = undefined;\n",
|
| 269 |
+
" }\n",
|
| 270 |
+
" console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
|
| 271 |
+
" }\n",
|
| 272 |
+
" load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n",
|
| 273 |
+
" console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
|
| 274 |
+
" run_inline_js();\n",
|
| 275 |
+
" });\n",
|
| 276 |
+
" }\n",
|
| 277 |
+
" }\n",
|
| 278 |
+
" // Give older versions of the autoload script a head-start to ensure\n",
|
| 279 |
+
" // they initialize before we start loading newer version.\n",
|
| 280 |
+
" setTimeout(load_or_wait, 100)\n",
|
| 281 |
+
"}(window));"
|
| 282 |
+
],
|
| 283 |
+
"application/vnd.holoviews_load.v0+json": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n const py_version = '3.7.3'.replace('rc', '-rc.').replace('.dev', '-dev.');\n const reloading = false;\n const Bokeh = root.Bokeh;\n\n // Set a timeout for this load but only if we are not already initializing\n if (typeof (root._bokeh_timeout) === \"undefined\" || (force || !root._bokeh_is_initializing)) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\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, js_modules, js_exports, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\n if (js_exports == null) js_exports = {};\n\n root._bokeh_onload_callbacks.push(callback);\n\n if (root._bokeh_is_loading > 0) {\n // Don't load bokeh if it is still initializing\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n } else if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n // There is nothing to load\n run_callbacks();\n return null;\n }\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 window._bokeh_on_load = on_load\n\n function on_error(e) {\n const src_el = e.srcElement\n console.error(\"failed to load \" + (src_el.href || src_el.src));\n }\n\n const skip = [];\n if (window.requirejs) {\n window.requirejs.config({'packages': {}, 'paths': {}, 'shim': {}});\n root._bokeh_is_loading = css_urls.length + 0;\n } else {\n root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n }\n\n const existing_stylesheets = []\n const links = document.getElementsByTagName('link')\n for (let i = 0; i < links.length; i++) {\n const link = links[i]\n if (link.href != null) {\n existing_stylesheets.push(link.href)\n }\n }\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const escaped = encodeURI(url)\n if (existing_stylesheets.indexOf(escaped) !== -1) {\n on_load()\n continue;\n }\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 } var existing_scripts = []\n const scripts = document.getElementsByTagName('script')\n for (let i = 0; i < scripts.length; i++) {\n var script = scripts[i]\n if (script.src != null) {\n existing_scripts.push(script.src)\n }\n }\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n const 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 for (let i = 0; i < js_modules.length; i++) {\n const url = js_modules[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\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 element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (const name in js_exports) {\n const url = js_exports[name];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) >= 0 || root[name] != null) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n var element = document.createElement('script');\n element.onerror = on_error;\n element.async = false;\n element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n element.textContent = `\n import ${name} from \"${url}\"\n window.${name} = ${name}\n window._bokeh_on_load()\n `\n document.head.appendChild(element);\n }\n if (!js_urls.length && !js_modules.length) {\n on_load()\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 const js_urls = [\"https://cdn.holoviz.org/panel/1.7.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.7.3.min.js\", \"https://cdn.holoviz.org/panel/1.7.0/dist/panel.min.js\"];\n const js_modules = [];\n const js_exports = {};\n const css_urls = [];\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {} // ensure no trailing comma for IE\n ];\n\n function run_inline_js() {\n if ((root.Bokeh !== undefined) || (force === true)) {\n for (let i = 0; i < inline_js.length; i++) {\n try {\n inline_js[i].call(root, root.Bokeh);\n } catch(e) {\n if (!reloading) {\n throw e;\n }\n }\n }\n // Cache old bokeh versions\n if (Bokeh != undefined && !reloading) {\n var NewBokeh = root.Bokeh;\n if (Bokeh.versions === undefined) {\n Bokeh.versions = new Map();\n }\n if (NewBokeh.version !== Bokeh.version) {\n Bokeh.versions.set(NewBokeh.version, NewBokeh)\n }\n root.Bokeh = Bokeh;\n }\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 }\n root._bokeh_is_initializing = false\n }\n\n function load_or_wait() {\n // Implement a backoff loop that tries to ensure we do not load multiple\n // versions of Bokeh and its dependencies at the same time.\n // In recent versions we use the root._bokeh_is_initializing flag\n // to determine whether there is an ongoing attempt to initialize\n // bokeh, however for backward compatibility we also try to ensure\n // that we do not start loading a newer (Panel>=1.0 and Bokeh>3) version\n // before older versions are fully initialized.\n if (root._bokeh_is_initializing && Date.now() > root._bokeh_timeout) {\n // If the timeout and bokeh was not successfully loaded we reset\n // everything and try loading again\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_is_initializing = false;\n root._bokeh_onload_callbacks = undefined;\n root._bokeh_is_loading = 0\n console.log(\"Bokeh: BokehJS was loaded multiple times but one version failed to initialize.\");\n load_or_wait();\n } else if (root._bokeh_is_initializing || (typeof root._bokeh_is_initializing === \"undefined\" && root._bokeh_onload_callbacks !== undefined)) {\n setTimeout(load_or_wait, 100);\n } else {\n root._bokeh_is_initializing = true\n root._bokeh_onload_callbacks = []\n const bokeh_loaded = root.Bokeh != null && (root.Bokeh.version === py_version || (root.Bokeh.versions !== undefined && root.Bokeh.versions.has(py_version)));\n if (!reloading && !bokeh_loaded) {\n if (root.Bokeh) {\n root.Bokeh = undefined;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n }\n load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n }\n // Give older versions of the autoload script a head-start to ensure\n // they initialize before we start loading newer version.\n setTimeout(load_or_wait, 100)\n}(window));"
|
| 284 |
+
},
|
| 285 |
+
"metadata": {},
|
| 286 |
+
"output_type": "display_data"
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"data": {
|
| 290 |
+
"application/javascript": [
|
| 291 |
+
"\n",
|
| 292 |
+
"if ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n",
|
| 293 |
+
" window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n",
|
| 294 |
+
"}\n",
|
| 295 |
+
"\n",
|
| 296 |
+
"\n",
|
| 297 |
+
" function JupyterCommManager() {\n",
|
| 298 |
+
" }\n",
|
| 299 |
+
"\n",
|
| 300 |
+
" JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n",
|
| 301 |
+
" if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n",
|
| 302 |
+
" var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n",
|
| 303 |
+
" comm_manager.register_target(comm_id, function(comm) {\n",
|
| 304 |
+
" comm.on_msg(msg_handler);\n",
|
| 305 |
+
" });\n",
|
| 306 |
+
" } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n",
|
| 307 |
+
" window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n",
|
| 308 |
+
" comm.onMsg = msg_handler;\n",
|
| 309 |
+
" });\n",
|
| 310 |
+
" } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n",
|
| 311 |
+
" google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n",
|
| 312 |
+
" var messages = comm.messages[Symbol.asyncIterator]();\n",
|
| 313 |
+
" function processIteratorResult(result) {\n",
|
| 314 |
+
" var message = result.value;\n",
|
| 315 |
+
" console.log(message)\n",
|
| 316 |
+
" var content = {data: message.data, comm_id};\n",
|
| 317 |
+
" var buffers = []\n",
|
| 318 |
+
" for (var buffer of message.buffers || []) {\n",
|
| 319 |
+
" buffers.push(new DataView(buffer))\n",
|
| 320 |
+
" }\n",
|
| 321 |
+
" var metadata = message.metadata || {};\n",
|
| 322 |
+
" var msg = {content, buffers, metadata}\n",
|
| 323 |
+
" msg_handler(msg);\n",
|
| 324 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 325 |
+
" }\n",
|
| 326 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 327 |
+
" })\n",
|
| 328 |
+
" }\n",
|
| 329 |
+
" }\n",
|
| 330 |
+
"\n",
|
| 331 |
+
" JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n",
|
| 332 |
+
" if (comm_id in window.PyViz.comms) {\n",
|
| 333 |
+
" return window.PyViz.comms[comm_id];\n",
|
| 334 |
+
" } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n",
|
| 335 |
+
" var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n",
|
| 336 |
+
" var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n",
|
| 337 |
+
" if (msg_handler) {\n",
|
| 338 |
+
" comm.on_msg(msg_handler);\n",
|
| 339 |
+
" }\n",
|
| 340 |
+
" } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n",
|
| 341 |
+
" var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n",
|
| 342 |
+
" comm.open();\n",
|
| 343 |
+
" if (msg_handler) {\n",
|
| 344 |
+
" comm.onMsg = msg_handler;\n",
|
| 345 |
+
" }\n",
|
| 346 |
+
" } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n",
|
| 347 |
+
" var comm_promise = google.colab.kernel.comms.open(comm_id)\n",
|
| 348 |
+
" comm_promise.then((comm) => {\n",
|
| 349 |
+
" window.PyViz.comms[comm_id] = comm;\n",
|
| 350 |
+
" if (msg_handler) {\n",
|
| 351 |
+
" var messages = comm.messages[Symbol.asyncIterator]();\n",
|
| 352 |
+
" function processIteratorResult(result) {\n",
|
| 353 |
+
" var message = result.value;\n",
|
| 354 |
+
" var content = {data: message.data};\n",
|
| 355 |
+
" var metadata = message.metadata || {comm_id};\n",
|
| 356 |
+
" var msg = {content, metadata}\n",
|
| 357 |
+
" msg_handler(msg);\n",
|
| 358 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 359 |
+
" }\n",
|
| 360 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 361 |
+
" }\n",
|
| 362 |
+
" })\n",
|
| 363 |
+
" var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n",
|
| 364 |
+
" return comm_promise.then((comm) => {\n",
|
| 365 |
+
" comm.send(data, metadata, buffers, disposeOnDone);\n",
|
| 366 |
+
" });\n",
|
| 367 |
+
" };\n",
|
| 368 |
+
" var comm = {\n",
|
| 369 |
+
" send: sendClosure\n",
|
| 370 |
+
" };\n",
|
| 371 |
+
" }\n",
|
| 372 |
+
" window.PyViz.comms[comm_id] = comm;\n",
|
| 373 |
+
" return comm;\n",
|
| 374 |
+
" }\n",
|
| 375 |
+
" window.PyViz.comm_manager = new JupyterCommManager();\n",
|
| 376 |
+
" \n",
|
| 377 |
+
"\n",
|
| 378 |
+
"\n",
|
| 379 |
+
"var JS_MIME_TYPE = 'application/javascript';\n",
|
| 380 |
+
"var HTML_MIME_TYPE = 'text/html';\n",
|
| 381 |
+
"var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n",
|
| 382 |
+
"var CLASS_NAME = 'output';\n",
|
| 383 |
+
"\n",
|
| 384 |
+
"/**\n",
|
| 385 |
+
" * Render data to the DOM node\n",
|
| 386 |
+
" */\n",
|
| 387 |
+
"function render(props, node) {\n",
|
| 388 |
+
" var div = document.createElement(\"div\");\n",
|
| 389 |
+
" var script = document.createElement(\"script\");\n",
|
| 390 |
+
" node.appendChild(div);\n",
|
| 391 |
+
" node.appendChild(script);\n",
|
| 392 |
+
"}\n",
|
| 393 |
+
"\n",
|
| 394 |
+
"/**\n",
|
| 395 |
+
" * Handle when a new output is added\n",
|
| 396 |
+
" */\n",
|
| 397 |
+
"function handle_add_output(event, handle) {\n",
|
| 398 |
+
" var output_area = handle.output_area;\n",
|
| 399 |
+
" var output = handle.output;\n",
|
| 400 |
+
" if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
|
| 401 |
+
" return\n",
|
| 402 |
+
" }\n",
|
| 403 |
+
" var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
|
| 404 |
+
" var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
|
| 405 |
+
" if (id !== undefined) {\n",
|
| 406 |
+
" var nchildren = toinsert.length;\n",
|
| 407 |
+
" var html_node = toinsert[nchildren-1].children[0];\n",
|
| 408 |
+
" html_node.innerHTML = output.data[HTML_MIME_TYPE];\n",
|
| 409 |
+
" var scripts = [];\n",
|
| 410 |
+
" var nodelist = html_node.querySelectorAll(\"script\");\n",
|
| 411 |
+
" for (var i in nodelist) {\n",
|
| 412 |
+
" if (nodelist.hasOwnProperty(i)) {\n",
|
| 413 |
+
" scripts.push(nodelist[i])\n",
|
| 414 |
+
" }\n",
|
| 415 |
+
" }\n",
|
| 416 |
+
"\n",
|
| 417 |
+
" scripts.forEach( function (oldScript) {\n",
|
| 418 |
+
" var newScript = document.createElement(\"script\");\n",
|
| 419 |
+
" var attrs = [];\n",
|
| 420 |
+
" var nodemap = oldScript.attributes;\n",
|
| 421 |
+
" for (var j in nodemap) {\n",
|
| 422 |
+
" if (nodemap.hasOwnProperty(j)) {\n",
|
| 423 |
+
" attrs.push(nodemap[j])\n",
|
| 424 |
+
" }\n",
|
| 425 |
+
" }\n",
|
| 426 |
+
" attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n",
|
| 427 |
+
" newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n",
|
| 428 |
+
" oldScript.parentNode.replaceChild(newScript, oldScript);\n",
|
| 429 |
+
" });\n",
|
| 430 |
+
" if (JS_MIME_TYPE in output.data) {\n",
|
| 431 |
+
" toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n",
|
| 432 |
+
" }\n",
|
| 433 |
+
" output_area._hv_plot_id = id;\n",
|
| 434 |
+
" if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n",
|
| 435 |
+
" window.PyViz.plot_index[id] = Bokeh.index[id];\n",
|
| 436 |
+
" } else {\n",
|
| 437 |
+
" window.PyViz.plot_index[id] = null;\n",
|
| 438 |
+
" }\n",
|
| 439 |
+
" } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
|
| 440 |
+
" var bk_div = document.createElement(\"div\");\n",
|
| 441 |
+
" bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
|
| 442 |
+
" var script_attrs = bk_div.children[0].attributes;\n",
|
| 443 |
+
" for (var i = 0; i < script_attrs.length; i++) {\n",
|
| 444 |
+
" toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
|
| 445 |
+
" }\n",
|
| 446 |
+
" // store reference to server id on output_area\n",
|
| 447 |
+
" output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
|
| 448 |
+
" }\n",
|
| 449 |
+
"}\n",
|
| 450 |
+
"\n",
|
| 451 |
+
"/**\n",
|
| 452 |
+
" * Handle when an output is cleared or removed\n",
|
| 453 |
+
" */\n",
|
| 454 |
+
"function handle_clear_output(event, handle) {\n",
|
| 455 |
+
" var id = handle.cell.output_area._hv_plot_id;\n",
|
| 456 |
+
" var server_id = handle.cell.output_area._bokeh_server_id;\n",
|
| 457 |
+
" if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n",
|
| 458 |
+
" var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n",
|
| 459 |
+
" if (server_id !== null) {\n",
|
| 460 |
+
" comm.send({event_type: 'server_delete', 'id': server_id});\n",
|
| 461 |
+
" return;\n",
|
| 462 |
+
" } else if (comm !== null) {\n",
|
| 463 |
+
" comm.send({event_type: 'delete', 'id': id});\n",
|
| 464 |
+
" }\n",
|
| 465 |
+
" delete PyViz.plot_index[id];\n",
|
| 466 |
+
" if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n",
|
| 467 |
+
" var doc = window.Bokeh.index[id].model.document\n",
|
| 468 |
+
" doc.clear();\n",
|
| 469 |
+
" const i = window.Bokeh.documents.indexOf(doc);\n",
|
| 470 |
+
" if (i > -1) {\n",
|
| 471 |
+
" window.Bokeh.documents.splice(i, 1);\n",
|
| 472 |
+
" }\n",
|
| 473 |
+
" }\n",
|
| 474 |
+
"}\n",
|
| 475 |
+
"\n",
|
| 476 |
+
"/**\n",
|
| 477 |
+
" * Handle kernel restart event\n",
|
| 478 |
+
" */\n",
|
| 479 |
+
"function handle_kernel_cleanup(event, handle) {\n",
|
| 480 |
+
" delete PyViz.comms[\"hv-extension-comm\"];\n",
|
| 481 |
+
" window.PyViz.plot_index = {}\n",
|
| 482 |
+
"}\n",
|
| 483 |
+
"\n",
|
| 484 |
+
"/**\n",
|
| 485 |
+
" * Handle update_display_data messages\n",
|
| 486 |
+
" */\n",
|
| 487 |
+
"function handle_update_output(event, handle) {\n",
|
| 488 |
+
" handle_clear_output(event, {cell: {output_area: handle.output_area}})\n",
|
| 489 |
+
" handle_add_output(event, handle)\n",
|
| 490 |
+
"}\n",
|
| 491 |
+
"\n",
|
| 492 |
+
"function register_renderer(events, OutputArea) {\n",
|
| 493 |
+
" function append_mime(data, metadata, element) {\n",
|
| 494 |
+
" // create a DOM node to render to\n",
|
| 495 |
+
" var toinsert = this.create_output_subarea(\n",
|
| 496 |
+
" metadata,\n",
|
| 497 |
+
" CLASS_NAME,\n",
|
| 498 |
+
" EXEC_MIME_TYPE\n",
|
| 499 |
+
" );\n",
|
| 500 |
+
" this.keyboard_manager.register_events(toinsert);\n",
|
| 501 |
+
" // Render to node\n",
|
| 502 |
+
" var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
|
| 503 |
+
" render(props, toinsert[0]);\n",
|
| 504 |
+
" element.append(toinsert);\n",
|
| 505 |
+
" return toinsert\n",
|
| 506 |
+
" }\n",
|
| 507 |
+
"\n",
|
| 508 |
+
" events.on('output_added.OutputArea', handle_add_output);\n",
|
| 509 |
+
" events.on('output_updated.OutputArea', handle_update_output);\n",
|
| 510 |
+
" events.on('clear_output.CodeCell', handle_clear_output);\n",
|
| 511 |
+
" events.on('delete.Cell', handle_clear_output);\n",
|
| 512 |
+
" events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n",
|
| 513 |
+
"\n",
|
| 514 |
+
" OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
|
| 515 |
+
" safe: true,\n",
|
| 516 |
+
" index: 0\n",
|
| 517 |
+
" });\n",
|
| 518 |
+
"}\n",
|
| 519 |
+
"\n",
|
| 520 |
+
"if (window.Jupyter !== undefined) {\n",
|
| 521 |
+
" try {\n",
|
| 522 |
+
" var events = require('base/js/events');\n",
|
| 523 |
+
" var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
|
| 524 |
+
" if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
|
| 525 |
+
" register_renderer(events, OutputArea);\n",
|
| 526 |
+
" }\n",
|
| 527 |
+
" } catch(err) {\n",
|
| 528 |
+
" }\n",
|
| 529 |
+
"}\n"
|
| 530 |
+
],
|
| 531 |
+
"application/vnd.holoviews_load.v0+json": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n console.log(message)\n var content = {data: message.data, comm_id};\n var buffers = []\n for (var buffer of message.buffers || []) {\n buffers.push(new DataView(buffer))\n }\n var metadata = message.metadata || {};\n var msg = {content, buffers, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n })\n }\n }\n\n JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n if (comm_id in window.PyViz.comms) {\n return window.PyViz.comms[comm_id];\n } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n if (msg_handler) {\n comm.on_msg(msg_handler);\n }\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n comm.open();\n if (msg_handler) {\n comm.onMsg = msg_handler;\n }\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n var comm_promise = google.colab.kernel.comms.open(comm_id)\n comm_promise.then((comm) => {\n window.PyViz.comms[comm_id] = comm;\n if (msg_handler) {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n var content = {data: message.data};\n var metadata = message.metadata || {comm_id};\n var msg = {content, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n }\n })\n var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n return comm_promise.then((comm) => {\n comm.send(data, metadata, buffers, disposeOnDone);\n });\n };\n var comm = {\n send: sendClosure\n };\n }\n window.PyViz.comms[comm_id] = comm;\n return comm;\n }\n window.PyViz.comm_manager = new JupyterCommManager();\n \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n var div = document.createElement(\"div\");\n var script = document.createElement(\"script\");\n node.appendChild(div);\n node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n var output_area = handle.output_area;\n var output = handle.output;\n if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n return\n }\n var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n if (id !== undefined) {\n var nchildren = toinsert.length;\n var html_node = toinsert[nchildren-1].children[0];\n html_node.innerHTML = output.data[HTML_MIME_TYPE];\n var scripts = [];\n var nodelist = html_node.querySelectorAll(\"script\");\n for (var i in nodelist) {\n if (nodelist.hasOwnProperty(i)) {\n scripts.push(nodelist[i])\n }\n }\n\n scripts.forEach( function (oldScript) {\n var newScript = document.createElement(\"script\");\n var attrs = [];\n var nodemap = oldScript.attributes;\n for (var j in nodemap) {\n if (nodemap.hasOwnProperty(j)) {\n attrs.push(nodemap[j])\n }\n }\n attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n oldScript.parentNode.replaceChild(newScript, oldScript);\n });\n if (JS_MIME_TYPE in output.data) {\n toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n }\n output_area._hv_plot_id = id;\n if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n window.PyViz.plot_index[id] = Bokeh.index[id];\n } else {\n window.PyViz.plot_index[id] = null;\n }\n } else 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].childNodes[1].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/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n var id = handle.cell.output_area._hv_plot_id;\n var server_id = handle.cell.output_area._bokeh_server_id;\n if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n if (server_id !== null) {\n comm.send({event_type: 'server_delete', 'id': server_id});\n return;\n } else if (comm !== null) {\n comm.send({event_type: 'delete', 'id': id});\n }\n delete PyViz.plot_index[id];\n if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n var doc = window.Bokeh.index[id].model.document\n doc.clear();\n const i = window.Bokeh.documents.indexOf(doc);\n if (i > -1) {\n window.Bokeh.documents.splice(i, 1);\n }\n }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n delete PyViz.comms[\"hv-extension-comm\"];\n window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n handle_clear_output(event, {cell: {output_area: handle.output_area}})\n handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\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[0]);\n element.append(toinsert);\n return toinsert\n }\n\n events.on('output_added.OutputArea', handle_add_output);\n events.on('output_updated.OutputArea', handle_update_output);\n events.on('clear_output.CodeCell', handle_clear_output);\n events.on('delete.Cell', handle_clear_output);\n events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n safe: true,\n index: 0\n });\n}\n\nif (window.Jupyter !== undefined) {\n try {\n var events = require('base/js/events');\n var OutputArea = require('notebook/js/outputarea').OutputArea;\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n } catch(err) {\n }\n}\n"
|
| 532 |
+
},
|
| 533 |
+
"metadata": {},
|
| 534 |
+
"output_type": "display_data"
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"data": {
|
| 538 |
+
"application/vnd.holoviews_exec.v0+json": "",
|
| 539 |
+
"text/html": [
|
| 540 |
+
"<div id='90e4f3e0-e125-41cb-ba8a-7ff21fd13786'>\n",
|
| 541 |
+
" <div id=\"dd81d0ec-07ae-4824-a826-7aba00062948\" data-root-id=\"90e4f3e0-e125-41cb-ba8a-7ff21fd13786\" style=\"display: contents;\"></div>\n",
|
| 542 |
+
"</div>\n",
|
| 543 |
+
"<script type=\"application/javascript\">(function(root) {\n",
|
| 544 |
+
" var docs_json = {\"8bd6ac8d-ec6c-417b-b5b0-7cc4a4ef72ae\":{\"version\":\"3.7.3\",\"title\":\"Bokeh Application\",\"roots\":[{\"type\":\"object\",\"name\":\"panel.models.browser.BrowserInfo\",\"id\":\"90e4f3e0-e125-41cb-ba8a-7ff21fd13786\"},{\"type\":\"object\",\"name\":\"panel.models.comm_manager.CommManager\",\"id\":\"2ba4b174-9b74-414b-9e2e-1e76627e6d86\",\"attributes\":{\"plot_id\":\"90e4f3e0-e125-41cb-ba8a-7ff21fd13786\",\"comm_id\":\"5739849bf9814223a9916f00f3c48483\",\"client_comm_id\":\"fd7bf85861be431891500fe44f1b59ab\"}}],\"defs\":[{\"type\":\"model\",\"name\":\"ReactiveHTML1\"},{\"type\":\"model\",\"name\":\"FlexBox1\",\"properties\":[{\"name\":\"align_content\",\"kind\":\"Any\",\"default\":\"flex-start\"},{\"name\":\"align_items\",\"kind\":\"Any\",\"default\":\"flex-start\"},{\"name\":\"flex_direction\",\"kind\":\"Any\",\"default\":\"row\"},{\"name\":\"flex_wrap\",\"kind\":\"Any\",\"default\":\"wrap\"},{\"name\":\"gap\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"justify_content\",\"kind\":\"Any\",\"default\":\"flex-start\"}]},{\"type\":\"model\",\"name\":\"FloatPanel1\",\"properties\":[{\"name\":\"config\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"contained\",\"kind\":\"Any\",\"default\":true},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"right-top\"},{\"name\":\"offsetx\",\"kind\":\"Any\",\"default\":null},{\"name\":\"offsety\",\"kind\":\"Any\",\"default\":null},{\"name\":\"theme\",\"kind\":\"Any\",\"default\":\"primary\"},{\"name\":\"status\",\"kind\":\"Any\",\"default\":\"normalized\"}]},{\"type\":\"model\",\"name\":\"GridStack1\",\"properties\":[{\"name\":\"ncols\",\"kind\":\"Any\",\"default\":null},{\"name\":\"nrows\",\"kind\":\"Any\",\"default\":null},{\"name\":\"allow_resize\",\"kind\":\"Any\",\"default\":true},{\"name\":\"allow_drag\",\"kind\":\"Any\",\"default\":true},{\"name\":\"state\",\"kind\":\"Any\",\"default\":[]}]},{\"type\":\"model\",\"name\":\"drag1\",\"properties\":[{\"name\":\"slider_width\",\"kind\":\"Any\",\"default\":5},{\"name\":\"slider_color\",\"kind\":\"Any\",\"default\":\"black\"},{\"name\":\"value\",\"kind\":\"Any\",\"default\":50}]},{\"type\":\"model\",\"name\":\"click1\",\"properties\":[{\"name\":\"terminal_output\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"debug_name\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"clears\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"FastWrapper1\",\"properties\":[{\"name\":\"object\",\"kind\":\"Any\",\"default\":null},{\"name\":\"style\",\"kind\":\"Any\",\"default\":null}]},{\"type\":\"model\",\"name\":\"NotificationArea1\",\"properties\":[{\"name\":\"js_events\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"max_notifications\",\"kind\":\"Any\",\"default\":5},{\"name\":\"notifications\",\"kind\":\"Any\",\"default\":[]},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"bottom-right\"},{\"name\":\"_clear\",\"kind\":\"Any\",\"default\":0},{\"name\":\"types\",\"kind\":\"Any\",\"default\":[{\"type\":\"map\",\"entries\":[[\"type\",\"warning\"],[\"background\",\"#ffc107\"],[\"icon\",{\"type\":\"map\",\"entries\":[[\"className\",\"fas fa-exclamation-triangle\"],[\"tagName\",\"i\"],[\"color\",\"white\"]]}]]},{\"type\":\"map\",\"entries\":[[\"type\",\"info\"],[\"background\",\"#007bff\"],[\"icon\",{\"type\":\"map\",\"entries\":[[\"className\",\"fas fa-info-circle\"],[\"tagName\",\"i\"],[\"color\",\"white\"]]}]]}]}]},{\"type\":\"model\",\"name\":\"Notification\",\"properties\":[{\"name\":\"background\",\"kind\":\"Any\",\"default\":null},{\"name\":\"duration\",\"kind\":\"Any\",\"default\":3000},{\"name\":\"icon\",\"kind\":\"Any\",\"default\":null},{\"name\":\"message\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"notification_type\",\"kind\":\"Any\",\"default\":null},{\"name\":\"_rendered\",\"kind\":\"Any\",\"default\":false},{\"name\":\"_destroyed\",\"kind\":\"Any\",\"default\":false}]},{\"type\":\"model\",\"name\":\"TemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"BootstrapTemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"TemplateEditor1\",\"properties\":[{\"name\":\"layout\",\"kind\":\"Any\",\"default\":[]}]},{\"type\":\"model\",\"name\":\"MaterialTemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"ReactiveESM1\",\"properties\":[{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"JSComponent1\",\"properties\":[{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"ReactComponent1\",\"properties\":[{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"AnyWidgetComponent1\",\"properties\":[{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"request_value1\",\"properties\":[{\"name\":\"fill\",\"kind\":\"Any\",\"default\":\"none\"},{\"name\":\"_synced\",\"kind\":\"Any\",\"default\":null},{\"name\":\"_request_sync\",\"kind\":\"Any\",\"default\":0}]}]}};\n",
|
| 545 |
+
" var render_items = [{\"docid\":\"8bd6ac8d-ec6c-417b-b5b0-7cc4a4ef72ae\",\"roots\":{\"90e4f3e0-e125-41cb-ba8a-7ff21fd13786\":\"dd81d0ec-07ae-4824-a826-7aba00062948\"},\"root_ids\":[\"90e4f3e0-e125-41cb-ba8a-7ff21fd13786\"]}];\n",
|
| 546 |
+
" var docs = Object.values(docs_json)\n",
|
| 547 |
+
" if (!docs) {\n",
|
| 548 |
+
" return\n",
|
| 549 |
+
" }\n",
|
| 550 |
+
" const py_version = docs[0].version.replace('rc', '-rc.').replace('.dev', '-dev.')\n",
|
| 551 |
+
" async function embed_document(root) {\n",
|
| 552 |
+
" var Bokeh = get_bokeh(root)\n",
|
| 553 |
+
" await Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
|
| 554 |
+
" for (const render_item of render_items) {\n",
|
| 555 |
+
" for (const root_id of render_item.root_ids) {\n",
|
| 556 |
+
"\tconst id_el = document.getElementById(root_id)\n",
|
| 557 |
+
"\tif (id_el.children.length && id_el.children[0].hasAttribute('data-root-id')) {\n",
|
| 558 |
+
"\t const root_el = id_el.children[0]\n",
|
| 559 |
+
"\t root_el.id = root_el.id + '-rendered'\n",
|
| 560 |
+
"\t for (const child of root_el.children) {\n",
|
| 561 |
+
" // Ensure JupyterLab does not capture keyboard shortcuts\n",
|
| 562 |
+
" // see: https://jupyterlab.readthedocs.io/en/4.1.x/extension/notebook.html#keyboard-interaction-model\n",
|
| 563 |
+
"\t child.setAttribute('data-lm-suppress-shortcuts', 'true')\n",
|
| 564 |
+
"\t }\n",
|
| 565 |
+
"\t}\n",
|
| 566 |
+
" }\n",
|
| 567 |
+
" }\n",
|
| 568 |
+
" }\n",
|
| 569 |
+
" function get_bokeh(root) {\n",
|
| 570 |
+
" if (root.Bokeh === undefined) {\n",
|
| 571 |
+
" return null\n",
|
| 572 |
+
" } else if (root.Bokeh.version !== py_version) {\n",
|
| 573 |
+
" if (root.Bokeh.versions === undefined || !root.Bokeh.versions.has(py_version)) {\n",
|
| 574 |
+
"\treturn null\n",
|
| 575 |
+
" }\n",
|
| 576 |
+
" return root.Bokeh.versions.get(py_version);\n",
|
| 577 |
+
" } else if (root.Bokeh.version === py_version) {\n",
|
| 578 |
+
" return root.Bokeh\n",
|
| 579 |
+
" }\n",
|
| 580 |
+
" return null\n",
|
| 581 |
+
" }\n",
|
| 582 |
+
" function is_loaded(root) {\n",
|
| 583 |
+
" var Bokeh = get_bokeh(root)\n",
|
| 584 |
+
" return (Bokeh != null && Bokeh.Panel !== undefined)\n",
|
| 585 |
+
" }\n",
|
| 586 |
+
" if (is_loaded(root)) {\n",
|
| 587 |
+
" embed_document(root);\n",
|
| 588 |
+
" } else {\n",
|
| 589 |
+
" var attempts = 0;\n",
|
| 590 |
+
" var timer = setInterval(function(root) {\n",
|
| 591 |
+
" if (is_loaded(root)) {\n",
|
| 592 |
+
" clearInterval(timer);\n",
|
| 593 |
+
" embed_document(root);\n",
|
| 594 |
+
" } else if (document.readyState == \"complete\") {\n",
|
| 595 |
+
" attempts++;\n",
|
| 596 |
+
" if (attempts > 200) {\n",
|
| 597 |
+
" clearInterval(timer);\n",
|
| 598 |
+
"\t var Bokeh = get_bokeh(root)\n",
|
| 599 |
+
"\t if (Bokeh == null || Bokeh.Panel == null) {\n",
|
| 600 |
+
" console.warn(\"Panel: ERROR: Unable to run Panel code because Bokeh or Panel library is missing\");\n",
|
| 601 |
+
"\t } else {\n",
|
| 602 |
+
"\t console.warn(\"Panel: WARNING: Attempting to render but not all required libraries could be resolved.\")\n",
|
| 603 |
+
"\t embed_document(root)\n",
|
| 604 |
+
"\t }\n",
|
| 605 |
+
" }\n",
|
| 606 |
+
" }\n",
|
| 607 |
+
" }, 25, root)\n",
|
| 608 |
+
" }\n",
|
| 609 |
+
"})(window);</script>"
|
| 610 |
+
]
|
| 611 |
+
},
|
| 612 |
+
"metadata": {
|
| 613 |
+
"application/vnd.holoviews_exec.v0+json": {
|
| 614 |
+
"id": "90e4f3e0-e125-41cb-ba8a-7ff21fd13786"
|
| 615 |
+
}
|
| 616 |
+
},
|
| 617 |
+
"output_type": "display_data"
|
| 618 |
+
},
|
| 619 |
+
{
|
| 620 |
+
"data": {
|
| 621 |
+
"text/html": [
|
| 622 |
+
"<script type=\"esms-options\">{\"shimMode\": true}</script><style>*[data-root-id],\n",
|
| 623 |
+
"*[data-root-id] > * {\n",
|
| 624 |
+
" box-sizing: border-box;\n",
|
| 625 |
+
" font-family: var(--jp-ui-font-family);\n",
|
| 626 |
+
" font-size: var(--jp-ui-font-size1);\n",
|
| 627 |
+
" color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
|
| 628 |
+
"}\n",
|
| 629 |
+
"\n",
|
| 630 |
+
"/* Override VSCode background color */\n",
|
| 631 |
+
".cell-output-ipywidget-background:has(\n",
|
| 632 |
+
" > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
|
| 633 |
+
" ),\n",
|
| 634 |
+
".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
|
| 635 |
+
" background-color: transparent !important;\n",
|
| 636 |
+
"}\n",
|
| 637 |
+
"</style>"
|
| 638 |
+
]
|
| 639 |
+
},
|
| 640 |
+
"metadata": {},
|
| 641 |
+
"output_type": "display_data"
|
| 642 |
+
},
|
| 643 |
+
{
|
| 644 |
+
"data": {
|
| 645 |
+
"application/javascript": [
|
| 646 |
+
"(function(root) {\n",
|
| 647 |
+
" function now() {\n",
|
| 648 |
+
" return new Date();\n",
|
| 649 |
+
" }\n",
|
| 650 |
+
"\n",
|
| 651 |
+
" const force = false;\n",
|
| 652 |
+
" const py_version = '3.7.3'.replace('rc', '-rc.').replace('.dev', '-dev.');\n",
|
| 653 |
+
" const reloading = true;\n",
|
| 654 |
+
" const Bokeh = root.Bokeh;\n",
|
| 655 |
+
"\n",
|
| 656 |
+
" // Set a timeout for this load but only if we are not already initializing\n",
|
| 657 |
+
" if (typeof (root._bokeh_timeout) === \"undefined\" || (force || !root._bokeh_is_initializing)) {\n",
|
| 658 |
+
" root._bokeh_timeout = Date.now() + 5000;\n",
|
| 659 |
+
" root._bokeh_failed_load = false;\n",
|
| 660 |
+
" }\n",
|
| 661 |
+
"\n",
|
| 662 |
+
" function run_callbacks() {\n",
|
| 663 |
+
" try {\n",
|
| 664 |
+
" root._bokeh_onload_callbacks.forEach(function(callback) {\n",
|
| 665 |
+
" if (callback != null)\n",
|
| 666 |
+
" callback();\n",
|
| 667 |
+
" });\n",
|
| 668 |
+
" } finally {\n",
|
| 669 |
+
" delete root._bokeh_onload_callbacks;\n",
|
| 670 |
+
" }\n",
|
| 671 |
+
" console.debug(\"Bokeh: all callbacks have finished\");\n",
|
| 672 |
+
" }\n",
|
| 673 |
+
"\n",
|
| 674 |
+
" function load_libs(css_urls, js_urls, js_modules, js_exports, callback) {\n",
|
| 675 |
+
" if (css_urls == null) css_urls = [];\n",
|
| 676 |
+
" if (js_urls == null) js_urls = [];\n",
|
| 677 |
+
" if (js_modules == null) js_modules = [];\n",
|
| 678 |
+
" if (js_exports == null) js_exports = {};\n",
|
| 679 |
+
"\n",
|
| 680 |
+
" root._bokeh_onload_callbacks.push(callback);\n",
|
| 681 |
+
"\n",
|
| 682 |
+
" if (root._bokeh_is_loading > 0) {\n",
|
| 683 |
+
" // Don't load bokeh if it is still initializing\n",
|
| 684 |
+
" console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
|
| 685 |
+
" return null;\n",
|
| 686 |
+
" } else if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n",
|
| 687 |
+
" // There is nothing to load\n",
|
| 688 |
+
" run_callbacks();\n",
|
| 689 |
+
" return null;\n",
|
| 690 |
+
" }\n",
|
| 691 |
+
"\n",
|
| 692 |
+
" function on_load() {\n",
|
| 693 |
+
" root._bokeh_is_loading--;\n",
|
| 694 |
+
" if (root._bokeh_is_loading === 0) {\n",
|
| 695 |
+
" console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
|
| 696 |
+
" run_callbacks()\n",
|
| 697 |
+
" }\n",
|
| 698 |
+
" }\n",
|
| 699 |
+
" window._bokeh_on_load = on_load\n",
|
| 700 |
+
"\n",
|
| 701 |
+
" function on_error(e) {\n",
|
| 702 |
+
" const src_el = e.srcElement\n",
|
| 703 |
+
" console.error(\"failed to load \" + (src_el.href || src_el.src));\n",
|
| 704 |
+
" }\n",
|
| 705 |
+
"\n",
|
| 706 |
+
" const skip = [];\n",
|
| 707 |
+
" if (window.requirejs) {\n",
|
| 708 |
+
" window.requirejs.config({'packages': {}, 'paths': {}, 'shim': {}});\n",
|
| 709 |
+
" root._bokeh_is_loading = css_urls.length + 0;\n",
|
| 710 |
+
" } else {\n",
|
| 711 |
+
" root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n",
|
| 712 |
+
" }\n",
|
| 713 |
+
"\n",
|
| 714 |
+
" const existing_stylesheets = []\n",
|
| 715 |
+
" const links = document.getElementsByTagName('link')\n",
|
| 716 |
+
" for (let i = 0; i < links.length; i++) {\n",
|
| 717 |
+
" const link = links[i]\n",
|
| 718 |
+
" if (link.href != null) {\n",
|
| 719 |
+
" existing_stylesheets.push(link.href)\n",
|
| 720 |
+
" }\n",
|
| 721 |
+
" }\n",
|
| 722 |
+
" for (let i = 0; i < css_urls.length; i++) {\n",
|
| 723 |
+
" const url = css_urls[i];\n",
|
| 724 |
+
" const escaped = encodeURI(url)\n",
|
| 725 |
+
" if (existing_stylesheets.indexOf(escaped) !== -1) {\n",
|
| 726 |
+
" on_load()\n",
|
| 727 |
+
" continue;\n",
|
| 728 |
+
" }\n",
|
| 729 |
+
" const element = document.createElement(\"link\");\n",
|
| 730 |
+
" element.onload = on_load;\n",
|
| 731 |
+
" element.onerror = on_error;\n",
|
| 732 |
+
" element.rel = \"stylesheet\";\n",
|
| 733 |
+
" element.type = \"text/css\";\n",
|
| 734 |
+
" element.href = url;\n",
|
| 735 |
+
" console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
|
| 736 |
+
" document.body.appendChild(element);\n",
|
| 737 |
+
" } var existing_scripts = []\n",
|
| 738 |
+
" const scripts = document.getElementsByTagName('script')\n",
|
| 739 |
+
" for (let i = 0; i < scripts.length; i++) {\n",
|
| 740 |
+
" var script = scripts[i]\n",
|
| 741 |
+
" if (script.src != null) {\n",
|
| 742 |
+
" existing_scripts.push(script.src)\n",
|
| 743 |
+
" }\n",
|
| 744 |
+
" }\n",
|
| 745 |
+
" for (let i = 0; i < js_urls.length; i++) {\n",
|
| 746 |
+
" const url = js_urls[i];\n",
|
| 747 |
+
" const escaped = encodeURI(url)\n",
|
| 748 |
+
" if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n",
|
| 749 |
+
" if (!window.requirejs) {\n",
|
| 750 |
+
" on_load();\n",
|
| 751 |
+
" }\n",
|
| 752 |
+
" continue;\n",
|
| 753 |
+
" }\n",
|
| 754 |
+
" const element = document.createElement('script');\n",
|
| 755 |
+
" element.onload = on_load;\n",
|
| 756 |
+
" element.onerror = on_error;\n",
|
| 757 |
+
" element.async = false;\n",
|
| 758 |
+
" element.src = url;\n",
|
| 759 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 760 |
+
" document.head.appendChild(element);\n",
|
| 761 |
+
" }\n",
|
| 762 |
+
" for (let i = 0; i < js_modules.length; i++) {\n",
|
| 763 |
+
" const url = js_modules[i];\n",
|
| 764 |
+
" const escaped = encodeURI(url)\n",
|
| 765 |
+
" if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n",
|
| 766 |
+
" if (!window.requirejs) {\n",
|
| 767 |
+
" on_load();\n",
|
| 768 |
+
" }\n",
|
| 769 |
+
" continue;\n",
|
| 770 |
+
" }\n",
|
| 771 |
+
" var element = document.createElement('script');\n",
|
| 772 |
+
" element.onload = on_load;\n",
|
| 773 |
+
" element.onerror = on_error;\n",
|
| 774 |
+
" element.async = false;\n",
|
| 775 |
+
" element.src = url;\n",
|
| 776 |
+
" element.type = \"module\";\n",
|
| 777 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 778 |
+
" document.head.appendChild(element);\n",
|
| 779 |
+
" }\n",
|
| 780 |
+
" for (const name in js_exports) {\n",
|
| 781 |
+
" const url = js_exports[name];\n",
|
| 782 |
+
" const escaped = encodeURI(url)\n",
|
| 783 |
+
" if (skip.indexOf(escaped) >= 0 || root[name] != null) {\n",
|
| 784 |
+
" if (!window.requirejs) {\n",
|
| 785 |
+
" on_load();\n",
|
| 786 |
+
" }\n",
|
| 787 |
+
" continue;\n",
|
| 788 |
+
" }\n",
|
| 789 |
+
" var element = document.createElement('script');\n",
|
| 790 |
+
" element.onerror = on_error;\n",
|
| 791 |
+
" element.async = false;\n",
|
| 792 |
+
" element.type = \"module\";\n",
|
| 793 |
+
" console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
|
| 794 |
+
" element.textContent = `\n",
|
| 795 |
+
" import ${name} from \"${url}\"\n",
|
| 796 |
+
" window.${name} = ${name}\n",
|
| 797 |
+
" window._bokeh_on_load()\n",
|
| 798 |
+
" `\n",
|
| 799 |
+
" document.head.appendChild(element);\n",
|
| 800 |
+
" }\n",
|
| 801 |
+
" if (!js_urls.length && !js_modules.length) {\n",
|
| 802 |
+
" on_load()\n",
|
| 803 |
+
" }\n",
|
| 804 |
+
" };\n",
|
| 805 |
+
"\n",
|
| 806 |
+
" function inject_raw_css(css) {\n",
|
| 807 |
+
" const element = document.createElement(\"style\");\n",
|
| 808 |
+
" element.appendChild(document.createTextNode(css));\n",
|
| 809 |
+
" document.body.appendChild(element);\n",
|
| 810 |
+
" }\n",
|
| 811 |
+
"\n",
|
| 812 |
+
" const js_urls = [\"https://cdn.holoviz.org/panel/1.7.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\"];\n",
|
| 813 |
+
" const js_modules = [];\n",
|
| 814 |
+
" const js_exports = {};\n",
|
| 815 |
+
" const css_urls = [];\n",
|
| 816 |
+
" const inline_js = [ function(Bokeh) {\n",
|
| 817 |
+
" Bokeh.set_log_level(\"info\");\n",
|
| 818 |
+
" },\n",
|
| 819 |
+
"function(Bokeh) {} // ensure no trailing comma for IE\n",
|
| 820 |
+
" ];\n",
|
| 821 |
+
"\n",
|
| 822 |
+
" function run_inline_js() {\n",
|
| 823 |
+
" if ((root.Bokeh !== undefined) || (force === true)) {\n",
|
| 824 |
+
" for (let i = 0; i < inline_js.length; i++) {\n",
|
| 825 |
+
" try {\n",
|
| 826 |
+
" inline_js[i].call(root, root.Bokeh);\n",
|
| 827 |
+
" } catch(e) {\n",
|
| 828 |
+
" if (!reloading) {\n",
|
| 829 |
+
" throw e;\n",
|
| 830 |
+
" }\n",
|
| 831 |
+
" }\n",
|
| 832 |
+
" }\n",
|
| 833 |
+
" // Cache old bokeh versions\n",
|
| 834 |
+
" if (Bokeh != undefined && !reloading) {\n",
|
| 835 |
+
" var NewBokeh = root.Bokeh;\n",
|
| 836 |
+
" if (Bokeh.versions === undefined) {\n",
|
| 837 |
+
" Bokeh.versions = new Map();\n",
|
| 838 |
+
" }\n",
|
| 839 |
+
" if (NewBokeh.version !== Bokeh.version) {\n",
|
| 840 |
+
" Bokeh.versions.set(NewBokeh.version, NewBokeh)\n",
|
| 841 |
+
" }\n",
|
| 842 |
+
" root.Bokeh = Bokeh;\n",
|
| 843 |
+
" }\n",
|
| 844 |
+
" } else if (Date.now() < root._bokeh_timeout) {\n",
|
| 845 |
+
" setTimeout(run_inline_js, 100);\n",
|
| 846 |
+
" } else if (!root._bokeh_failed_load) {\n",
|
| 847 |
+
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
|
| 848 |
+
" root._bokeh_failed_load = true;\n",
|
| 849 |
+
" }\n",
|
| 850 |
+
" root._bokeh_is_initializing = false\n",
|
| 851 |
+
" }\n",
|
| 852 |
+
"\n",
|
| 853 |
+
" function load_or_wait() {\n",
|
| 854 |
+
" // Implement a backoff loop that tries to ensure we do not load multiple\n",
|
| 855 |
+
" // versions of Bokeh and its dependencies at the same time.\n",
|
| 856 |
+
" // In recent versions we use the root._bokeh_is_initializing flag\n",
|
| 857 |
+
" // to determine whether there is an ongoing attempt to initialize\n",
|
| 858 |
+
" // bokeh, however for backward compatibility we also try to ensure\n",
|
| 859 |
+
" // that we do not start loading a newer (Panel>=1.0 and Bokeh>3) version\n",
|
| 860 |
+
" // before older versions are fully initialized.\n",
|
| 861 |
+
" if (root._bokeh_is_initializing && Date.now() > root._bokeh_timeout) {\n",
|
| 862 |
+
" // If the timeout and bokeh was not successfully loaded we reset\n",
|
| 863 |
+
" // everything and try loading again\n",
|
| 864 |
+
" root._bokeh_timeout = Date.now() + 5000;\n",
|
| 865 |
+
" root._bokeh_is_initializing = false;\n",
|
| 866 |
+
" root._bokeh_onload_callbacks = undefined;\n",
|
| 867 |
+
" root._bokeh_is_loading = 0\n",
|
| 868 |
+
" console.log(\"Bokeh: BokehJS was loaded multiple times but one version failed to initialize.\");\n",
|
| 869 |
+
" load_or_wait();\n",
|
| 870 |
+
" } else if (root._bokeh_is_initializing || (typeof root._bokeh_is_initializing === \"undefined\" && root._bokeh_onload_callbacks !== undefined)) {\n",
|
| 871 |
+
" setTimeout(load_or_wait, 100);\n",
|
| 872 |
+
" } else {\n",
|
| 873 |
+
" root._bokeh_is_initializing = true\n",
|
| 874 |
+
" root._bokeh_onload_callbacks = []\n",
|
| 875 |
+
" const bokeh_loaded = root.Bokeh != null && (root.Bokeh.version === py_version || (root.Bokeh.versions !== undefined && root.Bokeh.versions.has(py_version)));\n",
|
| 876 |
+
" if (!reloading && !bokeh_loaded) {\n",
|
| 877 |
+
" if (root.Bokeh) {\n",
|
| 878 |
+
" root.Bokeh = undefined;\n",
|
| 879 |
+
" }\n",
|
| 880 |
+
" console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
|
| 881 |
+
" }\n",
|
| 882 |
+
" load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n",
|
| 883 |
+
" console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
|
| 884 |
+
" run_inline_js();\n",
|
| 885 |
+
" });\n",
|
| 886 |
+
" }\n",
|
| 887 |
+
" }\n",
|
| 888 |
+
" // Give older versions of the autoload script a head-start to ensure\n",
|
| 889 |
+
" // they initialize before we start loading newer version.\n",
|
| 890 |
+
" setTimeout(load_or_wait, 100)\n",
|
| 891 |
+
"}(window));"
|
| 892 |
+
],
|
| 893 |
+
"application/vnd.holoviews_load.v0+json": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = false;\n const py_version = '3.7.3'.replace('rc', '-rc.').replace('.dev', '-dev.');\n const reloading = true;\n const Bokeh = root.Bokeh;\n\n // Set a timeout for this load but only if we are not already initializing\n if (typeof (root._bokeh_timeout) === \"undefined\" || (force || !root._bokeh_is_initializing)) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\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, js_modules, js_exports, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\n if (js_exports == null) js_exports = {};\n\n root._bokeh_onload_callbacks.push(callback);\n\n if (root._bokeh_is_loading > 0) {\n // Don't load bokeh if it is still initializing\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n } else if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n // There is nothing to load\n run_callbacks();\n return null;\n }\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 window._bokeh_on_load = on_load\n\n function on_error(e) {\n const src_el = e.srcElement\n console.error(\"failed to load \" + (src_el.href || src_el.src));\n }\n\n const skip = [];\n if (window.requirejs) {\n window.requirejs.config({'packages': {}, 'paths': {}, 'shim': {}});\n root._bokeh_is_loading = css_urls.length + 0;\n } else {\n root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n }\n\n const existing_stylesheets = []\n const links = document.getElementsByTagName('link')\n for (let i = 0; i < links.length; i++) {\n const link = links[i]\n if (link.href != null) {\n existing_stylesheets.push(link.href)\n }\n }\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const escaped = encodeURI(url)\n if (existing_stylesheets.indexOf(escaped) !== -1) {\n on_load()\n continue;\n }\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 } var existing_scripts = []\n const scripts = document.getElementsByTagName('script')\n for (let i = 0; i < scripts.length; i++) {\n var script = scripts[i]\n if (script.src != null) {\n existing_scripts.push(script.src)\n }\n }\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n const 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 for (let i = 0; i < js_modules.length; i++) {\n const url = js_modules[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\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 element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (const name in js_exports) {\n const url = js_exports[name];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) >= 0 || root[name] != null) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n var element = document.createElement('script');\n element.onerror = on_error;\n element.async = false;\n element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n element.textContent = `\n import ${name} from \"${url}\"\n window.${name} = ${name}\n window._bokeh_on_load()\n `\n document.head.appendChild(element);\n }\n if (!js_urls.length && !js_modules.length) {\n on_load()\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 const js_urls = [\"https://cdn.holoviz.org/panel/1.7.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\"];\n const js_modules = [];\n const js_exports = {};\n const css_urls = [];\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {} // ensure no trailing comma for IE\n ];\n\n function run_inline_js() {\n if ((root.Bokeh !== undefined) || (force === true)) {\n for (let i = 0; i < inline_js.length; i++) {\n try {\n inline_js[i].call(root, root.Bokeh);\n } catch(e) {\n if (!reloading) {\n throw e;\n }\n }\n }\n // Cache old bokeh versions\n if (Bokeh != undefined && !reloading) {\n var NewBokeh = root.Bokeh;\n if (Bokeh.versions === undefined) {\n Bokeh.versions = new Map();\n }\n if (NewBokeh.version !== Bokeh.version) {\n Bokeh.versions.set(NewBokeh.version, NewBokeh)\n }\n root.Bokeh = Bokeh;\n }\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 }\n root._bokeh_is_initializing = false\n }\n\n function load_or_wait() {\n // Implement a backoff loop that tries to ensure we do not load multiple\n // versions of Bokeh and its dependencies at the same time.\n // In recent versions we use the root._bokeh_is_initializing flag\n // to determine whether there is an ongoing attempt to initialize\n // bokeh, however for backward compatibility we also try to ensure\n // that we do not start loading a newer (Panel>=1.0 and Bokeh>3) version\n // before older versions are fully initialized.\n if (root._bokeh_is_initializing && Date.now() > root._bokeh_timeout) {\n // If the timeout and bokeh was not successfully loaded we reset\n // everything and try loading again\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_is_initializing = false;\n root._bokeh_onload_callbacks = undefined;\n root._bokeh_is_loading = 0\n console.log(\"Bokeh: BokehJS was loaded multiple times but one version failed to initialize.\");\n load_or_wait();\n } else if (root._bokeh_is_initializing || (typeof root._bokeh_is_initializing === \"undefined\" && root._bokeh_onload_callbacks !== undefined)) {\n setTimeout(load_or_wait, 100);\n } else {\n root._bokeh_is_initializing = true\n root._bokeh_onload_callbacks = []\n const bokeh_loaded = root.Bokeh != null && (root.Bokeh.version === py_version || (root.Bokeh.versions !== undefined && root.Bokeh.versions.has(py_version)));\n if (!reloading && !bokeh_loaded) {\n if (root.Bokeh) {\n root.Bokeh = undefined;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n }\n load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n }\n // Give older versions of the autoload script a head-start to ensure\n // they initialize before we start loading newer version.\n setTimeout(load_or_wait, 100)\n}(window));"
|
| 894 |
+
},
|
| 895 |
+
"metadata": {},
|
| 896 |
+
"output_type": "display_data"
|
| 897 |
+
},
|
| 898 |
+
{
|
| 899 |
+
"data": {
|
| 900 |
+
"application/javascript": [
|
| 901 |
+
"\n",
|
| 902 |
+
"if ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n",
|
| 903 |
+
" window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n",
|
| 904 |
+
"}\n",
|
| 905 |
+
"\n",
|
| 906 |
+
"\n",
|
| 907 |
+
" function JupyterCommManager() {\n",
|
| 908 |
+
" }\n",
|
| 909 |
+
"\n",
|
| 910 |
+
" JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n",
|
| 911 |
+
" if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n",
|
| 912 |
+
" var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n",
|
| 913 |
+
" comm_manager.register_target(comm_id, function(comm) {\n",
|
| 914 |
+
" comm.on_msg(msg_handler);\n",
|
| 915 |
+
" });\n",
|
| 916 |
+
" } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n",
|
| 917 |
+
" window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n",
|
| 918 |
+
" comm.onMsg = msg_handler;\n",
|
| 919 |
+
" });\n",
|
| 920 |
+
" } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n",
|
| 921 |
+
" google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n",
|
| 922 |
+
" var messages = comm.messages[Symbol.asyncIterator]();\n",
|
| 923 |
+
" function processIteratorResult(result) {\n",
|
| 924 |
+
" var message = result.value;\n",
|
| 925 |
+
" console.log(message)\n",
|
| 926 |
+
" var content = {data: message.data, comm_id};\n",
|
| 927 |
+
" var buffers = []\n",
|
| 928 |
+
" for (var buffer of message.buffers || []) {\n",
|
| 929 |
+
" buffers.push(new DataView(buffer))\n",
|
| 930 |
+
" }\n",
|
| 931 |
+
" var metadata = message.metadata || {};\n",
|
| 932 |
+
" var msg = {content, buffers, metadata}\n",
|
| 933 |
+
" msg_handler(msg);\n",
|
| 934 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 935 |
+
" }\n",
|
| 936 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 937 |
+
" })\n",
|
| 938 |
+
" }\n",
|
| 939 |
+
" }\n",
|
| 940 |
+
"\n",
|
| 941 |
+
" JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n",
|
| 942 |
+
" if (comm_id in window.PyViz.comms) {\n",
|
| 943 |
+
" return window.PyViz.comms[comm_id];\n",
|
| 944 |
+
" } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n",
|
| 945 |
+
" var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n",
|
| 946 |
+
" var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n",
|
| 947 |
+
" if (msg_handler) {\n",
|
| 948 |
+
" comm.on_msg(msg_handler);\n",
|
| 949 |
+
" }\n",
|
| 950 |
+
" } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n",
|
| 951 |
+
" var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n",
|
| 952 |
+
" comm.open();\n",
|
| 953 |
+
" if (msg_handler) {\n",
|
| 954 |
+
" comm.onMsg = msg_handler;\n",
|
| 955 |
+
" }\n",
|
| 956 |
+
" } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n",
|
| 957 |
+
" var comm_promise = google.colab.kernel.comms.open(comm_id)\n",
|
| 958 |
+
" comm_promise.then((comm) => {\n",
|
| 959 |
+
" window.PyViz.comms[comm_id] = comm;\n",
|
| 960 |
+
" if (msg_handler) {\n",
|
| 961 |
+
" var messages = comm.messages[Symbol.asyncIterator]();\n",
|
| 962 |
+
" function processIteratorResult(result) {\n",
|
| 963 |
+
" var message = result.value;\n",
|
| 964 |
+
" var content = {data: message.data};\n",
|
| 965 |
+
" var metadata = message.metadata || {comm_id};\n",
|
| 966 |
+
" var msg = {content, metadata}\n",
|
| 967 |
+
" msg_handler(msg);\n",
|
| 968 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 969 |
+
" }\n",
|
| 970 |
+
" return messages.next().then(processIteratorResult);\n",
|
| 971 |
+
" }\n",
|
| 972 |
+
" })\n",
|
| 973 |
+
" var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n",
|
| 974 |
+
" return comm_promise.then((comm) => {\n",
|
| 975 |
+
" comm.send(data, metadata, buffers, disposeOnDone);\n",
|
| 976 |
+
" });\n",
|
| 977 |
+
" };\n",
|
| 978 |
+
" var comm = {\n",
|
| 979 |
+
" send: sendClosure\n",
|
| 980 |
+
" };\n",
|
| 981 |
+
" }\n",
|
| 982 |
+
" window.PyViz.comms[comm_id] = comm;\n",
|
| 983 |
+
" return comm;\n",
|
| 984 |
+
" }\n",
|
| 985 |
+
" window.PyViz.comm_manager = new JupyterCommManager();\n",
|
| 986 |
+
" \n",
|
| 987 |
+
"\n",
|
| 988 |
+
"\n",
|
| 989 |
+
"var JS_MIME_TYPE = 'application/javascript';\n",
|
| 990 |
+
"var HTML_MIME_TYPE = 'text/html';\n",
|
| 991 |
+
"var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n",
|
| 992 |
+
"var CLASS_NAME = 'output';\n",
|
| 993 |
+
"\n",
|
| 994 |
+
"/**\n",
|
| 995 |
+
" * Render data to the DOM node\n",
|
| 996 |
+
" */\n",
|
| 997 |
+
"function render(props, node) {\n",
|
| 998 |
+
" var div = document.createElement(\"div\");\n",
|
| 999 |
+
" var script = document.createElement(\"script\");\n",
|
| 1000 |
+
" node.appendChild(div);\n",
|
| 1001 |
+
" node.appendChild(script);\n",
|
| 1002 |
+
"}\n",
|
| 1003 |
+
"\n",
|
| 1004 |
+
"/**\n",
|
| 1005 |
+
" * Handle when a new output is added\n",
|
| 1006 |
+
" */\n",
|
| 1007 |
+
"function handle_add_output(event, handle) {\n",
|
| 1008 |
+
" var output_area = handle.output_area;\n",
|
| 1009 |
+
" var output = handle.output;\n",
|
| 1010 |
+
" if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
|
| 1011 |
+
" return\n",
|
| 1012 |
+
" }\n",
|
| 1013 |
+
" var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
|
| 1014 |
+
" var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
|
| 1015 |
+
" if (id !== undefined) {\n",
|
| 1016 |
+
" var nchildren = toinsert.length;\n",
|
| 1017 |
+
" var html_node = toinsert[nchildren-1].children[0];\n",
|
| 1018 |
+
" html_node.innerHTML = output.data[HTML_MIME_TYPE];\n",
|
| 1019 |
+
" var scripts = [];\n",
|
| 1020 |
+
" var nodelist = html_node.querySelectorAll(\"script\");\n",
|
| 1021 |
+
" for (var i in nodelist) {\n",
|
| 1022 |
+
" if (nodelist.hasOwnProperty(i)) {\n",
|
| 1023 |
+
" scripts.push(nodelist[i])\n",
|
| 1024 |
+
" }\n",
|
| 1025 |
+
" }\n",
|
| 1026 |
+
"\n",
|
| 1027 |
+
" scripts.forEach( function (oldScript) {\n",
|
| 1028 |
+
" var newScript = document.createElement(\"script\");\n",
|
| 1029 |
+
" var attrs = [];\n",
|
| 1030 |
+
" var nodemap = oldScript.attributes;\n",
|
| 1031 |
+
" for (var j in nodemap) {\n",
|
| 1032 |
+
" if (nodemap.hasOwnProperty(j)) {\n",
|
| 1033 |
+
" attrs.push(nodemap[j])\n",
|
| 1034 |
+
" }\n",
|
| 1035 |
+
" }\n",
|
| 1036 |
+
" attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n",
|
| 1037 |
+
" newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n",
|
| 1038 |
+
" oldScript.parentNode.replaceChild(newScript, oldScript);\n",
|
| 1039 |
+
" });\n",
|
| 1040 |
+
" if (JS_MIME_TYPE in output.data) {\n",
|
| 1041 |
+
" toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n",
|
| 1042 |
+
" }\n",
|
| 1043 |
+
" output_area._hv_plot_id = id;\n",
|
| 1044 |
+
" if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n",
|
| 1045 |
+
" window.PyViz.plot_index[id] = Bokeh.index[id];\n",
|
| 1046 |
+
" } else {\n",
|
| 1047 |
+
" window.PyViz.plot_index[id] = null;\n",
|
| 1048 |
+
" }\n",
|
| 1049 |
+
" } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
|
| 1050 |
+
" var bk_div = document.createElement(\"div\");\n",
|
| 1051 |
+
" bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
|
| 1052 |
+
" var script_attrs = bk_div.children[0].attributes;\n",
|
| 1053 |
+
" for (var i = 0; i < script_attrs.length; i++) {\n",
|
| 1054 |
+
" toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
|
| 1055 |
+
" }\n",
|
| 1056 |
+
" // store reference to server id on output_area\n",
|
| 1057 |
+
" output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
|
| 1058 |
+
" }\n",
|
| 1059 |
+
"}\n",
|
| 1060 |
+
"\n",
|
| 1061 |
+
"/**\n",
|
| 1062 |
+
" * Handle when an output is cleared or removed\n",
|
| 1063 |
+
" */\n",
|
| 1064 |
+
"function handle_clear_output(event, handle) {\n",
|
| 1065 |
+
" var id = handle.cell.output_area._hv_plot_id;\n",
|
| 1066 |
+
" var server_id = handle.cell.output_area._bokeh_server_id;\n",
|
| 1067 |
+
" if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n",
|
| 1068 |
+
" var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n",
|
| 1069 |
+
" if (server_id !== null) {\n",
|
| 1070 |
+
" comm.send({event_type: 'server_delete', 'id': server_id});\n",
|
| 1071 |
+
" return;\n",
|
| 1072 |
+
" } else if (comm !== null) {\n",
|
| 1073 |
+
" comm.send({event_type: 'delete', 'id': id});\n",
|
| 1074 |
+
" }\n",
|
| 1075 |
+
" delete PyViz.plot_index[id];\n",
|
| 1076 |
+
" if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n",
|
| 1077 |
+
" var doc = window.Bokeh.index[id].model.document\n",
|
| 1078 |
+
" doc.clear();\n",
|
| 1079 |
+
" const i = window.Bokeh.documents.indexOf(doc);\n",
|
| 1080 |
+
" if (i > -1) {\n",
|
| 1081 |
+
" window.Bokeh.documents.splice(i, 1);\n",
|
| 1082 |
+
" }\n",
|
| 1083 |
+
" }\n",
|
| 1084 |
+
"}\n",
|
| 1085 |
+
"\n",
|
| 1086 |
+
"/**\n",
|
| 1087 |
+
" * Handle kernel restart event\n",
|
| 1088 |
+
" */\n",
|
| 1089 |
+
"function handle_kernel_cleanup(event, handle) {\n",
|
| 1090 |
+
" delete PyViz.comms[\"hv-extension-comm\"];\n",
|
| 1091 |
+
" window.PyViz.plot_index = {}\n",
|
| 1092 |
+
"}\n",
|
| 1093 |
+
"\n",
|
| 1094 |
+
"/**\n",
|
| 1095 |
+
" * Handle update_display_data messages\n",
|
| 1096 |
+
" */\n",
|
| 1097 |
+
"function handle_update_output(event, handle) {\n",
|
| 1098 |
+
" handle_clear_output(event, {cell: {output_area: handle.output_area}})\n",
|
| 1099 |
+
" handle_add_output(event, handle)\n",
|
| 1100 |
+
"}\n",
|
| 1101 |
+
"\n",
|
| 1102 |
+
"function register_renderer(events, OutputArea) {\n",
|
| 1103 |
+
" function append_mime(data, metadata, element) {\n",
|
| 1104 |
+
" // create a DOM node to render to\n",
|
| 1105 |
+
" var toinsert = this.create_output_subarea(\n",
|
| 1106 |
+
" metadata,\n",
|
| 1107 |
+
" CLASS_NAME,\n",
|
| 1108 |
+
" EXEC_MIME_TYPE\n",
|
| 1109 |
+
" );\n",
|
| 1110 |
+
" this.keyboard_manager.register_events(toinsert);\n",
|
| 1111 |
+
" // Render to node\n",
|
| 1112 |
+
" var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
|
| 1113 |
+
" render(props, toinsert[0]);\n",
|
| 1114 |
+
" element.append(toinsert);\n",
|
| 1115 |
+
" return toinsert\n",
|
| 1116 |
+
" }\n",
|
| 1117 |
+
"\n",
|
| 1118 |
+
" events.on('output_added.OutputArea', handle_add_output);\n",
|
| 1119 |
+
" events.on('output_updated.OutputArea', handle_update_output);\n",
|
| 1120 |
+
" events.on('clear_output.CodeCell', handle_clear_output);\n",
|
| 1121 |
+
" events.on('delete.Cell', handle_clear_output);\n",
|
| 1122 |
+
" events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n",
|
| 1123 |
+
"\n",
|
| 1124 |
+
" OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
|
| 1125 |
+
" safe: true,\n",
|
| 1126 |
+
" index: 0\n",
|
| 1127 |
+
" });\n",
|
| 1128 |
+
"}\n",
|
| 1129 |
+
"\n",
|
| 1130 |
+
"if (window.Jupyter !== undefined) {\n",
|
| 1131 |
+
" try {\n",
|
| 1132 |
+
" var events = require('base/js/events');\n",
|
| 1133 |
+
" var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
|
| 1134 |
+
" if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
|
| 1135 |
+
" register_renderer(events, OutputArea);\n",
|
| 1136 |
+
" }\n",
|
| 1137 |
+
" } catch(err) {\n",
|
| 1138 |
+
" }\n",
|
| 1139 |
+
"}\n"
|
| 1140 |
+
],
|
| 1141 |
+
"application/vnd.holoviews_load.v0+json": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n console.log(message)\n var content = {data: message.data, comm_id};\n var buffers = []\n for (var buffer of message.buffers || []) {\n buffers.push(new DataView(buffer))\n }\n var metadata = message.metadata || {};\n var msg = {content, buffers, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n })\n }\n }\n\n JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n if (comm_id in window.PyViz.comms) {\n return window.PyViz.comms[comm_id];\n } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n if (msg_handler) {\n comm.on_msg(msg_handler);\n }\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n comm.open();\n if (msg_handler) {\n comm.onMsg = msg_handler;\n }\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n var comm_promise = google.colab.kernel.comms.open(comm_id)\n comm_promise.then((comm) => {\n window.PyViz.comms[comm_id] = comm;\n if (msg_handler) {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n var content = {data: message.data};\n var metadata = message.metadata || {comm_id};\n var msg = {content, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n }\n })\n var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n return comm_promise.then((comm) => {\n comm.send(data, metadata, buffers, disposeOnDone);\n });\n };\n var comm = {\n send: sendClosure\n };\n }\n window.PyViz.comms[comm_id] = comm;\n return comm;\n }\n window.PyViz.comm_manager = new JupyterCommManager();\n \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n var div = document.createElement(\"div\");\n var script = document.createElement(\"script\");\n node.appendChild(div);\n node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n var output_area = handle.output_area;\n var output = handle.output;\n if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n return\n }\n var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n if (id !== undefined) {\n var nchildren = toinsert.length;\n var html_node = toinsert[nchildren-1].children[0];\n html_node.innerHTML = output.data[HTML_MIME_TYPE];\n var scripts = [];\n var nodelist = html_node.querySelectorAll(\"script\");\n for (var i in nodelist) {\n if (nodelist.hasOwnProperty(i)) {\n scripts.push(nodelist[i])\n }\n }\n\n scripts.forEach( function (oldScript) {\n var newScript = document.createElement(\"script\");\n var attrs = [];\n var nodemap = oldScript.attributes;\n for (var j in nodemap) {\n if (nodemap.hasOwnProperty(j)) {\n attrs.push(nodemap[j])\n }\n }\n attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n oldScript.parentNode.replaceChild(newScript, oldScript);\n });\n if (JS_MIME_TYPE in output.data) {\n toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n }\n output_area._hv_plot_id = id;\n if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n window.PyViz.plot_index[id] = Bokeh.index[id];\n } else {\n window.PyViz.plot_index[id] = null;\n }\n } else 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].childNodes[1].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/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n var id = handle.cell.output_area._hv_plot_id;\n var server_id = handle.cell.output_area._bokeh_server_id;\n if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n if (server_id !== null) {\n comm.send({event_type: 'server_delete', 'id': server_id});\n return;\n } else if (comm !== null) {\n comm.send({event_type: 'delete', 'id': id});\n }\n delete PyViz.plot_index[id];\n if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n var doc = window.Bokeh.index[id].model.document\n doc.clear();\n const i = window.Bokeh.documents.indexOf(doc);\n if (i > -1) {\n window.Bokeh.documents.splice(i, 1);\n }\n }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n delete PyViz.comms[\"hv-extension-comm\"];\n window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n handle_clear_output(event, {cell: {output_area: handle.output_area}})\n handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\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[0]);\n element.append(toinsert);\n return toinsert\n }\n\n events.on('output_added.OutputArea', handle_add_output);\n events.on('output_updated.OutputArea', handle_update_output);\n events.on('clear_output.CodeCell', handle_clear_output);\n events.on('delete.Cell', handle_clear_output);\n events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n safe: true,\n index: 0\n });\n}\n\nif (window.Jupyter !== undefined) {\n try {\n var events = require('base/js/events');\n var OutputArea = require('notebook/js/outputarea').OutputArea;\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n } catch(err) {\n }\n}\n"
|
| 1142 |
+
},
|
| 1143 |
+
"metadata": {},
|
| 1144 |
+
"output_type": "display_data"
|
| 1145 |
+
},
|
| 1146 |
+
{
|
| 1147 |
+
"name": "stdout",
|
| 1148 |
+
"output_type": "stream",
|
| 1149 |
+
"text": [
|
| 1150 |
+
"Launching server at http://localhost:54272\n"
|
| 1151 |
+
]
|
| 1152 |
+
},
|
| 1153 |
+
{
|
| 1154 |
+
"data": {
|
| 1155 |
+
"text/plain": [
|
| 1156 |
+
"<panel.io.server.Server at 0x1c8971fb5f0>"
|
| 1157 |
+
]
|
| 1158 |
+
},
|
| 1159 |
+
"execution_count": 1,
|
| 1160 |
+
"metadata": {},
|
| 1161 |
+
"output_type": "execute_result"
|
| 1162 |
+
}
|
| 1163 |
+
],
|
| 1164 |
+
"source": [
|
| 1165 |
+
"import matplotlib.pyplot as plt\n",
|
| 1166 |
+
"import rioxarray\n",
|
| 1167 |
+
"import hvplot.xarray\n",
|
| 1168 |
+
"import panel as pn\n",
|
| 1169 |
+
"\n",
|
| 1170 |
+
"# define input\n",
|
| 1171 |
+
"FOLDER_AN_SURFACE = f\"/Users/Adian/MLFinalProject/antarctica_bedmachine_v3_7/\"\n",
|
| 1172 |
+
"file_an_bedmac = f\"{FOLDER_AN_SURFACE}BedMachineAntarctica-v3.nc\"\n",
|
| 1173 |
+
"\n",
|
| 1174 |
+
"# use rioxarray to open the netcdf file. rioxarray is one option. Others possible.\n",
|
| 1175 |
+
"an_bedmac = rioxarray.open_rasterio(file_an_bedmac)\n",
|
| 1176 |
+
"\n",
|
| 1177 |
+
"# print content. Many data variables. Among those are ice 'surface' and 'surface'.\n",
|
| 1178 |
+
"# see https://nsidc.org/sites/default/files/documents/user-guide/nsidc-0756-v003-userguide.pdf for more\n",
|
| 1179 |
+
"#print(an_bedmac)\n",
|
| 1180 |
+
"\n",
|
| 1181 |
+
"# the ice surface map nodata value is set as 9.96921e+36\n",
|
| 1182 |
+
"nodata_ith = an_bedmac['surface'].rio.nodata\n",
|
| 1183 |
+
"# print(nodata_ith)\n",
|
| 1184 |
+
"\n",
|
| 1185 |
+
"# you may want to replace those values with nan not to carry around this value.\n",
|
| 1186 |
+
"an_bedmac['surface'] = an_bedmac['surface'].where(an_bedmac['surface'] != 0.0)\n",
|
| 1187 |
+
"\n",
|
| 1188 |
+
"# Plot: strategy 1 (easier but worse)\n",
|
| 1189 |
+
"# matplotlib (no interactivity, static image, loads the entire array into memory)\n",
|
| 1190 |
+
"# an_bedmac['surface'].plot()\n",
|
| 1191 |
+
"# plt.show()\n",
|
| 1192 |
+
"\n",
|
| 1193 |
+
"# Plot: strategy 2 (a little more elaborate)\n",
|
| 1194 |
+
"# A nice alternative to play around with the plot in an interactive fashion:\n",
|
| 1195 |
+
"# initialize the Panel runtime environment\n",
|
| 1196 |
+
"pn.extension()\n",
|
| 1197 |
+
"\n",
|
| 1198 |
+
"def view():\n",
|
| 1199 |
+
" return an_bedmac['surface'].hvplot.image(\n",
|
| 1200 |
+
" x='x', y='y',\n",
|
| 1201 |
+
" rasterize=True, # Datashader aggregates data to fit the screen resolution\n",
|
| 1202 |
+
" dynamic=True, # plot will dynamically update\n",
|
| 1203 |
+
" ).opts(\n",
|
| 1204 |
+
" cmap='turbo',\n",
|
| 1205 |
+
" width=700,\n",
|
| 1206 |
+
" height=700,\n",
|
| 1207 |
+
" )\n",
|
| 1208 |
+
"\n",
|
| 1209 |
+
"# displayed the raster in the browser\n",
|
| 1210 |
+
"pn.serve(view, title=\"tab_title\", show=True)"
|
| 1211 |
+
]
|
| 1212 |
+
},
|
| 1213 |
+
{
|
| 1214 |
+
"cell_type": "code",
|
| 1215 |
+
"execution_count": null,
|
| 1216 |
+
"id": "b0a5765f-b498-4cf5-a0d5-9d44ec669207",
|
| 1217 |
+
"metadata": {},
|
| 1218 |
+
"outputs": [],
|
| 1219 |
+
"source": []
|
| 1220 |
+
}
|
| 1221 |
+
],
|
| 1222 |
+
"metadata": {
|
| 1223 |
+
"kernelspec": {
|
| 1224 |
+
"display_name": "appmlenv",
|
| 1225 |
+
"language": "python",
|
| 1226 |
+
"name": "appmlenv"
|
| 1227 |
+
},
|
| 1228 |
+
"language_info": {
|
| 1229 |
+
"codemirror_mode": {
|
| 1230 |
+
"name": "ipython",
|
| 1231 |
+
"version": 3
|
| 1232 |
+
},
|
| 1233 |
+
"file_extension": ".py",
|
| 1234 |
+
"mimetype": "text/x-python",
|
| 1235 |
+
"name": "python",
|
| 1236 |
+
"nbconvert_exporter": "python",
|
| 1237 |
+
"pygments_lexer": "ipython3",
|
| 1238 |
+
"version": "3.12.1"
|
| 1239 |
+
}
|
| 1240 |
+
},
|
| 1241 |
+
"nbformat": 4,
|
| 1242 |
+
"nbformat_minor": 5
|
| 1243 |
+
}
|