{ "cells": [ { "cell_type": "markdown", "id": "5d475da2-ff82-40d5-8809-4804ee5973a9", "metadata": {}, "source": [ "# Generic Notebook for NeuroML Models" ] }, { "cell_type": "markdown", "id": "2ea359be-5028-45d5-8944-2e73df46036b", "metadata": { "tags": [] }, "source": [ "## *Source path and LEMS filename*" ] }, { "cell_type": "code", "execution_count": 1, "id": "d35178bf-2df3-42ab-be25-975d6ffa68c3", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c16e3aa514f84de687804ec6107782e3", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HTML(value=\"Enter Path to NeuroML Model and LEMS filename below: \")" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "09600b89ebcc4e0695f83137defddfde", "version_major": 2, "version_minor": 0 }, "text/plain": [ "interactive(children=(Text(value='../../Tutorial/Source/', description='Path:', layout=Layout(width='80%'), pl…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import ipywidgets\n", "import ui_widget\n", "from importlib.machinery import SourceFileLoader\n", "%matplotlib widget\n", "\n", "#widget to read input files\n", "display(ui_widget.header,ui_widget.loader)" ] }, { "cell_type": "markdown", "id": "a4956041-c21f-40ea-ab03-3cc19ac2a498", "metadata": { "tags": [] }, "source": [ "## *Parse NML files and build dashboard*" ] }, { "cell_type": "code", "execution_count": 3, "id": "5f912104-c914-4f01-a3f4-2c9f01707b55", "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Skipping file : Cells.xml <- not in source directory\n", "Skipping file : Networks.xml <- not in source directory\n", "Skipping file : Simulation.xml <- not in source directory\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "16839e9e06924d13a8c659c7271db7e5", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Tab(children=(Accordion(children=(VBox(children=(HBox(children=(Text(value='component', disabled=True, layout=…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3df6439f5aee4ba1b1df8da601429f21", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(Button(button_style='info', description='Update Model', style=ButtonStyle(), tooltip='Update Ne…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "cf3d8e6602fa407c98499114c9e8b3bd", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b40e20ed899e4fb295c9fc06e4b3be57", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output(layout=Layout(border='1px solid'))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d28dff9ca6e44fddb74d8006a3713219", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Button(button_style='success', description='Plot Output', style=ButtonStyle(), tooltip='Plot outputs recorded …" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d7576cdda6a24b3c9b5fe5d0dd79277d", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# get path and filename from above widget----------------------------------------------------#\n", "path2source = ui_widget.loader.result[0]\n", "fname_LEMS = ui_widget.loader.result[1]\n", "\n", "# imports the python module-----------------------------------------------------------------#\n", "nmlPython = SourceFileLoader(\"nml2jupyter_ver2.py\",\"nml2jupyter_ver2.py\").load_module()\n", "runner = nmlPython.nml2jupyter(path2source, fname_LEMS)\n", "\n", "runner.parseNML()\n", "runner.generateDashboard()\n", "runner.loadGUI()" ] }, { "cell_type": "code", "execution_count": null, "id": "ef9e271b-45b6-4864-be3d-e55628cb1735", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }