treizh commited on
Commit
456e7e8
·
verified ·
1 Parent(s): 2002cda

Upload app.ipynb with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.ipynb +584 -26
app.ipynb CHANGED
@@ -16,9 +16,18 @@
16
  },
17
  {
18
  "cell_type": "code",
19
- "execution_count": null,
20
  "metadata": {},
21
- "outputs": [],
 
 
 
 
 
 
 
 
 
22
  "source": [
23
  "%load_ext autoreload\n",
24
  "%autoreload 2"
@@ -26,7 +35,7 @@
26
  },
27
  {
28
  "cell_type": "code",
29
- "execution_count": null,
30
  "metadata": {},
31
  "outputs": [],
32
  "source": [
@@ -51,9 +60,133 @@
51
  },
52
  {
53
  "cell_type": "code",
54
- "execution_count": null,
55
  "metadata": {},
56
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  "source": [
58
  "pn.extension(\"tabulator\")\n",
59
  "\n",
@@ -62,7 +195,7 @@
62
  },
63
  {
64
  "cell_type": "code",
65
- "execution_count": null,
66
  "metadata": {},
67
  "outputs": [],
68
  "source": [
@@ -81,7 +214,7 @@
81
  },
82
  {
83
  "cell_type": "code",
84
- "execution_count": null,
85
  "metadata": {},
86
  "outputs": [],
87
  "source": [
@@ -93,6 +226,15 @@
93
  "execution_count": null,
94
  "metadata": {},
95
  "outputs": [],
 
 
 
 
 
 
 
 
 
96
  "source": [
97
  "# Setup Paths\n",
98
  "if tc.phenopsis.joinpath(EXPERIMENT).is_dir() is True:\n",
@@ -108,7 +250,7 @@
108
  },
109
  {
110
  "cell_type": "code",
111
- "execution_count": null,
112
  "metadata": {},
113
  "outputs": [],
114
  "source": [
@@ -120,6 +262,363 @@
120
  "}"
121
  ]
122
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  {
124
  "cell_type": "markdown",
125
  "metadata": {},
@@ -136,7 +635,7 @@
136
  },
137
  {
138
  "cell_type": "code",
139
- "execution_count": null,
140
  "metadata": {},
141
  "outputs": [],
142
  "source": [
@@ -164,10 +663,11 @@
164
  "ck_show_finished = pn.widgets.Checkbox(name=\"Show completed plants\", value=False)\n",
165
  "\n",
166
  "im_current = pn.pane.Image(max_width=800, max_height=800, sizing_mode=\"stretch_width\")\n",
167
- "discrete_player = pn.widgets.DiscretePlayer(\n",
168
- " name=\"Discrete Player\", options=[0], value=0, loop_policy=\"loop\"\n",
169
  ")\n",
170
- "discrete_player.interval = 500\n",
 
171
  "ii_disease_index = pn.widgets.IntInput(\n",
172
  " name=\"Disease Index\",\n",
173
  " start=0,\n",
@@ -199,7 +699,7 @@
199
  },
200
  {
201
  "cell_type": "code",
202
- "execution_count": null,
203
  "metadata": {},
204
  "outputs": [],
205
  "source": [
@@ -213,7 +713,8 @@
213
  "\n",
214
  " string_io = StringIO(value.decode(\"utf8\"))\n",
215
  " ret = pd.read_csv(string_io, sep=\";\").assign(\n",
216
- " file_name=lambda x: x.filepath.str.replace(\".tif\", \".jpg\")\n",
 
217
  " )\n",
218
  " if \"di\" not in ret:\n",
219
  " ret[\"di\"] = 0\n",
@@ -262,8 +763,8 @@
262
  " try:\n",
263
  " row = (\n",
264
  " get_plant_data(df=table.value, plant_name=sl_plant.value)\n",
265
- " .set_index(\"job_id\")\n",
266
- " .loc[discrete_player.value]\n",
267
  " )\n",
268
  " if pt_images.joinpath(row.file_name).is_file() is True:\n",
269
  " im_current.object = ti.to_pil(\n",
@@ -281,25 +782,44 @@
281
  "\n",
282
  "@pn.depends(sl_plant.param.value, watch=True)\n",
283
  "def on_plant_changed(plant_name):\n",
284
- " discrete_player.options = get_plant_data(\n",
285
- " df=table.value, plant_name=plant_name\n",
286
- " ).job_id.to_list()\n",
287
- " discrete_player.value = discrete_player.options[0]\n",
288
  " update_image()\n",
289
  "\n",
290
  "\n",
291
- "@pn.depends(discrete_player.param.value, watch=True)\n",
292
  "def on_index_changed(index):\n",
293
  " update_image()\n",
294
  "\n",
295
  "\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  "@pn.depends(ii_disease_index.param.value, watch=True)\n",
297
  "def on_di_changed(di):\n",
298
  " if updating is True:\n",
299
  " return\n",
300
  " table.value.loc[\n",
301
  " (table.value.plant == sl_plant.value)\n",
302
- " & (table.value.job_id >= discrete_player.value),\n",
303
  " \"di\",\n",
304
  " ] = di\n",
305
  " table.value.loc[(table.value.plant == sl_plant.value), \"done\"] = True\n",
@@ -315,6 +835,27 @@
315
  " pg_completion.value = len(table.value[table.value.done == True].plant.unique())"
316
  ]
317
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  {
319
  "cell_type": "markdown",
320
  "metadata": {},
@@ -324,7 +865,7 @@
324
  },
325
  {
326
  "cell_type": "code",
327
- "execution_count": null,
328
  "metadata": {},
329
  "outputs": [],
330
  "source": [
@@ -363,7 +904,7 @@
363
  ")\n",
364
  "main = pn.Column(\n",
365
  " im_current,\n",
366
- " pn.Row(discrete_player, ii_disease_index, dwn_annotations),\n",
367
  " max_width=800,\n",
368
  " max_height=800,\n",
369
  " sizing_mode=\"stretch_width\",\n",
@@ -379,10 +920,27 @@
379
  },
380
  {
381
  "cell_type": "code",
382
- "execution_count": null,
383
  "metadata": {},
384
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  "source": [
 
386
  "pn.Row(sidebar, main)"
387
  ]
388
  },
 
16
  },
17
  {
18
  "cell_type": "code",
19
+ "execution_count": 15,
20
  "metadata": {},
21
+ "outputs": [
22
+ {
23
+ "name": "stdout",
24
+ "output_type": "stream",
25
+ "text": [
26
+ "The autoreload extension is already loaded. To reload it, use:\n",
27
+ " %reload_ext autoreload\n"
28
+ ]
29
+ }
30
+ ],
31
  "source": [
32
  "%load_ext autoreload\n",
33
  "%autoreload 2"
 
35
  },
36
  {
37
  "cell_type": "code",
38
+ "execution_count": 16,
39
  "metadata": {},
40
  "outputs": [],
41
  "source": [
 
60
  },
61
  {
62
  "cell_type": "code",
63
+ "execution_count": 17,
64
  "metadata": {},
65
+ "outputs": [
66
+ {
67
+ "data": {
68
+ "application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n var py_version = '3.4.3'.replace('rc', '-rc.').replace('.dev', '-dev.');\n var reloading = false;\n var Bokeh = root.Bokeh;\n\n if (typeof (root._bokeh_timeout) === \"undefined\" || force) {\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 console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n run_callbacks();\n return null;\n }\n if (!reloading) {\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\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() {\n console.error(\"failed to load \" + url);\n }\n\n var skip = [];\n if (window.requirejs) {\n window.requirejs.config({'packages': {}, 'paths': {'tabulator': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/tabulator.min', 'moment': 'https://cdn.jsdelivr.net/npm/luxon/build/global/luxon.min'}, 'shim': {}});\n require([\"tabulator\"], function(Tabulator) {\n\twindow.Tabulator = Tabulator\n\ton_load()\n })\n require([\"moment\"], function(moment) {\n\twindow.moment = moment\n\ton_load()\n })\n root._bokeh_is_loading = css_urls.length + 2;\n } else {\n root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n }\n\n var existing_stylesheets = []\n var links = document.getElementsByTagName('link')\n for (var i = 0; i < links.length; i++) {\n var link = links[i]\n if (link.href != null) {\n\texisting_stylesheets.push(link.href)\n }\n }\n for (var i = 0; i < css_urls.length; i++) {\n var url = css_urls[i];\n if (existing_stylesheets.indexOf(url) !== -1) {\n\ton_load()\n\tcontinue;\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 } if (((window.Tabulator !== undefined) && (!(window.Tabulator instanceof HTMLElement))) || window.requirejs) {\n var urls = ['https://cdn.holoviz.org/panel/1.4.5/dist/bundled/datatabulator/[email protected]/dist/js/tabulator.min.js'];\n for (var i = 0; i < urls.length; i++) {\n skip.push(urls[i])\n }\n } if (((window.moment !== undefined) && (!(window.moment instanceof HTMLElement))) || window.requirejs) {\n var urls = ['https://cdn.holoviz.org/panel/1.4.5/dist/bundled/datatabulator/luxon/build/global/luxon.min.js'];\n for (var i = 0; i < urls.length; i++) {\n skip.push(urls[i])\n }\n } var existing_scripts = []\n var scripts = document.getElementsByTagName('script')\n for (var i = 0; i < scripts.length; i++) {\n var script = scripts[i]\n if (script.src != null) {\n\texisting_scripts.push(script.src)\n }\n }\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n if (skip.indexOf(url) !== -1 || existing_scripts.indexOf(url) !== -1) {\n\tif (!window.requirejs) {\n\t on_load();\n\t}\n\tcontinue;\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 console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (var i = 0; i < js_modules.length; i++) {\n var url = js_modules[i];\n if (skip.indexOf(url) !== -1 || existing_scripts.indexOf(url) !== -1) {\n\tif (!window.requirejs) {\n\t on_load();\n\t}\n\tcontinue;\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 var url = js_exports[name];\n if (skip.indexOf(url) >= 0 || root[name] != null) {\n\tif (!window.requirejs) {\n\t on_load();\n\t}\n\tcontinue;\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 var js_urls = [\"https://cdn.holoviz.org/panel/1.4.5/dist/bundled/datatabulator/[email protected]/dist/js/tabulator.min.js\", \"https://cdn.holoviz.org/panel/1.4.5/dist/bundled/datatabulator/luxon/build/global/luxon.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.4.3.min.js\", \"https://cdn.holoviz.org/panel/1.4.5/dist/panel.min.js\"];\n var js_modules = [];\n var js_exports = {};\n var css_urls = [\"https://cdn.holoviz.org/panel/1.4.5/dist/bundled/datatabulator/[email protected]/dist/css/tabulator_simple.min.css?v=1.4.5\"];\n var 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 (var i = 0; i < inline_js.length; i++) {\n\ttry {\n inline_js[i].call(root, root.Bokeh);\n\t} catch(e) {\n\t if (!reloading) {\n\t throw e;\n\t }\n\t}\n }\n // Cache old bokeh versions\n if (Bokeh != undefined && !reloading) {\n\tvar NewBokeh = root.Bokeh;\n\tif (Bokeh.versions === undefined) {\n\t Bokeh.versions = new Map();\n\t}\n\tif (NewBokeh.version !== Bokeh.version) {\n\t Bokeh.versions.set(NewBokeh.version, NewBokeh)\n\t}\n\troot.Bokeh = Bokeh;\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n }\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 root._bokeh_is_initializing = false;\n root._bokeh_onload_callbacks = undefined;\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 var bokeh_loaded = Bokeh != null && (Bokeh.version === py_version || (Bokeh.versions !== undefined && Bokeh.versions.has(py_version)));\n if (!reloading && !bokeh_loaded) {\n\troot.Bokeh = undefined;\n }\n load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n\tconsole.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n\trun_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));",
69
+ "application/vnd.holoviews_load.v0+json": ""
70
+ },
71
+ "metadata": {},
72
+ "output_type": "display_data"
73
+ },
74
+ {
75
+ "data": {
76
+ "application/javascript": "\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",
77
+ "application/vnd.holoviews_load.v0+json": ""
78
+ },
79
+ "metadata": {},
80
+ "output_type": "display_data"
81
+ },
82
+ {
83
+ "data": {
84
+ "text/html": [
85
+ "<style>*[data-root-id],\n",
86
+ "*[data-root-id] > * {\n",
87
+ " box-sizing: border-box;\n",
88
+ " font-family: var(--jp-ui-font-family);\n",
89
+ " font-size: var(--jp-ui-font-size1);\n",
90
+ " color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
91
+ "}\n",
92
+ "\n",
93
+ "/* Override VSCode background color */\n",
94
+ ".cell-output-ipywidget-background:has(\n",
95
+ " > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
96
+ " ),\n",
97
+ ".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
98
+ " background-color: transparent !important;\n",
99
+ "}\n",
100
+ "</style>"
101
+ ]
102
+ },
103
+ "metadata": {},
104
+ "output_type": "display_data"
105
+ },
106
+ {
107
+ "data": {
108
+ "application/vnd.holoviews_exec.v0+json": "",
109
+ "text/html": [
110
+ "<div id='a47cdb5e-d733-4f9b-bd1b-f250f1a7dd25'>\n",
111
+ " <div id=\"d14a773c-bf88-48d3-af32-581489fb8408\" data-root-id=\"a47cdb5e-d733-4f9b-bd1b-f250f1a7dd25\" style=\"display: contents;\"></div>\n",
112
+ "</div>\n",
113
+ "<script type=\"application/javascript\">(function(root) {\n",
114
+ " var docs_json = {\"0e2c5e43-62ff-4de1-9ae7-0832274c0dbd\":{\"version\":\"3.4.3\",\"title\":\"Bokeh Application\",\"roots\":[{\"type\":\"object\",\"name\":\"panel.models.browser.BrowserInfo\",\"id\":\"a47cdb5e-d733-4f9b-bd1b-f250f1a7dd25\"},{\"type\":\"object\",\"name\":\"panel.models.comm_manager.CommManager\",\"id\":\"bc803979-b3e4-4de5-bd72-5cdec0528e40\",\"attributes\":{\"plot_id\":\"a47cdb5e-d733-4f9b-bd1b-f250f1a7dd25\",\"comm_id\":\"5d501e51e0a34cb09bf1242d375fbd5c\",\"client_comm_id\":\"f59e1db059e84a3b9248ae05d46d1712\"}}],\"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\":\"mode\",\"kind\":\"Any\",\"default\":\"warn\"},{\"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\":\"NotificationAreaBase1\",\"properties\":[{\"name\":\"js_events\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"bottom-right\"},{\"name\":\"_clear\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"NotificationArea1\",\"properties\":[{\"name\":\"js_events\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"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\":\"_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\":\"copy_to_clipboard1\",\"properties\":[{\"name\":\"fill\",\"kind\":\"Any\",\"default\":\"none\"},{\"name\":\"value\",\"kind\":\"Any\",\"default\":null}]}]}};\n",
115
+ " var render_items = [{\"docid\":\"0e2c5e43-62ff-4de1-9ae7-0832274c0dbd\",\"roots\":{\"a47cdb5e-d733-4f9b-bd1b-f250f1a7dd25\":\"d14a773c-bf88-48d3-af32-581489fb8408\"},\"root_ids\":[\"a47cdb5e-d733-4f9b-bd1b-f250f1a7dd25\"]}];\n",
116
+ " var docs = Object.values(docs_json)\n",
117
+ " if (!docs) {\n",
118
+ " return\n",
119
+ " }\n",
120
+ " const py_version = docs[0].version.replace('rc', '-rc.').replace('.dev', '-dev.')\n",
121
+ " async function embed_document(root) {\n",
122
+ " var Bokeh = get_bokeh(root)\n",
123
+ " await Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
124
+ " for (const render_item of render_items) {\n",
125
+ " for (const root_id of render_item.root_ids) {\n",
126
+ "\tconst id_el = document.getElementById(root_id)\n",
127
+ "\tif (id_el.children.length && id_el.children[0].hasAttribute('data-root-id')) {\n",
128
+ "\t const root_el = id_el.children[0]\n",
129
+ "\t root_el.id = root_el.id + '-rendered'\n",
130
+ "\t for (const child of root_el.children) {\n",
131
+ " // Ensure JupyterLab does not capture keyboard shortcuts\n",
132
+ " // see: https://jupyterlab.readthedocs.io/en/4.1.x/extension/notebook.html#keyboard-interaction-model\n",
133
+ "\t child.setAttribute('data-lm-suppress-shortcuts', 'true')\n",
134
+ "\t }\n",
135
+ "\t}\n",
136
+ " }\n",
137
+ " }\n",
138
+ " }\n",
139
+ " function get_bokeh(root) {\n",
140
+ " if (root.Bokeh === undefined) {\n",
141
+ " return null\n",
142
+ " } else if (root.Bokeh.version !== py_version) {\n",
143
+ " if (root.Bokeh.versions === undefined || !root.Bokeh.versions.has(py_version)) {\n",
144
+ "\treturn null\n",
145
+ " }\n",
146
+ " return root.Bokeh.versions.get(py_version);\n",
147
+ " } else if (root.Bokeh.version === py_version) {\n",
148
+ " return root.Bokeh\n",
149
+ " }\n",
150
+ " return null\n",
151
+ " }\n",
152
+ " function is_loaded(root) {\n",
153
+ " var Bokeh = get_bokeh(root)\n",
154
+ " return (Bokeh != null && Bokeh.Panel !== undefined && ( root.Tabulator !== undefined) && ( root.Tabulator !== undefined) && ( root.Tabulator !== undefined))\n",
155
+ " }\n",
156
+ " if (is_loaded(root)) {\n",
157
+ " embed_document(root);\n",
158
+ " } else {\n",
159
+ " var attempts = 0;\n",
160
+ " var timer = setInterval(function(root) {\n",
161
+ " if (is_loaded(root)) {\n",
162
+ " clearInterval(timer);\n",
163
+ " embed_document(root);\n",
164
+ " } else if (document.readyState == \"complete\") {\n",
165
+ " attempts++;\n",
166
+ " if (attempts > 200) {\n",
167
+ " clearInterval(timer);\n",
168
+ "\t var Bokeh = get_bokeh(root)\n",
169
+ "\t if (Bokeh == null || Bokeh.Panel == null) {\n",
170
+ " console.warn(\"Panel: ERROR: Unable to run Panel code because Bokeh or Panel library is missing\");\n",
171
+ "\t } else {\n",
172
+ "\t console.warn(\"Panel: WARNING: Attempting to render but not all required libraries could be resolved.\")\n",
173
+ "\t embed_document(root)\n",
174
+ "\t }\n",
175
+ " }\n",
176
+ " }\n",
177
+ " }, 25, root)\n",
178
+ " }\n",
179
+ "})(window);</script>"
180
+ ]
181
+ },
182
+ "metadata": {
183
+ "application/vnd.holoviews_exec.v0+json": {
184
+ "id": "a47cdb5e-d733-4f9b-bd1b-f250f1a7dd25"
185
+ }
186
+ },
187
+ "output_type": "display_data"
188
+ }
189
+ ],
190
  "source": [
191
  "pn.extension(\"tabulator\")\n",
192
  "\n",
 
195
  },
196
  {
197
  "cell_type": "code",
198
+ "execution_count": 18,
199
  "metadata": {},
200
  "outputs": [],
201
  "source": [
 
214
  },
215
  {
216
  "cell_type": "code",
217
+ "execution_count": 19,
218
  "metadata": {},
219
  "outputs": [],
220
  "source": [
 
226
  "execution_count": null,
227
  "metadata": {},
228
  "outputs": [],
229
+ "source": [
230
+ "INDEX_KEY = \"date_time\""
231
+ ]
232
+ },
233
+ {
234
+ "cell_type": "code",
235
+ "execution_count": 20,
236
+ "metadata": {},
237
+ "outputs": [],
238
  "source": [
239
  "# Setup Paths\n",
240
  "if tc.phenopsis.joinpath(EXPERIMENT).is_dir() is True:\n",
 
250
  },
251
  {
252
  "cell_type": "code",
253
+ "execution_count": 21,
254
  "metadata": {},
255
  "outputs": [],
256
  "source": [
 
262
  "}"
263
  ]
264
  },
265
+ {
266
+ "cell_type": "code",
267
+ "execution_count": 35,
268
+ "metadata": {},
269
+ "outputs": [
270
+ {
271
+ "data": {
272
+ "text/html": [
273
+ "<div>\n",
274
+ "<style scoped>\n",
275
+ " .dataframe tbody tr th:only-of-type {\n",
276
+ " vertical-align: middle;\n",
277
+ " }\n",
278
+ "\n",
279
+ " .dataframe tbody tr th {\n",
280
+ " vertical-align: top;\n",
281
+ " }\n",
282
+ "\n",
283
+ " .dataframe thead th {\n",
284
+ " text-align: right;\n",
285
+ " }\n",
286
+ "</style>\n",
287
+ "<table border=\"1\" class=\"dataframe\">\n",
288
+ " <thead>\n",
289
+ " <tr style=\"text-align: right;\">\n",
290
+ " <th></th>\n",
291
+ " <th>experiment</th>\n",
292
+ " <th>plant</th>\n",
293
+ " <th>camera</th>\n",
294
+ " <th>date_time</th>\n",
295
+ " <th>angle</th>\n",
296
+ " <th>wavelength</th>\n",
297
+ " <th>height</th>\n",
298
+ " <th>job_id</th>\n",
299
+ " <th>filepath</th>\n",
300
+ " <th>robot</th>\n",
301
+ " <th>date</th>\n",
302
+ " <th>time</th>\n",
303
+ " <th>hour</th>\n",
304
+ " <th>plant_id</th>\n",
305
+ " <th>PositionPlante</th>\n",
306
+ " <th>plaque</th>\n",
307
+ " <th>position</th>\n",
308
+ " <th>treatment</th>\n",
309
+ " <th>x</th>\n",
310
+ " <th>y</th>\n",
311
+ " <th>timestamp</th>\n",
312
+ " <th>file_name</th>\n",
313
+ " </tr>\n",
314
+ " </thead>\n",
315
+ " <tbody>\n",
316
+ " <tr>\n",
317
+ " <th>0</th>\n",
318
+ " <td>72AC_PhD_2404</td>\n",
319
+ " <td>72AC73_CL_RS_XX</td>\n",
320
+ " <td>cam_scan_phenopsis</td>\n",
321
+ " <td>2024-07-27 10:06:09</td>\n",
322
+ " <td>0</td>\n",
323
+ " <td>SW755</td>\n",
324
+ " <td>0</td>\n",
325
+ " <td>2273</td>\n",
326
+ " <td>72AC_PhD_2404#20240727120609#72AC73_CL_RS_XX#LIN#0#SW755#2273#0.tif</td>\n",
327
+ " <td>phenopsis</td>\n",
328
+ " <td>2024-07-27</td>\n",
329
+ " <td>10:06:09.601000</td>\n",
330
+ " <td>12</td>\n",
331
+ " <td>73</td>\n",
332
+ " <td>P3_A1</td>\n",
333
+ " <td>3</td>\n",
334
+ " <td>1</td>\n",
335
+ " <td>RS</td>\n",
336
+ " <td>13</td>\n",
337
+ " <td>1</td>\n",
338
+ " <td>2024-07-27 10:06:09.601000+00:00</td>\n",
339
+ " <td>72AC_PhD_2404#20240727120609#72AC73_CL_RS_XX#LIN#0#SW755#2273#0.jpg</td>\n",
340
+ " </tr>\n",
341
+ " <tr>\n",
342
+ " <th>1</th>\n",
343
+ " <td>72AC_PhD_2404</td>\n",
344
+ " <td>72AC73_CL_RS_XX</td>\n",
345
+ " <td>cam_scan_phenopsis</td>\n",
346
+ " <td>2024-07-27 13:06:10</td>\n",
347
+ " <td>0</td>\n",
348
+ " <td>SW755</td>\n",
349
+ " <td>0</td>\n",
350
+ " <td>2274</td>\n",
351
+ " <td>72AC_PhD_2404#20240727150610#72AC73_CL_RS_XX#LIN#0#SW755#2274#0.tif</td>\n",
352
+ " <td>phenopsis</td>\n",
353
+ " <td>2024-07-27</td>\n",
354
+ " <td>13:06:10.811000</td>\n",
355
+ " <td>15</td>\n",
356
+ " <td>73</td>\n",
357
+ " <td>P3_A1</td>\n",
358
+ " <td>3</td>\n",
359
+ " <td>1</td>\n",
360
+ " <td>RS</td>\n",
361
+ " <td>13</td>\n",
362
+ " <td>1</td>\n",
363
+ " <td>2024-07-27 13:06:10.811000+00:00</td>\n",
364
+ " <td>72AC_PhD_2404#20240727150610#72AC73_CL_RS_XX#LIN#0#SW755#2274#0.jpg</td>\n",
365
+ " </tr>\n",
366
+ " <tr>\n",
367
+ " <th>2</th>\n",
368
+ " <td>72AC_PhD_2404</td>\n",
369
+ " <td>72AC73_CL_RS_XX</td>\n",
370
+ " <td>cam_scan_phenopsis</td>\n",
371
+ " <td>2024-07-28 10:06:11</td>\n",
372
+ " <td>0</td>\n",
373
+ " <td>SW755</td>\n",
374
+ " <td>0</td>\n",
375
+ " <td>2277</td>\n",
376
+ " <td>72AC_PhD_2404#20240728120610#72AC73_CL_RS_XX#LIN#0#SW755#2277#0.tif</td>\n",
377
+ " <td>phenopsis</td>\n",
378
+ " <td>2024-07-28</td>\n",
379
+ " <td>10:06:11.133000</td>\n",
380
+ " <td>12</td>\n",
381
+ " <td>73</td>\n",
382
+ " <td>P3_A1</td>\n",
383
+ " <td>3</td>\n",
384
+ " <td>1</td>\n",
385
+ " <td>RS</td>\n",
386
+ " <td>13</td>\n",
387
+ " <td>1</td>\n",
388
+ " <td>2024-07-28 10:06:11.133000+00:00</td>\n",
389
+ " <td>72AC_PhD_2404#20240728120610#72AC73_CL_RS_XX#LIN#0#SW755#2277#0.jpg</td>\n",
390
+ " </tr>\n",
391
+ " <tr>\n",
392
+ " <th>3</th>\n",
393
+ " <td>72AC_PhD_2404</td>\n",
394
+ " <td>72AC73_CL_RS_XX</td>\n",
395
+ " <td>cam_scan_phenopsis</td>\n",
396
+ " <td>2024-07-28 13:06:12</td>\n",
397
+ " <td>0</td>\n",
398
+ " <td>SW755</td>\n",
399
+ " <td>0</td>\n",
400
+ " <td>2278</td>\n",
401
+ " <td>72AC_PhD_2404#20240728150612#72AC73_CL_RS_XX#LIN#0#SW755#2278#0.tif</td>\n",
402
+ " <td>phenopsis</td>\n",
403
+ " <td>2024-07-28</td>\n",
404
+ " <td>13:06:12.678000</td>\n",
405
+ " <td>15</td>\n",
406
+ " <td>73</td>\n",
407
+ " <td>P3_A1</td>\n",
408
+ " <td>3</td>\n",
409
+ " <td>1</td>\n",
410
+ " <td>RS</td>\n",
411
+ " <td>13</td>\n",
412
+ " <td>1</td>\n",
413
+ " <td>2024-07-28 13:06:12.678000+00:00</td>\n",
414
+ " <td>72AC_PhD_2404#20240728150612#72AC73_CL_RS_XX#LIN#0#SW755#2278#0.jpg</td>\n",
415
+ " </tr>\n",
416
+ " <tr>\n",
417
+ " <th>4</th>\n",
418
+ " <td>72AC_PhD_2404</td>\n",
419
+ " <td>72AC73_CL_RS_XX</td>\n",
420
+ " <td>cam_scan_phenopsis</td>\n",
421
+ " <td>2024-07-29 10:06:10</td>\n",
422
+ " <td>0</td>\n",
423
+ " <td>SW755</td>\n",
424
+ " <td>0</td>\n",
425
+ " <td>2281</td>\n",
426
+ " <td>72AC_PhD_2404#20240729120609#72AC73_CL_RS_XX#LIN#0#SW755#2281#0.tif</td>\n",
427
+ " <td>phenopsis</td>\n",
428
+ " <td>2024-07-29</td>\n",
429
+ " <td>10:06:10.204000</td>\n",
430
+ " <td>12</td>\n",
431
+ " <td>73</td>\n",
432
+ " <td>P3_A1</td>\n",
433
+ " <td>3</td>\n",
434
+ " <td>1</td>\n",
435
+ " <td>RS</td>\n",
436
+ " <td>13</td>\n",
437
+ " <td>1</td>\n",
438
+ " <td>2024-07-29 10:06:10.204000+00:00</td>\n",
439
+ " <td>72AC_PhD_2404#20240729120609#72AC73_CL_RS_XX#LIN#0#SW755#2281#0.jpg</td>\n",
440
+ " </tr>\n",
441
+ " <tr>\n",
442
+ " <th>...</th>\n",
443
+ " <td>...</td>\n",
444
+ " <td>...</td>\n",
445
+ " <td>...</td>\n",
446
+ " <td>...</td>\n",
447
+ " <td>...</td>\n",
448
+ " <td>...</td>\n",
449
+ " <td>...</td>\n",
450
+ " <td>...</td>\n",
451
+ " <td>...</td>\n",
452
+ " <td>...</td>\n",
453
+ " <td>...</td>\n",
454
+ " <td>...</td>\n",
455
+ " <td>...</td>\n",
456
+ " <td>...</td>\n",
457
+ " <td>...</td>\n",
458
+ " <td>...</td>\n",
459
+ " <td>...</td>\n",
460
+ " <td>...</td>\n",
461
+ " <td>...</td>\n",
462
+ " <td>...</td>\n",
463
+ " <td>...</td>\n",
464
+ " <td>...</td>\n",
465
+ " </tr>\n",
466
+ " <tr>\n",
467
+ " <th>6043</th>\n",
468
+ " <td>72AC_PhD_2404</td>\n",
469
+ " <td>72AC468_CL_DC_XX</td>\n",
470
+ " <td>cam_scan_phenopsis</td>\n",
471
+ " <td>2024-08-05 10:37:34</td>\n",
472
+ " <td>0</td>\n",
473
+ " <td>SW755</td>\n",
474
+ " <td>0</td>\n",
475
+ " <td>2310</td>\n",
476
+ " <td>72AC_PhD_2404#20240805123734#72AC468_CL_DC_XX#LIN#0#SW755#2310#0.tif</td>\n",
477
+ " <td>phenopsis</td>\n",
478
+ " <td>2024-08-05</td>\n",
479
+ " <td>10:37:34.721000</td>\n",
480
+ " <td>12</td>\n",
481
+ " <td>468</td>\n",
482
+ " <td>P13_A36</td>\n",
483
+ " <td>13</td>\n",
484
+ " <td>36</td>\n",
485
+ " <td>DC</td>\n",
486
+ " <td>36</td>\n",
487
+ " <td>12</td>\n",
488
+ " <td>2024-08-05 10:37:34.721000+00:00</td>\n",
489
+ " <td>72AC_PhD_2404#20240805123734#72AC468_CL_DC_XX#LIN#0#SW755#2310#0.jpg</td>\n",
490
+ " </tr>\n",
491
+ " <tr>\n",
492
+ " <th>6044</th>\n",
493
+ " <td>72AC_PhD_2404</td>\n",
494
+ " <td>72AC468_CL_DC_XX</td>\n",
495
+ " <td>cam_scan_phenopsis</td>\n",
496
+ " <td>2024-08-05 13:37:35</td>\n",
497
+ " <td>0</td>\n",
498
+ " <td>SW755</td>\n",
499
+ " <td>0</td>\n",
500
+ " <td>2311</td>\n",
501
+ " <td>72AC_PhD_2404#20240805153734#72AC468_CL_DC_XX#LIN#0#SW755#2311#0.tif</td>\n",
502
+ " <td>phenopsis</td>\n",
503
+ " <td>2024-08-05</td>\n",
504
+ " <td>13:37:35.100000</td>\n",
505
+ " <td>15</td>\n",
506
+ " <td>468</td>\n",
507
+ " <td>P13_A36</td>\n",
508
+ " <td>13</td>\n",
509
+ " <td>36</td>\n",
510
+ " <td>DC</td>\n",
511
+ " <td>36</td>\n",
512
+ " <td>12</td>\n",
513
+ " <td>2024-08-05 13:37:35.100000+00:00</td>\n",
514
+ " <td>72AC_PhD_2404#20240805153734#72AC468_CL_DC_XX#LIN#0#SW755#2311#0.jpg</td>\n",
515
+ " </tr>\n",
516
+ " <tr>\n",
517
+ " <th>6045</th>\n",
518
+ " <td>72AC_PhD_2404</td>\n",
519
+ " <td>72AC468_CL_DC_XX</td>\n",
520
+ " <td>cam_scan_phenopsis</td>\n",
521
+ " <td>2024-08-06 10:37:30</td>\n",
522
+ " <td>0</td>\n",
523
+ " <td>SW755</td>\n",
524
+ " <td>0</td>\n",
525
+ " <td>2314</td>\n",
526
+ " <td>72AC_PhD_2404#20240806123730#72AC468_CL_DC_XX#LIN#0#SW755#2314#0.tif</td>\n",
527
+ " <td>phenopsis</td>\n",
528
+ " <td>2024-08-06</td>\n",
529
+ " <td>10:37:30.918000</td>\n",
530
+ " <td>12</td>\n",
531
+ " <td>468</td>\n",
532
+ " <td>P13_A36</td>\n",
533
+ " <td>13</td>\n",
534
+ " <td>36</td>\n",
535
+ " <td>DC</td>\n",
536
+ " <td>36</td>\n",
537
+ " <td>12</td>\n",
538
+ " <td>2024-08-06 10:37:30.918000+00:00</td>\n",
539
+ " <td>72AC_PhD_2404#20240806123730#72AC468_CL_DC_XX#LIN#0#SW755#2314#0.jpg</td>\n",
540
+ " </tr>\n",
541
+ " <tr>\n",
542
+ " <th>6046</th>\n",
543
+ " <td>72AC_PhD_2404</td>\n",
544
+ " <td>72AC468_CL_DC_XX</td>\n",
545
+ " <td>cam_scan_phenopsis</td>\n",
546
+ " <td>2024-08-06 13:37:35</td>\n",
547
+ " <td>0</td>\n",
548
+ " <td>SW755</td>\n",
549
+ " <td>0</td>\n",
550
+ " <td>2315</td>\n",
551
+ " <td>72AC_PhD_2404#20240806153734#72AC468_CL_DC_XX#LIN#0#SW755#2315#0.tif</td>\n",
552
+ " <td>phenopsis</td>\n",
553
+ " <td>2024-08-06</td>\n",
554
+ " <td>13:37:35.629000</td>\n",
555
+ " <td>15</td>\n",
556
+ " <td>468</td>\n",
557
+ " <td>P13_A36</td>\n",
558
+ " <td>13</td>\n",
559
+ " <td>36</td>\n",
560
+ " <td>DC</td>\n",
561
+ " <td>36</td>\n",
562
+ " <td>12</td>\n",
563
+ " <td>2024-08-06 13:37:35.629000+00:00</td>\n",
564
+ " <td>72AC_PhD_2404#20240806153734#72AC468_CL_DC_XX#LIN#0#SW755#2315#0.jpg</td>\n",
565
+ " </tr>\n",
566
+ " <tr>\n",
567
+ " <th>6047</th>\n",
568
+ " <td>72AC_PhD_2404</td>\n",
569
+ " <td>72AC468_CL_DC_XX</td>\n",
570
+ " <td>cam_scan_phenopsis</td>\n",
571
+ " <td>2024-08-07 10:37:36</td>\n",
572
+ " <td>0</td>\n",
573
+ " <td>SW755</td>\n",
574
+ " <td>0</td>\n",
575
+ " <td>2318</td>\n",
576
+ " <td>72AC_PhD_2404#20240807123735#72AC468_CL_DC_XX#LIN#0#SW755#2318#0.tif</td>\n",
577
+ " <td>phenopsis</td>\n",
578
+ " <td>2024-08-07</td>\n",
579
+ " <td>10:37:36.146000</td>\n",
580
+ " <td>12</td>\n",
581
+ " <td>468</td>\n",
582
+ " <td>P13_A36</td>\n",
583
+ " <td>13</td>\n",
584
+ " <td>36</td>\n",
585
+ " <td>DC</td>\n",
586
+ " <td>36</td>\n",
587
+ " <td>12</td>\n",
588
+ " <td>2024-08-07 10:37:36.146000+00:00</td>\n",
589
+ " <td>72AC_PhD_2404#20240807123735#72AC468_CL_DC_XX#LIN#0#SW755#2318#0.jpg</td>\n",
590
+ " </tr>\n",
591
+ " </tbody>\n",
592
+ "</table>\n",
593
+ "<p>6048 rows × 22 columns</p>\n",
594
+ "</div>"
595
+ ],
596
+ "text/plain": [
597
+ " experiment plant camera date_time angle wavelength height job_id filepath robot date time hour plant_id PositionPlante plaque position treatment x y timestamp file_name\n",
598
+ "0 72AC_PhD_2404 72AC73_CL_RS_XX cam_scan_phenopsis 2024-07-27 10:06:09 0 SW755 0 2273 72AC_PhD_2404#20240727120609#72AC73_CL_RS_XX#LIN#0#SW755#2273#0.tif phenopsis 2024-07-27 10:06:09.601000 12 73 P3_A1 3 1 RS 13 1 2024-07-27 10:06:09.601000+00:00 72AC_PhD_2404#20240727120609#72AC73_CL_RS_XX#LIN#0#SW755#2273#0.jpg\n",
599
+ "1 72AC_PhD_2404 72AC73_CL_RS_XX cam_scan_phenopsis 2024-07-27 13:06:10 0 SW755 0 2274 72AC_PhD_2404#20240727150610#72AC73_CL_RS_XX#LIN#0#SW755#2274#0.tif phenopsis 2024-07-27 13:06:10.811000 15 73 P3_A1 3 1 RS 13 1 2024-07-27 13:06:10.811000+00:00 72AC_PhD_2404#20240727150610#72AC73_CL_RS_XX#LIN#0#SW755#2274#0.jpg\n",
600
+ "2 72AC_PhD_2404 72AC73_CL_RS_XX cam_scan_phenopsis 2024-07-28 10:06:11 0 SW755 0 2277 72AC_PhD_2404#20240728120610#72AC73_CL_RS_XX#LIN#0#SW755#2277#0.tif phenopsis 2024-07-28 10:06:11.133000 12 73 P3_A1 3 1 RS 13 1 2024-07-28 10:06:11.133000+00:00 72AC_PhD_2404#20240728120610#72AC73_CL_RS_XX#LIN#0#SW755#2277#0.jpg\n",
601
+ "3 72AC_PhD_2404 72AC73_CL_RS_XX cam_scan_phenopsis 2024-07-28 13:06:12 0 SW755 0 2278 72AC_PhD_2404#20240728150612#72AC73_CL_RS_XX#LIN#0#SW755#2278#0.tif phenopsis 2024-07-28 13:06:12.678000 15 73 P3_A1 3 1 RS 13 1 2024-07-28 13:06:12.678000+00:00 72AC_PhD_2404#20240728150612#72AC73_CL_RS_XX#LIN#0#SW755#2278#0.jpg\n",
602
+ "4 72AC_PhD_2404 72AC73_CL_RS_XX cam_scan_phenopsis 2024-07-29 10:06:10 0 SW755 0 2281 72AC_PhD_2404#20240729120609#72AC73_CL_RS_XX#LIN#0#SW755#2281#0.tif phenopsis 2024-07-29 10:06:10.204000 12 73 P3_A1 3 1 RS 13 1 2024-07-29 10:06:10.204000+00:00 72AC_PhD_2404#20240729120609#72AC73_CL_RS_XX#LIN#0#SW755#2281#0.jpg\n",
603
+ "... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... .. .. ... ...\n",
604
+ "6043 72AC_PhD_2404 72AC468_CL_DC_XX cam_scan_phenopsis 2024-08-05 10:37:34 0 SW755 0 2310 72AC_PhD_2404#20240805123734#72AC468_CL_DC_XX#LIN#0#SW755#2310#0.tif phenopsis 2024-08-05 10:37:34.721000 12 468 P13_A36 13 36 DC 36 12 2024-08-05 10:37:34.721000+00:00 72AC_PhD_2404#20240805123734#72AC468_CL_DC_XX#LIN#0#SW755#2310#0.jpg\n",
605
+ "6044 72AC_PhD_2404 72AC468_CL_DC_XX cam_scan_phenopsis 2024-08-05 13:37:35 0 SW755 0 2311 72AC_PhD_2404#20240805153734#72AC468_CL_DC_XX#LIN#0#SW755#2311#0.tif phenopsis 2024-08-05 13:37:35.100000 15 468 P13_A36 13 36 DC 36 12 2024-08-05 13:37:35.100000+00:00 72AC_PhD_2404#20240805153734#72AC468_CL_DC_XX#LIN#0#SW755#2311#0.jpg\n",
606
+ "6045 72AC_PhD_2404 72AC468_CL_DC_XX cam_scan_phenopsis 2024-08-06 10:37:30 0 SW755 0 2314 72AC_PhD_2404#20240806123730#72AC468_CL_DC_XX#LIN#0#SW755#2314#0.tif phenopsis 2024-08-06 10:37:30.918000 12 468 P13_A36 13 36 DC 36 12 2024-08-06 10:37:30.918000+00:00 72AC_PhD_2404#20240806123730#72AC468_CL_DC_XX#LIN#0#SW755#2314#0.jpg\n",
607
+ "6046 72AC_PhD_2404 72AC468_CL_DC_XX cam_scan_phenopsis 2024-08-06 13:37:35 0 SW755 0 2315 72AC_PhD_2404#20240806153734#72AC468_CL_DC_XX#LIN#0#SW755#2315#0.tif phenopsis 2024-08-06 13:37:35.629000 15 468 P13_A36 13 36 DC 36 12 2024-08-06 13:37:35.629000+00:00 72AC_PhD_2404#20240806153734#72AC468_CL_DC_XX#LIN#0#SW755#2315#0.jpg\n",
608
+ "6047 72AC_PhD_2404 72AC468_CL_DC_XX cam_scan_phenopsis 2024-08-07 10:37:36 0 SW755 0 2318 72AC_PhD_2404#20240807123735#72AC468_CL_DC_XX#LIN#0#SW755#2318#0.tif phenopsis 2024-08-07 10:37:36.146000 12 468 P13_A36 13 36 DC 36 12 2024-08-07 10:37:36.146000+00:00 72AC_PhD_2404#20240807123735#72AC468_CL_DC_XX#LIN#0#SW755#2318#0.jpg\n",
609
+ "\n",
610
+ "[6048 rows x 22 columns]"
611
+ ]
612
+ },
613
+ "execution_count": 35,
614
+ "metadata": {},
615
+ "output_type": "execute_result"
616
+ }
617
+ ],
618
+ "source": [
619
+ "# pd.read_csv(pt_data.joinpath(f\"{EXPERIMENT}_raw.csv\"), sep=\";\").assign(date_time=lambda x: x.date_time.str.split(\".\", expand=True)[0])"
620
+ ]
621
+ },
622
  {
623
  "cell_type": "markdown",
624
  "metadata": {},
 
635
  },
636
  {
637
  "cell_type": "code",
638
+ "execution_count": 30,
639
  "metadata": {},
640
  "outputs": [],
641
  "source": [
 
663
  "ck_show_finished = pn.widgets.Checkbox(name=\"Show completed plants\", value=False)\n",
664
  "\n",
665
  "im_current = pn.pane.Image(max_width=800, max_height=800, sizing_mode=\"stretch_width\")\n",
666
+ "discrete_slider = pn.widgets.DiscreteSlider(\n",
667
+ " name=\"Discrete Player\", options=[0], value=0\n",
668
  ")\n",
669
+ "bt_previous = pn.widgets.ButtonIcon(icon=\"caret-left\", size=\"4em\", toggle_duration=500)\n",
670
+ "bt_next = pn.widgets.ButtonIcon(icon=\"caret-right\", size=\"4em\", toggle_duration=500)\n",
671
  "ii_disease_index = pn.widgets.IntInput(\n",
672
  " name=\"Disease Index\",\n",
673
  " start=0,\n",
 
699
  },
700
  {
701
  "cell_type": "code",
702
+ "execution_count": 27,
703
  "metadata": {},
704
  "outputs": [],
705
  "source": [
 
713
  "\n",
714
  " string_io = StringIO(value.decode(\"utf8\"))\n",
715
  " ret = pd.read_csv(string_io, sep=\";\").assign(\n",
716
+ " file_name=lambda x: x.filepath.str.replace(\".tif\", \".jpg\"),\n",
717
+ " date_time=lambda x: x.date_time.str.split(\".\", expand=True)[0],\n",
718
  " )\n",
719
  " if \"di\" not in ret:\n",
720
  " ret[\"di\"] = 0\n",
 
763
  " try:\n",
764
  " row = (\n",
765
  " get_plant_data(df=table.value, plant_name=sl_plant.value)\n",
766
+ " .set_index(INDEX_KEY)\n",
767
+ " .loc[discrete_slider.value]\n",
768
  " )\n",
769
  " if pt_images.joinpath(row.file_name).is_file() is True:\n",
770
  " im_current.object = ti.to_pil(\n",
 
782
  "\n",
783
  "@pn.depends(sl_plant.param.value, watch=True)\n",
784
  "def on_plant_changed(plant_name):\n",
785
+ " discrete_slider.options = get_plant_data(df=table.value, plant_name=plant_name)[\n",
786
+ " INDEX_KEY\n",
787
+ " ].to_list()\n",
788
+ " discrete_slider.value = discrete_slider.options[0]\n",
789
  " update_image()\n",
790
  "\n",
791
  "\n",
792
+ "@pn.depends(discrete_slider.param.value, watch=True)\n",
793
  "def on_index_changed(index):\n",
794
  " update_image()\n",
795
  "\n",
796
  "\n",
797
+ "def do_previous(event):\n",
798
+ " discrete_slider.value = discrete_slider.options[\n",
799
+ " max(discrete_slider.options.index(discrete_slider.value) - 1, 0)\n",
800
+ " ]\n",
801
+ "\n",
802
+ "\n",
803
+ "def do_next(event):\n",
804
+ " discrete_slider.value = discrete_slider.options[\n",
805
+ " min(\n",
806
+ " discrete_slider.options.index(discrete_slider.value) + 1,\n",
807
+ " len(discrete_slider.options) - 1,\n",
808
+ " )\n",
809
+ " ]\n",
810
+ "\n",
811
+ "\n",
812
+ "bt_previous.on_click(do_previous)\n",
813
+ "bt_next.on_click(do_next)\n",
814
+ "\n",
815
+ "\n",
816
  "@pn.depends(ii_disease_index.param.value, watch=True)\n",
817
  "def on_di_changed(di):\n",
818
  " if updating is True:\n",
819
  " return\n",
820
  " table.value.loc[\n",
821
  " (table.value.plant == sl_plant.value)\n",
822
+ " & (table.value[INDEX_KEY] >= discrete_slider.value),\n",
823
  " \"di\",\n",
824
  " ] = di\n",
825
  " table.value.loc[(table.value.plant == sl_plant.value), \"done\"] = True\n",
 
835
  " pg_completion.value = len(table.value[table.value.done == True].plant.unique())"
836
  ]
837
  },
838
+ {
839
+ "cell_type": "code",
840
+ "execution_count": 32,
841
+ "metadata": {},
842
+ "outputs": [
843
+ {
844
+ "data": {
845
+ "text/plain": [
846
+ "2"
847
+ ]
848
+ },
849
+ "execution_count": 32,
850
+ "metadata": {},
851
+ "output_type": "execute_result"
852
+ }
853
+ ],
854
+ "source": [
855
+ "a = [1, 2, 3, 4, 5, 6]\n",
856
+ "a.index(3)"
857
+ ]
858
+ },
859
  {
860
  "cell_type": "markdown",
861
  "metadata": {},
 
865
  },
866
  {
867
  "cell_type": "code",
868
+ "execution_count": 28,
869
  "metadata": {},
870
  "outputs": [],
871
  "source": [
 
904
  ")\n",
905
  "main = pn.Column(\n",
906
  " im_current,\n",
907
+ " pn.Row(bt_previous, discrete_slider, bt_next, ii_disease_index, dwn_annotations),\n",
908
  " max_width=800,\n",
909
  " max_height=800,\n",
910
  " sizing_mode=\"stretch_width\",\n",
 
920
  },
921
  {
922
  "cell_type": "code",
923
+ "execution_count": 29,
924
  "metadata": {},
925
+ "outputs": [
926
+ {
927
+ "data": {
928
+ "application/vnd.jupyter.widget-view+json": {
929
+ "model_id": "aaae447d85264800b41a5618d8e78171",
930
+ "version_major": 2,
931
+ "version_minor": 0
932
+ },
933
+ "text/plain": [
934
+ "BokehModel(combine_events=True, render_bundle={'docs_json': {'fbfa3e7d-2cea-465d-9844-cecbf0c4a154': {'version…"
935
+ ]
936
+ },
937
+ "execution_count": 29,
938
+ "metadata": {},
939
+ "output_type": "execute_result"
940
+ }
941
+ ],
942
  "source": [
943
+ "# sidebar.width = 330\n",
944
  "pn.Row(sidebar, main)"
945
  ]
946
  },