├── .binstar.yml ├── .gitignore ├── CHANGES.rst ├── Deployment.rst ├── LICENSE.txt ├── MANIFEST.in ├── README.rst ├── conda.recipe ├── build.sh └── meta.yaml ├── docs ├── Makefile ├── _static │ ├── .gitignore │ ├── Mattioni_Neuronvisio.bib │ ├── Neuronvisio_3D.png │ ├── Neuronvisio_Controls.png │ ├── Neuronvisio_Controls_Init_and_Run.png │ ├── Neuronvisio_Controls_selecting_variable.png │ ├── Neuronvisio_Refs.png │ ├── Neuronvisio_sec_info.png │ ├── Simple_model.png │ ├── cerebellum_network.png │ ├── hdf_neuronvisio_structure.png │ ├── neuronWithSpines.png │ ├── neuronvisio_main_control.png │ ├── neuronvisio_modelDB.png │ ├── nrnvisio-mayavi-color.png │ ├── nrnvisio-mayavi-color2.png │ ├── nrnvisio-user-color.png │ ├── plotting_vector_results.png │ ├── pylab_integration.png │ ├── pyramidal.png │ ├── pyramidal_3D_change_voltage.png │ ├── spines_detailed.png │ └── voltage_variations.png ├── _templates │ ├── .gitignore │ └── layout.html ├── changes.rst ├── conf.py ├── controls.rst ├── gettingstarted.rst ├── index.rst ├── install.rst ├── make.bat ├── manager.rst ├── reference.rst ├── requirements.txt ├── screenshots.rst ├── storage.rst └── visio.rst ├── environment.yml ├── examples ├── cerebellum_network │ ├── NeuroML │ │ └── Ex6_Cerebellum_networks.xml │ ├── README.md │ └── hoc │ │ ├── Ex6_CerebellumDemo.hoc │ │ ├── GranGolgiSyn.mod │ │ ├── GranPurkSyn.mod │ │ ├── GranuleCell.hoc │ │ ├── KConductance.mod │ │ ├── MFExtSynInput.mod │ │ ├── MFGranSyn.mod │ │ ├── MossyFiber.hoc │ │ ├── NaConductance.mod │ │ ├── PassiveCond.mod │ │ ├── PurkinjeCell.hoc │ │ ├── cellCheck.hoc │ │ ├── main.py │ │ └── nCtools.hoc ├── medium_model.py ├── pyramidal │ ├── README_NEURONVISIO.rst │ ├── demo.hoc │ ├── dks577.append.hoc │ ├── dks577a.hoc │ ├── kd3h5.mod │ ├── main.py │ ├── mosinit.hoc │ ├── na3h5.mod │ └── readme.txt └── simple_model.py ├── gpl.txt ├── neuronvisio ├── __init__.py ├── colorbutton.py ├── command_line.py ├── controls.py ├── icons │ ├── document-open.svg │ ├── document-save-as.svg │ ├── document-save.svg │ ├── help-browser.svg │ ├── res.qrc │ └── system-log-out.svg ├── manager.py ├── modeldb │ ├── BeautifulSoup.py │ ├── ModelDB.py │ ├── ModelDB.xml │ ├── ModelsTree.py │ ├── Updater.py │ └── __init__.py ├── res.py ├── ui │ ├── neuronvisio.ui │ └── qtAbout.ui └── visio.py ├── scripts ├── neuronvisio ├── neuronvisio-modeldb-updater ├── neuronvisio-modeldb-updater.bat └── neuronvisio.bat └── setup.py /.binstar.yml: -------------------------------------------------------------------------------- 1 | package: neuronvisio 2 | script: 3 | - conda build conda.recipe 4 | build_targets: conda 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore the files for git 2 | 3 | # All the python compiled 4 | *.pyc 5 | .project 6 | .pydevproject 7 | *.egg-info 8 | 9 | # Bkp 10 | *~ 11 | *i686 12 | *x86_64 13 | dist 14 | deb_dist 15 | 16 | #Sphinx built website. 17 | docs/_build 18 | 19 | #eclipse coding 20 | .settings 21 | 22 | # Models download folder 23 | 24 | src/Models 25 | Models 26 | 27 | /build 28 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | 0.9.1 -- 1 October 2015 2 | ======================= 3 | 4 | - Fixed small formatting issue on the docs 5 | - Added pytables to the run dependences 6 | 7 | 0.9.0 -- 24 September 2015 8 | ========================== 9 | 10 | - Created a conda package for Neuronvisio 11 | - Dropped paver for normal install via PyPi (Closed #57) 12 | 13 | 14 | 0.8.6 -- 8 March 2013 15 | ===================== 16 | 17 | - we are using pip and requirements.txt to be able to install packages from DCVS 18 | - MacOs is now supported when we open the model, if not mosinit is present #56 19 | - Better explanation to the User if a model can't be loaded. #55 20 | - Improved Install Docs for Mac. PR #53 and #54 21 | - Added 24 models available from ModelDB 22 | 23 | 24 | 0.8.5 -- 6 Jul 2012 25 | =================== 26 | 27 | - Closed #49 28 | - Text in the Animation is always formatted with 3 digits. 29 | - Added the ability to load a NeuroML (xml), a Hoc (.hoc) or a HDF file (.h5) 30 | with Neuronvisio format directly when the program is launched. 31 | 32 | 0.8.4 -- 12 Jun 2012 33 | ==================== 34 | 35 | - Added new model to the ModelDBlist 36 | - updated the documentation 37 | - Added 3 new models to ModelDB 38 | 39 | 0.8.3 -- 18 May 2012 40 | ==================== 41 | 42 | - Fixed paver minilib, missing from the tarball 43 | - Added one new model to the ModelDB.xml 44 | - Improved the documentation of several classes 45 | - Inserted the domain in the about (neuronvisio.org) 46 | 47 | 0.8.2 -- 23 Apr 2012 48 | ==================== 49 | 50 | - Added two new model to ModelDB.xml 51 | - Introduced a new method to assign a color to more than one sections from 52 | the console 53 | - Added the apptools patched version as explicit dependency until it's not 54 | released officially. 55 | 56 | 0.8.1 -- 19 March 2012 57 | ====================== 58 | 59 | - Added new models on the ModelDB.xml 60 | - Closed #45 61 | - Easy function to export a video as a stack of screenshots 62 | - Updated the docs to work witht the latest pyqt 63 | - Geometry node in the HDF is directly a NeuroML string 64 | and not wrapped in a list 65 | 66 | 0.8.0 -- 15 Feb 2012 67 | ==================== 68 | 69 | - New repo layout 70 | - Ported to Mayavi 4.1.1.dev 71 | - Closed #31 72 | - Reorganized controls method in alphabetical order. 73 | - Animation set true when simulation is launched. 74 | - Fixed a vectors handling if no values present. 75 | - Updated the doc for Mayavi 4.0.0 76 | - Load hoc or hdf with the same method 77 | - Added new models from ModelDB 78 | - User Interface improvement 79 | - Closed #37 80 | - Closed #32 81 | - Closed #34 82 | - Improved nrnvisio.py to integrate seamlessy with IPython session, 83 | or create a new one on the fly 84 | - Automatic handling of Mayavi installation through pip. 85 | 86 | 0.7.3 -- 24 Nov 2011 87 | ==================== 88 | 89 | - Inserted how to configure ipython with the pylab and Q4Agg support in the doc 90 | - Selected section is now stored and used if the vector are created only for one sec 91 | - Inserted two new models on the ModelDb.xml. Fix #30. 92 | - Included the ModelDB.xml in the package 93 | 94 | 0.7.2 -- 8 Nov 2011 95 | =================== 96 | 97 | - Inserted modeldb in the pavement. 98 | 99 | 0.7.1 -- 8 Nov 2011 100 | =================== 101 | 102 | - fixed the name of the exectable on the setup file 103 | 104 | 0.7.0 -- 3 Nov 2011 105 | =================== 106 | 107 | - Added a new tab to have a ModelDb explorer inside Neuronvisio 108 | - Integrate the ability to download and extract a NEURON model from ModelDb 109 | - Ability to load the model directly from Neuronvisio 110 | - Used the logging python system through the package 111 | - Updated the docs to explain the ModelDb integration. 112 | 113 | 114 | 0.6.2 -- 16 Jun 2011 115 | ==================== 116 | 117 | - New API to select sections directly from the commandline 118 | (`controls.select_sections()`) 119 | - Animation Timeliner set up only if simulation has ran or be 120 | reloaded. 121 | 122 | 123 | 0.6.1 -- 9 Jun 2011 124 | =================== 125 | 126 | - Animation ported to the new infrastructure. 127 | - Updated the requirements with setuptools (needed for paver) 128 | - Animation timeline accept an arbitrary time and display it on the 129 | visio window. 130 | 131 | 0.6.0 -- 10 May 2011 132 | ==================== 133 | 134 | - Added the function to plot a 3D plot to the manager (manager.plot3D) 135 | - Animation can will be enabled if any simulation is ran, either from the gui 136 | or the code. 137 | - Completely rewrote the visualization method. Now completely integrates in the mayavi pipelines, 138 | therefore axes and other modules/filters can be added at will 139 | - Now it's faster. A lot faster 140 | - All the segments are plotted, not only the section. This is extremely helpful with geometrical reconstruct 141 | neurons and networks. 142 | - Updated the docs and the screenshots. 143 | 144 | 0.5.2 -- 26 Jan 2011 145 | ==================== 146 | 147 | - Updated the version recall to GitPython 0.3.1 (used only if present!) 148 | - HocVector into NumpyArray for saving with swap in place, to reduce overhead 149 | - Restructured the package for an easier installation 150 | - Added the possibility to build documentation offline 151 | 152 | 153 | 0.5.1 - 23 Nov 2010 154 | =================== 155 | 156 | - Fixed the picking of the cylinder. Possible to select a cylinder 157 | clicking anywhere. 158 | - Possibility to plot points instead of a lines 159 | - BaseREf class are discriminated through the group id and not any more on 160 | class base. 161 | 162 | 163 | 0.5.0 - 19 Jun 2010 164 | =================== 165 | 166 | - Closed #16 167 | - Fixed some typos on the docs 168 | - Mechanisms are shown on the info tab 169 | - Refactored code for extensibility 170 | - Storage moved to a hdf file. 171 | - Extensibility to other kind of variables, not only vectors 172 | 173 | 0.4.4 - 1 Apr 2010 174 | ================== 175 | 176 | - Fixed the name on the README 177 | - Treeview updated everytime a database is loaded. 178 | 179 | 180 | 0.4.3 - 2 Mar 2010 181 | ================== 182 | 183 | - Info sections updated 184 | - Update the docs and website 185 | 186 | 187 | 0.4.2 - 18 Feb 2010 188 | =================== 189 | 190 | - Added simulation saving abilities. 191 | - Updated the doc 192 | 193 | 194 | 0.4.1 - 28 Jan 2010 195 | ======================== 196 | 197 | - Closed #13 198 | - Introduced a tab to retrieve info on the section 199 | 200 | 0.4.0 - 19 Jan 2010 201 | ======================== 202 | 203 | - Remplemented using Mayavi2 and Qt4 for better performance and better usability. 204 | - Cleanup and refactoring of the code. 205 | - Closed #11, #12, #15 206 | 207 | 0.3.5 - 20 Nov 2009 208 | =================== 209 | 210 | - Using sphinx for the doc 211 | - Using paver for deployment 212 | - python egg and easy install support 213 | - User manuel available in pdf format 214 | 215 | 216 | 0.3.4 - 15 Sep 2009 217 | =================== 218 | 219 | - Changed the way the module is imported to allow other program to use the manager 220 | as a storing objects for results. 221 | 222 | 0.3.3 - 3 Sep 2009 223 | ================== 224 | 225 | - Integrated the pylab interface using the GTK backend provided by pylab. 226 | It is possible to zoom and navigate the graph with the pylab tools. 227 | - It is now possible to decide in which figure to plot, using the current figure selector. 228 | 229 | 0.3.22 - 31 Jul 2009 230 | ==================== 231 | 232 | - Closed bug #10 233 | - Changed the name of the module from nrnVisio to nrnvisio to be python 234 | standard compliant. 235 | - Manager being transformed into a library (WIP) 236 | 237 | 0.3.21 - 20 Jul 2009 238 | ==================== 239 | 240 | - Better handling of the pick section routine 241 | - Changed the examples to use the create statement for hoc, to have 242 | a proper name of the section also in python. 243 | - Modified the GUI to handle a runtime change of a section. The model is redrawn 244 | completely, the zoom is conserved. 245 | 246 | 0.3.2 - 20 Jul 2009 247 | =================== 248 | 249 | Bug Release. Closed Bug #9 250 | 251 | 0.3.1 - 18 Jul 2009 252 | =================== 253 | 254 | Bug Release. 255 | 256 | 0.3.0 - 14 Jul 2009 257 | =================== 258 | 259 | New Features 260 | ------------ 261 | 262 | - Stop Button on the animation Control 263 | - Better handling on the timeline updating routine. 264 | 265 | BUGFixes 266 | -------- 267 | 268 | - Closed bug #8 269 | - Closed bug #3 270 | 271 | 272 | 0.2.0 - 6 Jul 2009 273 | ================== 274 | 275 | New Features 276 | ------------ 277 | 278 | Some new features has been introduced: 279 | 280 | - User defined color. The user can now change the colors of the model for a better contrast. 281 | - Info tab. Reports the properties of the selected section. 282 | 283 | BUGFixes 284 | -------- 285 | 286 | - Closed bug #4 287 | - Closed bug #5 288 | - Closed bug #6 289 | 290 | 291 | 292 | 0.1.0 - 30 Jun 2009 293 | =================== 294 | 295 | Fist public release. 296 | 297 | Features 298 | -------- 299 | 300 | - 3D visualization of the model with the possibility to change it runtime 301 | - Creation of vectors to record any variable present in the section 302 | - Pylab integration to plot directly the result of the simulation 303 | - Explore of the timecourse of any variable among time using a color coded scale in the 3d representation 304 | - the GUI runs in its own thread so it's possible to use the console to modify/interact with the model. 305 | -------------------------------------------------------------------------------- /Deployment.rst: -------------------------------------------------------------------------------- 1 | ========== 2 | Deployment 3 | ========== 4 | 5 | To update the docs just do 6 | 7 | paver docs 8 | 9 | To submit it to github 10 | 11 | paver ghpages 12 | 13 | In one go 14 | 15 | paver update_docs 16 | 17 | 18 | Making the release and pushing on piPy 19 | ------------------------------------- 20 | 21 | paver sdist upload 22 | 23 | 24 | Tools used for development 25 | -------------------------- 26 | 27 | Paved==0.4.1 28 | Paver==1.0.5 29 | Sphinx==1.1.3 30 | ghp-import==0.1.8 31 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Neuronvisio is a user interface for NEURON simulator environment 2 | 3 | Copyright (c) 2009, Michele Mattioni 4 | All rights reserved. 5 | 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | include *.rst 3 | include setup.py 4 | 5 | include neuronvisio/modeldb/ModelDB.xml 6 | recursive-include neuronvisio/ui * 7 | recursive-include examples * 8 | recursive-include docs * 9 | prune docs/_build 10 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Neuronvisio 2 | =========== 3 | 4 | .. image:: https://readthedocs.org/projects/neuronvisio/badge/?version=latest 5 | :target: https://readthedocs.org/projects/neuronvisio/?badge=latest 6 | :alt: Documentation Status 7 | 8 | .. image:: https://img.shields.io/pypi/v/neuronvisio.svg 9 | :target: https://pypi.python.org/pypi/neuronvisio 10 | 11 | What is it 12 | ---------- 13 | 14 | Neuronvisio is a Graphical User Interface for `NEURON simulator environment 15 | `_. 16 | Neuronvisio connect with NEURON using the new python NEURON interface. 17 | 18 | Features 19 | -------- 20 | 21 | - 3D visualization of the model with the possibility to change it runtime 22 | - Creation of vectors to record any variables present in the section 23 | - Pylab integration to plot directly the result of the simulation 24 | - Exploration of the timecourse of any variable among time using a color coded scale 25 | - the GUI runs in its own thread so it's possible to use the console (integrated with IPython) 26 | - automatically download and load models from `ModelDB `_ 27 | 28 | More info are available on the homepage: http://neuronvisio.org 29 | 30 | Offline Documentation 31 | --------------------- 32 | 33 | To create offline documentation similar to the one online you will need 34 | sphinx http://sphinx.pocoo.org/ installed. 35 | 36 | Move in the doc directory:: 37 | 38 | cd docs 39 | 40 | and then launch:: 41 | 42 | make html 43 | 44 | In the `_build/html` directory you will have the online doc. 45 | 46 | How To release 47 | -------------- 48 | 49 | 1. Update Changelog 50 | 2. Change version at `neuronvisio/__init__.py` 51 | 3. Change to same version in conda.recipe/meta.yaml 52 | 4. Commit everything 53 | 5. Tag repo 54 | `python setup.py tag` 55 | 6. Upload to pipy and anaconda.org 56 | - PiPy: 57 | 58 | python setup.py make_release 59 | 60 | - Anaconda.org: 61 | Got to anaconda.org and click on the website so the last build will be uploaded 62 | to the channel. 63 | -------------------------------------------------------------------------------- /conda.recipe/build.sh: -------------------------------------------------------------------------------- 1 | $PYTHON setup.py install 2 | -------------------------------------------------------------------------------- /conda.recipe/meta.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: neuronvisio 3 | version: 0.9.1 4 | 5 | source: 6 | # Change to match the most recent release 7 | #git_tag: 0.8.7.dev0 8 | git_url: ../ 9 | 10 | build: 11 | number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }} 12 | entry_points: 13 | - neuronvisio = neuronvisio.command_line:main_neuronvisio 14 | - neuronvisio-model-updater = neuronvisio.commandline:main_model_updater 15 | 16 | test: 17 | imports: 18 | - neuronvisio 19 | 20 | requirements: 21 | build: 22 | - python 23 | run: 24 | - python 25 | - neuron 26 | - mayavi 27 | - traits 28 | - ipython 29 | - matplotlib 30 | - pytables 31 | 32 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | # the i18n builder cannot share the environment and doctrees with the others 15 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 16 | 17 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 18 | 19 | help: 20 | @echo "Please use \`make ' where is one of" 21 | @echo " html to make standalone HTML files" 22 | @echo " dirhtml to make HTML files named index.html in directories" 23 | @echo " singlehtml to make a single large HTML file" 24 | @echo " pickle to make pickle files" 25 | @echo " json to make JSON files" 26 | @echo " htmlhelp to make HTML files and a HTML help project" 27 | @echo " qthelp to make HTML files and a qthelp project" 28 | @echo " devhelp to make HTML files and a Devhelp project" 29 | @echo " epub to make an epub" 30 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 31 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 32 | @echo " text to make text files" 33 | @echo " man to make manual pages" 34 | @echo " texinfo to make Texinfo files" 35 | @echo " info to make Texinfo files and run them through makeinfo" 36 | @echo " gettext to make PO message catalogs" 37 | @echo " changes to make an overview of all changed/added/deprecated items" 38 | @echo " linkcheck to check all external links for integrity" 39 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 40 | 41 | clean: 42 | -rm -rf $(BUILDDIR)/* 43 | 44 | html: 45 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 48 | 49 | dirhtml: 50 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 51 | @echo 52 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 53 | 54 | singlehtml: 55 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 56 | @echo 57 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 58 | 59 | pickle: 60 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 61 | @echo 62 | @echo "Build finished; now you can process the pickle files." 63 | 64 | json: 65 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 66 | @echo 67 | @echo "Build finished; now you can process the JSON files." 68 | 69 | htmlhelp: 70 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 71 | @echo 72 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 73 | ".hhp project file in $(BUILDDIR)/htmlhelp." 74 | 75 | qthelp: 76 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 77 | @echo 78 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 79 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 80 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Neuronvisio.qhcp" 81 | @echo "To view the help file:" 82 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Neuronvisio.qhc" 83 | 84 | devhelp: 85 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 86 | @echo 87 | @echo "Build finished." 88 | @echo "To view the help file:" 89 | @echo "# mkdir -p $$HOME/.local/share/devhelp/Neuronvisio" 90 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Neuronvisio" 91 | @echo "# devhelp" 92 | 93 | epub: 94 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 95 | @echo 96 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 97 | 98 | latex: 99 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 100 | @echo 101 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 102 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 103 | "(use \`make latexpdf' here to do that automatically)." 104 | 105 | latexpdf: 106 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 107 | @echo "Running LaTeX files through pdflatex..." 108 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 109 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 110 | 111 | text: 112 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 113 | @echo 114 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 115 | 116 | man: 117 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 118 | @echo 119 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 120 | 121 | texinfo: 122 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 123 | @echo 124 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 125 | @echo "Run \`make' in that directory to run these through makeinfo" \ 126 | "(use \`make info' here to do that automatically)." 127 | 128 | info: 129 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 130 | @echo "Running Texinfo files through makeinfo..." 131 | make -C $(BUILDDIR)/texinfo info 132 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 133 | 134 | gettext: 135 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 136 | @echo 137 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 138 | 139 | changes: 140 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 141 | @echo 142 | @echo "The overview file is in $(BUILDDIR)/changes." 143 | 144 | linkcheck: 145 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 146 | @echo 147 | @echo "Link check complete; look for any errors in the above output " \ 148 | "or in $(BUILDDIR)/linkcheck/output.txt." 149 | 150 | doctest: 151 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 152 | @echo "Testing of doctests in the sources finished, look at the " \ 153 | "results in $(BUILDDIR)/doctest/output.txt." 154 | -------------------------------------------------------------------------------- /docs/_static/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/.gitignore -------------------------------------------------------------------------------- /docs/_static/Mattioni_Neuronvisio.bib: -------------------------------------------------------------------------------- 1 | @ARTICLE{Mattioni2012, 2 | author = {Mattioni, Michele and Cohen, Uri and Le Nov\`{e}re, Nicolas}, 3 | title = {Neuronvisio: a Graphical User Interface with 3D capabilities for NEURON}, 4 | journal = {Frontiers in Neuroinformatics}, 5 | VOLUME = {6}, 6 | YEAR = {2012}, 7 | NUMBER = {00020}, 8 | URL = {http://www.frontiersin.org/Journal/Abstract.aspx?s=752&name=neuroinformatics&ART_DOI=10.3389/fninf.2012.00020}, 9 | DOI = {10.3389/fninf.2012.00020}, 10 | ISSN = {1662-5196}, 11 | ABSTRACT = {The NEURON simulation environment is a commonly used tool to perform electrical simulation of neurons and neuronal networks. The NEURON User Interface, based on the now discontinued InterViews library, provides some limited facilities to explore models and to plot their simulation results. Other limitations include the inability to generate a three dimensional visualization, no standard mean to save the results of simulations, or to store the model geometry within the results. Neuronvisio (http://neuronvisio.org) aims to address these deficiencies through a set of well designed python APIs and provides an improved UI, allowing users to explore and interact with the model. 12 | 13 | Neuronvisio also facilitates access to previously published models, allowing usersto browse, download and locally run NEURON models stored in ModelDB. Neuronvisio uses the matplotlib library to plot simulation results and uses the HDF standard format to store simulation results. Neuronvisio can be viewed as an extension of NEURON, facilitating typical user workflows such as model browsing, selection, download, compilation and simulation. The 3D viewer simplifies the exploration of complex model structure, while matplotlib permits the plotting of high-quality graphs. The newly introduced ability of saving numerical results allows users to perform additional analysis on their previous simulations.} 14 | -------------------------------------------------------------------------------- /docs/_static/Neuronvisio_3D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/Neuronvisio_3D.png -------------------------------------------------------------------------------- /docs/_static/Neuronvisio_Controls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/Neuronvisio_Controls.png -------------------------------------------------------------------------------- /docs/_static/Neuronvisio_Controls_Init_and_Run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/Neuronvisio_Controls_Init_and_Run.png -------------------------------------------------------------------------------- /docs/_static/Neuronvisio_Controls_selecting_variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/Neuronvisio_Controls_selecting_variable.png -------------------------------------------------------------------------------- /docs/_static/Neuronvisio_Refs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/Neuronvisio_Refs.png -------------------------------------------------------------------------------- /docs/_static/Neuronvisio_sec_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/Neuronvisio_sec_info.png -------------------------------------------------------------------------------- /docs/_static/Simple_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/Simple_model.png -------------------------------------------------------------------------------- /docs/_static/cerebellum_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/cerebellum_network.png -------------------------------------------------------------------------------- /docs/_static/hdf_neuronvisio_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/hdf_neuronvisio_structure.png -------------------------------------------------------------------------------- /docs/_static/neuronWithSpines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/neuronWithSpines.png -------------------------------------------------------------------------------- /docs/_static/neuronvisio_main_control.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/neuronvisio_main_control.png -------------------------------------------------------------------------------- /docs/_static/neuronvisio_modelDB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/neuronvisio_modelDB.png -------------------------------------------------------------------------------- /docs/_static/nrnvisio-mayavi-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/nrnvisio-mayavi-color.png -------------------------------------------------------------------------------- /docs/_static/nrnvisio-mayavi-color2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/nrnvisio-mayavi-color2.png -------------------------------------------------------------------------------- /docs/_static/nrnvisio-user-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/nrnvisio-user-color.png -------------------------------------------------------------------------------- /docs/_static/plotting_vector_results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/plotting_vector_results.png -------------------------------------------------------------------------------- /docs/_static/pylab_integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/pylab_integration.png -------------------------------------------------------------------------------- /docs/_static/pyramidal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/pyramidal.png -------------------------------------------------------------------------------- /docs/_static/pyramidal_3D_change_voltage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/pyramidal_3D_change_voltage.png -------------------------------------------------------------------------------- /docs/_static/spines_detailed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/spines_detailed.png -------------------------------------------------------------------------------- /docs/_static/voltage_variations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_static/voltage_variations.png -------------------------------------------------------------------------------- /docs/_templates/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/docs/_templates/.gitignore -------------------------------------------------------------------------------- /docs/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | 3 | {%- block extrahead %} 4 | {{ super() }} 5 | 10 | {% endblock %} 11 | 12 | {% block footer %} 13 | {{ super() }} 14 | 31 | {% endblock %} 32 | -------------------------------------------------------------------------------- /docs/changes.rst: -------------------------------------------------------------------------------- 1 | ********************** 2 | Changes in Neuronvisio 3 | ********************** 4 | 5 | .. include:: ../CHANGES.rst 6 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys,os 4 | import neuronvisio 5 | 6 | project = "Neuronvisio" 7 | author = neuronvisio.__authors__ 8 | version = neuronvisio.__version__ 9 | release = version 10 | copyright = '2009 - 2015, Michele Mattioni' 11 | 12 | # Extension 13 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 14 | 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 15 | 'sphinx.ext.autosummary'] 16 | 17 | 18 | intersphinx_mapping = {'http://docs.python.org/': None} 19 | htmlhelp_basename = 'Neuronvisiodoc' 20 | # Source 21 | master_doc = 'index' 22 | templates_path = ['_templates'] 23 | source_suffix = '.rst' 24 | exclude_trees = [] 25 | pygments_style = 'sphinx' 26 | 27 | 28 | # -- Options for HTML output --------------------------------------------------- 29 | 30 | # The theme to use for HTML and HTML Help pages. Major themes that come with 31 | # Sphinx are currently 'default' and 'sphinxdoc'. 32 | html_theme = 'sphinxdoc' 33 | 34 | # Theme options are theme-specific and customize the look and feel of a theme 35 | # further. For a list of options available for each theme, see the 36 | # documentation. 37 | #html_theme_options = {} 38 | 39 | # Add any paths that contain custom themes here, relative to this directory. 40 | html_theme_path = ['_template'] 41 | 42 | # The name for this set of Sphinx documents. If None, it defaults to 43 | # " v documentation". 44 | #html_title = None 45 | 46 | # A shorter title for the navigation bar. Default is the same as html_title. 47 | #html_short_title = None 48 | 49 | # The name of an image file (relative to this directory) to place at the top 50 | # of the sidebar. 51 | #html_logo = None 52 | 53 | # The name of an image file (within the static path) to use as favicon of the 54 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 55 | # pixels large. 56 | #html_favicon = None 57 | 58 | # Add any paths that contain custom static files (such as style sheets) here, 59 | # relative to this directory. They are copied after the builtin static files, 60 | # so a file named "default.css" will overwrite the builtin "default.css". 61 | html_static_path = ['_static'] 62 | 63 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 64 | # using the given strftime format. 65 | html_last_updated_fmt = '%b %d, %Y' 66 | 67 | # If true, SmartyPants will be used to convert quotes and dashes to 68 | # typographically correct entities. 69 | html_use_smartypants = True 70 | 71 | # Custom sidebar templates, maps document names to template names. 72 | #html_sidebars = {} 73 | 74 | # Additional templates that should be rendered to pages, maps page names to 75 | # template names. 76 | #html_additional_pages = {} 77 | 78 | # If false, no module index is generated. 79 | #html_use_modindex = True 80 | 81 | # If false, no index is generated. 82 | #html_use_index = True 83 | 84 | # If true, the index is split into individual pages for each letter. 85 | #html_split_index = False 86 | 87 | # If true, links to the reST sources are added to the pages. 88 | #html_show_sourcelink = True 89 | 90 | # If true, an OpenSearch description file will be output, and all pages will 91 | # contain a tag referring to it. The value of this option must be the 92 | # base URL from which the finished HTML is served. 93 | #html_use_opensearch = '' 94 | 95 | # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). 96 | #html_file_suffix = '' 97 | 98 | # Output file base name for HTML help builder. 99 | htmlhelp_basename = '%sdoc' % project 100 | 101 | # -- Options for LaTeX output -------------------------------------------------- 102 | 103 | # The paper size ('letter' or 'a4'). 104 | latex_paper_size = 'a4' 105 | 106 | # The font size ('10pt', '11pt' or '12pt'). 107 | #latex_font_size = '10pt' 108 | 109 | # Grouping the document tree into LaTeX files. List of tuples 110 | # (source start file, target name, title, author, documentclass [howto/manual]). 111 | 112 | # latex build settings 113 | latex_documents = [ 114 | ('index', '%s.tex' % project, u'%s Documentation' % project, 115 | "Michele Mattioni", 'manual', True), 116 | ] 117 | 118 | # The name of an image file (relative to this directory) to place at the top of 119 | # the title page. 120 | #latex_logo = None 121 | 122 | # For "manual" documents, if this is true, then toplevel headings are parts, 123 | # not chapters. 124 | latex_use_parts = False 125 | 126 | # Additional stuff for the LaTeX preamble. 127 | #latex_preamble = '' 128 | 129 | # Documents to append as an appendix to all manuals. 130 | #latex_appendices = [] 131 | 132 | # If false, no module index is generated. 133 | #latex_use_modindex = True 134 | 135 | # Extension Options 136 | autoclass_content='both' 137 | 138 | # Mocking class existence for ReadTheDocs autodoc 139 | 140 | import sys 141 | 142 | class Mock(object): 143 | def __init__(self, *args, **kwargs): 144 | pass 145 | 146 | def __call__(self, *args, **kwargs): 147 | return Mock() 148 | 149 | @classmethod 150 | def __getattr__(self, name): 151 | if name in ('__file__', '__path__'): 152 | return '/dev/null' 153 | elif name[0] == name[0].upper(): 154 | return type(name, (), {}) 155 | else: 156 | return Mock() 157 | 158 | #MOCK_MODULES = ['neuron', 'numpy', 'tables', 'bisect', 159 | # 'pyface', 'pyface.qt', 160 | # 'traits', 'traits.api', 'traitsui', 'traitsui.api', 161 | # 'matplotlib', 'matplotlib.pyplot', 162 | # 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui', 163 | # 'mayavi', 'mayavi.core', 'mayavi.core.ui','mayavi.core.ui.api'] 164 | #for mod_name in MOCK_MODULES: 165 | # sys.modules[mod_name] = Mock() 166 | 167 | -------------------------------------------------------------------------------- /docs/controls.rst: -------------------------------------------------------------------------------- 1 | :mod:`neuronvisio.controls` -- User Interface module 2 | ==================================================== 3 | 4 | .. automodule:: neuronvisio.controls 5 | 6 | :class:`Controls` 7 | ----------------- 8 | 9 | .. autoclass:: Controls 10 | :members: 11 | 12 | :class:`Timeloop` 13 | ----------------- 14 | 15 | .. autoclass:: Timeloop 16 | :members: 17 | -------------------------------------------------------------------------------- /docs/gettingstarted.rst: -------------------------------------------------------------------------------- 1 | .. _getting started: 2 | 3 | *************** 4 | Getting Started 5 | *************** 6 | 7 | How does it work 8 | ================ 9 | 10 | To run Neuronvisio you can either use the provided `neuronvisio` executable, 11 | which will create an ipython_ session:: 12 | 13 | $ neuronvisio 14 | 15 | .. _ipython: http://ipython.org/ 16 | 17 | .. note:: On windows, you can launch it with `neuronvisio.bat` 18 | 19 | or you can start ipython and load neuronvisio from within your script, 20 | as explained in section `How to integrate Neuronvisio with your code`_ 21 | 22 | To load Neuronvisio just paste this two lines in ipython:: 23 | 24 | from neuronvisio.controls import Controls 25 | controls = Controls() # starting the GUI 26 | 27 | The Control class run the main loop of the application with all the GUI activities 28 | in its own thread. The console is ready for input so you can enter your command to 29 | the prompt as you would do normally when using NEURON_. 30 | 31 | .. _NEURON: http://www.neuron.yale.edu/neuron/ 32 | 33 | .. _loading-a-file: 34 | 35 | Loading a file 36 | -------------- 37 | 38 | You can also load 3 different formats right now: 39 | 40 | 1. A NeuroML file (.xml) 41 | 2. A NEURON hoc file hoc file (.hoc) 42 | 3. A HDF file formatted according to Neuronvisio format, (.h5). Check `storage`. 43 | 44 | to load any of them just pass it as an argument:: 45 | 46 | $ neuronvisio path/to/my/file.hoc (or .h5, or .xml) 47 | 48 | .. note: The import of the NeuroML is done using the current NeuroML importer facilities provided with NEURON, which they are not working all the time. When released, we will switch to libNeuroML_. 49 | 50 | .. _libNeuroML: https://github.com/NeuralEnsemble/libNeuroML 51 | 52 | How to integrate Neuronvisio with your code 53 | =========================================== 54 | 55 | The integration is rather simple and you can use either the python or the hoc 56 | scripts that you already have. 57 | 58 | .. _python-integration: 59 | 60 | Python integration 61 | ------------------ 62 | 63 | If you have a model written in python, just import the module on top of your 64 | script. The simple example (in the example directory) give you an idea how to do 65 | it. 66 | 67 | A classical template is:: 68 | 69 | from neuronvisio.controls import Controls 70 | from neuron import h 71 | controls = Controls() # starting the GUI 72 | # Your model here 73 | 74 | .. _hoc-integration: 75 | 76 | Hoc Intergration 77 | ---------------- 78 | 79 | You have to load your hoc script using the python interface of _NEURON. 80 | The pyramidal example gives an idea how to integrate existent _NEURON model 81 | with it. 82 | 83 | A classical template is:: 84 | 85 | from neuronvisio.controls import Controls 86 | from neuron import h 87 | controls = Controls() # starting the GUI 88 | h.load_file('path/to/my_model.hoc') 89 | 90 | Neuronvisio features 91 | ==================== 92 | 93 | Visualization 94 | ------------- 95 | 96 | To visualize you model after you loaded you have to click the Plot3d button. 97 | 98 | .. image:: _static/neuronvisio_main_control.png 99 | 100 | 101 | The 3D window will open showing your model: 102 | 103 | .. image:: _static/Neuronvisio_3D.png 104 | 105 | How to rotate 106 | ------------- 107 | 108 | Hold the left button and move the mouse. 109 | 110 | How to zoom 111 | ----------- 112 | 113 | Use your mouse's wheel or the right button of the mouse. 114 | 115 | How to move 116 | ----------- 117 | 118 | Hold the wheel down and move the mouse. 119 | 120 | Plotting the simulation results 121 | =============================== 122 | 123 | Creating the vectors 124 | -------------------- 125 | 126 | To plot the simulation's results you first have to create a Vector 127 | (or more than one) to record the variable that you are interested in. 128 | 129 | For example if you are interested in the voltage you have to insert `v` 130 | in the 'Variable to record` and click `Create Vector`. 131 | 132 | .. image:: _static/neuronvisio_main_control.png 133 | 134 | Run the simulation 135 | ------------------ 136 | 137 | The simulation can be run clicking on the `Init & Run` button. 138 | It will run until the tstop. 139 | 140 | .. image:: _static/neuronvisio_main_control.png 141 | 142 | 143 | Plotting the simulation 144 | ----------------------- 145 | 146 | To plot the results click on the tab 'Plots' and select the variable 147 | from the section you want to plot. Then click `Plot`. 148 | 149 | If you want to plot more variables in one go hold `Ctrl` and select as 150 | many as you want, then click `Plot` 151 | 152 | If you want to insert the legend just select the `legend box` 153 | 154 | .. image:: _static/plotting_vector_results.png 155 | :scale: 70 156 | 157 | Investigate the section parameters 158 | ================================== 159 | 160 | Select a section (Just click over it) and the section info 161 | will be displayed in the Sec Info Tab. 162 | 163 | .. image:: _static/Neuronvisio_sec_info.png 164 | :scale: 80 165 | 166 | ModelDB Integration 167 | =================== 168 | 169 | This section describe how to load a model from ModelDb in Neuronvisio, 170 | and how to get the latest model from the ModelDB, if they are not 171 | already present in the ModelDB XML list. 172 | 173 | Browsing the NEURON models from ModelDB 174 | --------------------------------------- 175 | 176 | ModelDB database is a lightly curated repository of computational models, 177 | published in litterature http://senselab.med.yale.edu/ModelDB/. While 178 | ModelDB accepts models in a variety of format, a large subset is formed 179 | by models stored in NEURON format. The ModelDB NEURON’s model are stored 180 | in an XML file, which comes with Neuronvisio source code. The file is 181 | parsed at run time and the content is loaded in a Qt tree widget, 182 | available in the ModelDB explorer tab. 183 | 184 | It is possible to browse among all the available models 185 | per year of publication, authors, title and unique id number. The columns 186 | can be ordered alphabetically, and it is possible to perform a simple search, 187 | writing the desired keyword in the search box. 188 | 189 | If available, the README associated with the model is displayed, 190 | together with a custom model overview which summarizes the features of 191 | the model, enumerating the type of channels used, the cell types, the 192 | brain region, etc. 193 | 194 | .. image:: _static/neuronvisio_modelDB.png 195 | 196 | Loading a NEURON model from ModelDB 197 | ----------------------------------- 198 | 199 | Any of the models available on the ModelDB explorer tab can downloaded and extracted. 200 | The models which have a `mosinit.hoc` will also be compiled and loaded in the current 201 | session, giving the user the possibility to explore and simulate the model. 202 | 203 | If no `mosinit.hoc` is found, the software will open the folder where the model has been downloaded, 204 | warning the user of the impossibility to load it automatically. 205 | 206 | .. note:: if the model does not have a `mosinit.hoc`, Neuronvisio cannot load it, because does not know what to load as master file. You can always load the relevant file following the section :ref:`hoc-integration` or :ref:`python-integration`. 207 | 208 | 209 | 210 | Updating information from ModelDB 211 | --------------------------------- 212 | 213 | The content of the XML file which is included with each version of 214 | Neuronvisio is usually up-to-date with the content of ModelDB at the time 215 | of the release. Updating this file from the online DB can be done by 216 | manually, if required, by running from any shell the script 217 | `neuronvisio-modeldb-updater`. Neuronvisio updater will find where the 218 | current `ModelDB.xml` is stored, and update with the latest items, if any. 219 | 220 | .. note:: You need to be able to write on the `ModelDB.xml` location. If you have installed the package as root, you may need to run it as root. 221 | 222 | It should be noted that the model extraction from ModelDB is slowed down 223 | to 1/sec in order to avoid loading the site. Also this process only 224 | update the file with models which do not exist in the local XML file 225 | and does not currently refresh the content of existing ones. 226 | 227 | Troubleshooting 228 | =============== 229 | 230 | If you start ipython with the `--pylab=qt` switch and get and error like:: 231 | 232 | /usr/local/lib/python2.7/dist-packages/pyface/qt/__init__.py in prepare_pyqt4() 233 | 15 # Set PySide compatible APIs. 234 | 235 | 16 import sip 236 | ---> 17 sip.setapi('QString', 2) 237 | 18 sip.setapi('QVariant', 2) 238 | 19 239 | 240 | ValueError: API 'QString' has already been set to version 1 241 | 242 | 243 | It means ipython has loaded the PyQt4 using the Version 1 of the API, which 244 | is default on Python 2.7 (Version 2 is default on Python 3.) 245 | 246 | To solve this you can either define the variable `QT_API=pyqt`, e.g. in bash:: 247 | 248 | $ export QT_API=pyqt 249 | $ ipython --pylab=qt 250 | 251 | Or you can launch ipython without pylab support, load Neuronvisio and then 252 | load pylab with the magic `%pylab`. 253 | 254 | Picking the right backend 255 | ------------------------- 256 | 257 | If when you try to plot matplotlib segfault, you may have the wrong backend selected. 258 | Neuronvisio try to set the right backed, but if you start ipython with --pylab, automatically 259 | a bakcend is loaded and we can't change it due to matplotlib technical limitation. 260 | 261 | To solve this, just `customize your matplotlibrc`_ downloading the matplotlibrc_, saving 262 | the file in `.matplotlib/matplotlibrc` and changing the backend to `Qt4Agg`, from:: 263 | 264 | backend : GTKAgg 265 | 266 | to:: 267 | 268 | backend : Qt4Agg 269 | 270 | .. _matplotlibrc: http://matplotlib.sourceforge.net/_static/matplotlibrc 271 | .. _customize your matplotlibrc: http://matplotlib.sourceforge.net/users/customizing.html#customizing-matplotlib -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | *********** 2 | Neuronvisio 3 | *********** 4 | 5 | What is it 6 | ========== 7 | 8 | Neuronvisio is a Graphical User Interface for `NEURON simulator environment 9 | `_ with 3D capabilities. Neuronvisio 10 | makes easy to select and investigate sections' properties and it offers 11 | easy integration with matplotlib for plotting the results. 12 | 13 | The geometry can be saved using NeuroML_ and the computational results in 14 | a customised and extensible HDF5 format; the results can then be reload in the software 15 | and analysed in a later stage, without re-running the simulation. 16 | 17 | .. _NeuroML: http://www.neuroml.org/ 18 | 19 | 20 | Features 21 | ======== 22 | 23 | - 3D visualization of the model with the possibility to change it runtime 24 | - Creation of vectors to record any variables present in the section 25 | - Pylab integration to plot directly the result of the simulation 26 | - Exploration of the timecourse of any variable among time using a color coded scale 27 | - Saving the results simulation for later analysis 28 | - Automatic download and running of models in ModelDB_ 29 | 30 | .. _ModelDB: http://senselab.med.yale.edu/modeldb/ 31 | 32 | How to use it 33 | ============= 34 | 35 | Launch it from the terminal:: 36 | 37 | $ neuronvisio 38 | 39 | then check the :ref:`getting started` section for more info. 40 | 41 | Quick Links 42 | =========== 43 | 44 | - Install Neuronvisio: :ref:`install` 45 | - Browse the code: `Github Repo`_ 46 | - Subscribe to the Mailing List: `Google group`_ 47 | - Read the docs of any versions: `Read the docs`_ 48 | - Report an issue: `Issues tracker`_ 49 | 50 | .. _Google group: http://groups.google.com/group/neuronvisio 51 | .. _github repo: http://github.com/mattions/neuronvisio 52 | .. _Issues tracker: http://github.com/mattions/neuronvisio/issues 53 | .. _Read the docs: http://readthedocs.org/docs/neuronvisio/ 54 | 55 | 56 | How to cite Neuronvisio 57 | ======================= 58 | 59 | The paper describing Neuronvisio_ has been published in `Frontiers Neuroinformatics`_, 60 | here the text citation: 61 | 62 | .. note:: Mattioni M, Cohen U and Le Novère N (2012) Neuronvisio: a graphical user interface with 3D capabilities for NEURON. Front. Neuroinform. 6:20. doi: 10.3389/fninf.2012.00020 63 | 64 | or get the BibTeX_. 65 | 66 | .. _Frontiers Neuroinformatics: http://www.frontiersin.org/neuroinformatics/10.3389/fninf.2012.00020/abstract 67 | .. _Neuronvisio: http://neuronvisio.org 68 | .. _BibTeX: _static/Mattioni_Neuronvisio.bib 69 | 70 | Contents 71 | ======== 72 | 73 | .. toctree:: 74 | :maxdepth: 2 75 | 76 | install 77 | gettingstarted 78 | storage 79 | screenshots 80 | reference 81 | changes 82 | 83 | Indices and tables 84 | ================== 85 | 86 | * :ref:`genindex` 87 | * :ref:`modindex` 88 | * :ref:`search` 89 | -------------------------------------------------------------------------------- /docs/install.rst: -------------------------------------------------------------------------------- 1 | .. _install: 2 | 3 | ******* 4 | Install 5 | ******* 6 | 7 | Requirements 8 | ============ 9 | 10 | To install Neuronvisio you need to satisfy the following dependencies 11 | 12 | - PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/download 13 | - matplotlib: http://matplotlib.sourceforge.net/ 14 | - setuptools: http://pypi.python.org/pypi/setuptools 15 | - pytables: http://www.pytables.org/ 16 | - ipython: http://ipython.org 0.12 (can be automatically installed, see `Package Install`_) 17 | - mayavi2: http://code.enthought.com/projects/mayavi/ 4.2.0 or better (can be automatically installed, see `Package Install`_) 18 | 19 | and of course NEURON_>=7.2 compiled with python support 20 | 21 | .. _NEURON: http://www.neuron.yale.edu/neuron/ 22 | 23 | Easy Way: Use conda 24 | ------------------- 25 | 26 | You can install all the dependencies and everything you need (also NEURON) to run Neuronvisio with one command 27 | once you have conda installed. If you do not have, get it from here (http://conda.pydata.org/miniconda.html) 28 | :: 29 | 30 | # Create a new environment and install neuronvisio there 31 | conda create -n neuronvisio_env neuronvisio -c mattions 32 | 33 | After the installation activate the environment and you good to go: 34 | :: 35 | 36 | source activate neuronvisio_env 37 | neuronvisio 38 | 39 | If the HOC file does not get found, export NEURONHOME variable like 40 | :: 41 | export NEURONHOME=$CONDA_ENV_PATH/share/nrn/ 42 | neuronvisio 43 | 44 | The packages are made only for linux-x64, but we are looking into expanding them to 45 | all the supported platforms. 46 | 47 | Otherwise you could install by hand following the instructions below. 48 | 49 | Ubuntu and friends 50 | ------------------ 51 | 52 | On Ubuntu you can easily install all the requirements using apt-get with:: 53 | 54 | sudo apt-get install python-qt4 python-matplotlib python-setuptools python-tables \ 55 | mayavi2 56 | 57 | If you are running a different flavour of GNU/Linux, like Fedora for example, just install 58 | the requirements with your package manager. 59 | 60 | Next, see the instructions on installation of NEURON with Python available at 61 | http://andrewdavison.info/notes/installation-neuron-python/ 62 | 63 | Proceed to the `Package Install`_ . 64 | 65 | 66 | Mac OS X 67 | --------- 68 | 69 | Install the Homebrew package manager:: 70 | 71 | ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" 72 | 73 | Ensure your homebrew installation is fully updated:: 74 | 75 | brew update 76 | 77 | and "raring to brew" (configured to Homebrew's liking) by following the instructions given by:: 78 | 79 | brew doctor 80 | 81 | For example, it is critical to ensure sure that you don't have another python distribution on your path (eg. Enthought), and it is also recommended that you place "/usr/local/bin" before "/usr/bin" in your PATH variable set in your "$HOME/.bash_profile" settings file. 82 | 83 | Install all the homebrew packages you need, including the Homebrew version of python. NB: It is recommended by a few internet sources (eg. https://python-guide.readthedocs.org/en/latest/starting/install/osx/) to install python as a framework (the '--framework' option below) but it is not strictly necessary for the installation of Neuronvisio:: 84 | 85 | brew install python --framework 86 | brew install qt 87 | brew install homebrew/science/hdf5 88 | 89 | At the time of writing, Mayavi (installed by the NeuronVisio package installer) doesn't work with the latest version of VTK (6.0.0) so you will need to install version 5.10.1 instead. Also, VTK has been moved to the homebrew-science "tap" so you will need to tap that first before installing it, i.e.:: 90 | 91 | brew tap homebrew/science 92 | cd /usr/local/Library/Taps/homebrew-science 93 | git checkout 27a4327 vtk.rb 94 | brew install vtk --python --qt --pyqt 95 | 96 | Install python packages using pip, ensuring that you are using the Homebrew version of pip, /usr/local/bin/pip, which you should be if you put /usr/local/bin before /usr/bin in your PATH variable (this can be checked using the "which pip" command). You may also run into problems if you have setuptools in your system python ('/Library/Python/2.7/site-packages'), in this case temporarily move the system setuptools to somewhere else for the rest of the installation procedure:: 97 | 98 | pip install numpy 99 | pip install matplotlib 100 | pip install numexpr 101 | pip install cython 102 | pip install ipython 103 | 104 | After installing ipython you will probably want to put a link to it somewhere on your path, eg. /usr/local/bin:: 105 | 106 | ln -s /usr/local/share/ipython /usr/local/bin/ipython 107 | 108 | Next, see the instructions on installation of NEURON with Python available at 109 | http://www.davison.webfactional.com/notes/installation-neuron-python/ (again ensuring you are using the Homebrew version of python '/usr/local/bin/python') 110 | 111 | Try the `Package Install`_ but if that fails use the `Source Code`_ instructions (I needed to do this at least) 112 | 113 | 114 | Windows 115 | ------- 116 | 117 | Under Windows it is recommended to get a prepackaged scientific python distribution 118 | which contains most of neuronvisio's dependencies, such as: 119 | 120 | - Enthought Distribution: http://www.enthought.com/products/epd.php (free for an 121 | academic use) 122 | - Python(x,y): http://www.pythonxy.com/foreword.php (free) 123 | 124 | Alternatively, if you want to do it yourself, you will need to manually install 125 | and configure the dependencies listed in `Requirements`_ 126 | 127 | A portable and already compiled version of NEURON for Python is available 128 | from https://bitbucket.org/uric/pyneuron/ or simply by using:: 129 | 130 | pip install PyNEURON 131 | 132 | Proceed to the `Package Install`_ . 133 | 134 | 135 | Package Install 136 | =============== 137 | 138 | To install Neuronvisio we suggest to create a virtualenv and install 139 | the packages there. Check out virtualenv_ and virtualenvwrapper_ 140 | 141 | .. _virtualenv: http://pypi.python.org/pypi/virtualenv 142 | .. _virtualenvwrapper: http://pypi.python.org/pypi/virtualenvwrapper 143 | 144 | If you have `pip`_ installed and all the requirements are already met you 145 | can install neuronvisio from PyPi_ typing:: 146 | 147 | pip install -U neuronvisio 148 | 149 | .. note:: Mayavi stack and ipython will be installed automatically as Neuronvisio requirements from PyPi. 150 | 151 | .. _PyPi: http://pypi.python.org/pypi/neuronvisio/ 152 | .. _pip: http://pypi.python.org/pypi/pip 153 | 154 | Running the bleeding edge 155 | ------------------------- 156 | 157 | If you want to run the latest code, directly from the repo, you can do it using pip:: 158 | 159 | pip install -e git+https://github.com/mattions/neuronvisio.git#egg=neuronvisio 160 | 161 | then you need to add the directory (the absolute path) to your PYTHONPATH (in bash):: 162 | 163 | export PYTHONPATH=$PYTHONPATH:/path-to-neuronvisio-dir 164 | 165 | .. _source-code-section: 166 | 167 | Source Code 168 | =========== 169 | 170 | The `source code`_ is on github_ at this address and git_ is used as software 171 | management tool 172 | 173 | .. _source code: http://github.com/mattions/neuronvisio 174 | .. _github: https://github.com/ 175 | .. _git: http://git-scm.com/ 176 | 177 | To install from the git just clone the repo:: 178 | 179 | git clone git://github.com/mattions/neuronvisio.git 180 | 181 | and then run:: 182 | 183 | python setup.py install 184 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 10 | set I18NSPHINXOPTS=%SPHINXOPTS% . 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. linkcheck to check all external links for integrity 37 | echo. doctest to run all doctests embedded in the documentation if enabled 38 | goto end 39 | ) 40 | 41 | if "%1" == "clean" ( 42 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 43 | del /q /s %BUILDDIR%\* 44 | goto end 45 | ) 46 | 47 | if "%1" == "html" ( 48 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 49 | if errorlevel 1 exit /b 1 50 | echo. 51 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 52 | goto end 53 | ) 54 | 55 | if "%1" == "dirhtml" ( 56 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 57 | if errorlevel 1 exit /b 1 58 | echo. 59 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 60 | goto end 61 | ) 62 | 63 | if "%1" == "singlehtml" ( 64 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 65 | if errorlevel 1 exit /b 1 66 | echo. 67 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 68 | goto end 69 | ) 70 | 71 | if "%1" == "pickle" ( 72 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 73 | if errorlevel 1 exit /b 1 74 | echo. 75 | echo.Build finished; now you can process the pickle files. 76 | goto end 77 | ) 78 | 79 | if "%1" == "json" ( 80 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 81 | if errorlevel 1 exit /b 1 82 | echo. 83 | echo.Build finished; now you can process the JSON files. 84 | goto end 85 | ) 86 | 87 | if "%1" == "htmlhelp" ( 88 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 89 | if errorlevel 1 exit /b 1 90 | echo. 91 | echo.Build finished; now you can run HTML Help Workshop with the ^ 92 | .hhp project file in %BUILDDIR%/htmlhelp. 93 | goto end 94 | ) 95 | 96 | if "%1" == "qthelp" ( 97 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 98 | if errorlevel 1 exit /b 1 99 | echo. 100 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 101 | .qhcp project file in %BUILDDIR%/qthelp, like this: 102 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Neuronvisio.qhcp 103 | echo.To view the help file: 104 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Neuronvisio.ghc 105 | goto end 106 | ) 107 | 108 | if "%1" == "devhelp" ( 109 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 110 | if errorlevel 1 exit /b 1 111 | echo. 112 | echo.Build finished. 113 | goto end 114 | ) 115 | 116 | if "%1" == "epub" ( 117 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 118 | if errorlevel 1 exit /b 1 119 | echo. 120 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 121 | goto end 122 | ) 123 | 124 | if "%1" == "latex" ( 125 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 129 | goto end 130 | ) 131 | 132 | if "%1" == "text" ( 133 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 134 | if errorlevel 1 exit /b 1 135 | echo. 136 | echo.Build finished. The text files are in %BUILDDIR%/text. 137 | goto end 138 | ) 139 | 140 | if "%1" == "man" ( 141 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 142 | if errorlevel 1 exit /b 1 143 | echo. 144 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 145 | goto end 146 | ) 147 | 148 | if "%1" == "texinfo" ( 149 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 150 | if errorlevel 1 exit /b 1 151 | echo. 152 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 153 | goto end 154 | ) 155 | 156 | if "%1" == "gettext" ( 157 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 158 | if errorlevel 1 exit /b 1 159 | echo. 160 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 161 | goto end 162 | ) 163 | 164 | if "%1" == "changes" ( 165 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 166 | if errorlevel 1 exit /b 1 167 | echo. 168 | echo.The overview file is in %BUILDDIR%/changes. 169 | goto end 170 | ) 171 | 172 | if "%1" == "linkcheck" ( 173 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 174 | if errorlevel 1 exit /b 1 175 | echo. 176 | echo.Link check complete; look for any errors in the above output ^ 177 | or in %BUILDDIR%/linkcheck/output.txt. 178 | goto end 179 | ) 180 | 181 | if "%1" == "doctest" ( 182 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 183 | if errorlevel 1 exit /b 1 184 | echo. 185 | echo.Testing of doctests in the sources finished, look at the ^ 186 | results in %BUILDDIR%/doctest/output.txt. 187 | goto end 188 | ) 189 | 190 | :end 191 | -------------------------------------------------------------------------------- /docs/manager.rst: -------------------------------------------------------------------------------- 1 | :mod:`neuronvisio.manager` -- Manage the map between vectors and sections 2 | ========================================================================= 3 | 4 | 5 | .. automodule:: neuronvisio.manager 6 | 7 | :class:`Manager` 8 | ---------------- 9 | 10 | .. autoclass:: Manager 11 | :members: 12 | 13 | :class:`BaseRef` 14 | ---------------- 15 | 16 | .. autoclass:: BaseRef 17 | :members: 18 | 19 | :class:`VecRef` 20 | --------------- 21 | 22 | .. autoclass:: VecRef 23 | :members: 24 | 25 | :class:`SynVecRef` 26 | ------------------ 27 | 28 | .. autoclass:: SynVecRef 29 | :members: 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/reference.rst: -------------------------------------------------------------------------------- 1 | ********* 2 | Reference 3 | ********* 4 | 5 | The API directly from the docstrings in the code_. 6 | 7 | .. _code: http://github.com/mattions/neuronvisio 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | manager 13 | visio 14 | controls 15 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | Babel==2.0 2 | Jinja2==2.8 3 | MarkupSafe==0.23 4 | Pygments==2.0.2 5 | Sphinx==1.3.1 6 | alabaster==0.7.6 7 | argparse==1.2.1 8 | docutils==0.12 9 | pytz==2015.4 10 | six==1.9.0 11 | snowballstemmer==1.2.0 12 | sphinx-rtd-theme==0.1.8 13 | wsgiref==0.1.2 14 | -------------------------------------------------------------------------------- /docs/screenshots.rst: -------------------------------------------------------------------------------- 1 | .. _screenshots: 2 | 3 | **************************************** 4 | How to take screenshots and make movies 5 | **************************************** 6 | 7 | GUI control 8 | =========== 9 | 10 | This is the Controls window. You can create vectors and run simulations. The time shows 11 | you the time of the NEURON_ simulator. 12 | 13 | .. _NEURON: http://www.neuron.yale.edu/neuron/ 14 | 15 | You can change the `tstop`, the `dt` and the initial voltage from the GUI or 16 | the console. 17 | 18 | .. image:: _static/Neuronvisio_Controls_Init_and_Run.png 19 | 20 | 3-D rendering 21 | ============= 22 | 23 | Rendering of a simple model with 3 section. 24 | 25 | .. image:: _static/Simple_model.png 26 | 27 | The neurons is rendered using the Mayavi pipeline, where is possibile to choose 28 | from different colormap and additional filters. 29 | Using the `GnBu` colormap with the Axes. 30 | 31 | .. image:: _static/nrnvisio-mayavi-color.png 32 | :scale: 70 33 | 34 | Using the `red-blue` colormap with the Axes. 35 | 36 | .. image:: _static/nrnvisio-mayavi-color2.png 37 | :scale: 70 38 | 39 | 3-rendering of a 3d-points reconstructed model 40 | ---------------------------------------------- 41 | 42 | Rendering of a more complex model, a pyramidal neuron. 43 | 44 | .. image:: _static/Neuronvisio_3D.png 45 | :scale: 70 46 | 47 | 48 | Timecourse movie and pylab graphs 49 | ================================= 50 | 51 | It is possible to follow the timecourse of a variable in the whole neuron or 52 | networks using the bottom slider, after the simulation has been ran, 53 | or reloaded. If a particular point in time is of interest, insert in the 54 | animation Time line textfield and hit return. 55 | 56 | The pylab graphs are integrated and can be easily generated with a click. 57 | For example here we shows hhow the voltage change in a simple model and in 58 | a pyramidal one. 59 | 60 | Pyramidal neuron 61 | ---------------- 62 | 63 | The propagation of the voltage among the neuron. The stimuli was given in the 64 | soma. 65 | 66 | .. image:: _static/pyramidal_3D_change_voltage.png 67 | :scale: 70 68 | 69 | The `pyramidal example`_ is shipped with Neuronvisio. 70 | 71 | .. _pyramidal example: https://github.com/mattions/neuronvisio/tree/master/examples/pyramidal 72 | 73 | Medium Spiny Neuron with explicit spines modelled 74 | ------------------------------------------------- 75 | 76 | There are more than 4000 sections in this model, where each spine is individually modelled 77 | and distributed on the MSN body. 78 | 79 | .. image:: _static/neuronWithSpines.png 80 | :scale: 50 81 | 82 | A zoomed version, with one spine's head selected. 83 | 84 | .. image:: _static/spines_detailed.png 85 | :scale: 30 86 | 87 | Pylab integration 88 | ----------------- 89 | 90 | It is possible to use the standard pylab tool and to plot the timecourses in 91 | the current figure, or create a new one just selecting another output figure 92 | number. 93 | 94 | .. image:: _static/pylab_integration.png 95 | :scale: 70 96 | 97 | Network example 98 | =============== 99 | 100 | Neuronvisio can handle the visualization of networks. 101 | For example check out the `Cerebellum Networks`_ example, ported to NEURON with 102 | neuroConstruct_. 103 | 104 | This `Cerebellum Network example`_ is shipped with Neuronvisio code. 105 | 106 | .. _neuroConstruct: http://www.neuroconstruct.org 107 | .. _Cerebellum Networks: http://www.neuroconstruct.org/samples/index.html#Ex6_CerebellumDemo-N101EA 108 | .. _Cerebellum Network example: https://github.com/mattions/neuronvisio/tree/master/examples/cerebellum_network 109 | .. image:: _static/cerebellum_network.png 110 | 111 | Making a movie 112 | ============== 113 | 114 | To make a movie it is possible to call the function :py:class:`neuronvisio.controls.Controls.make_animation_screenshots`:: 115 | 116 | controls.make_animation_screenshots(time_start, time_stop=None, 117 | saving_dir='anim') 118 | 119 | which will save all the screenshots in brand new directory (default is anim). 120 | To stack them in a movie, you can use ffmpeg with the following command:: 121 | 122 | ffmpeg -f image2 -r 10 -i %09d.png -sameq anim.mov -pass 2 123 | 124 | One of the example video, using the pyrimidal neuron can be seen here: 125 | http://www.youtube.com/watch?v=LOuptLKZ5rU -------------------------------------------------------------------------------- /docs/storage.rst: -------------------------------------------------------------------------------- 1 | ************************************** 2 | Saving and loading simulations' reults 3 | ************************************** 4 | 5 | 6 | HDF structure 7 | ============= 8 | 9 | Neuronvisio stores simulation's results using the hdf_ standard, using PyTables_ This is very handy 10 | when you simulation takes a long time to run and you want to inspect again the results, 11 | without re-run it. 12 | 13 | .. _hdf: http://www.hdfgroup.org/ 14 | .. _PyTables: http://www.pytables.org 15 | 16 | The file has a structure shown in the following _static 17 | 18 | .. image:: _static/hdf_neuronvisio_structure.png 19 | :scale: 30 20 | 21 | The Refs is the data structure used by Neuronvisio. The `VecRef` is the specialized one. It is possible to add more 22 | Ref subclassing the :class:`manager.BaseRef`. 23 | 24 | Using the manager object to store the results of your simulation 25 | ---------------------------------------------------------------- 26 | 27 | This is a quick example how to save the simulation in neuronvisio:: 28 | 29 | # Model geometry already instantiated. 30 | # 31 | from neuronvisio.manager import Manager 32 | manager = Manager() 33 | manager.add_all_vecRef('v') # Adding vector for the variable v 34 | 35 | # Perform your simulation 36 | # ... 37 | # 38 | 39 | # file where to save the results 40 | filename = 'storage.h5' 41 | # Saving the vectors 42 | manager.save_to_hdf(filename) 43 | 44 | If you run a lot of simulations you want maybe to run the same script but without rewriting 45 | the same results. Manager has a nice method to help you called create_new_dir:: 46 | 47 | saving_dir = manager.create_new_dir() # Create a new dir per Simulation, ordered by Day. 48 | hdf_name = 'storage.h5' 49 | filename = os.path.join(saving_dir, hdf_name) 50 | # Saving the vectors 51 | manager.save_to_hdf(filename) 52 | 53 | Loading a previous simulation 54 | ----------------------------- 55 | 56 | To load the results of a simulation you can start neuronvisio giving the path_to_the_hdf_file:: 57 | 58 | $ neuronvisio path/to/storage.h5 59 | 60 | or you can just start neuronvisio and use the Load button:: 61 | 62 | $ neuronvisio 63 | 64 | Saving your variables in storage.h5 and use Neuronvisio to plot them 65 | ==================================================================== 66 | 67 | The `BaseRef` can be used to store computational results which are not in NEURON 68 | vectors format. Every BaseRef object is contained in a group, which is specified 69 | by the `group_id` attribute. The group_id is than used by Neuronvisio to pair the 70 | saved vectors with the time vectors which is required to plot. 71 | 72 | To subclass the BaseRef just create a class:: 73 | 74 | from neuronvisio.manager import BaseRef 75 | 76 | class MyRef(BaseRef): 77 | 78 | def __init__(self, sec_name=None, vecs=None, detail=None): 79 | 80 | BaseRef.__init__(self) 81 | self.group_id = 'MyGroup' 82 | self.sec_name = sec_name 83 | self.vecs = vecs 84 | self.detail = detail 85 | 86 | 87 | Then you can create it:: 88 | 89 | myRef = MyRef(sec_name=sec_name, 90 | vecs=vecs, 91 | detail=detail) 92 | 93 | `sec_name` should be the name of the section where the variable is been recorded, 94 | vecs is a dictionary with the variable name as key and the python_list with the 95 | computed value. A numpy array or an HocVector is also accepted. 96 | 97 | After that you can add to the manager using the `manager.add_ref` which takes two 98 | arguments: 99 | 100 | - the myRef object 101 | - the x variable. 102 | 103 | The x variable is the independent one, usually the time, which will be used to plot the from the 104 | Neuronvisio graphical interface. If don't need to supply your own time vector, because is the 105 | same of the main NEURON one, you can use the `manager.groups['t']` which will return the 106 | NEURON time array:: 107 | 108 | manager.add_ref(myRef, x) 109 | 110 | All together is:: 111 | 112 | class MyRef(BaseRef): 113 | 114 | def __init__(self, sec_name=None, vecs=None, detail=None): 115 | 116 | BaseRef.__init__(self) 117 | self.sec_name = sec_name 118 | self.vecs = vecs 119 | self.detail = detail 120 | 121 | 122 | myRef = MyRef(sec_name=sec_name, 123 | vecs=vecs, 124 | detail=detail) 125 | manager.add_ref(myRef, x) 126 | 127 | Then you just need to save the file where is more convenient for you:: 128 | 129 | filename = 'storage.h5' 130 | # Saving the vectors 131 | manager.save_to_hdf(filename) 132 | 133 | When you reload the simulation you will have your variables back 134 | 135 | .. image:: _static/Neuronvisio_Refs.png -------------------------------------------------------------------------------- /docs/visio.rst: -------------------------------------------------------------------------------- 1 | :mod:`neuronvisio.visio` -- 3D Visual operations 2 | ================================================ 3 | 4 | .. automodule:: neuronvisio.visio 5 | 6 | :class:`Visio` 7 | -------------- 8 | 9 | .. autoclass:: Visio 10 | :members: 11 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: neuronvisio_env 2 | channels: 3 | - mattions 4 | dependencies: 5 | - apptools=4.2.1=py27_0 6 | - cairo=1.12.18=4 7 | - configobj=5.0.6=py27_0 8 | - decorator=4.0.2=py27_0 9 | - envisage=4.4.0=py27_1 10 | - fontconfig=2.11.1=4 11 | - freetype=2.5.2=2 12 | - ipython=4.0.0=py27_0 13 | - ipython_genutils=0.1.0=py27_0 14 | - iv=19=0 15 | - libgfortran=1.0=0 16 | - libpng=1.6.17=0 17 | - libxml2=2.9.2=0 18 | - matplotlib=1.4.3=np19py27_2 19 | - mayavi=4.4.0=np19py27_0 20 | - neuron=7.4=py27_0 21 | - numpy=1.9.2=py27_1 22 | - openblas=0.2.14=1 23 | - openssl=1.0.1k=1 24 | - path.py=7.6=py27_0 25 | - pexpect=3.3=py27_0 26 | - pickleshare=0.5=py27_0 27 | - pip=7.1.2=py27_0 28 | - pixman=0.26.2=0 29 | - py2cairo=1.10.0=py27_2 30 | - pyface=4.4.0=py27_0 31 | - pyparsing=2.0.3=py27_0 32 | - pyqt=4.11.3=py27_1 33 | - python=2.7.10=0 34 | - python-dateutil=2.4.2=py27_0 35 | - pytz=2015.4=py27_0 36 | - qt=4.8.6=3 37 | - readline=6.2=2 38 | - setuptools=18.1=py27_0 39 | - simplegeneric=0.8.1=py27_0 40 | - sip=4.16.5=py27_0 41 | - six=1.9.0=py27_0 42 | - sqlite=3.8.4.1=1 43 | - system=5.8=2 44 | - tk=8.5.18=0 45 | - traitlets=4.0.0=py27_0 46 | - traits=4.4.0=py27_0 47 | - traitsui=4.4.0=py27_0 48 | - vtk=5.10.1=py27_1 49 | - wheel=0.24.0=py27_0 50 | - zlib=1.2.8=0 51 | - sphinx=1.3.1=py27_0 52 | 53 | 54 | -------------------------------------------------------------------------------- /examples/cerebellum_network/README.md: -------------------------------------------------------------------------------- 1 | Network example visualized with Neuronvisio 2 | =========================================== 3 | 4 | This directory contains the [Cerebellum example] (http://www.neuroconstruct.org/samples/index.html#Ex6_CerebellumDemo-N101EA) in two forms: 5 | 6 | - the generated hoc from [neuroConstruct] (http://www.neuroconstruct.org) 7 | - the Network NeuroML (Level 3, version 1.8) 8 | 9 | note: This model is only for demonstration of networks visualization, and 10 | it should be not used as starting point to develop new model, because the channels 11 | value are not verified. 12 | 13 | To run the hoc version 14 | ---------------------- 15 | 16 | cd hoc 17 | 18 | start an ipython session 19 | 20 | ipython 21 | 22 | and then load the main.py 23 | 24 | run main.py 25 | 26 | Before every run you need to clear the compiled mod files. 27 | 28 | 29 | To run the NeuroML 30 | ------------------ 31 | 32 | you can load the NeuroML with 33 | 34 | neuronvisio Ex6_Cerebellum_networks.xml 35 | 36 | makes sure the path to Ex6_Cerebellum_networks.xml is complete 37 | 38 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/GranGolgiSyn.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | ************************************************** 4 | File generated by: neuroConstruct v1.6.0 5 | ************************************************** 6 | 7 | 8 | ENDCOMMENT 9 | 10 | 11 | ? This is a NEURON mod file generated from a ChannelML file 12 | 13 | ? Unit system of original ChannelML file: Physiological Units 14 | 15 | COMMENT 16 | ChannelML file describing a synaptic mechanism 17 | ENDCOMMENT 18 | 19 | ? Creating synaptic mechanism, based on NEURON source impl of Exp2Syn 20 | 21 | 22 | TITLE Channel: GranGolgiSyn 23 | 24 | COMMENT 25 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as 26 | double exponential function of time 27 | ENDCOMMENT 28 | 29 | 30 | UNITS { 31 | (nA) = (nanoamp) 32 | (mV) = (millivolt) 33 | (uS) = (microsiemens) 34 | } 35 | 36 | 37 | NEURON { 38 | POINT_PROCESS GranGolgiSyn 39 | RANGE tau_rise, tau_decay 40 | GLOBAL total 41 | 42 | 43 | 44 | RANGE i, e, gmax 45 | NONSPECIFIC_CURRENT i 46 | RANGE g, factor 47 | 48 | } 49 | 50 | PARAMETER { 51 | gmax = 0.01 52 | tau_rise = 1 (ms) <1e-9,1e9> 53 | tau_decay = 2 (ms) <1e-9,1e9> 54 | e = 0 (mV) 55 | 56 | } 57 | 58 | 59 | ASSIGNED { 60 | v (mV) 61 | i (nA) 62 | g (uS) 63 | factor 64 | total (uS) 65 | 66 | } 67 | 68 | STATE { 69 | A (uS) 70 | B (uS) 71 | } 72 | 73 | INITIAL { 74 | LOCAL tp 75 | total = 0 76 | 77 | if (tau_rise == 0) { 78 | tau_rise = 1e-9 : will effectively give a single exponential timecourse synapse 79 | } 80 | 81 | if (tau_rise/tau_decay > .999999) { 82 | tau_rise = .999999*tau_decay : will result in an "alpha" synapse waveform 83 | } 84 | A = 0 85 | B = 0 86 | tp = (tau_rise*tau_decay)/(tau_decay - tau_rise) * log(tau_decay/tau_rise) 87 | factor = -exp(-tp/tau_rise) + exp(-tp/tau_decay) 88 | factor = 1/factor 89 | } 90 | 91 | BREAKPOINT { 92 | SOLVE state METHOD cnexp 93 | g = gmax * (B - A) 94 | i = g*(v - e) 95 | 96 | 97 | } 98 | 99 | 100 | DERIVATIVE state { 101 | A' = -A/tau_rise 102 | B' = -B/tau_decay 103 | } 104 | 105 | NET_RECEIVE(weight (uS)) { 106 | 107 | state_discontinuity(A, A + weight*factor 108 | ) 109 | state_discontinuity(B, B + weight*factor 110 | ) 111 | 112 | 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/GranPurkSyn.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | ************************************************** 4 | File generated by: neuroConstruct v1.6.0 5 | ************************************************** 6 | 7 | 8 | ENDCOMMENT 9 | 10 | 11 | ? This is a NEURON mod file generated from a ChannelML file 12 | 13 | ? Unit system of original ChannelML file: Physiological Units 14 | 15 | COMMENT 16 | ChannelML file describing a single synaptic mechanism 17 | ENDCOMMENT 18 | 19 | ? Creating synaptic mechanism, based on NEURON source impl of Exp2Syn 20 | 21 | 22 | TITLE Channel: GranPurkSyn 23 | 24 | COMMENT 25 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as 26 | double exponential function of time. Mappings exist for NEURON and GENESIS. 27 | ENDCOMMENT 28 | 29 | 30 | UNITS { 31 | (nA) = (nanoamp) 32 | (mV) = (millivolt) 33 | (uS) = (microsiemens) 34 | } 35 | 36 | 37 | NEURON { 38 | POINT_PROCESS GranPurkSyn 39 | RANGE tau_rise, tau_decay 40 | GLOBAL total 41 | 42 | 43 | 44 | RANGE i, e, gmax 45 | NONSPECIFIC_CURRENT i 46 | RANGE g, factor 47 | 48 | } 49 | 50 | PARAMETER { 51 | gmax = 0.01 52 | tau_rise = 1 (ms) <1e-9,1e9> 53 | tau_decay = 2 (ms) <1e-9,1e9> 54 | e = 0 (mV) 55 | 56 | } 57 | 58 | 59 | ASSIGNED { 60 | v (mV) 61 | i (nA) 62 | g (uS) 63 | factor 64 | total (uS) 65 | 66 | } 67 | 68 | STATE { 69 | A (uS) 70 | B (uS) 71 | } 72 | 73 | INITIAL { 74 | LOCAL tp 75 | total = 0 76 | 77 | if (tau_rise == 0) { 78 | tau_rise = 1e-9 : will effectively give a single exponential timecourse synapse 79 | } 80 | 81 | if (tau_rise/tau_decay > .999999) { 82 | tau_rise = .999999*tau_decay : will result in an "alpha" synapse waveform 83 | } 84 | A = 0 85 | B = 0 86 | tp = (tau_rise*tau_decay)/(tau_decay - tau_rise) * log(tau_decay/tau_rise) 87 | factor = -exp(-tp/tau_rise) + exp(-tp/tau_decay) 88 | factor = 1/factor 89 | } 90 | 91 | BREAKPOINT { 92 | SOLVE state METHOD cnexp 93 | g = gmax * (B - A) 94 | i = g*(v - e) 95 | 96 | 97 | } 98 | 99 | 100 | DERIVATIVE state { 101 | A' = -A/tau_rise 102 | B' = -B/tau_decay 103 | } 104 | 105 | NET_RECEIVE(weight (uS)) { 106 | 107 | state_discontinuity(A, A + weight*factor 108 | ) 109 | state_discontinuity(B, B + weight*factor 110 | ) 111 | 112 | 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/GranuleCell.hoc: -------------------------------------------------------------------------------- 1 | 2 | // ****************************************************** 3 | // 4 | // File generated by: neuroConstruct v1.6.0 5 | // 6 | // Generally replicates hoc for Cell Type as exported from 7 | // NEURON's Cell Builder, together with some neuroConstruct 8 | // specific helper/info procedures, e.g. toString(), netInfo() 9 | // 10 | // ****************************************************** 11 | 12 | 13 | begintemplate GranuleCell 14 | 15 | public init, topol, basic_shape, subsets, geom, memb 16 | public synlist, x, y, z, position, connect2target 17 | 18 | public reference, type, description, name 19 | strdef reference, type, description, name 20 | 21 | public toString, netInfo 22 | 23 | public all 24 | 25 | objref synlist 26 | objref all 27 | objref stringFuncs 28 | 29 | public soma_group 30 | objref soma_group 31 | public axon_group 32 | objref axon_group 33 | public ascending_segment 34 | objref ascending_segment 35 | public parallel_fibers 36 | objref parallel_fibers 37 | 38 | proc init() { 39 | topol() 40 | subsets() 41 | geom() 42 | biophys() 43 | geom_nseg() 44 | synlist = new List() 45 | x = y = z = 0 46 | reference = $s1 47 | type = $s2 48 | description = $s3 49 | 50 | strdef indexNum 51 | stringFuncs = new StringFunctions() 52 | stringFuncs.tail(reference, "_", indexNum) 53 | while (stringFuncs.substr( indexNum, "_")>=0) { 54 | stringFuncs.tail(indexNum, "_", indexNum) 55 | } 56 | 57 | sprint(name, "%s", type) 58 | } 59 | 60 | create Soma 61 | public Soma 62 | create mainAxonSection 63 | public mainAxonSection 64 | create parallelFiberPos 65 | public parallelFiberPos 66 | create parallelFiberNeg 67 | public parallelFiberNeg 68 | 69 | proc topol() { 70 | connect mainAxonSection(0), Soma(0.5) 71 | connect parallelFiberPos(0), mainAxonSection(1.0) 72 | connect parallelFiberNeg(0), mainAxonSection(1.0) 73 | basic_shape() 74 | } 75 | 76 | proc basic_shape() { 77 | Soma {pt3dclear() pt3dadd(0.0, -4.0, 0.0, 8.0) pt3dadd(0.0, 4.0, 0.0, 8.0)} 78 | mainAxonSection {pt3dclear() pt3dadd(0.0, 0.0, 0.0, 1.2) pt3dadd(0.0, 140.0, 0.0, 1.2)} 79 | parallelFiberPos {pt3dclear() pt3dadd(0.0, 140.0, 0.0, 1.2) pt3dadd(10.0, 140.0, 0.0, 1.2)} 80 | parallelFiberNeg {pt3dclear() pt3dadd(0.0, 140.0, 0.0, 1.2) pt3dadd(-10.0, 140.0, 0.0, 1.2)} 81 | parallelFiberPos {pt3dadd(20.0, 140.0, 0.0, 1.2)} 82 | parallelFiberNeg {pt3dadd(-20.0, 140.0, 0.0, 1.2)} 83 | parallelFiberPos {pt3dadd(30.0, 140.0, 0.0, 1.2)} 84 | parallelFiberNeg {pt3dadd(-30.0, 140.0, 0.0, 1.2)} 85 | parallelFiberPos {pt3dadd(40.0, 140.0, 0.0, 1.2)} 86 | parallelFiberNeg {pt3dadd(-40.0, 140.0, 0.0, 1.2)} 87 | parallelFiberPos {pt3dadd(50.0, 140.0, 0.0, 1.2)} 88 | parallelFiberNeg {pt3dadd(-50.0, 140.0, 0.0, 1.2)} 89 | parallelFiberPos {pt3dadd(60.0, 140.0, 0.0, 1.2)} 90 | parallelFiberNeg {pt3dadd(-60.0, 140.0, 0.0, 1.2)} 91 | parallelFiberPos {pt3dadd(70.0, 140.0, 0.0, 1.2)} 92 | parallelFiberNeg {pt3dadd(-70.0, 140.0, 0.0, 1.2)} 93 | parallelFiberPos {pt3dadd(80.0, 140.0, 0.0, 1.2)} 94 | parallelFiberNeg {pt3dadd(-80.0, 140.0, 0.0, 1.2)} 95 | parallelFiberPos {pt3dadd(90.0, 140.0, 0.0, 1.2)} 96 | parallelFiberNeg {pt3dadd(-90.0, 140.0, 0.0, 1.2)} 97 | parallelFiberPos {pt3dadd(100.0, 140.0, 0.0, 1.2)} 98 | parallelFiberNeg {pt3dadd(-100.0, 140.0, 0.0, 1.2)} 99 | parallelFiberPos {pt3dadd(110.0, 140.0, 0.0, 1.2)} 100 | parallelFiberNeg {pt3dadd(-110.0, 140.0, 0.0, 1.2)} 101 | parallelFiberPos {pt3dadd(120.0, 140.0, 0.0, 1.2)} 102 | parallelFiberNeg {pt3dadd(-120.0, 140.0, 0.0, 1.2)} 103 | } 104 | 105 | proc subsets() { local i 106 | 107 | all = new SectionList() 108 | 109 | 110 | soma_group = new SectionList() 111 | 112 | Soma soma_group.append() 113 | 114 | 115 | axon_group = new SectionList() 116 | 117 | mainAxonSection axon_group.append() 118 | parallelFiberPos axon_group.append() 119 | parallelFiberNeg axon_group.append() 120 | 121 | 122 | ascending_segment = new SectionList() 123 | 124 | mainAxonSection ascending_segment.append() 125 | 126 | 127 | parallel_fibers = new SectionList() 128 | 129 | parallelFiberPos parallel_fibers.append() 130 | parallelFiberNeg parallel_fibers.append() 131 | 132 | 133 | Soma all.append() 134 | mainAxonSection all.append() 135 | parallelFiberPos all.append() 136 | parallelFiberNeg all.append() 137 | } 138 | 139 | proc geom() { 140 | } 141 | 142 | proc biophys() { 143 | forsec all cm = 1.0 144 | forsec all Ra = 20.0 145 | 146 | forsec all { insert KConductance { gmax_KConductance = 0.036 } ek = -77.0 // note: this is val from ChannelML, may be reset later 147 | 148 | } 149 | 150 | forsec soma_group { insert PassiveCond { gmax_PassiveCond = 3.0E-4 } 151 | } 152 | 153 | forsec soma_group { insert NaConductance { gmax_NaConductance = 0.12 } ena = 50.0 // note: this is val from ChannelML, may be reset later 154 | 155 | } 156 | 157 | forsec axon_group { insert NaConductance { gmax_NaConductance = 0.12 } ena = 50.0 // note: this is val from ChannelML, may be reset later 158 | 159 | } 160 | 161 | forsec axon_group { insert PassiveCond { gmax_PassiveCond = 3.0E-4 } 162 | } 163 | 164 | } 165 | 166 | proc geom_nseg() { 167 | mainAxonSection nseg = 2 168 | parallelFiberPos nseg = 2 169 | parallelFiberNeg nseg = 2 170 | } 171 | 172 | 173 | proc position() { local i 174 | forsec all { 175 | for i = 0, n3d()-1 { 176 | pt3dchange(i, $1+x3d(i), $2+y3d(i), $3+z3d(i), diam3d(i)) 177 | } 178 | } 179 | x = $1 y = $2 z = $3 180 | } 181 | 182 | proc connect2target() { //$o1 target point process, $o2 returned NetCon 183 | 184 | Soma $o2 = new NetCon(&v(1), $o1) 185 | } 186 | 187 | proc toString() { 188 | strdef info 189 | sprint(info, "Cell ref: %s (%s), at: (%d, %d, %d)", reference, name, x, y, z) 190 | print info 191 | } 192 | 193 | proc netInfo() { 194 | strdef info 195 | sprint(info, "Cell reference: %s, type: %s", reference, type) 196 | print "-------- ",info 197 | print " There are ", synlist.count(), " connections in ", synlist 198 | for i=0,synlist.count()-1 { 199 | print " Connection from ", synlist.o[i].precell, " to: ", synlist.o[i].postcell 200 | print " Pre: Weight: ", synlist.o[i].weight, ", delay: ", synlist.o[i].delay, ", threshold: ", synlist.o[i].threshold 201 | print " Post: ", synlist.o[i].syn(), ", gmax: ", synlist.o[i].syn().gmax , ", e: ", synlist.o[i].syn().e , ", rise time: ", synlist.o[i].syn().tau_rise , ", decay time: ", synlist.o[i].syn().tau_decay 202 | print " " 203 | } 204 | 205 | 206 | 207 | print "-------- " 208 | print " " 209 | } 210 | 211 | 212 | endtemplate GranuleCell 213 | 214 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/KConductance.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | ************************************************** 4 | File generated by: neuroConstruct v1.6.0 5 | ************************************************** 6 | 7 | 8 | ENDCOMMENT 9 | 10 | 11 | ? This is a NEURON mod file generated from a ChannelML file 12 | 13 | ? Unit system of original ChannelML file: Physiological Units 14 | 15 | COMMENT 16 | ChannelML file containing a single Channel description 17 | ENDCOMMENT 18 | 19 | TITLE Channel: KConductance 20 | 21 | COMMENT 22 | Simple example of K conductance in squid giant axon. Based on channel from Hodgkin and Huxley 1952 23 | ENDCOMMENT 24 | 25 | 26 | UNITS { 27 | (mA) = (milliamp) 28 | (mV) = (millivolt) 29 | (S) = (siemens) 30 | (um) = (micrometer) 31 | (molar) = (1/liter) 32 | (mM) = (millimolar) 33 | (l) = (liter) 34 | } 35 | 36 | 37 | 38 | NEURON { 39 | 40 | 41 | SUFFIX KConductance 42 | USEION k READ ek WRITE ik VALENCE 1 ? reversal potential of ion is read, outgoing current is written 43 | 44 | 45 | RANGE gmax, gion 46 | 47 | RANGE ninf, ntau 48 | 49 | } 50 | 51 | PARAMETER { 52 | 53 | 54 | gmax = 0.036 (S/cm2) ? default value, should be overwritten when conductance placed on cell 55 | 56 | } 57 | 58 | 59 | 60 | ASSIGNED { 61 | 62 | 63 | v (mV) 64 | 65 | celsius (degC) 66 | 67 | 68 | ? Reversal potential of k 69 | ek (mV) 70 | ? The outward flow of ion: k calculated by rate equations... 71 | ik (mA/cm2) 72 | 73 | 74 | gion (S/cm2) 75 | ninf 76 | ntau (ms) 77 | 78 | } 79 | 80 | BREAKPOINT { 81 | 82 | SOLVE states METHOD cnexp 83 | 84 | 85 | gion = gmax*((n)^4) 86 | 87 | ik = gion*(v - ek) 88 | 89 | 90 | } 91 | 92 | 93 | 94 | INITIAL { 95 | 96 | ek = -77.0 97 | 98 | rates(v) 99 | n = ninf 100 | 101 | 102 | } 103 | 104 | STATE { 105 | n 106 | 107 | } 108 | 109 | DERIVATIVE states { 110 | rates(v) 111 | n' = (ninf - n)/ntau 112 | 113 | } 114 | 115 | PROCEDURE rates(v(mV)) { 116 | 117 | ? Note: not all of these may be used, depending on the form of rate equations 118 | LOCAL alpha, beta, tau, inf, gamma, zeta, temp_adj_n, A_alpha_n, B_alpha_n, Vhalf_alpha_n, A_beta_n, B_beta_n, Vhalf_beta_n 119 | 120 | TABLE ninf, ntau 121 | DEPEND celsius 122 | FROM -100 TO 100 WITH 400 123 | 124 | 125 | UNITSOFF 126 | temp_adj_n = 1 127 | 128 | 129 | 130 | 131 | 132 | 133 | ? *** Adding rate equations for gate: n *** 134 | 135 | ? Found a parameterised form of rate equation for alpha, using expression: A*((v-Vhalf)/B) / (1 - exp(-((v-Vhalf)/B))) 136 | A_alpha_n = 0.1 137 | B_alpha_n = 10 138 | Vhalf_alpha_n = -55 139 | alpha = A_alpha_n * vtrap((v - Vhalf_alpha_n), B_alpha_n) 140 | 141 | 142 | ? Found a parameterised form of rate equation for beta, using expression: A*exp((v-Vhalf)/B) 143 | A_beta_n = 0.125 144 | B_beta_n = -80 145 | Vhalf_beta_n = -65 146 | beta = A_beta_n * exp((v - Vhalf_beta_n) / B_beta_n) 147 | 148 | ntau = 1/(temp_adj_n*(alpha + beta)) 149 | ninf = alpha/(alpha + beta) 150 | 151 | 152 | 153 | ? *** Finished rate equations for gate: n *** 154 | 155 | 156 | 157 | 158 | } 159 | 160 | 161 | ? Function to assist with parameterised expressions of type linoid/exp_linear 162 | 163 | FUNCTION vtrap(VminV0, B) { 164 | if (fabs(VminV0/B) < 1e-6) { 165 | vtrap = (1 + VminV0/B/2) 166 | }else{ 167 | vtrap = (VminV0 / B) /(1 - exp((-1 *VminV0)/B)) 168 | } 169 | } 170 | 171 | UNITSON 172 | 173 | 174 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/MFExtSynInput.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | ************************************************** 4 | File generated by: neuroConstruct v1.6.0 5 | ************************************************** 6 | 7 | 8 | ENDCOMMENT 9 | 10 | 11 | ? This is a NEURON mod file generated from a ChannelML file 12 | 13 | ? Unit system of original ChannelML file: Physiological Units 14 | 15 | COMMENT 16 | ChannelML file describing a single synaptic mechanism 17 | ENDCOMMENT 18 | 19 | ? Creating synaptic mechanism, based on NEURON source impl of Exp2Syn 20 | 21 | 22 | TITLE Channel: MFExtSynInput 23 | 24 | COMMENT 25 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as 26 | double exponential function of time. Mappings exist for NEURON and GENESIS. 27 | ENDCOMMENT 28 | 29 | 30 | UNITS { 31 | (nA) = (nanoamp) 32 | (mV) = (millivolt) 33 | (uS) = (microsiemens) 34 | } 35 | 36 | 37 | NEURON { 38 | POINT_PROCESS MFExtSynInput 39 | RANGE tau_rise, tau_decay 40 | GLOBAL total 41 | 42 | 43 | 44 | RANGE i, e, gmax 45 | NONSPECIFIC_CURRENT i 46 | RANGE g, factor 47 | 48 | } 49 | 50 | PARAMETER { 51 | gmax = 0.01 52 | tau_rise = 1 (ms) <1e-9,1e9> 53 | tau_decay = 2 (ms) <1e-9,1e9> 54 | e = 0 (mV) 55 | 56 | } 57 | 58 | 59 | ASSIGNED { 60 | v (mV) 61 | i (nA) 62 | g (uS) 63 | factor 64 | total (uS) 65 | 66 | } 67 | 68 | STATE { 69 | A (uS) 70 | B (uS) 71 | } 72 | 73 | INITIAL { 74 | LOCAL tp 75 | total = 0 76 | 77 | if (tau_rise == 0) { 78 | tau_rise = 1e-9 : will effectively give a single exponential timecourse synapse 79 | } 80 | 81 | if (tau_rise/tau_decay > .999999) { 82 | tau_rise = .999999*tau_decay : will result in an "alpha" synapse waveform 83 | } 84 | A = 0 85 | B = 0 86 | tp = (tau_rise*tau_decay)/(tau_decay - tau_rise) * log(tau_decay/tau_rise) 87 | factor = -exp(-tp/tau_rise) + exp(-tp/tau_decay) 88 | factor = 1/factor 89 | } 90 | 91 | BREAKPOINT { 92 | SOLVE state METHOD cnexp 93 | g = gmax * (B - A) 94 | i = g*(v - e) 95 | 96 | 97 | } 98 | 99 | 100 | DERIVATIVE state { 101 | A' = -A/tau_rise 102 | B' = -B/tau_decay 103 | } 104 | 105 | NET_RECEIVE(weight (uS)) { 106 | 107 | state_discontinuity(A, A + weight*factor 108 | ) 109 | state_discontinuity(B, B + weight*factor 110 | ) 111 | 112 | 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/MFGranSyn.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | ************************************************** 4 | File generated by: neuroConstruct v1.6.0 5 | ************************************************** 6 | 7 | 8 | ENDCOMMENT 9 | 10 | 11 | ? This is a NEURON mod file generated from a ChannelML file 12 | 13 | ? Unit system of original ChannelML file: Physiological Units 14 | 15 | COMMENT 16 | ChannelML file describing a single synaptic mechanism 17 | ENDCOMMENT 18 | 19 | ? Creating synaptic mechanism, based on NEURON source impl of Exp2Syn 20 | 21 | 22 | TITLE Channel: MFGranSyn 23 | 24 | COMMENT 25 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as 26 | double exponential function of time. Mappings exist for NEURON and GENESIS. 27 | ENDCOMMENT 28 | 29 | 30 | UNITS { 31 | (nA) = (nanoamp) 32 | (mV) = (millivolt) 33 | (uS) = (microsiemens) 34 | } 35 | 36 | 37 | NEURON { 38 | POINT_PROCESS MFGranSyn 39 | RANGE tau_rise, tau_decay 40 | GLOBAL total 41 | 42 | 43 | 44 | RANGE i, e, gmax 45 | NONSPECIFIC_CURRENT i 46 | RANGE g, factor 47 | 48 | } 49 | 50 | PARAMETER { 51 | gmax = 0.01 52 | tau_rise = 1 (ms) <1e-9,1e9> 53 | tau_decay = 2 (ms) <1e-9,1e9> 54 | e = 0 (mV) 55 | 56 | } 57 | 58 | 59 | ASSIGNED { 60 | v (mV) 61 | i (nA) 62 | g (uS) 63 | factor 64 | total (uS) 65 | 66 | } 67 | 68 | STATE { 69 | A (uS) 70 | B (uS) 71 | } 72 | 73 | INITIAL { 74 | LOCAL tp 75 | total = 0 76 | 77 | if (tau_rise == 0) { 78 | tau_rise = 1e-9 : will effectively give a single exponential timecourse synapse 79 | } 80 | 81 | if (tau_rise/tau_decay > .999999) { 82 | tau_rise = .999999*tau_decay : will result in an "alpha" synapse waveform 83 | } 84 | A = 0 85 | B = 0 86 | tp = (tau_rise*tau_decay)/(tau_decay - tau_rise) * log(tau_decay/tau_rise) 87 | factor = -exp(-tp/tau_rise) + exp(-tp/tau_decay) 88 | factor = 1/factor 89 | } 90 | 91 | BREAKPOINT { 92 | SOLVE state METHOD cnexp 93 | g = gmax * (B - A) 94 | i = g*(v - e) 95 | 96 | 97 | } 98 | 99 | 100 | DERIVATIVE state { 101 | A' = -A/tau_rise 102 | B' = -B/tau_decay 103 | } 104 | 105 | NET_RECEIVE(weight (uS)) { 106 | 107 | state_discontinuity(A, A + weight*factor 108 | ) 109 | state_discontinuity(B, B + weight*factor 110 | ) 111 | 112 | 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/MossyFiber.hoc: -------------------------------------------------------------------------------- 1 | 2 | // ****************************************************** 3 | // 4 | // File generated by: neuroConstruct v1.6.0 5 | // 6 | // Generally replicates hoc for Cell Type as exported from 7 | // NEURON's Cell Builder, together with some neuroConstruct 8 | // specific helper/info procedures, e.g. toString(), netInfo() 9 | // 10 | // ****************************************************** 11 | 12 | 13 | begintemplate MossyFiber 14 | 15 | public init, topol, basic_shape, subsets, geom, memb 16 | public synlist, x, y, z, position, connect2target 17 | 18 | public reference, type, description, name 19 | strdef reference, type, description, name 20 | 21 | public toString, netInfo 22 | 23 | public all 24 | 25 | objref synlist 26 | objref all 27 | objref stringFuncs 28 | 29 | public soma_group 30 | objref soma_group 31 | 32 | proc init() { 33 | topol() 34 | subsets() 35 | geom() 36 | biophys() 37 | geom_nseg() 38 | synlist = new List() 39 | x = y = z = 0 40 | reference = $s1 41 | type = $s2 42 | description = $s3 43 | 44 | strdef indexNum 45 | stringFuncs = new StringFunctions() 46 | stringFuncs.tail(reference, "_", indexNum) 47 | while (stringFuncs.substr( indexNum, "_")>=0) { 48 | stringFuncs.tail(indexNum, "_", indexNum) 49 | } 50 | 51 | sprint(name, "%s", type) 52 | } 53 | 54 | create Soma 55 | public Soma 56 | 57 | proc topol() { 58 | basic_shape() 59 | } 60 | 61 | proc basic_shape() { 62 | Soma {pt3dclear() pt3dadd(0.0, 0.0, 0.0, 10.0) pt3dadd(0.0, 20.0, 0.0, 10.0)} 63 | } 64 | 65 | proc subsets() { local i 66 | 67 | all = new SectionList() 68 | 69 | 70 | soma_group = new SectionList() 71 | 72 | Soma soma_group.append() 73 | 74 | 75 | Soma all.append() 76 | } 77 | 78 | proc geom() { 79 | } 80 | 81 | proc biophys() { 82 | forsec all cm = 1.0 83 | forsec all Ra = 30.0 84 | 85 | forsec all { insert NaConductance { gmax_NaConductance = 0.12 } ena = 50.0 // note: this is val from ChannelML, may be reset later 86 | 87 | } 88 | 89 | forsec all { insert KConductance { gmax_KConductance = 0.036 } ek = -77.0 // note: this is val from ChannelML, may be reset later 90 | 91 | } 92 | 93 | forsec all { insert PassiveCond { gmax_PassiveCond = 3.0E-4 } 94 | } 95 | 96 | } 97 | 98 | proc geom_nseg() { 99 | } 100 | 101 | 102 | proc position() { local i 103 | forsec all { 104 | for i = 0, n3d()-1 { 105 | pt3dchange(i, $1+x3d(i), $2+y3d(i), $3+z3d(i), diam3d(i)) 106 | } 107 | } 108 | x = $1 y = $2 z = $3 109 | } 110 | 111 | proc connect2target() { //$o1 target point process, $o2 returned NetCon 112 | 113 | Soma $o2 = new NetCon(&v(1), $o1) 114 | } 115 | 116 | proc toString() { 117 | strdef info 118 | sprint(info, "Cell ref: %s (%s), at: (%d, %d, %d)", reference, name, x, y, z) 119 | print info 120 | } 121 | 122 | proc netInfo() { 123 | strdef info 124 | sprint(info, "Cell reference: %s, type: %s", reference, type) 125 | print "-------- ",info 126 | print " There are ", synlist.count(), " connections in ", synlist 127 | for i=0,synlist.count()-1 { 128 | print " Connection from ", synlist.o[i].precell, " to: ", synlist.o[i].postcell 129 | print " Pre: Weight: ", synlist.o[i].weight, ", delay: ", synlist.o[i].delay, ", threshold: ", synlist.o[i].threshold 130 | print " Post: ", synlist.o[i].syn(), ", gmax: ", synlist.o[i].syn().gmax , ", e: ", synlist.o[i].syn().e , ", rise time: ", synlist.o[i].syn().tau_rise , ", decay time: ", synlist.o[i].syn().tau_decay 131 | print " " 132 | } 133 | 134 | 135 | 136 | print "-------- " 137 | print " " 138 | } 139 | 140 | 141 | endtemplate MossyFiber 142 | 143 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/NaConductance.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | ************************************************** 4 | File generated by: neuroConstruct v1.6.0 5 | ************************************************** 6 | 7 | 8 | ENDCOMMENT 9 | 10 | 11 | ? This is a NEURON mod file generated from a ChannelML file 12 | 13 | ? Unit system of original ChannelML file: Physiological Units 14 | 15 | COMMENT 16 | ChannelML file containing a single Channel description 17 | ENDCOMMENT 18 | 19 | TITLE Channel: NaConductance 20 | 21 | COMMENT 22 | Simple example of Na conductance in squid giant axon. Based on channel from Hodgkin and Huxley 1952 23 | ENDCOMMENT 24 | 25 | 26 | UNITS { 27 | (mA) = (milliamp) 28 | (mV) = (millivolt) 29 | (S) = (siemens) 30 | (um) = (micrometer) 31 | (molar) = (1/liter) 32 | (mM) = (millimolar) 33 | (l) = (liter) 34 | } 35 | 36 | 37 | 38 | NEURON { 39 | 40 | 41 | SUFFIX NaConductance 42 | USEION na READ ena WRITE ina VALENCE 1 ? reversal potential of ion is read, outgoing current is written 43 | 44 | 45 | RANGE gmax, gion 46 | 47 | RANGE minf, mtau 48 | 49 | RANGE hinf, htau 50 | 51 | } 52 | 53 | PARAMETER { 54 | 55 | 56 | gmax = 0.12 (S/cm2) ? default value, should be overwritten when conductance placed on cell 57 | 58 | } 59 | 60 | 61 | 62 | ASSIGNED { 63 | 64 | 65 | v (mV) 66 | 67 | celsius (degC) 68 | 69 | 70 | ? Reversal potential of na 71 | ena (mV) 72 | ? The outward flow of ion: na calculated by rate equations... 73 | ina (mA/cm2) 74 | 75 | 76 | gion (S/cm2) 77 | minf 78 | mtau (ms) 79 | hinf 80 | htau (ms) 81 | 82 | } 83 | 84 | BREAKPOINT { 85 | 86 | SOLVE states METHOD cnexp 87 | 88 | 89 | gion = gmax*((m)^3)*((h)^1) 90 | 91 | ina = gion*(v - ena) 92 | 93 | 94 | } 95 | 96 | 97 | 98 | INITIAL { 99 | 100 | ena = 50 101 | 102 | rates(v) 103 | m = minf 104 | h = hinf 105 | 106 | 107 | } 108 | 109 | STATE { 110 | m 111 | h 112 | 113 | } 114 | 115 | DERIVATIVE states { 116 | rates(v) 117 | m' = (minf - m)/mtau 118 | h' = (hinf - h)/htau 119 | 120 | } 121 | 122 | PROCEDURE rates(v(mV)) { 123 | 124 | ? Note: not all of these may be used, depending on the form of rate equations 125 | LOCAL alpha, beta, tau, inf, gamma, zeta, temp_adj_m, A_alpha_m, B_alpha_m, Vhalf_alpha_m, A_beta_m, B_beta_m, Vhalf_beta_m, temp_adj_h, A_alpha_h, B_alpha_h, Vhalf_alpha_h, A_beta_h, B_beta_h, Vhalf_beta_h 126 | 127 | TABLE minf, mtau,hinf, htau 128 | DEPEND celsius 129 | FROM -100 TO 100 WITH 400 130 | 131 | 132 | UNITSOFF 133 | temp_adj_m = 1 134 | temp_adj_h = 1 135 | 136 | 137 | 138 | 139 | 140 | 141 | ? *** Adding rate equations for gate: m *** 142 | 143 | ? Found a parameterised form of rate equation for alpha, using expression: A*((v-Vhalf)/B) / (1 - exp(-((v-Vhalf)/B))) 144 | A_alpha_m = 1 145 | B_alpha_m = 10 146 | Vhalf_alpha_m = -40 147 | alpha = A_alpha_m * vtrap((v - Vhalf_alpha_m), B_alpha_m) 148 | 149 | 150 | ? Found a parameterised form of rate equation for beta, using expression: A*exp((v-Vhalf)/B) 151 | A_beta_m = 4 152 | B_beta_m = -18 153 | Vhalf_beta_m = -65 154 | beta = A_beta_m * exp((v - Vhalf_beta_m) / B_beta_m) 155 | 156 | mtau = 1/(temp_adj_m*(alpha + beta)) 157 | minf = alpha/(alpha + beta) 158 | 159 | 160 | 161 | ? *** Finished rate equations for gate: m *** 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | ? *** Adding rate equations for gate: h *** 171 | 172 | ? Found a parameterised form of rate equation for alpha, using expression: A*exp((v-Vhalf)/B) 173 | A_alpha_h = 0.07 174 | B_alpha_h = -20 175 | Vhalf_alpha_h = -65 176 | alpha = A_alpha_h * exp((v - Vhalf_alpha_h) / B_alpha_h) 177 | 178 | 179 | ? Found a parameterised form of rate equation for beta, using expression: A / (1 + exp((v-Vhalf)/B)) 180 | A_beta_h = 1 181 | B_beta_h = -10 182 | Vhalf_beta_h = -35 183 | beta = A_beta_h / (exp((v - Vhalf_beta_h) / B_beta_h) + 1) 184 | 185 | htau = 1/(temp_adj_h*(alpha + beta)) 186 | hinf = alpha/(alpha + beta) 187 | 188 | 189 | 190 | ? *** Finished rate equations for gate: h *** 191 | 192 | 193 | 194 | 195 | } 196 | 197 | 198 | ? Function to assist with parameterised expressions of type linoid/exp_linear 199 | 200 | FUNCTION vtrap(VminV0, B) { 201 | if (fabs(VminV0/B) < 1e-6) { 202 | vtrap = (1 + VminV0/B/2) 203 | }else{ 204 | vtrap = (VminV0 / B) /(1 - exp((-1 *VminV0)/B)) 205 | } 206 | } 207 | 208 | UNITSON 209 | 210 | 211 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/PassiveCond.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | 3 | ************************************************** 4 | File generated by: neuroConstruct v1.6.0 5 | ************************************************** 6 | 7 | 8 | ENDCOMMENT 9 | 10 | 11 | ? This is a NEURON mod file generated from a ChannelML file 12 | 13 | ? Unit system of original ChannelML file: Physiological Units 14 | 15 | COMMENT 16 | ChannelML file containing a single Channel description 17 | ENDCOMMENT 18 | 19 | TITLE Channel: PassiveCond 20 | 21 | COMMENT 22 | Simple example of a leak/passive conductance. Note: for GENESIS cells with a single leak conductance, 23 | it is better to use the Rm and Em variables for a passive current. 24 | ENDCOMMENT 25 | 26 | 27 | UNITS { 28 | (mA) = (milliamp) 29 | (mV) = (millivolt) 30 | (S) = (siemens) 31 | (um) = (micrometer) 32 | (molar) = (1/liter) 33 | (mM) = (millimolar) 34 | (l) = (liter) 35 | } 36 | 37 | 38 | 39 | NEURON { 40 | 41 | 42 | SUFFIX PassiveCond 43 | ? A non specific current is present 44 | RANGE e 45 | NONSPECIFIC_CURRENT i 46 | 47 | RANGE gmax, gion 48 | 49 | } 50 | 51 | PARAMETER { 52 | 53 | 54 | gmax = 0.0003 (S/cm2) ? default value, should be overwritten when conductance placed on cell 55 | 56 | e = -54.3 (mV) ? default value, should be overwritten when conductance placed on cell 57 | 58 | } 59 | 60 | 61 | 62 | ASSIGNED { 63 | 64 | 65 | v (mV) 66 | 67 | i (mA/cm2) 68 | 69 | } 70 | 71 | BREAKPOINT { 72 | i = gmax*(v - e) 73 | 74 | 75 | } 76 | 77 | 78 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/PurkinjeCell.hoc: -------------------------------------------------------------------------------- 1 | 2 | // ****************************************************** 3 | // 4 | // File generated by: neuroConstruct v1.6.0 5 | // 6 | // Generally replicates hoc for Cell Type as exported from 7 | // NEURON's Cell Builder, together with some neuroConstruct 8 | // specific helper/info procedures, e.g. toString(), netInfo() 9 | // 10 | // ****************************************************** 11 | 12 | 13 | begintemplate PurkinjeCell 14 | 15 | public init, topol, basic_shape, subsets, geom, memb 16 | public synlist, x, y, z, position, connect2target 17 | 18 | public reference, type, description, name 19 | strdef reference, type, description, name 20 | 21 | public toString, netInfo 22 | 23 | public all 24 | 25 | objref synlist 26 | objref all 27 | objref stringFuncs 28 | 29 | public soma_group 30 | objref soma_group 31 | public axon_group 32 | objref axon_group 33 | public dendrite_group 34 | objref dendrite_group 35 | public main_dends 36 | objref main_dends 37 | 38 | proc init() { 39 | topol() 40 | subsets() 41 | geom() 42 | biophys() 43 | geom_nseg() 44 | synlist = new List() 45 | x = y = z = 0 46 | reference = $s1 47 | type = $s2 48 | description = $s3 49 | 50 | strdef indexNum 51 | stringFuncs = new StringFunctions() 52 | stringFuncs.tail(reference, "_", indexNum) 53 | while (stringFuncs.substr( indexNum, "_")>=0) { 54 | stringFuncs.tail(indexNum, "_", indexNum) 55 | } 56 | 57 | sprint(name, "%s", type) 58 | } 59 | 60 | create Soma 61 | public Soma 62 | create AxonSec 63 | public AxonSec 64 | create DendRootSec 65 | public DendRootSec 66 | create DendSec1 67 | public DendSec1 68 | create DendSec2 69 | public DendSec2 70 | create DendSec3 71 | public DendSec3 72 | create Dend_4_Sec 73 | public Dend_4_Sec 74 | create Dend_5_Sec 75 | public Dend_5_Sec 76 | create Dend_6_Sec 77 | public Dend_6_Sec 78 | create Dend_7_Sec 79 | public Dend_7_Sec 80 | create Dend_8_Sec 81 | public Dend_8_Sec 82 | create Dend_9_Sec 83 | public Dend_9_Sec 84 | create Dend_10_Sec 85 | public Dend_10_Sec 86 | create Dend_11_Sec 87 | public Dend_11_Sec 88 | create Dend_12_Sec 89 | public Dend_12_Sec 90 | create Dend_13_Sec 91 | public Dend_13_Sec 92 | create Dend_14_Sec 93 | public Dend_14_Sec 94 | create Dend_15_Sec 95 | public Dend_15_Sec 96 | create Dend_16_Sec 97 | public Dend_16_Sec 98 | create Dend_17_Sec 99 | public Dend_17_Sec 100 | create Dend_18_Sec 101 | public Dend_18_Sec 102 | create Dend_19_Sec 103 | public Dend_19_Sec 104 | create Dend_20_Sec 105 | public Dend_20_Sec 106 | create Dend_21_Sec 107 | public Dend_21_Sec 108 | create Dend_22_Sec 109 | public Dend_22_Sec 110 | create Dend_23_Sec 111 | public Dend_23_Sec 112 | create Dend_24_Sec 113 | public Dend_24_Sec 114 | create Dend_25_Sec 115 | public Dend_25_Sec 116 | create Dend_26_Sec 117 | public Dend_26_Sec 118 | create Dend_27_Sec 119 | public Dend_27_Sec 120 | create Dend_28_Sec 121 | public Dend_28_Sec 122 | create Dend_29_Sec 123 | public Dend_29_Sec 124 | create Dend_30_Sec 125 | public Dend_30_Sec 126 | create Dend_31_Sec 127 | public Dend_31_Sec 128 | create Dend_32_Sec 129 | public Dend_32_Sec 130 | create Dend_33_Sec 131 | public Dend_33_Sec 132 | create Dend_34_Sec 133 | public Dend_34_Sec 134 | create Dend_35_Sec 135 | public Dend_35_Sec 136 | create Dend_36_Sec 137 | public Dend_36_Sec 138 | create Dend_37_Sec 139 | public Dend_37_Sec 140 | create Dend_38_Sec 141 | public Dend_38_Sec 142 | create Dend_39_Sec 143 | public Dend_39_Sec 144 | 145 | proc topol() { 146 | connect AxonSec(0), Soma(0.5) 147 | connect DendRootSec(0), Soma(0.5) 148 | connect DendSec1(0), DendRootSec(1.0) 149 | connect DendSec2(0), DendRootSec(1.0) 150 | connect DendSec3(0), DendRootSec(1.0) 151 | connect Dend_4_Sec(0), DendSec1(1.0) 152 | connect Dend_5_Sec(0), DendSec1(1.0) 153 | connect Dend_6_Sec(0), DendSec1(1.0) 154 | connect Dend_7_Sec(0), DendSec2(1.0) 155 | connect Dend_8_Sec(0), DendSec2(1.0) 156 | connect Dend_9_Sec(0), DendSec2(1.0) 157 | connect Dend_10_Sec(0), DendSec3(1.0) 158 | connect Dend_11_Sec(0), DendSec3(1.0) 159 | connect Dend_12_Sec(0), DendSec3(1.0) 160 | connect Dend_13_Sec(0), Dend_4_Sec(1.0) 161 | connect Dend_14_Sec(0), Dend_4_Sec(1.0) 162 | connect Dend_15_Sec(0), Dend_4_Sec(1.0) 163 | connect Dend_16_Sec(0), Dend_5_Sec(1.0) 164 | connect Dend_17_Sec(0), Dend_5_Sec(1.0) 165 | connect Dend_18_Sec(0), Dend_5_Sec(1.0) 166 | connect Dend_19_Sec(0), Dend_6_Sec(1.0) 167 | connect Dend_20_Sec(0), Dend_6_Sec(1.0) 168 | connect Dend_21_Sec(0), Dend_6_Sec(1.0) 169 | connect Dend_22_Sec(0), Dend_7_Sec(1.0) 170 | connect Dend_23_Sec(0), Dend_7_Sec(1.0) 171 | connect Dend_24_Sec(0), Dend_7_Sec(1.0) 172 | connect Dend_25_Sec(0), Dend_8_Sec(1.0) 173 | connect Dend_26_Sec(0), Dend_8_Sec(1.0) 174 | connect Dend_27_Sec(0), Dend_8_Sec(1.0) 175 | connect Dend_28_Sec(0), Dend_9_Sec(1.0) 176 | connect Dend_29_Sec(0), Dend_9_Sec(1.0) 177 | connect Dend_30_Sec(0), Dend_9_Sec(1.0) 178 | connect Dend_31_Sec(0), Dend_10_Sec(1.0) 179 | connect Dend_32_Sec(0), Dend_10_Sec(1.0) 180 | connect Dend_33_Sec(0), Dend_10_Sec(1.0) 181 | connect Dend_34_Sec(0), Dend_11_Sec(1.0) 182 | connect Dend_35_Sec(0), Dend_11_Sec(1.0) 183 | connect Dend_36_Sec(0), Dend_11_Sec(1.0) 184 | connect Dend_37_Sec(0), Dend_12_Sec(1.0) 185 | connect Dend_38_Sec(0), Dend_12_Sec(1.0) 186 | connect Dend_39_Sec(0), Dend_12_Sec(1.0) 187 | basic_shape() 188 | } 189 | 190 | proc basic_shape() { 191 | Soma {pt3dclear() pt3dadd(0.0, -15.0, 0.0, 30.0) pt3dadd(0.0, 15.0, 0.0, 30.0)} 192 | AxonSec {pt3dclear() pt3dadd(0.0, 0.0, 0.0, 2.0) pt3dadd(0.0, -140.0, 0.0, 2.0)} 193 | DendRootSec {pt3dclear() pt3dadd(0.0, 0.0, 0.0, 3.0) pt3dadd(0.0, 30.0, 0.0, 3.0)} 194 | DendSec1 {pt3dclear() pt3dadd(0.0, 30.0, 0.0, 3.0) pt3dadd(0.0, 50.0, 0.0, 3.0)} 195 | DendSec2 {pt3dclear() pt3dadd(0.0, 30.0, 0.0, 3.0) pt3dadd(0.0, 50.0, -40.0, 3.0)} 196 | DendSec3 {pt3dclear() pt3dadd(0.0, 30.0, 0.0, 3.0) pt3dadd(0.0, 50.0, 40.0, 3.0)} 197 | Dend_4_Sec {pt3dclear() pt3dadd(0.0, 50.0, 0.0, 3.0) pt3dadd(0.0, 80.0, -10.0, 1.8000001)} 198 | Dend_5_Sec {pt3dclear() pt3dadd(0.0, 50.0, 0.0, 3.0) pt3dadd(0.0, 80.0, 10.0, 1.8000001)} 199 | Dend_6_Sec {pt3dclear() pt3dadd(0.0, 50.0, 0.0, 3.0) pt3dadd(0.0, 85.0, 0.0, 1.8000001)} 200 | Dend_7_Sec {pt3dclear() pt3dadd(0.0, 50.0, -40.0, 3.0) pt3dadd(0.0, 70.0, -50.0, 1.8000001)} 201 | Dend_8_Sec {pt3dclear() pt3dadd(0.0, 50.0, -40.0, 3.0) pt3dadd(0.0, 70.0, -30.0, 1.8000001)} 202 | Dend_9_Sec {pt3dclear() pt3dadd(0.0, 50.0, -40.0, 3.0) pt3dadd(0.0, 75.0, -40.0, 1.8000001)} 203 | Dend_10_Sec {pt3dclear() pt3dadd(0.0, 50.0, 40.0, 3.0) pt3dadd(0.0, 70.0, 30.0, 1.8000001)} 204 | Dend_11_Sec {pt3dclear() pt3dadd(0.0, 50.0, 40.0, 3.0) pt3dadd(0.0, 70.0, 50.0, 1.8000001)} 205 | Dend_12_Sec {pt3dclear() pt3dadd(0.0, 50.0, 40.0, 3.0) pt3dadd(0.0, 75.0, 40.0, 1.8000001)} 206 | Dend_13_Sec {pt3dclear() pt3dadd(0.0, 80.0, -10.0, 1.8000001) pt3dadd(5.0, 130.0, -24.0, 1.08)} 207 | Dend_14_Sec {pt3dclear() pt3dadd(0.0, 80.0, -10.0, 1.8000001) pt3dadd(0.0, 130.0, -10.0, 1.08)} 208 | Dend_15_Sec {pt3dclear() pt3dadd(0.0, 80.0, -10.0, 1.8000001) pt3dadd(-5.0, 130.0, 4.0, 1.08)} 209 | Dend_16_Sec {pt3dclear() pt3dadd(0.0, 80.0, 10.0, 1.8000001) pt3dadd(5.0, 130.0, -4.0, 1.08)} 210 | Dend_17_Sec {pt3dclear() pt3dadd(0.0, 80.0, 10.0, 1.8000001) pt3dadd(0.0, 130.0, 10.0, 1.08)} 211 | Dend_18_Sec {pt3dclear() pt3dadd(0.0, 80.0, 10.0, 1.8000001) pt3dadd(-5.0, 130.0, 24.0, 1.08)} 212 | Dend_19_Sec {pt3dclear() pt3dadd(0.0, 85.0, 0.0, 1.8000001) pt3dadd(5.0, 135.0, -14.0, 1.08)} 213 | Dend_20_Sec {pt3dclear() pt3dadd(0.0, 85.0, 0.0, 1.8000001) pt3dadd(0.0, 135.0, 0.0, 1.08)} 214 | Dend_21_Sec {pt3dclear() pt3dadd(0.0, 85.0, 0.0, 1.8000001) pt3dadd(-5.0, 135.0, 14.0, 1.08)} 215 | Dend_22_Sec {pt3dclear() pt3dadd(0.0, 70.0, -50.0, 1.8000001) pt3dadd(5.0, 120.0, -64.0, 1.08)} 216 | Dend_23_Sec {pt3dclear() pt3dadd(0.0, 70.0, -50.0, 1.8000001) pt3dadd(0.0, 120.0, -50.0, 1.08)} 217 | Dend_24_Sec {pt3dclear() pt3dadd(0.0, 70.0, -50.0, 1.8000001) pt3dadd(-5.0, 120.0, -36.0, 1.08)} 218 | Dend_25_Sec {pt3dclear() pt3dadd(0.0, 70.0, -30.0, 1.8000001) pt3dadd(5.0, 120.0, -44.0, 1.08)} 219 | Dend_26_Sec {pt3dclear() pt3dadd(0.0, 70.0, -30.0, 1.8000001) pt3dadd(0.0, 120.0, -30.0, 1.08)} 220 | Dend_27_Sec {pt3dclear() pt3dadd(0.0, 70.0, -30.0, 1.8000001) pt3dadd(-5.0, 120.0, -16.0, 1.08)} 221 | Dend_28_Sec {pt3dclear() pt3dadd(0.0, 75.0, -40.0, 1.8000001) pt3dadd(5.0, 125.0, -54.0, 1.08)} 222 | Dend_29_Sec {pt3dclear() pt3dadd(0.0, 75.0, -40.0, 1.8000001) pt3dadd(0.0, 125.0, -40.0, 1.08)} 223 | Dend_30_Sec {pt3dclear() pt3dadd(0.0, 75.0, -40.0, 1.8000001) pt3dadd(-5.0, 125.0, -26.0, 1.08)} 224 | Dend_31_Sec {pt3dclear() pt3dadd(0.0, 70.0, 30.0, 1.8000001) pt3dadd(5.0, 120.0, 16.0, 1.08)} 225 | Dend_32_Sec {pt3dclear() pt3dadd(0.0, 70.0, 30.0, 1.8000001) pt3dadd(0.0, 120.0, 30.0, 1.08)} 226 | Dend_33_Sec {pt3dclear() pt3dadd(0.0, 70.0, 30.0, 1.8000001) pt3dadd(-5.0, 120.0, 44.0, 1.08)} 227 | Dend_34_Sec {pt3dclear() pt3dadd(0.0, 70.0, 50.0, 1.8000001) pt3dadd(5.0, 120.0, 36.0, 1.08)} 228 | Dend_35_Sec {pt3dclear() pt3dadd(0.0, 70.0, 50.0, 1.8000001) pt3dadd(0.0, 120.0, 50.0, 1.08)} 229 | Dend_36_Sec {pt3dclear() pt3dadd(0.0, 70.0, 50.0, 1.8000001) pt3dadd(-5.0, 120.0, 64.0, 1.08)} 230 | Dend_37_Sec {pt3dclear() pt3dadd(0.0, 75.0, 40.0, 1.8000001) pt3dadd(5.0, 125.0, 26.0, 1.08)} 231 | Dend_38_Sec {pt3dclear() pt3dadd(0.0, 75.0, 40.0, 1.8000001) pt3dadd(0.0, 125.0, 40.0, 1.08)} 232 | Dend_39_Sec {pt3dclear() pt3dadd(0.0, 75.0, 40.0, 1.8000001) pt3dadd(-5.0, 125.0, 54.0, 1.08)} 233 | } 234 | 235 | proc subsets() { local i 236 | 237 | all = new SectionList() 238 | subsets_extra_0() 239 | subsets_extra_1() 240 | } 241 | 242 | proc subsets_extra_0(){ 243 | 244 | 245 | soma_group = new SectionList() 246 | 247 | Soma soma_group.append() 248 | 249 | 250 | axon_group = new SectionList() 251 | 252 | AxonSec axon_group.append() 253 | 254 | 255 | dendrite_group = new SectionList() 256 | 257 | DendRootSec dendrite_group.append() 258 | DendSec1 dendrite_group.append() 259 | DendSec2 dendrite_group.append() 260 | DendSec3 dendrite_group.append() 261 | Dend_4_Sec dendrite_group.append() 262 | Dend_5_Sec dendrite_group.append() 263 | Dend_6_Sec dendrite_group.append() 264 | Dend_7_Sec dendrite_group.append() 265 | Dend_8_Sec dendrite_group.append() 266 | Dend_9_Sec dendrite_group.append() 267 | Dend_10_Sec dendrite_group.append() 268 | Dend_11_Sec dendrite_group.append() 269 | Dend_12_Sec dendrite_group.append() 270 | Dend_13_Sec dendrite_group.append() 271 | Dend_14_Sec dendrite_group.append() 272 | Dend_15_Sec dendrite_group.append() 273 | Dend_16_Sec dendrite_group.append() 274 | Dend_17_Sec dendrite_group.append() 275 | Dend_18_Sec dendrite_group.append() 276 | Dend_19_Sec dendrite_group.append() 277 | Dend_20_Sec dendrite_group.append() 278 | Dend_21_Sec dendrite_group.append() 279 | Dend_22_Sec dendrite_group.append() 280 | Dend_23_Sec dendrite_group.append() 281 | Dend_24_Sec dendrite_group.append() 282 | Dend_25_Sec dendrite_group.append() 283 | Dend_26_Sec dendrite_group.append() 284 | Dend_27_Sec dendrite_group.append() 285 | Dend_28_Sec dendrite_group.append() 286 | Dend_29_Sec dendrite_group.append() 287 | Dend_30_Sec dendrite_group.append() 288 | Dend_31_Sec dendrite_group.append() 289 | Dend_32_Sec dendrite_group.append() 290 | Dend_33_Sec dendrite_group.append() 291 | Dend_34_Sec dendrite_group.append() 292 | Dend_35_Sec dendrite_group.append() 293 | Dend_36_Sec dendrite_group.append() 294 | Dend_37_Sec dendrite_group.append() 295 | Dend_38_Sec dendrite_group.append() 296 | Dend_39_Sec dendrite_group.append() 297 | 298 | 299 | main_dends = new SectionList() 300 | 301 | Dend_13_Sec main_dends.append() 302 | Dend_14_Sec main_dends.append() 303 | Dend_15_Sec main_dends.append() 304 | Dend_16_Sec main_dends.append() 305 | Dend_17_Sec main_dends.append() 306 | Dend_18_Sec main_dends.append() 307 | Dend_19_Sec main_dends.append() 308 | Dend_20_Sec main_dends.append() 309 | Dend_21_Sec main_dends.append() 310 | Dend_22_Sec main_dends.append() 311 | Dend_23_Sec main_dends.append() 312 | Dend_24_Sec main_dends.append() 313 | Dend_25_Sec main_dends.append() 314 | Dend_26_Sec main_dends.append() 315 | Dend_27_Sec main_dends.append() 316 | Dend_28_Sec main_dends.append() 317 | Dend_29_Sec main_dends.append() 318 | Dend_30_Sec main_dends.append() 319 | Dend_31_Sec main_dends.append() 320 | Dend_32_Sec main_dends.append() 321 | Dend_33_Sec main_dends.append() 322 | Dend_34_Sec main_dends.append() 323 | Dend_35_Sec main_dends.append() 324 | Dend_36_Sec main_dends.append() 325 | Dend_37_Sec main_dends.append() 326 | Dend_38_Sec main_dends.append() 327 | Dend_39_Sec main_dends.append() 328 | 329 | 330 | Soma all.append() 331 | AxonSec all.append() 332 | DendRootSec all.append() 333 | DendSec1 all.append() 334 | DendSec2 all.append() 335 | DendSec3 all.append() 336 | Dend_4_Sec all.append() 337 | Dend_5_Sec all.append() 338 | Dend_6_Sec all.append() 339 | Dend_7_Sec all.append() 340 | Dend_8_Sec all.append() 341 | Dend_9_Sec all.append() 342 | Dend_10_Sec all.append() 343 | Dend_11_Sec all.append() 344 | Dend_12_Sec all.append() 345 | Dend_13_Sec all.append() 346 | Dend_14_Sec all.append() 347 | Dend_15_Sec all.append() 348 | Dend_16_Sec all.append() 349 | Dend_17_Sec all.append() 350 | Dend_18_Sec all.append() 351 | Dend_19_Sec all.append() 352 | } 353 | 354 | proc subsets_extra_1(){ 355 | Dend_20_Sec all.append() 356 | Dend_21_Sec all.append() 357 | Dend_22_Sec all.append() 358 | Dend_23_Sec all.append() 359 | Dend_24_Sec all.append() 360 | Dend_25_Sec all.append() 361 | Dend_26_Sec all.append() 362 | Dend_27_Sec all.append() 363 | Dend_28_Sec all.append() 364 | Dend_29_Sec all.append() 365 | Dend_30_Sec all.append() 366 | Dend_31_Sec all.append() 367 | Dend_32_Sec all.append() 368 | Dend_33_Sec all.append() 369 | Dend_34_Sec all.append() 370 | Dend_35_Sec all.append() 371 | Dend_36_Sec all.append() 372 | Dend_37_Sec all.append() 373 | Dend_38_Sec all.append() 374 | Dend_39_Sec all.append() 375 | } 376 | 377 | proc geom() { 378 | } 379 | 380 | proc biophys() { 381 | forsec all cm = 1.0 382 | forsec all Ra = 30.0 383 | 384 | forsec soma_group { insert KConductance { gmax_KConductance = 0.036 } ek = -77.0 // note: this is val from ChannelML, may be reset later 385 | 386 | } 387 | 388 | forsec soma_group { insert NaConductance { gmax_NaConductance = 0.12 } ena = 50.0 // note: this is val from ChannelML, may be reset later 389 | 390 | } 391 | 392 | forsec soma_group { insert PassiveCond { gmax_PassiveCond = 3.0E-4 } 393 | } 394 | 395 | forsec axon_group { insert NaConductance { gmax_NaConductance = 0.12 } ena = 50.0 // note: this is val from ChannelML, may be reset later 396 | 397 | } 398 | 399 | forsec axon_group { insert KConductance { gmax_KConductance = 0.036 } ek = -77.0 // note: this is val from ChannelML, may be reset later 400 | 401 | } 402 | 403 | forsec axon_group { insert PassiveCond { gmax_PassiveCond = 3.0E-4 } 404 | } 405 | 406 | forsec dendrite_group { insert NaConductance { gmax_NaConductance = 0.12 } ena = 50.0 // note: this is val from ChannelML, may be reset later 407 | 408 | } 409 | 410 | forsec dendrite_group { insert PassiveCond { gmax_PassiveCond = 3.0E-4 } 411 | } 412 | 413 | forsec dendrite_group { insert KConductance { gmax_KConductance = 0.036 } ek = -77.0 // note: this is val from ChannelML, may be reset later 414 | 415 | } 416 | 417 | } 418 | 419 | proc geom_nseg() { 420 | AxonSec nseg = 3 421 | } 422 | 423 | 424 | proc position() { local i 425 | forsec all { 426 | for i = 0, n3d()-1 { 427 | pt3dchange(i, $1+x3d(i), $2+y3d(i), $3+z3d(i), diam3d(i)) 428 | } 429 | } 430 | x = $1 y = $2 z = $3 431 | } 432 | 433 | proc connect2target() { //$o1 target point process, $o2 returned NetCon 434 | 435 | Soma $o2 = new NetCon(&v(1), $o1) 436 | } 437 | 438 | proc toString() { 439 | strdef info 440 | sprint(info, "Cell ref: %s (%s), at: (%d, %d, %d)", reference, name, x, y, z) 441 | print info 442 | } 443 | 444 | proc netInfo() { 445 | strdef info 446 | sprint(info, "Cell reference: %s, type: %s", reference, type) 447 | print "-------- ",info 448 | print " There are ", synlist.count(), " connections in ", synlist 449 | for i=0,synlist.count()-1 { 450 | print " Connection from ", synlist.o[i].precell, " to: ", synlist.o[i].postcell 451 | print " Pre: Weight: ", synlist.o[i].weight, ", delay: ", synlist.o[i].delay, ", threshold: ", synlist.o[i].threshold 452 | print " Post: ", synlist.o[i].syn(), ", gmax: ", synlist.o[i].syn().gmax , ", e: ", synlist.o[i].syn().e , ", rise time: ", synlist.o[i].syn().tau_rise , ", decay time: ", synlist.o[i].syn().tau_decay 453 | print " " 454 | } 455 | 456 | 457 | 458 | print "-------- " 459 | print " " 460 | } 461 | 462 | 463 | endtemplate PurkinjeCell 464 | 465 | -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/cellCheck.hoc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * A neuroConstruct helper file to print out details of a single cell's overall state 4 | * and a helper function for the current NEURON state 5 | * 6 | */ 7 | 8 | objref mt, ms 9 | mt = new MechanismType(0) 10 | 11 | double totParamVal[32] // max number params 12 | 13 | dummyRevPot = 99999 14 | 15 | 16 | proc cellInfoOne() { 17 | 18 | totalDiam = 0 19 | totalNseg = 0 20 | totalL = 0 21 | 22 | totalRa = 0 23 | totalCm = 0 24 | 25 | numSections = 0 26 | 27 | forsec $s1 { 28 | 29 | totalDiam = totalDiam + diam 30 | totalNseg = totalNseg + nseg 31 | totalRa = totalRa + Ra 32 | totalCm = totalCm + cm 33 | 34 | totalL = totalL + L 35 | numSections = numSections + 1 36 | } 37 | 38 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 39 | 40 | print "+ " 41 | print "+ Temperature: ", celsius 42 | print "+ " 43 | print "+ Total diam: ", totalDiam 44 | print "+ Total length ", totalL 45 | print "+ Total nseg: ", totalNseg 46 | print "+ Total Ra: ", totalRa 47 | print "+ Total cm: ", totalCm 48 | print "+ " 49 | 50 | strdef mname 51 | strdef pname 52 | 53 | totEk = 0 54 | totko = 0 55 | totki = 0 56 | numEk = 0 57 | totENa = 0 58 | totnao = 0 59 | totnai = 0 60 | numENa = 0 61 | totECa = 0 62 | totcai = 0 63 | totcao = 0 64 | numECa = 0 65 | 66 | forsec $s1 { 67 | if (ismembrane("k_ion")) { 68 | numEk = numEk +1 69 | totEk = totEk + ek 70 | totko = totko + ko 71 | totki = totki + ki 72 | } 73 | if (ismembrane("na_ion")) { 74 | numENa = numENa +1 75 | totENa = totENa + ena 76 | totnao = totnao + nao 77 | totnai = totnai + nai 78 | } 79 | if (ismembrane("ca_ion")) { 80 | numECa = numECa +1 81 | totECa = totECa + eca 82 | totcai = totcai + cai 83 | totcao = totcao + cao 84 | } 85 | } 86 | 87 | if ( numEk != 0 ){ 88 | print "+ k ion on ", numEk,"secs, ave rev pot: ", (totEk/numEk), ", int conc: ",(totki/numEk), ", ext conc: ",(totko/numEk) 89 | } 90 | if ( numENa != 0 ){ 91 | print "+ na ion on ", numENa,"secs, ave rev pot: ", (totENa/numENa), ", int conc: ",(totnai/numENa), ", ext conc: ",(totnao/numENa) 92 | } 93 | if ( numECa != 0 ){ 94 | print "+ ca ion on ", numECa,"secs, ave rev pot: ", (totECa/numECa), ", int conc: ",(totcai/numECa), ", ext conc: ",(totcao/numECa) 95 | } 96 | 97 | print "+ " 98 | 99 | for i=0, mt.count()-1 { 100 | mt.select(i) 101 | mt.selected(mname) 102 | numPresent = 0 103 | ms = new MechanismStandard(mname, 1) 104 | numParams = ms.count() 105 | 106 | 107 | for j=0, numParams-1 { 108 | totParamVal[j] = 0 109 | } 110 | 111 | 112 | forsec $s1 { 113 | if (ismembrane(mname)) { 114 | numPresent = numPresent + 1 115 | 116 | ms.in() // load with values of current section 117 | 118 | for j=0, numParams-1 { 119 | ms.name(pname, j) 120 | //print "Param: ", pname, " value: ", ms.get(pname) 121 | 122 | totParamVal[j] = totParamVal[j] + ms.get(pname) 123 | } 124 | } 125 | } 126 | 127 | if (numPresent>0) { 128 | print "+ Mechanism: ", mname, " present on: ", numPresent, "sections, num params: ", numParams, "" 129 | for j=0, numParams-1 { 130 | ms.name(pname, j) 131 | print "+ - ", pname, " AVE value all sections: ", (totParamVal[j]/numPresent) 132 | } 133 | } 134 | } 135 | 136 | 137 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 138 | 139 | 140 | } 141 | 142 | 143 | proc cellInfo() { 144 | cellInfoOne("") 145 | } 146 | 147 | 148 | 149 | 150 | proc simInfo() { 151 | 152 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 153 | 154 | 155 | active = cvode.active() 156 | 157 | 158 | print "+ Simulation temperature: ", celsius 159 | print "+ tstop: ", tstop 160 | print "+ dt: ", dt 161 | print "+ Variable time step active: ", active 162 | 163 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 164 | 165 | } -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/main.py: -------------------------------------------------------------------------------- 1 | # This example comes with NeuronVisio. 2 | 3 | # The model is the ported one from the NeuroML website 4 | # http://www.neuroconstruct.org/samples/index.html#Ex6_CerebellumDemo-N101EA 5 | 6 | # You need to compile the hoc file before launching it 7 | # $ nrnivmodl 8 | 9 | # Importing Neuronvisio 10 | from neuronvisio.controls import Controls 11 | controls = Controls() 12 | 13 | # loading the model 14 | # importing the interview so the GUI does not freeze 15 | # Uncomment this if you want to use also the interview GUI 16 | #import neuron.gui 17 | 18 | # Load the script 19 | h.load_file("Ex6_CerebellumDemo.hoc") 20 | 21 | # Uncomment, or copy paste in the ipython console to record and run our vectors 22 | 23 | # Record the voltage for all the sections 24 | #controls.manager.add_all_vecRef('v') 25 | 26 | # Initializing also our vectors 27 | #controls.init() 28 | 29 | # Run 30 | #controls.run() -------------------------------------------------------------------------------- /examples/cerebellum_network/hoc/nCtools.hoc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * A neuroConstruct helper file of some simple utilities for checking the 4 | * morphologies of cells loaded into NEURON 5 | * 6 | * Some of these functions provide GENESIS like output, for comparing models in each simulator 7 | * Some functions need a little more tweaking 8 | * 9 | */ 10 | 11 | objectvar nil 12 | 13 | 14 | /* 15 | * Provides information on the morphology of the current accessed section 16 | */ 17 | proc morph() { 18 | 19 | totalarea = 0 20 | print "Currently addressed section: ", secname() 21 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 22 | print "+ Number of 3D info points: ", n3d() 23 | 24 | for i=0,n3d()-1{ 25 | 26 | delx = x3d(i)-lastx 27 | dely = y3d(i)-lasty 28 | delz = z3d(i)-lastz 29 | len = sqrt((delx*delx)+(dely*dely)+(delz*delz)) 30 | 31 | if (i==0){ 32 | delx = dely = delz = len = 0 33 | } 34 | 35 | print "+ ", secname(), " ", i, ": (", x3d(i), ", ", y3d(i), ", ", z3d(i),") diam: ", diam3d(i), " del: (", delx,", ", dely,", ", delz,") len: ", len 36 | 37 | lastx = x3d(i) 38 | lasty = y3d(i) 39 | lastz = z3d(i) 40 | 41 | } 42 | 43 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 44 | 45 | print "+ Number of segments (nseg): ", nseg 46 | 47 | for i=0,nseg+1{ 48 | print "+ ", secname(), " ", i/(nseg+1), " diam: ", diam((i/(nseg+1))), " area: ", area((i/(nseg+1))), " um^2" 49 | totalarea = totalarea + area((i/(nseg+1))) 50 | } 51 | print "+ Total area: ", totalarea 52 | 53 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 54 | print "" 55 | } 56 | 57 | 58 | 59 | /* 60 | * Provides information on the total area, etc. 61 | * Useful as a simple test for comparing cells 62 | */ 63 | proc areainfo(){ 64 | 65 | totalnum = 0 66 | totalarea = 0 67 | 68 | forall totalnum = totalnum +1 69 | 70 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 71 | 72 | print "+" 73 | forall { 74 | 75 | totalsecarea = 0 76 | 77 | for i=0,n3d()-1 print "+ ", secname(), " ", i, ": (", x3d(i), ", ", y3d(i), ", ", z3d(i), ") diam: ", diam3d(i) 78 | 79 | for i=0,nseg+1{ 80 | //print "+ ", secname(), " ", i/(nseg+1), " diam: ", diam((i/(nseg+1))), " area: ", area((i/(nseg+1))), " um^2" 81 | totalsecarea = totalsecarea + area((i/(nseg+1))) 82 | } 83 | print "+ Total section area in ",secname(), ": ", totalsecarea 84 | 85 | totalarea = totalarea + totalsecarea 86 | } 87 | 88 | print "+" 89 | print "+ Number of sections: ", totalnum 90 | print "+ Total all sections: ", totalarea, " um^2" 91 | print "+ Total all sections: ", totalarea/(1000000*1000000), " m^2" 92 | print "+ Total all sections: ", totalarea/(10000*10000), " cm^2" 93 | 94 | print "+" 95 | 96 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 97 | } 98 | 99 | 100 | /* 101 | * Prints voltage of all of the created compartments 102 | */ 103 | proc allv(){ 104 | 105 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 106 | 107 | forall { 108 | if (nseg ==1) { 109 | print secname(), ": ", v 110 | } else { 111 | print secname(), " (nseg = ",nseg,"): " 112 | for i=0,nseg+1{ 113 | strdef ind 114 | sprint(ind, " %f: ", (i/(nseg+1))) 115 | 116 | print ind, "\t\t ", v((i/(nseg+1))) 117 | } 118 | 119 | } 120 | } 121 | 122 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 123 | 124 | } 125 | 126 | /* 127 | * Prints ca conc of all of the created compartments 128 | */ 129 | proc allca(){ 130 | 131 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 132 | 133 | forall { 134 | if (ismembrane("ca_ion")) { 135 | if (nseg ==1) { 136 | print secname(), ": ", cai 137 | } else { 138 | print secname(), " (nseg = ",nseg,"): " 139 | for i=0,nseg+1{ 140 | strdef ind 141 | sprint(ind, " %f: ", (i/(nseg+1))) 142 | print ind, "\t\t ", cai((i/(nseg+1))) 143 | } 144 | 145 | } 146 | } 147 | } 148 | 149 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 150 | 151 | } 152 | 153 | /* 154 | * Prints info on network connections 155 | */ 156 | proc allsyns() { 157 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 158 | 159 | for i=0,allCells.count()-1 { 160 | 161 | allCells.o[i].netInfo() 162 | 163 | } 164 | 165 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 166 | 167 | } 168 | 169 | 170 | 171 | /* 172 | * Prints info on all cells 173 | */ 174 | proc allcells() { 175 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 176 | 177 | for i=0,allCells.count()-1 { 178 | allCells.o[i].toString() 179 | } 180 | 181 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 182 | 183 | } 184 | 185 | /* 186 | * Provides information on the current section similar to that produced 187 | * with "showfield *" in GENESIS 188 | */ 189 | proc gen() { 190 | 191 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 192 | 193 | totalarea = 0 194 | totalRa = 0 195 | 196 | 197 | print "" 198 | print secname() 199 | print "" 200 | print "Voltage = ", v 201 | 202 | for i=0,nseg+1{ 203 | 204 | thisPoint = i/(nseg+1) 205 | nextPoint = (i+1)/(nseg+1) 206 | halfWay = thisPoint 207 | 208 | 209 | areaHere = area(halfWay) 210 | 211 | RaHere = ri(halfWay) 212 | 213 | print " - Section from ", thisPoint, " to ", nextPoint, ", area: ", areaHere 214 | 215 | print " Ra to end of this length = ", RaHere*1000, " ohm" 216 | 217 | 218 | totalarea = totalarea + areaHere 219 | if (i>0){ 220 | totalRa = totalRa + RaHere 221 | } 222 | } 223 | 224 | print "Total area = ", totalarea 225 | print "Total Ra = ", totalRa*1000 , " ohm" 226 | 227 | 228 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 229 | 230 | } 231 | 232 | 233 | 234 | 235 | /* 236 | * Provides information on the current section, like an expanded psection() 237 | */ 238 | proc secinfo() { 239 | 240 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 241 | 242 | totalarea = 0 243 | totalRa = 0 244 | 245 | 246 | print "" 247 | print secname() 248 | print "" 249 | print "Voltage = ", v 250 | print "nseg = ", nseg 251 | 252 | 253 | for i=1,nseg+1{ 254 | 255 | thisPoint = i/(nseg+1) 256 | nextPoint = (i+1)/(nseg+1) 257 | halfWay = thisPoint 258 | 259 | 260 | areaHere = area(halfWay) 261 | 262 | RaHere = ri(halfWay) 263 | 264 | print " - Section from ", thisPoint, ", to ", nextPoint, ", area: ", areaHere 265 | 266 | print " Ra = ", RaHere*1000, " ohm" 267 | 268 | 269 | totalarea = totalarea + areaHere 270 | totalRa = totalRa + RaHere 271 | } 272 | 273 | print "Total area = ", totalarea 274 | print "Total Ra = ", totalRa*1000 , " ohm (Note that this doesn't have any physical meaning)" 275 | 276 | 277 | print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 278 | 279 | } 280 | 281 | 282 | objectvar listNcSyn 283 | objectvar listNcPre 284 | 285 | 286 | proc netConnInfo() { 287 | netConInfo() 288 | } 289 | 290 | /* 291 | * Helper functions for getting more info on NetConn objects 292 | */ 293 | proc netConInfo() { 294 | 295 | 296 | print "-- ",hostid,"---------------------------------------------------------" 297 | print "-- ",hostid,"-- NetConn: ", $o1 298 | if ($o1!=nil) { 299 | print "-- ",hostid,"-- Pre: ",$o1.precell(),", Syn: ",$o1.syn,"(",$o1.postcell, ")", ", Active: ",$o1.active(),", Valid: ",$o1.valid() 300 | /* 301 | // Doesn't seem to work with section in template... 302 | if ($o1.precell()!=nil) { 303 | print "-- ",hostid,"-- From: ", $o1.precell().toString() 304 | loc = $o1.preloc() 305 | print "-- ",hostid,"-- Section: ", secname(), " - ", loc 306 | pop_section() 307 | 308 | }*/ 309 | if ($o1.postcell()!=nil) { print "-- ",hostid,"-- To: ", $o1.postcell().toString() } 310 | print "-- ",hostid,"-- Weight: ",$o1.weight, ", Delay: ",$o1.delay, ", Thresh: ",$o1.threshold 311 | 312 | listNcSyn = $o1.synlist() 313 | 314 | for i=0,listNcSyn.count()-1 { 315 | print "-- ",hostid,"-- NetConns sharing syn: ", listNcSyn.o(i) 316 | } 317 | 318 | listNcPre = $o1.precelllist() 319 | 320 | for i=0,listNcPre.count()-1 { 321 | print "-- ",hostid,"-- NetConns sharing pre cell: ", listNcPre.o(i) 322 | } 323 | } 324 | 325 | print "-- ",hostid,"---------------------------------------------------------" 326 | } 327 | 328 | proc netConInfoParallel() { 329 | netConInfo($o1) 330 | if ($o1!=nil) { 331 | print "-- ",hostid,"----------------------- Src gid: ", $o1.srcgid 332 | } 333 | print " " 334 | } 335 | 336 | 337 | // Some utilities for automating testing of generated NEURON 338 | 339 | numTestsPassed = 0 340 | numTestsFailed = 0 341 | 342 | 343 | proc testEquals() { 344 | 345 | if ($1 != $2) { 346 | print "Test failed: ", $1, " != ", $2 347 | numTestsFailed = numTestsFailed + 1 348 | } else { 349 | numTestsPassed = numTestsPassed + 1 350 | } 351 | 352 | } 353 | 354 | 355 | objref testResultFile 356 | 357 | proc createTestReport() { 358 | 359 | print "------------------------------------------------------------------------------" 360 | 361 | print " Finished tests. Number of passed tests: ", numTestsPassed, ", number of failed tests: ", numTestsFailed 362 | 363 | {testResultFile = new File()} 364 | 365 | if(numTestsFailed == 0) { 366 | testResultFile.wopen("passed") 367 | } else { 368 | testResultFile.wopen("failed") 369 | } 370 | 371 | {testResultFile.printf("numPassed=%g\n", numTestsPassed)} 372 | {testResultFile.printf("numFailed=%g\n", numTestsFailed)} 373 | 374 | {testResultFile.close()} 375 | 376 | 377 | print "------------------------------------------------------------------------------" 378 | 379 | } 380 | 381 | -------------------------------------------------------------------------------- /examples/medium_model.py: -------------------------------------------------------------------------------- 1 | """ 2 | This example comes with NeuronVisio. 3 | Cell model taken from the paper: 4 | 5 | NEURON and Python 6 | Hines et al. 7 | Frontiers in Neuroinformatics 8 | (2009) 9 | DOI 10.3389/neuro.11/001.2009 10 | 11 | """ 12 | 13 | from itertools import chain 14 | 15 | # Importing Neuronvisio 16 | from neuronvisio.controls import Controls 17 | controls = Controls() 18 | 19 | # Importing the hoc interpreter 20 | from neuron import h 21 | 22 | # topology 23 | soma = h.Section(name='soma') 24 | apical = h.Section(name='apical') 25 | basilar = h.Section(name='basilar') 26 | axon = h.Section(name='axon') 27 | 28 | apical.connect(soma, 1, 0) 29 | basilar.connect(soma , 0, 0) 30 | axon.connect(soma, 0, 0) 31 | 32 | # geometry 33 | soma.L = 30 34 | soma.nseg = 1 35 | soma.diam = 30 36 | 37 | apical.L = 600 38 | apical.nseg = 23 39 | apical.diam = 1 40 | 41 | basilar.L = 200 42 | basilar.nseg = 5 43 | basilar.diam = 2 44 | 45 | 46 | axon.L = 1000 47 | axon.nseg = 37 48 | axon.diam = 1 49 | 50 | # biophysics 51 | for sec in h.allsec(): 52 | sec.Ra = 100 53 | sec.cm = 1 54 | 55 | soma.insert('hh') 56 | 57 | 58 | apical.insert('pas') 59 | 60 | basilar.insert('pas') 61 | 62 | for seg in chain (apical, basilar ): 63 | seg.pas.g = 0.0002 64 | seg.pas.e = -65 65 | 66 | axon.insert('hh') 67 | 68 | 69 | # --------------------- Instrumentation --------------------- 70 | # synaptic input 71 | syn = h.AlphaSynapse(0.5, sec=soma) 72 | syn.onset = 0.5 73 | syn.gmax = 0.05 74 | syn.e = 0 75 | -------------------------------------------------------------------------------- /examples/pyramidal/README_NEURONVISIO.rst: -------------------------------------------------------------------------------- 1 | ======================== 2 | Running with Neuronvisio 3 | ======================== 4 | 5 | 6 | To run with neuronvisio the model just launch tha main from an ipython console:: 7 | 8 | ipython -pylab 9 | 10 | run main.py 11 | 12 | Don't forget to compile the mod file first with nrnivmodl. More info online at 13 | http://mattions.github.com/neuronvisio/ 14 | -------------------------------------------------------------------------------- /examples/pyramidal/demo.hoc: -------------------------------------------------------------------------------- 1 | 2 | // -------------------------------------------------------------- 3 | 4 | // Investigating ANTIDROMIC ACTION POTENTIALS 5 | 6 | // Using Diana Smetters p19 rat L5 pyramid 7 | 8 | // Huguenard/McCormick HH kinetics 9 | // na3h5.mod, kd3h5.mod 10 | 11 | // Set up to reproduce Stuart and Sakmann (1994), Fig. 2a 12 | 13 | // -------------------------------------------------------------- 14 | 15 | 16 | // used to load_proc("nrnmainmenu") for early pre 5.x versions of neuron 17 | //load_file("nrngui.hoc") 18 | 19 | 20 | // -------------------------------------------------------------- 21 | // redefine some things in stdrun.hoc 22 | // -------------------------------------------------------------- 23 | 24 | tstop = 60 25 | steps_per_ms = 40 26 | dt = 0.025 27 | 28 | 29 | // -------------------------------------------------------------- 30 | // cell geometry 31 | // -------------------------------------------------------------- 32 | 33 | 34 | xopen("dks577a.hoc") 35 | xopen("dks577.append.hoc") 36 | 37 | 38 | // -------------------------------------------------------------- 39 | // passive & active membrane 40 | // -------------------------------------------------------------- 41 | 42 | ra = 200 43 | global_ra = ra 44 | rm = 40000 45 | c_m = 0.75 46 | v_init = -70 47 | celsius = 23 48 | 49 | Ek = -90 50 | Ena = 60 51 | 52 | 53 | gna_dend = 30 54 | gna_node = 30000 55 | gk = 100 56 | frac_gk_apical = 0 57 | gk_node = 0 58 | 59 | 60 | proc install_channels() { 61 | 62 | // passive 63 | forall { 64 | insert pas 65 | Ra = ra 66 | cm = c_m 67 | g_pas = 1/rm 68 | e_pas = v_init 69 | } 70 | // exceptions along the axon 71 | forsec "myelin" cm = 0.04 72 | forsec "node" g_pas = 0.02 73 | 74 | add_spines(apical,sd_apical) 75 | add_spines(oblique,sd_oblique) 76 | add_spines(distal,sd_distal) 77 | add_spines(basal,sd_basal) 78 | 79 | 80 | // Na+ channels 81 | 82 | forall insert na3 83 | forsec dend gbar_na3 = gna_dend 84 | forsec "myelin" gbar_na3 = gna_dend 85 | soma.gbar_na3 = gna_dend 86 | hill.gbar_na3 = gna_node 87 | iseg.gbar_na3 = gna_node 88 | forsec "node" gbar_na3 = gna_node 89 | 90 | forall if (ismembrane("na3")) ena = Ena // per S&S ena = 90 91 | 92 | // K+ channels 93 | 94 | forsec basal { 95 | insert kd3 96 | gbar_kd3 = gk 97 | } 98 | soma insert kd3 99 | soma.gbar_kd3 = gk 100 | 101 | // no K+ in apical dend or axon 102 | 103 | forall if (ismembrane("kd3")) ek = Ek // per S&S ek = -100 104 | } 105 | 106 | install_channels() 107 | -------------------------------------------------------------------------------- /examples/pyramidal/dks577.append.hoc: -------------------------------------------------------------------------------- 1 | 2 | 3 | // -------------------------------------------------------------- 4 | // Select which dendrites get na/kd channels 5 | // -------------------------------------------------------------- 6 | 7 | n_axon_seg = 5 8 | // n_axon_seg = 25 9 | create myelin[n_axon_seg],node[n_axon_seg] 10 | 11 | objectvar active, apical, basal, distal, dend, axon 12 | 13 | soma distance() 14 | 15 | dend = new SectionList() 16 | forsec "dend" dend.append() 17 | 18 | // distal dendrites 19 | distal = new SectionList() 20 | forsec "dend9" if (distance(0) > 550) distal.append() 21 | 22 | // apical 23 | apical = new SectionList() 24 | forsec "dend9" apical.append() 25 | 26 | // basal dendrites 27 | basal = new SectionList() 28 | forsec "dend" basal.append() 29 | forsec apical basal.remove() 30 | 31 | axon = new SectionList() 32 | hill axon.append() 33 | iseg axon.append() 34 | forsec "myelin" axon.append() 35 | forsec "node" axon.append() 36 | 37 | // active sections 38 | active = new SectionList() 39 | forall active.append() 40 | forsec "myelin" active.remove() 41 | 42 | 43 | 44 | // -------------------------------------------------------------- 45 | // Other geometry-specific locations 46 | // -------------------------------------------------------------- 47 | 48 | objref dsite 49 | dend9[76] dsite = new SectionRef() 50 | site_loc = 0.5 // distance = 416 um 51 | 52 | // synapses 53 | 54 | objref synloc 55 | synloc = new SectionList() 56 | forsec distal synloc.append() 57 | 58 | 59 | // along ap 60 | objref path 61 | path = new SectionList() 62 | 63 | dend9[76] path.append() 64 | dend9[72] path.append() 65 | dend9[68] path.append() 66 | dend9[62] path.append() 67 | dend9[56] path.append() 68 | dend9[50] path.append() 69 | dend9[48] path.append() 70 | dend9[38] path.append() 71 | dend9[30] path.append() 72 | dend9[24] path.append() 73 | dend9[8] path.append() 74 | dend9[0] path.append() 75 | 76 | 77 | // oblique 78 | objref oblique 79 | oblique = new SectionList() 80 | forsec apical oblique.append() 81 | forsec distal oblique.remove() 82 | forsec path oblique.remove() 83 | 84 | 85 | // -------------------------------------------------------------- 86 | // correct diameter of apical 87 | // -------------------------------------------------------------- 88 | 89 | 90 | double x[199],y[199],z[199],d[199] 91 | proc diam_interp() { local d0,d1 92 | 93 | d0 = $1 94 | d1 = $2 95 | 96 | for i=0,n3d()-1 { 97 | x[i]=x3d(i) y[i]=y3d(i) z[i]=z3d(i) 98 | } 99 | if (numarg() > 2) { 100 | n = $3 101 | } else { 102 | n = n3d() 103 | } 104 | max = n3d() 105 | pt3dclear() 106 | for i=0,n-1 { 107 | pt3dadd(x[i],y[i],z[i],i/n*d1+(1-i/n)*d0) 108 | } 109 | for i=n,max-1 { 110 | pt3dadd(x[i],y[i],z[i],i/n*d1+(1-i/n)*d0) 111 | } 112 | } 113 | 114 | proc shrink() { local factor 115 | 116 | factor = $1 117 | 118 | n = n3d() 119 | for i=0,n-1 { 120 | x[i]=x3d(i) y[i]=y3d(i) z[i]=z3d(i) d[i]=diam3d(i) 121 | } 122 | 123 | pt3dclear() 124 | for i=0,n-1 { 125 | pt3dadd(x[i]*factor,y[i]*factor,z[i]*factor,d[i]*factor) 126 | } 127 | } 128 | 129 | // -------------------------------------------------------------- 130 | // discretization 131 | // -------------------------------------------------------------- 132 | 133 | max_len_dend = 50 134 | forsec dend { 135 | n = L / max_len_dend 136 | if (n < 1) n = 1 137 | nseg = n+1 138 | } 139 | 140 | // give more segments to path 141 | 142 | max_len_path = 10 143 | forsec path { 144 | n = L / max_len_path 145 | if (n < 1) n = 1 146 | nseg = n+1 147 | } 148 | 149 | 150 | 151 | // -------------------------------------------------------------- 152 | // Axon geometry 153 | // -------------------------------------------------------------- 154 | 155 | // hillock 156 | // hillock is only a few microns long (2-4) and tapered diam from 4 to 1-2 um 157 | // then initial segment follows, can be 100-150 um long with diam of ~ 1 um 158 | // myelin starts after initial segment 159 | 160 | // initial segment 161 | // Farinas & DeFelipe J Comp Neurol 1991: 162 | // L diam 163 | // cocallosal 21.6 +- 4.10 1.06 +- 0.18 164 | // ispsilateral 22.24 +- 1.58 1.06 +- 0.12 165 | 166 | hill { 167 | L = 10 168 | nseg = 10 169 | diam(0:1) = 4:1 // taper 170 | } 171 | 172 | iseg { // initial segment between hillock + myelin 173 | L = 15 174 | nseg = 10 175 | // for(x) diam(x) = 3.5*exp(-(x*L+hill.L)/5)+.5 176 | diam = 1 177 | } 178 | 179 | // construct myelinated axon with nodes of ranvier 180 | for i=0,n_axon_seg-1 { 181 | myelin[i] { // myelin element 182 | nseg = 25 183 | L = 100 184 | diam = 1.5 185 | } 186 | node[i] { // nodes of Ranvier 187 | nseg = 1 188 | L = 1.0 189 | diam = 1.0 // nodes are thinner than axon 190 | } 191 | } 192 | 193 | 194 | iseg connect myelin[0](0), 1 195 | myelin[0] connect node[0](0), 1 196 | 197 | for i=0,n_axon_seg-2 { 198 | node[i] connect myelin[i+1](0), 1 199 | myelin[i+1] connect node[i+1](0), 1 200 | } 201 | 202 | access soma 203 | 204 | 205 | 206 | // -------------------------------------------------------------- 207 | // Spines 208 | // -------------------------------------------------------------- 209 | 210 | 211 | fold_spines = 0 212 | spine_area = 0.83 // um^2 -- Harris 213 | 214 | // spines per linear um 215 | // Larkman (1991) JCN 216 | sd_apical = 6.3 217 | sd_oblique = 1.5 218 | sd_basal = 1.43 219 | sd_distal = 0.91 220 | 221 | proc add_spines() { local a 222 | spine_dens = $2 223 | forsec $o1 { 224 | a =0 225 | for(x) a=a+area(x) 226 | 227 | if (fold_spines) { 228 | // Folding factor 229 | // Jack et al (1989), Marjor et al (1994) 230 | F = (L*spine_area*spine_dens + a)/a 231 | 232 | L = L * F^(2/3) 233 | for(x) diam(x) = diam(x) * F^(1/3) 234 | } else { 235 | F = 1 + L*spine_area*spine_dens/a 236 | cm = c_m * F 237 | g_pas = F/rm 238 | } 239 | } 240 | } 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /examples/pyramidal/kd3h5.mod: -------------------------------------------------------------------------------- 1 | 2 | COMMENT 3 | 4 | Kd3h5.mod 5 | 6 | Potassium channel, Hodgkin-Huxley style kinetics 7 | Kinetic rates based roughly on Sah et al. and Hamill et al. (1991) 8 | 9 | Use with na3h5.mod 10 | 11 | Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu 12 | 13 | ENDCOMMENT 14 | 15 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 16 | 17 | NEURON { 18 | SUFFIX kd3 19 | USEION k READ ek WRITE ik 20 | RANGE n, gk, gbar 21 | RANGE ninf, ntau 22 | GLOBAL Ra, Rb 23 | GLOBAL q10, temp, tadj, vmin, vmax 24 | } 25 | 26 | UNITS { 27 | (mA) = (milliamp) 28 | (mV) = (millivolt) 29 | (pS) = (picosiemens) 30 | (um) = (micron) 31 | } 32 | 33 | PARAMETER { 34 | gbar = 300 (pS/um2) : 0.03 mho/cm2 35 | v (mV) 36 | 37 | tha = 20 (mV) : v 1/2 for inf 38 | qa = 9 (mV) : inf slope 39 | 40 | Ra = 0.02 (/ms) : max act rate 41 | Rb = 0.002 (/ms) : max deact rate 42 | 43 | dt (ms) 44 | celsius (degC) 45 | temp = 16 (degC) : original temp 46 | q10 = 2.3 : temperature sensitivity 47 | 48 | vmin = -120 (mV) 49 | vmax = 100 (mV) 50 | } 51 | 52 | 53 | ASSIGNED { 54 | a (/ms) 55 | b (/ms) 56 | ik (mA/cm2) 57 | gk (pS/um2) 58 | ek (mV) 59 | ninf 60 | ntau (ms) 61 | tadj 62 | } 63 | 64 | 65 | STATE { n } 66 | 67 | INITIAL { 68 | trates(v) 69 | n = ninf 70 | } 71 | 72 | BREAKPOINT { 73 | SOLVE states 74 | gk = gbar*n 75 | ik = (1e-4) * gk * (v - ek) 76 | } 77 | 78 | LOCAL nexp 79 | 80 | PROCEDURE states() { :Computes state variable n 81 | trates(v) : at the current v and dt. 82 | n = n + nexp*(ninf-n) 83 | VERBATIM 84 | return 0; 85 | ENDVERBATIM 86 | } 87 | 88 | PROCEDURE trates(v) { :Computes rate and other constants at current v. 89 | :Call once from HOC to initialize inf at resting v. 90 | LOCAL tinc 91 | TABLE ninf, nexp 92 | DEPEND dt, celsius, temp, Ra, Rb, tha, qa 93 | 94 | FROM vmin TO vmax WITH 199 95 | 96 | rates(v): not consistently executed from here if usetable_hh == 1 97 | 98 | tadj = 3^((celsius - temp)/10) 99 | 100 | tinc = -dt * tadj 101 | nexp = 1 - exp(tinc/ntau) 102 | } 103 | 104 | 105 | PROCEDURE rates(v) { :Computes rate and other constants at current v. 106 | :Call once from HOC to initialize inf at resting v. 107 | 108 | a = Ra * (v - tha) / (1 - exp(-(v - tha)/qa)) 109 | b = -Rb * (v - tha) / (1 - exp((v - tha)/qa)) 110 | ntau = 1/(a+b) 111 | ninf = a*ntau 112 | } 113 | 114 | -------------------------------------------------------------------------------- /examples/pyramidal/main.py: -------------------------------------------------------------------------------- 1 | # This example comes with NeuronVisio. 2 | 3 | # In this example we show how to load a model written in hoc with neruonvisio and explore 4 | # it. 5 | 6 | # The model that I choose is: 7 | # A model of spike initiation in neocortical pyramidal neurons 8 | # Z. F. Mainen, J. Joerges, J. R. Huguenard and T. J. Sejnowski 9 | # Neuron 15, 1427-1439 (1995) 10 | 11 | # From the original demo I deleted the synapses and the interview panel for clarity. 12 | 13 | 14 | # You need to compile the hoc file before launching it 15 | # $ nrnivmodl 16 | 17 | # Importing Neuronvisio 18 | from neuronvisio.controls import Controls 19 | controls = Controls() 20 | 21 | # Importing hoc interpreter 22 | from neuron import h 23 | 24 | # loading the model 25 | # importing the interview so the GUI does not freeze 26 | # Uncomment this if you want to use also the interview GUI 27 | #import neuron.gui 28 | 29 | # Load the script 30 | h.load_file("demo.hoc") 31 | 32 | 33 | ## Insert an IClamp 34 | st = h.IClamp(0.5, sec=h.soma) 35 | st.amp = 0.25 36 | st.delay = 3 37 | st.dur = 40 38 | -------------------------------------------------------------------------------- /examples/pyramidal/mosinit.hoc: -------------------------------------------------------------------------------- 1 | xopen("demo.hoc") 2 | -------------------------------------------------------------------------------- /examples/pyramidal/na3h5.mod: -------------------------------------------------------------------------------- 1 | 2 | COMMENT 3 | 4 | na3h5.mod 5 | 6 | Sodium channel, Hodgkin-Huxley style kinetics. 7 | 8 | Kinetics were fit to data from Huguenard et al. (1988) and Hamill et 9 | al. (1991) 10 | 11 | qi is not well constrained by the data, since there are no points 12 | between -80 and -55. So this was fixed at 5 while the thi1,thi2,Rg,Rd 13 | were optimized using a simplex least square proc 14 | 15 | voltage dependencies are shifted approximately +5mV from the best 16 | fit to give higher threshold 17 | 18 | use with kd3h5.mod 19 | 20 | Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu 21 | 22 | ENDCOMMENT 23 | 24 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 25 | 26 | NEURON { 27 | SUFFIX na3 28 | USEION na READ ena WRITE ina 29 | RANGE m, h, gna, gbar, vshift 30 | GLOBAL tha, thi1, thi2, qa, qi, qinf, thinf 31 | RANGE minf, hinf, mtau, htau 32 | GLOBAL Ra, Rb, Rd, Rg 33 | GLOBAL q10, temp, tadj, vmin, vmax 34 | } 35 | 36 | PARAMETER { 37 | gbar = 1200 (pS/um2) : 0.12 mho/cm2 38 | vshift = 0 (mV) : voltage shift (affects all) 39 | 40 | tha = -35 (mV) : v 1/2 for act (-42) 41 | qa = 9 (mV) : act slope 42 | Ra = 0.182 (/ms) : open (v) 43 | Rb = 0.124 (/ms) : close (v) 44 | 45 | thi1 = -50 (mV) : v 1/2 for inact 46 | thi2 = -75 (mV) : v 1/2 for inact 47 | qi = 5 (mV) : inact tau slope 48 | thinf = -65 (mV) : inact inf slope 49 | qinf = 6.2 (mV) : inact inf slope 50 | Rg = 0.0091 (/ms) : inact (v) 51 | Rd = 0.024 (/ms) : inact recov (v) 52 | 53 | temp = 23 (degC) : original temp 54 | q10 = 2.3 : temperature sensitivity 55 | 56 | v (mV) 57 | dt (ms) 58 | celsius (degC) 59 | vmin = -120 (mV) 60 | vmax = 100 (mV) 61 | } 62 | 63 | 64 | UNITS { 65 | (mA) = (milliamp) 66 | (mV) = (millivolt) 67 | (pS) = (picosiemens) 68 | (um) = (micron) 69 | } 70 | 71 | ASSIGNED { 72 | ina (mA/cm2) 73 | gna (pS/um2) 74 | ena (mV) 75 | minf hinf 76 | mtau (ms) htau (ms) 77 | tadj 78 | } 79 | 80 | 81 | STATE { m h } 82 | 83 | INITIAL { 84 | trates(v+vshift) 85 | m = minf 86 | h = hinf 87 | } 88 | 89 | BREAKPOINT { 90 | SOLVE states 91 | gna = gbar*m*m*m*h 92 | ina = (1e-4) * gna * (v - ena) 93 | } 94 | 95 | LOCAL mexp, hexp 96 | 97 | PROCEDURE states() { :Computes state variables m, h, and n 98 | trates(v+vshift) : at the current v and dt. 99 | m = m + mexp*(minf-m) 100 | h = h + hexp*(hinf-h) 101 | VERBATIM 102 | return 0; 103 | ENDVERBATIM 104 | } 105 | 106 | PROCEDURE trates(v) { 107 | 108 | LOCAL tinc 109 | TABLE minf, mexp, hinf, hexp 110 | DEPEND dt, celsius, temp, Ra, Rb, Rd, Rg, tha, thi1, thi2, qa, qi, qinf 111 | 112 | FROM vmin TO vmax WITH 199 113 | 114 | rates(v): not consistently executed from here if usetable == 1 115 | 116 | tadj = q10^((celsius - temp)/10) 117 | tinc = -dt * tadj 118 | 119 | mexp = 1 - exp(tinc/mtau) 120 | hexp = 1 - exp(tinc/htau) 121 | } 122 | 123 | 124 | PROCEDURE rates(vm) { 125 | LOCAL a, b 126 | 127 | a = trap0(vm,tha,Ra,qa) 128 | b = trap0(-vm,-tha,Rb,qa) 129 | mtau = 1/(a+b) 130 | minf = a*mtau 131 | 132 | :"h" inactivation 133 | 134 | a = trap0(vm,thi1,Rd,qi) 135 | b = trap0(-vm,-thi2,Rg,qi) 136 | htau = 1/(a+b) 137 | hinf = 1/(1+exp((vm-thinf)/qinf)) 138 | } 139 | 140 | 141 | FUNCTION trap0(v,th,a,q) { 142 | if (fabs(v/th) > 1e-6) { 143 | trap0 = a * (v - th) / (1 - exp(-(v - th)/q)) 144 | } else { 145 | trap0 = a * q 146 | } 147 | } 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /examples/pyramidal/readme.txt: -------------------------------------------------------------------------------- 1 | This model is associated with the paper: 2 | 3 | A model of spike initiation in neocortical pyramidal neurons 4 | Z. F. Mainen, J. Joerges, J. R. Huguenard and T. J. Sejnowski 5 | Neuron 15, 1427-1439 (1995) 6 | 7 | 8 | Please see 9 | 10 | http://www.cnl.salk.edu/~zach/methods.html 11 | 12 | where a full text (postscript format) copy of the paper 13 | and copies of the model for early versions of neuron is available. 14 | 15 | This model contains compartmental models of a reconstructed neocortical 16 | neuron with active dendritic currents using NEURON. This paper examines 17 | the paradox that although spikes can back-propagate from the soma into dendrites 18 | with spike amplitudes maintained in dendrites by voltage-gated channels it rarely 19 | occurs that spikes are initiated in dendrites in these cells. The model suggests 20 | that dendritic channel inactivation and source-load considerations are contributing 21 | factors. See the paper for more details. 22 | 23 | This package is written in the NEURON simulation program written by Michael 24 | Hines and available on internet at: 25 | http://www.neuron.yale.edu/ 26 | 27 | 28 | HOW TO RUN (under NEURON version 5 and higher) 29 | ========================================= 30 | 31 | To compile the demo, NEURON and INTERVIEWS must be installed and working on 32 | the machine you are using. 33 | 34 | When the spikeinit.zip file is unzipped it creates a spikeinit directory which 35 | contains the hoc and mod NEURON program files. Change directory to spikeinit. 36 | 37 | under UNIX: 38 | =========== 39 | 40 | Just type "nrnivmodl" to compile the mechanisms 41 | given in the mod files in the directory. 42 | 43 | Execute the first figure demo program by typing: 44 | 45 | nrngui demo.hoc 46 | 47 | continue below under back to any platform: 48 | 49 | under MS WINDOWS (PC): 50 | ====================== 51 | 52 | Press Start button (lower left corner) and then press Programs and then 53 | NEURON and then mknrndll. Change directory to where the zip file was 54 | unzipped and enter the directory that came with the zip file (spikeinit). 55 | Press the nrnmech.dll button. 56 | 57 | You can start the simulation by a double click on 58 | demo.hoc 59 | in windows explorer. 60 | 61 | The simulation produces fig 3 from the paper. 62 | -------------------------------------------------------------------------------- /examples/simple_model.py: -------------------------------------------------------------------------------- 1 | # This example comes with NeuronVisio. 2 | 3 | # Importing the NeuronVisio 4 | from neuronvisio.controls import Controls 5 | controls = Controls() 6 | # Importing hoc interpreter 7 | from neuron import h 8 | 9 | # simple model 10 | 11 | soma = h.Section(name='soma') 12 | dend1 = h.Section(name='dend1') 13 | dend2 = h.Section(name='dend2') 14 | 15 | soma.diam = 10 16 | dend1.diam = 3 17 | dend2.diam = 3 18 | soma.L = 50 19 | dend1.L = 100 20 | dend2.L = 100 21 | 22 | dend1.connect(soma) 23 | dend2.connect(soma) 24 | 25 | # biophysics 26 | 27 | for sec in h.allsec(): 28 | sec.Ra = 100 29 | sec.cm = 1 30 | 31 | soma.insert('hh') 32 | dend1.insert('pas') 33 | dend2.insert('pas') 34 | 35 | # --------------------- Instrumentation --------------------- 36 | # synaptic input 37 | syn = h.AlphaSynapse(0.5, sec=soma) 38 | syn.onset = 0.5 39 | syn.gmax = 0.05 40 | syn.e = 0 41 | -------------------------------------------------------------------------------- /neuronvisio/__init__.py: -------------------------------------------------------------------------------- 1 | #""" 2 | #NeuronVisio is a Graphical User Interface for NEURON simulator enviroment 3 | # 4 | #Copyright (c) 2009, Michele Mattioni 5 | #All rights reserved. 6 | # 7 | # 8 | #This program is free software: you can redistribute it and/or modify 9 | #it under the terms of the GNU General Public License as published by 10 | #the Free Software Foundation, either version 3 of the License, or 11 | #(at your option) any later version. 12 | # 13 | #This program is distributed in the hope that it will be useful, 14 | #but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | #GNU General Public License for more details. 17 | # 18 | #You should have received a copy of the GNU General Public License 19 | #along with this program. If not, see . 20 | # 21 | #""" 22 | 23 | __authors__ = ['Michele Mattioni', 'Uri Cohen'] 24 | __authors_emails__ = ['', ''] 25 | __version__ = '0.9.1' 26 | 27 | 28 | import os 29 | # this add the commit of to the software version when run from a git repo 30 | try: 31 | import git 32 | if git.__version__ == '0.3.1': 33 | src_root = os.path.dirname(__path__[0]) # Getting the root of the module 34 | if git.repo.fun.is_git_dir(os.path.join(src_root, ".git")): 35 | r = git.Repo(src_root) 36 | git_commit = r.head.commit.hexsha 37 | __version__ = __version__ + ' : ' + git_commit 38 | raise ImportError 39 | except ImportError: 40 | pass 41 | -------------------------------------------------------------------------------- /neuronvisio/colorbutton.py: -------------------------------------------------------------------------------- 1 | """ 2 | colorbutton.py 3 | 4 | A tool button that enables the user to select colors using a color dialog. 5 | 6 | Copyright (C) 2007 David Boddie 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 | """ 22 | 23 | from PyQt4.QtCore import * 24 | from PyQt4.QtGui import * 25 | 26 | class ColorButton(QToolButton): 27 | 28 | __pyqtSignals__ = ("colorChanged(QColor)") 29 | 30 | def __init__(self, parent = None): 31 | 32 | QToolButton.__init__(self, parent) 33 | self.connect(self, SIGNAL("clicked()"), self.chooseColor) 34 | self._color = QColor() 35 | 36 | def chooseColor(self): 37 | 38 | rgba, valid = QColorDialog.getRgba(self._color.rgba(), self.parentWidget()) 39 | if valid: 40 | color = QColor.fromRgba(rgba) 41 | self.setColor(color) 42 | 43 | def color(self): 44 | 45 | return self._color 46 | 47 | @pyqtSignature("QColor") 48 | def setColor(self, color): 49 | 50 | if color != self._color: 51 | self._color = color 52 | self.emit(SIGNAL("colorChanged(QColor)"), self._color) 53 | pixmap = QPixmap(16, 16) 54 | pixmap.fill(color) 55 | self.setIcon(QIcon(pixmap)) 56 | 57 | color = pyqtProperty("QColor", color, setColor) 58 | -------------------------------------------------------------------------------- /neuronvisio/command_line.py: -------------------------------------------------------------------------------- 1 | """Module to handle commandline beahviour""" 2 | 3 | import sys 4 | 5 | def _load_neuronvisio(ipshell): 6 | """General method to load neuronvisio specific code. 7 | params: 8 | ipshell - IPython interactive shell, obtained either from the current 9 | session, or created ad hoc.""" 10 | 11 | ipshell.run_cell("import sys") 12 | # ipshell.run_cell("from neuron import h; h('nrn_load_dll(\"$(NEURONHOME)/stdrun.hoc\")')") 13 | ipshell.run_cell("from neuronvisio.controls import Controls") 14 | ipshell.run_cell("controls = Controls()") 15 | if len(sys.argv) == 2: 16 | ipshell.run_cell("controls.load(sys.argv[1])") 17 | return ipshell 18 | 19 | 20 | def main_neuronvisio(): 21 | try: 22 | # check if inside an ipython session 23 | # Not need to launch ipshell() at the end, 'cause already running 24 | ipshell = get_ipython() 25 | ipshell = _load_neuronvisio(ipshell) 26 | 27 | 28 | except NameError: 29 | # Not IPython running, create an ad hoc ipshell and launching. 30 | from IPython.terminal.embed import InteractiveShellEmbed 31 | ipshell = InteractiveShellEmbed(display_banner=False) 32 | ipshell = _load_neuronvisio(ipshell) 33 | ipshell() 34 | 35 | else: 36 | # Define a dummy ipshell() so the same code doesn't crash inside an 37 | # interactive IPython 38 | def ipshell(): pass 39 | 40 | def main_model_updater(): 41 | """Updates the ModelDB.xml in the current location""" 42 | 43 | import os 44 | import logging 45 | 46 | import neuronvisio.modeldb 47 | from neuronvisio.modeldb.Updater import ModelDBUpdater 48 | 49 | h = logging.StreamHandler(sys.stderr) 50 | h.setLevel(logging.DEBUG) 51 | logging.getLogger().addHandler(h) 52 | logging.getLogger().setLevel(logging.INFO) 53 | 54 | # Update models 55 | path_to_module_dir = neuronvisio.modeldb.__path__[0] 56 | print path_to_module_dir 57 | path_to_file = os.path.join(path_to_module_dir, 'ModelDB.xml') 58 | updater = ModelDBUpdater(path_to_file) 59 | updater.update() -------------------------------------------------------------------------------- /neuronvisio/icons/help-browser.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 22 | 29 | 31 | 35 | 39 | 40 | 43 | 47 | 51 | 52 | 63 | 65 | 69 | 73 | 74 | 85 | 96 | 97 | 120 | 134 | 135 | 137 | 138 | 140 | image/svg+xml 141 | 143 | Help Browser 144 | 2005-11-06 145 | 146 | 147 | Tuomas Kuosmanen 148 | 149 | 150 | 151 | 152 | help 153 | browser 154 | documentation 155 | docs 156 | man 157 | info 158 | 159 | 160 | 162 | 163 | 164 | Jakub Steiner, Andreas Nilsson 165 | 166 | 167 | http://tigert.com 168 | 169 | 171 | 173 | 175 | 177 | 178 | 179 | 180 | 184 | 194 | 204 | 214 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /neuronvisio/icons/res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | document-save-as.svg 4 | help-browser.svg 5 | system-log-out.svg 6 | document-save.svg 7 | document-open.svg 8 | 9 | 10 | -------------------------------------------------------------------------------- /neuronvisio/modeldb/ModelDB.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | import types 3 | import string 4 | import re 5 | import os 6 | import xml.etree.ElementTree 7 | import urllib 8 | import zipfile 9 | import logging 10 | import subprocess 11 | from sys import platform as _platform 12 | 13 | logger = logging.getLogger(__name__) 14 | 15 | HTML_BODY="" 16 | HTML_TABLE="" 17 | 18 | class Model(object): 19 | # Fields 20 | _model = None 21 | 22 | # Constants 23 | _MODEL_PROPERTIES = [('model_type', 0), ('model_concepts', 0), 24 | ('transmitters', 0),('genes', 0), ('receptors', 0), ('brain_regions', 0), 25 | ('channels', 0), ('cell_types', 0), ('gap_junctions', 0), 26 | ('implementers', 0), 27 | ('simulation_environment', 0)] 28 | _MODEL_PAGE_LAYOUT = """%(short_name)s|%(title)s 29 | Description: %(description)s 30 | Reference: %(reference)s 31 | ModelDB Page|Citations Query|Model #%(model_id)s""" 32 | _README_NOT_FOUND = "A readme file was not found for this model, try online at ModelDB" 33 | 34 | # Initialization 35 | def __init__(self, model): 36 | self._model = model 37 | 38 | # Public data accessors 39 | # Get a mapping of non-empty model properties 40 | def get_properties(self): 41 | for (k, s) in self._MODEL_PROPERTIES: 42 | t=self._model[k] 43 | t=t.strip() 44 | if len(t) == 0: # Show only non-empty properties 45 | continue 46 | k=k.replace('_', ' ') 47 | k=k.title() 48 | yield (k, t) 49 | 50 | def get_name(self): 51 | return self._model['short_name'] 52 | 53 | def get_title(self): 54 | return self._model['title'] 55 | 56 | def get_description(self): 57 | return self._model['description'] 58 | 59 | def get_reference(self): 60 | return self._model['reference'] 61 | 62 | def get_url(self): 63 | return self._model['url'] 64 | 65 | def get_id(self): 66 | return int(self._model['model_id']) 67 | 68 | def get_authors(self): 69 | return self._model['short_authors'] 70 | 71 | def get_year(self): 72 | return self._model['year'] 73 | 74 | # Get the model readme in text 75 | def get_readme_text(self): 76 | if self._model.has_key('readme') == False: 77 | return None 78 | return self._model['readme'] 79 | 80 | # Get the model readme in HTML 81 | def get_readme_html(self): 82 | readme = self.get_readme_text() 83 | if readme == "": 84 | return self._create_readme_tab(self._README_NOT_FOUND) 85 | return self._create_readme_tab(readme) 86 | 87 | # Get the model overview 88 | def get_overview(self): 89 | return self._create_overview_tab() 90 | 91 | # Public operations and manipulations 92 | # Check if model exists locally 93 | def exists_locally(self): 94 | return os.path.isdir(self.get_dir()) 95 | 96 | # Open model directory for browsing 97 | def browse(self): 98 | if self.exists_locally(): 99 | modelName = self.get_name() 100 | logger.info("Opening '" + self.get_dir()+"'.") 101 | self._start_file(self.get_dir()) 102 | else: 103 | logger.info("Model does not exists locally") 104 | 105 | # Download model file from network 106 | def download_model(self): 107 | modelId = self.get_id() 108 | if os.path.isdir('Models')==False: 109 | os.mkdir('Models') 110 | model_zipped= ('%s.zip') %modelId 111 | zipFile = os.path.join('Models', model_zipped) 112 | modelDir = self.get_dir() 113 | if not os.path.isfile(zipFile): 114 | if self._model['zip_url']=="": 115 | logger.info("No zip URL found for '" + self.get_name() + "'") 116 | return 117 | else: 118 | logger.info("Downloading model for '" + self.get_name() + "'") 119 | self._download_file(self._model['zip_url'], zipFile) 120 | logger.info("Download complete.") 121 | # TODO: open model data in tab 122 | # TODO: recolor, self.tree.SetItemColor(item, wx.Colour(100,10,255)) 123 | else: 124 | logger.info("Model for '" + self.get_name() + "' already downloaded") 125 | if not os.path.isdir(modelDir): 126 | self._extract_model(zipFile, modelDir) 127 | else: 128 | logger.info("Model for '" + self.get_name() + "' already extracted") 129 | return modelDir 130 | 131 | # Get model directory 132 | def get_dir(self): 133 | modelId = self.get_id() 134 | dirName = os.path.join('Models', str(modelId)) 135 | return dirName 136 | 137 | def get_tooltip(self): 138 | "Return the tooltip for the model." 139 | tooltip = '' 140 | if self.exists_locally(): 141 | tooltip = 'Model %s downloaded in %s' %(self.get_id(), 142 | self.get_dir()) 143 | else: 144 | tooltip = 'Model %s has not been downloaded' %self.get_id() 145 | return tooltip 146 | 147 | # Private implementation methods 148 | # Download model file from the network 149 | def _download_file(self, url, filename): 150 | logger.info("Creating " + filename) 151 | try: 152 | s = urllib.urlopen(url) 153 | f = open(filename, "wb") 154 | f.write(s.read()) 155 | f.close() 156 | except Exception as e: 157 | logger.info("Error downloading file: "+e.message) 158 | return 159 | logger.info("Done.") 160 | 161 | # Extract model zip file 162 | # ModelDB zip files contain trailing garbage which should be removed 163 | # See 'ZIP end of central directory record' in http://en.wikipedia.org/wiki/ZIP_%28file_format%29 164 | def _extract_model(self, zipFile, modelDir): 165 | logger.info("Extracting '" + zipFile + "' into " + modelDir) 166 | try: 167 | f = open(zipFile, 'r+b') 168 | data = f.read() 169 | pos = data.find('\x50\x4b\x05\x06') # End of central directory signature 170 | if (pos > 0): 171 | logger.debug("Truncating file at location " + str(pos + 22)+ ".") 172 | f.seek(pos + 22) # size of 'ZIP end of central directory record' 173 | f.truncate() 174 | f.close() 175 | zip = zipfile.ZipFile(zipFile, 'r') 176 | dirs = {} 177 | for file in zip.namelist(): 178 | dir = file[0:file.find('/')] 179 | if dirs.has_key(dir)==False: 180 | dirs[dir]=0 181 | else: 182 | dirs[dir]=dirs[dir]+1 183 | zip.extract(file, 'Models') 184 | zip.close() 185 | if len(dirs.keys()) == 1: 186 | os.rename('Models/' + dirs.keys()[0], modelDir) 187 | else: 188 | os.mkdir(modelDir) 189 | for d in dirs: 190 | os.rename('Models/' + d, modelDir + d) 191 | except Exception as e: 192 | logger.info("Error extracting file: "+str(e.message)) 193 | logger.info("Done.") 194 | 195 | # Create the HTML of the readme tab 196 | def _create_readme_tab(self, readme): 197 | html = "" 198 | html = html +HTML_BODY 199 | html = html + "

" + HTML_TABLE 200 | html = html + "

" + readme + "" 201 | html = html + "

" 202 | html = html + "" 203 | html = html + "" 204 | return html 205 | 206 | # Create the HTML of the overview tab 207 | def _create_overview_tab(self): 208 | html = "" 209 | html = html +HTML_BODY 210 | html = html + "" 218 | html = html + "
" 211 | html = html + "

Model Information

" 212 | html = html + "

" + self._generate_table(self._MODEL_PAGE_LAYOUT, 3) + "

" 213 | html = html + "
" 214 | html = html + "

Model Properties

" 215 | html = html + "

" + HTML_TABLE 216 | for k,s in self.get_properties(): 217 | html = html + "

" + k + "" + s + "

" 219 | html = html + "" 220 | html = html + "" 221 | html = html + "" 222 | return html 223 | 224 | # Create an HTML table from the given table format 225 | def _generate_table(self, format, cols): 226 | properties = self._model 227 | result=HTML_TABLE 228 | lines=format.split('\n') 229 | for l in lines: 230 | a='' 231 | i=0 232 | cells=l.split('|') 233 | v=cols-len(cells)+1 234 | for c in cells: 235 | i=i+1 236 | if (i == len(cells)): 237 | a=a+''+c%properties+'' 238 | else: 239 | a=a+''+c%properties+'' 240 | result = result + '' + a + '' 241 | result = result + "" 242 | return result 243 | 244 | def _start_file(self, filename): 245 | 246 | if _platform == "linux" or _platform == "linux2": 247 | # Implementation for Linux 248 | subprocess.Popen(['xdg-open', os.path.abspath(filename)]) 249 | elif _platform == "darwin": 250 | # OS X 251 | subprocess.Popen(['open', os.path.abspath(filename)]) 252 | elif _platform == "win32": 253 | # Implementation for Windows 254 | f=filename.replace('/', '\\') 255 | os.startfile(f) 256 | 257 | #--------------------------------------------------------------------------- 258 | class Models(): 259 | # Fields 260 | _log = None 261 | _name_re = None 262 | _modelList = [] 263 | _modelTree = {} 264 | 265 | # public methods 266 | # Initialize class, assuming the XML model DB is in the current directory 267 | def __init__(self): 268 | self._name_re = re.compile("^\s*(.*)\(((.*)(\d{4}).*)\)") 269 | path = os.path.split(os.path.abspath(__file__))[0] # base absolute dir 270 | self._modelList = self._generate_models_list(os.path.join(path, 'ModelDB.xml')) 271 | self._modelTree = self._generate_models_tree(self._modelList) 272 | 273 | # Get all model names 274 | def get_model_names(self, keyword=""): 275 | for name in self._modelTree.keys(): 276 | if not keyword or self.search(name, keyword): 277 | yield name 278 | 279 | # Check if specific model exists 280 | def has_model(self, modelName): 281 | return self._modelTree.has_key(modelName) 282 | 283 | # Get specific model 284 | def get_model(self, modelName): 285 | return Model(self._modelTree[modelName]) 286 | 287 | # Get the value of specific model field 288 | def get_field(self, model, field): 289 | return self._modelTree[model][field] 290 | 291 | """ Returns whether a model contains the search keyword or not. """ 292 | def search(self, name, keyword): 293 | return self._modelTree[name]['searchable'].find(keyword.lower()) >= 0 294 | 295 | # private methods 296 | # Generate the models list from the input XML 297 | def _generate_models_list(self, data): 298 | models=xml.etree.ElementTree.XML(open(data).read()) 299 | list=[] 300 | for m in models: 301 | d={} 302 | for c in m._children: 303 | if (len(c._children)>0): 304 | d[c.tag]=map((lambda a:a.text), c._children) 305 | else: 306 | d[c.tag]=c.text 307 | list.append(d) 308 | return list 309 | 310 | # Generate the models tree, moving each item into canonical form 311 | def _generate_models_tree(self, list): 312 | tree={} 313 | for m in list: 314 | search='' 315 | for s in m.keys(): 316 | search = search + "|" + self._to_text(m[s]) 317 | m['searchable']=search.lower() 318 | name=m['name'] 319 | [t, s, a, y]=self._get_title_authors_year_short_name(name) 320 | m['short_name']=s 321 | m['title']=t 322 | m['short_authors']=a 323 | m['year']=y 324 | c=self._to_text(m['citations']) 325 | if len(c)>0: 326 | m['citations']=self._MODELDB_BASE_URL + c 327 | for k in m.keys(): 328 | m[k]=self._to_text(m[k]) 329 | tree[s]=m 330 | return tree 331 | 332 | # Parse model short name into arguments 333 | def _get_title_authors_year_short_name(self, name): 334 | m=self._name_re.match(name) 335 | if m: 336 | return m.groups() 337 | else: 338 | raise Exception("no match in " + name) 339 | 340 | # Handle string, none and list values and change them to be stripped string 341 | def _to_text(self, t): 342 | if (type(t) == types.ListType): 343 | t=string.join(t, ',') 344 | if (type(t) == types.NoneType): 345 | t='' 346 | t=t.strip() 347 | return t 348 | 349 | # Constants 350 | _MODELDB_BASE_URL = 'http://senselab.med.yale.edu/modeldb/' 351 | -------------------------------------------------------------------------------- /neuronvisio/modeldb/ModelsTree.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | 3 | class ModelsTree: 4 | _treeList = [] 5 | 6 | def __init__(self, models): 7 | names = models.get_model_names() 8 | self._treeList.append(('Recent Additions/Updates', [])) 9 | self._treeList.append(('Local Models', [])) 10 | self._treeList.append(('Marked Models', [])) 11 | self._treeList.append(('Models (' + str(len(names)) + ')', names)) 12 | 13 | def get_tree(self): 14 | return self._treeList 15 | -------------------------------------------------------------------------------- /neuronvisio/modeldb/Updater.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | import urllib2 3 | import time 4 | import logging 5 | import xml.dom.minidom 6 | import re 7 | import types 8 | import codecs 9 | import os.path 10 | from BeautifulSoup import BeautifulSoup 11 | 12 | logger = logging.getLogger(__name__) 13 | 14 | # This class allows updating a ModelDB local store from the online site. 15 | # 16 | # It also offer a stand-alone main() which update the ModelDB.xml file 17 | # from current directory. 18 | class ModelDBUpdater: 19 | # Constants 20 | _BASE_URL = 'http://senselab.med.yale.edu/modeldb/' 21 | _START_URLS = ["http://senselab.med.yale.edu/modeldb/ModelList.asp?id=1882"] 22 | _DOWNLOAD_DELAY = 1 23 | _ID_REGEX = re.compile("ShowModel\.asp\?model=(\d*)") 24 | _NAME_REGEX = re.compile("^\s*(.*)\(((.*)(\d{4}).*)\)") 25 | 26 | # Private variables 27 | _last_download_time = 0 28 | _xml_file = "" 29 | _existing_items = {} 30 | _dom = None 31 | 32 | # Initialize an updater for a file with local ModelDB content 33 | def __init__(self, xml_file): 34 | self._xml_file = xml_file 35 | # Create the file if it does not exist 36 | if os.path.isfile(xml_file)==False: 37 | f=codecs.open(xml_file, "w", encoding='utf-8') 38 | f.write(''.decode('utf-8')) 39 | f.close() 40 | # Read the file into dom 41 | logger.info("Reading %s..."%xml_file) 42 | self._dom = xml.dom.minidom.parse(xml_file) 43 | # Create a list of available id-s 44 | items=self._dom.childNodes[0] 45 | ids=items.getElementsByTagName('model_id') 46 | for i in ids: 47 | id = i.childNodes[0].toxml().strip() 48 | self._existing_items[id] = True 49 | logger.info("Got %d models locally"%len(self._existing_items.keys())) 50 | 51 | # Update models XML file from online content 52 | def update(self): 53 | # Get online items and compare them to the local items 54 | online = self.get_online_items() 55 | logger.info("Got %d online items"%len(online)) 56 | new_ones = self.get_new_items(online) 57 | logger.info("Got %d new items"%len(new_ones)) 58 | # Add an item to the dom for each new item 59 | for i in new_ones.keys(): 60 | u=new_ones[i]['url'] 61 | v=self.parse_item(u) 62 | new_item = self._dom.createElement('item') 63 | for k in v.keys(): 64 | name = self._dom.createElement(k) 65 | if type(v[k]) == types.ListType: 66 | # Create a node named after the key with childrens named 'value' for each value 67 | for val in v[k]: 68 | value = self._dom.createElement('value') 69 | value.appendChild(self._dom.createTextNode(self._get_text(val))) 70 | name.appendChild(value) 71 | # "The most common shortcoming of BeautifulStoneSoup is that it doesn't know about 72 | # self-closing tags" so we need to add empty content in them 73 | if len(v[k])==0: 74 | name.appendChild(self._dom.createTextNode(u"")) 75 | else: 76 | name.appendChild(self._dom.createTextNode(self._get_text(v[k]))) 77 | new_item.appendChild(name) 78 | self._dom.childNodes[0].appendChild(new_item) 79 | self.update_xml() 80 | return new_ones 81 | 82 | # Compare existing items to online ones 83 | def get_new_items(self, online_items): 84 | online_ids = online_items.keys() 85 | new_items = {} 86 | for i in online_items: 87 | if self._existing_items.has_key(i)==False: 88 | new_items[i]=online_items[i] 89 | logger.info("New item %d %s"%(int(i), new_items[i]['name'])) 90 | return new_items 91 | 92 | # Find all online items 93 | def get_online_items(self): 94 | results = {} 95 | for u in self._START_URLS: 96 | list_data = self._get_url(u) 97 | soup = BeautifulSoup(list_data) 98 | for i in soup('tr'): 99 | if i.td.a==None or i.td.a.string==None: 100 | logger.warn("Ignoring empty item: %s"%i) 101 | else: 102 | # Filter only idems which have a valid id and name 103 | # This prevents collecting place-holders for yet-to-be-published items 104 | m=self._ID_REGEX.match(i.td.a['href']) 105 | n=self._NAME_REGEX.match(i.td.a.string) 106 | if not m: 107 | logger.warn("Ignoring bad model link: '%s'"%i.td.a['href']) 108 | elif not n: 109 | logger.warn("Ignoring bad model name: '%s'"%i.td.a.string) 110 | else: 111 | id = m.groups()[0] 112 | url = self._BASE_URL + i.td.a['href'] 113 | name = i.td.a.string 114 | map = {'url':url, 'name':name, 'id':id} 115 | results[id] = map 116 | return results 117 | 118 | # Write DOC back into XML file 119 | def update_xml(self): 120 | f = codecs.open(self._xml_file, "w", encoding='utf-8') 121 | xml=self._dom.toxml(encoding="utf-8") 122 | soup = BeautifulSoup(xml) 123 | try: 124 | f.write(soup.prettify().decode('utf-8')) 125 | f.close() 126 | except IOError: 127 | logger.error("Not able to write the file: %s" % self._xml_file) 128 | 129 | # Parse a ModelDB model page and extract an item dictionary 130 | def parse_item(self, url): 131 | data=self._get_url(url) 132 | 133 | # Extract main items from the page 134 | soup = BeautifulSoup(data) 135 | table1 = soup.find('table', {'id': 'Table1'}) 136 | table2 = soup.find('table', {'id': 'Table2'}) 137 | table3 = soup.find('table', {'id': 'Table3'}) 138 | if table1 == None or table2 == None or table3 == None: 139 | exit("Could not find a mandatory table") 140 | rows = table1.findAll('tr', {}, False) 141 | if rows == None: 142 | exit("Could not find model details") 143 | props = table2.findAll('tr', {}, False) 144 | if props == None: 145 | exit("Could not find model properties") 146 | files = table3.findAll('tr', {}, False) 147 | if files == None: 148 | exit("Could not find model files") 149 | 150 | item={} 151 | item['url']=url.encode('utf-8') 152 | 153 | # Model details 154 | item['name'] = rows[0].th.string 155 | if item['name'] == None: 156 | exit("Could not find mandatory field: name") 157 | item['model_id'] = rows[1].th.contents[2] 158 | if item['name'] == None: 159 | exit("Could not find mandatory field: name") 160 | item['description'] = self._html_to_text(rows[2].td.contents) 161 | if item['description'] == None: 162 | exit("Could not find mandatory field: description") 163 | item['reference'] = self._html_to_text(rows[2].td.contents[3:]) 164 | if rows[2].td.em != None and rows[2].td.em.a != None: 165 | item['article'] = rows[2].td.em.a['href'] 166 | if rows[2].td.small != None and rows[2].td.small.a != None: 167 | item['pubmed'] = rows[2].td.small.a['href'] 168 | item['citations'] = rows[3].td.a['href'] 169 | 170 | # Model properties 171 | item['model_type'] = self._list_to_text(props[0].findAll('td', {}, False)[1]('a')) 172 | item['brain_regions'] = self._list_to_text(props[1].findAll('td', {}, False)[1]('a')) 173 | item['cell_types'] = self._list_to_text(props[2].findAll('td', {}, False)[1]('a')) 174 | item['channels'] = self._list_to_text(props[3].findAll('td', {}, False)[1]('a')) 175 | item['gap_junctions'] = self._list_to_text(props[4].findAll('td', {}, False)[1]('a')) 176 | item['receptors'] = self._list_to_text(props[5].findAll('td', {}, False)[1]('a')) 177 | item['genes'] = self._list_to_text(props[6].findAll('td', {}, False)[1]('a')) 178 | item['transmitters'] = self._list_to_text(props[7].findAll('td', {}, False)[1]('a')) 179 | item['simulation_environment'] = self._list_to_text(props[8].findAll('td', {}, False)[1]('a')) 180 | if item['simulation_environment'] == None: 181 | exit("Could not find mandatory field: simulation_environment") 182 | item['model_concepts'] = self._list_to_text(props[9].findAll('td', {}, False)[1]('a')) 183 | item['implementers'] = self._list_to_text(props[10].findAll('td', {}, False)[1]('a')) 184 | 185 | # Model files 186 | links = files[0].td.div.findAll('a', None, False) 187 | zip_url=links[0]['href'] 188 | item['zip_url']=zip_url 189 | if item['zip_url'] == None: 190 | exit("Could not find mandatory field: zip_url") 191 | readme = files[1].findAll('td', None, False)[1] 192 | item['readme']=readme.renderContents().decode('utf-8') 193 | if item['readme'] == None: 194 | exit("Could not find mandatory field: readme") 195 | return item 196 | 197 | # Download data from URL with appropriate delays 198 | def _get_url(self, url): 199 | # Delay the download by some time, if needed 200 | time_since_download = time.time() - self._last_download_time 201 | if time_since_download < self._DOWNLOAD_DELAY: 202 | s = self._DOWNLOAD_DELAY - time_since_download 203 | logger.debug("Sleeping for %0.2f seconds"%s) 204 | time.sleep(s) 205 | 206 | # Perform the actual download 207 | logger.info("Reading %s"%url) 208 | data = urllib2.urlopen(url).read() 209 | self._last_download_time = time.time() 210 | return data 211 | 212 | # Extract text from a contents list, concatanating the text of the items into a single string 213 | def _html_to_text(self, h): 214 | t=u"" 215 | for i in h: 216 | if type(i).__name__=='NavigableString': 217 | t=t+i 218 | elif i.string != None: 219 | t=t+i.string 220 | else: 221 | logger.debug("No text extracted from %s"%str(i)) 222 | return t 223 | 224 | # Extract text from a list, returning a list of strings 225 | def _list_to_text(self, l): 226 | v=[] 227 | for i in l: 228 | v.append(self._html_to_text(i)) 229 | return v 230 | 231 | # Extract text from BeautifulStoneSoup node into a string 232 | def _get_text(self, node): 233 | if type(node).__name__ == 'NavigableString': 234 | return node.string 235 | elif type(node).__name__ == 'NavigableUnicodeString': 236 | return node.string 237 | elif type(node) == types.StringType: 238 | return unicode(node, 'utf-8') 239 | elif type(node) == types.UnicodeType: 240 | return node 241 | elif node == None: 242 | # See the comment above about the shortcoming of BeautifulStoneSoup 243 | return u"" 244 | return node.renderContents() 245 | -------------------------------------------------------------------------------- /neuronvisio/modeldb/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattions/neuronvisio/e28131f26186b60541662448ac302e11158801ff/neuronvisio/modeldb/__init__.py -------------------------------------------------------------------------------- /neuronvisio/ui/qtAbout.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog 4 | 5 | 6 | true 7 | 8 | 9 | 10 | 0 11 | 0 12 | 347 13 | 319 14 | 15 | 16 | 17 | About Neuronvisio 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Name and Version 26 | 27 | 28 | Qt::RichText 29 | 30 | 31 | Qt::AlignCenter 32 | 33 | 34 | 35 | 36 | 37 | 38 | Author 39 | 40 | 41 | Qt::AlignCenter 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Qt::Horizontal 51 | 52 | 53 | 54 | 40 55 | 20 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | &OK 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 0 74 | 0 75 | 76 | 77 | 78 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 79 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 80 | p, li { white-space: pre-wrap; } 81 | </style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> 82 | <p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> 83 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://neuronvisio.org"><span style=" text-decoration: underline; color:#0000ff;">neuronvisio.org</span></a></p></body></html> 84 | 85 | 86 | true 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | pushButton 98 | clicked(bool) 99 | Dialog 100 | close() 101 | 102 | 103 | 345 104 | 120 105 | 106 | 107 | 191 108 | 180 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /scripts/neuronvisio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Author Michele Mattioni 3 | # Fri Apr 9 11:35:29 BST 2010 4 | import sys 5 | import os 6 | sys.path.append(os.path.realpath(os.path.join(os.path.abspath(__file__), "../.."))) 7 | 8 | if __name__ == '__main__': 9 | from neuronvisio.command_line import main_neuronvisio 10 | main_neuronvisio() 11 | -------------------------------------------------------------------------------- /scripts/neuronvisio-modeldb-updater: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Author Michele Mattioni 3 | # Tue Feb 14 15:47:08 GMT 2012 4 | 5 | """Updates the ModelDB.xml in the current location""" 6 | 7 | import sys 8 | import os 9 | sys.path.append(os.path.realpath(os.path.join(os.path.abspath(__file__), "../.."))) 10 | 11 | 12 | if __name__ == '__main__': 13 | 14 | from neuronvisio.command_line import main_model_updater 15 | main_model_updater() 16 | -------------------------------------------------------------------------------- /scripts/neuronvisio-modeldb-updater.bat: -------------------------------------------------------------------------------- 1 | rem Used on Windows system to launch the neuronvisio script 2 | python -i %0\..\neuronvisio-modeldb-updater 3 | -------------------------------------------------------------------------------- /scripts/neuronvisio.bat: -------------------------------------------------------------------------------- 1 | rem Used on Windows system to launch the neuronvisio script 2 | python -i %0\..\neuronvisio 3 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | import os 5 | import subprocess 6 | 7 | try: 8 | from setuptools import setup 9 | except ImportError: 10 | from distutils.core import setup 11 | 12 | with open('README.rst') as readme_file: 13 | readme = readme_file.read() 14 | 15 | 16 | import neuronvisio 17 | 18 | version = neuronvisio.__version__ 19 | authors = neuronvisio.__authors__ 20 | authors_email = neuronvisio.__authors_emails__ 21 | 22 | 23 | if sys.argv[-1] == 'tag': 24 | os.system("git tag -a %s -m 'version %s'" % (version, version)) 25 | os.system("git push --tags") 26 | sys.exit() 27 | 28 | if sys.argv[-1] == 'make_docs': 29 | p = subprocess.Popen(["make", "html"], cwd="docs") 30 | p.wait() 31 | sys.exit() 32 | 33 | if sys.argv[-1] == "make_package": 34 | os.system("python setup.py sdist bdist_wheel") 35 | sys.exit() 36 | 37 | if sys.argv[-1] == "make_release": 38 | os.system("python setup.py sdist bdist_wheel upload") 39 | sys.exit() 40 | 41 | classifiers = [ 42 | # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers 43 | "Development Status :: 4 - Beta", 44 | "Programming Language :: Python", 45 | "Topic :: Scientific/Engineering :: Visualization" 46 | 47 | ] 48 | 49 | install_requires = [ 50 | # -*- Install requires: -*- 51 | 'setuptools', 52 | 'pip' 53 | ] 54 | 55 | entry_points = { 56 | 'console_scripts': [ 57 | 'neuronvisio = neuronvisio.command_line:main_neuronvisio', 58 | 'neuronvisio-model-updater = neuronvisio.command_line:main_model_updater' 59 | ], 60 | } 61 | # compatible with distutils of python 2.3+ or later 62 | setup( 63 | name='neuronvisio', 64 | version=version, 65 | description='Neuronvisio is a Graphical User Interface for NEURON simulator environment', 66 | long_description=open('README.rst', 'r').read(), 67 | packages = ['neuronvisio', 'neuronvisio.modeldb'], 68 | package_dir={'neuronvisio': 'neuronvisio'}, 69 | include_package_data=True, 70 | classifiers=classifiers, 71 | keywords='neuron, gui, pylab, 3D, visualization', 72 | author=authors, 73 | author_email=authors_email, 74 | url='http://neuronvisio.org', 75 | license='GPLv3', 76 | zip_safe=False, 77 | install_requires=install_requires, 78 | entry_points=entry_points 79 | ) --------------------------------------------------------------------------------