├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ ├── ci.yml
│ └── python-publish.yml
├── .gitignore
├── .mypy.ini
├── LICENSE.lesser
├── Manifest.in
├── README.md
├── docs
├── Makefile
├── NeuroMLlite_specification.json
├── NeuroMLlite_specification.yaml
├── README.md
├── _static
│ └── neuroml_logo.png
├── conf.py
├── generate.py
├── index.rst
├── make.bat
├── neuromllite.gui.rst
├── neuromllite.rst
├── neuromllite.sweep.rst
├── refs.bib
└── requirements.txt
├── examples
├── BBP_5percent.json
├── BBP_5percent.net.nml
├── Example1.py
├── Example10.py
├── Example10_Lorenz.json
├── Example10_Lorenz.mdf.yaml
├── Example11.py
├── Example11_Synapses.json
├── Example11_Synapses.net.nml
├── Example12.py
├── Example12_MultiComp.json
├── Example1_TestNetwork.json
├── Example2.py
├── Example2_TestNetwork.json
├── Example2_TestNetwork.net.nml
├── Example3.py
├── Example3_Network.json
├── Example3_Network.net.nml
├── Example3_Network_nodes.sonata.h5
├── Example4.py
├── Example4_PyNN.json
├── Example4_PyNN.net.nml
├── Example4_PyNN.yaml
├── Example5.py
├── Example6.py
├── Example6_PyNN.json
├── Example6_PyNN.net.nml
├── Example6_PyNN_noinputs.json
├── Example6_PyNN_noinputs.net.nml
├── Example7.py
├── Example7_Brunel2000.json
├── Example7_Brunel2000.net.nml
├── Example8.py
├── Example8_Extension.json
├── Example9.py
├── Example9_HindmarshRose.json
├── LEMS_SimExample3.xml
├── LEMS_SimExample4.xml
├── SimExample10.json
├── SimExample11.json
├── SimExample12_MultiComp.json
├── SimExample3.json
├── SimExample4.json
├── SimExample4.yaml
├── SimExample6_PyNN.json
├── SimExample7.json
├── SimExample8.json
├── SimExample9.json
├── arbor
│ ├── ArborExample.json
│ ├── ArborExample.py
│ ├── ArborExample.yaml
│ ├── SimArborExample.json
│ └── SimArborExample.yaml
├── clean.sh
├── images
│ ├── Ex1.png
│ ├── Ex2.png
│ ├── Ex4.png
│ ├── Ex5.png
│ ├── Ex5_BBP_5percent.png
│ ├── Ex6.circo.png
│ ├── Ex6.dot.png
│ ├── Ex6.fdp.png
│ ├── Ex6matrix.png
│ ├── Ex7.png
│ ├── bbp1.png
│ ├── bbp2.png
│ └── bbp3.png
├── sonatatest
│ ├── IntFireCells.xml
│ ├── LEMS_ImpulseSyn.xml
│ ├── SimSonataExample.json
│ ├── SonataExample.json
│ ├── SonataExample.py
│ ├── analyze_output.py
│ ├── analyze_output_utils.py
│ ├── circuit_config.json
│ ├── clean.sh
│ ├── components
│ │ └── point_neuron_models_dir
│ │ │ └── testcell.json
│ ├── config.json
│ ├── network
│ │ ├── SonataExample_node_types.csv
│ │ └── SonataExample_nodes.sonata.h5
│ ├── regenerateAndTest.sh
│ ├── run_bmtk.py
│ ├── run_pynml.jnml.sh
│ ├── run_pynn.py
│ └── simulation_config.json
├── spikeratetest
│ ├── .test.mep
│ ├── .test.nmllite.jnml.omt
│ ├── SimSpikers.json
│ ├── Spikers.json
│ ├── Spikers.py
│ └── test_jnml.py
└── test_files
│ ├── .test.ex3.jnml.omt
│ ├── .test.ex3.jnmleden.omt
│ ├── .test.ex3.jnmlnetpyne.omt
│ ├── .test.ex3.jnmlnrn.omt
│ ├── .test.ex4.jnml.omt
│ ├── .test.ex4.jnmleden.omt
│ ├── .test.ex4.jnmlnetpyne.omt
│ ├── .test.ex4.jnmlnrn.omt
│ ├── .test.ex4.jnmlpynnnrn.omt__
│ ├── .test.ex4.mep
│ ├── .test.ex4.nmllite.jnml.omt
│ ├── .test.ex4.nmllite.netpyne.omt_
│ ├── .test.ex4.nmllite.pynnbrian.omt_
│ ├── .test.ex4.nmllite.pynnnest.omt
│ ├── .test.ex4.nmllite.pynnnrn.omt
│ ├── .test.ex7.mep
│ ├── .test.ex7.nmllite.jnml.omt
│ ├── .test.ex7.nmllite.jnmlnrn.omt
│ ├── .test.ex7.nmllite.pynnnest.omt
│ ├── .test.ex7.nmllite.pynnnrn.omt
│ ├── .test.validate.omt
│ ├── HindmarshRose3d.xml
│ ├── Lorenz1963.xml
│ ├── NMDA.synapse.nml
│ ├── acnet2
│ ├── AMPA_syn.synapse.nml
│ ├── AMPA_syn_inh.synapse.nml
│ ├── Ca_conc.nml
│ ├── Ca_pyr.channel.nml
│ ├── GABA_syn.synapse.nml
│ ├── GABA_syn_inh.synapse.nml
│ ├── Kahp_pyr.channel.nml
│ ├── Kdr_bask.channel.nml
│ ├── Kdr_pyr.channel.nml
│ ├── LeakConductance_bask.channel.nml
│ ├── LeakConductance_pyr.channel.nml
│ ├── Na_bask.channel.nml
│ ├── Na_pyr.channel.nml
│ ├── bask.cell.nml
│ ├── pyr_4_sym.cell.nml
│ └── pyr_4_sym_soma.cell.nml
│ ├── ampa.synapse.nml
│ ├── gaba.synapse.nml
│ ├── hhcell.cell.nml
│ ├── iaf.cell.nml
│ ├── inputs.nml
│ ├── test_ex4_jnml.py
│ ├── test_ex4_netpyne.py
│ ├── test_ex4_pynn.py
│ ├── test_ex7_jnml.py
│ ├── test_ex7_jnmlnrn.py
│ ├── test_ex7_pynn.py
│ └── test_inputs
│ ├── InputTest.net.nml
│ └── LEMS_InputTest.xml
├── images
└── NetworkShorthand.png
├── neuromllite
├── ArborHandler.py
├── BBPConnectomeReader.py
├── BindsNETHandler.py
├── ConnectivityHandler.py
├── DefaultNetworkHandler.py
├── GraphVizHandler.py
├── MDFHandler.py
├── MatrixHandler.py
├── NetworkGenerator.py
├── NeuronHandler.py
├── PsyNeuLinkHandler.py
├── PsyNeuLinkReader.py
├── PyNNHandler.py
├── SonataHandler.py
├── SonataReader.py
├── __init__.py
├── gui
│ ├── NMLliteUI.py
│ └── __init__.py
├── sweep
│ ├── GenerateTests.py
│ ├── ParameterSweep.py
│ ├── __init__.py
│ └── cleanup.sh
├── test
│ ├── layout
│ │ ├── Example_Layout.json
│ │ ├── Example_Layout.net.nml
│ │ └── Layout.py
│ ├── sonata
│ │ └── test_sonata_reader.py
│ ├── temp
│ │ └── README.md
│ ├── test_base.py
│ ├── test_generate.py
│ └── test_utils.py
└── utils.py
├── regenerateAndTest.sh
├── requirements-extra.txt
└── setup.py
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: "[Bug]"
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior, for example the command you used.
15 |
16 | **Expected behavior**
17 | A clear and concise description of what you expected to happen.
18 |
19 | **Observed behavior**
20 |
21 | **System information:**
22 | - OS: [e.g. iOS]
23 | - Python version (`python --version`)
24 | - Version of tools in use (output of `nmllite-ui`)
25 |
26 |
27 | **Additional context**
28 | Add any other context about the problem here.
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/python-publish.yml:
--------------------------------------------------------------------------------
1 | # This workflow will upload a Python Package using Twine when a release is created
2 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3 |
4 | # This workflow uses actions that are not certified by GitHub.
5 | # They are provided by a third-party and are governed by
6 | # separate terms of service, privacy policy, and support
7 | # documentation.
8 |
9 | name: Upload Python Package
10 |
11 | on:
12 | release:
13 | types: [published]
14 |
15 | jobs:
16 | deploy:
17 |
18 | runs-on: ubuntu-latest
19 |
20 | steps:
21 | - uses: actions/checkout@v4
22 | - name: Set up Python
23 | uses: actions/setup-python@v5
24 | with:
25 | python-version: '3.x'
26 | - name: Install dependencies
27 | run: |
28 | python -m pip install --upgrade pip
29 | pip install build
30 | - name: Build package
31 | run: python -m build
32 | - name: Publish package
33 | uses: pypa/gh-action-pypi-publish@release/v1
34 | with:
35 | user: __token__
36 | password: ${{ secrets.PYPI_API_TOKEN }}
37 |
--------------------------------------------------------------------------------
/.mypy.ini:
--------------------------------------------------------------------------------
1 | [mypy]
2 | ignore_missing_imports = True
3 |
--------------------------------------------------------------------------------
/Manifest.in:
--------------------------------------------------------------------------------
1 | # include readme
2 | include README.md
3 |
4 | # include license file
5 | LICENSE.lesser
6 |
7 | # include everything in examples
8 | recursive-include examples *
9 | exclude examples/test_files/cons_locs_pathways_mc0_Column.h5
10 | exclude examples/images/*
11 |
12 | global-exclude x86_64
13 | global-exclude *.dat
14 | global-exclude *.spikes
15 | global-exclude *.pkl
16 | global-exclude *.pyc
17 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/docs/_static/neuroml_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/docs/_static/neuroml_logo.png
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. NeuroMLlite documentation master file, created by
2 | sphinx-quickstart on Tue Aug 24 14:37:05 2021.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | Welcome to NeuroMLlite's documentation!
7 | =======================================
8 |
9 | .. toctree::
10 | :maxdepth: 2
11 | :caption: Contents:
12 |
13 | neuromllite
14 |
15 |
16 |
17 | Indices and tables
18 | ==================
19 |
20 | * :ref:`genindex`
21 | * :ref:`modindex`
22 | * :ref:`search`
23 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=.
11 | set BUILDDIR=_build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/neuromllite.gui.rst:
--------------------------------------------------------------------------------
1 | neuromllite.gui package
2 | =======================
3 |
4 | Submodules
5 | ----------
6 |
7 | neuromllite.gui.NMLliteUI module
8 | --------------------------------
9 |
10 | .. automodule:: neuromllite.gui.NMLliteUI
11 | :members:
12 | :undoc-members:
13 | :show-inheritance:
14 |
15 | Module contents
16 | ---------------
17 |
18 | .. automodule:: neuromllite.gui
19 | :members:
20 | :undoc-members:
21 | :show-inheritance:
22 |
--------------------------------------------------------------------------------
/docs/neuromllite.rst:
--------------------------------------------------------------------------------
1 | neuromllite package
2 | ===================
3 |
4 | Subpackages
5 | -----------
6 |
7 | .. toctree::
8 | :maxdepth: 4
9 |
10 | neuromllite.gui
11 | neuromllite.sweep
12 |
13 | Submodules
14 | ----------
15 |
16 | neuromllite.ArborHandler module
17 | -------------------------------
18 |
19 | .. automodule:: neuromllite.ArborHandler
20 | :members:
21 | :undoc-members:
22 | :show-inheritance:
23 |
24 | neuromllite.BBPConnectomeReader module
25 | --------------------------------------
26 |
27 | .. automodule:: neuromllite.BBPConnectomeReader
28 | :members:
29 | :undoc-members:
30 | :show-inheritance:
31 |
32 | neuromllite.BaseTypes module
33 | ----------------------------
34 |
35 | .. automodule:: neuromllite.BaseTypes
36 | :members:
37 | :undoc-members:
38 | :show-inheritance:
39 |
40 | neuromllite.ConnectivityHandler module
41 | --------------------------------------
42 |
43 | .. automodule:: neuromllite.ConnectivityHandler
44 | :members:
45 | :undoc-members:
46 | :show-inheritance:
47 |
48 | neuromllite.DefaultNetworkHandler module
49 | ----------------------------------------
50 |
51 | .. automodule:: neuromllite.DefaultNetworkHandler
52 | :members:
53 | :undoc-members:
54 | :show-inheritance:
55 |
56 | neuromllite.GraphVizHandler module
57 | ----------------------------------
58 |
59 | .. automodule:: neuromllite.GraphVizHandler
60 | :members:
61 | :undoc-members:
62 | :show-inheritance:
63 |
64 | neuromllite.MDFHandler module
65 | -----------------------------
66 |
67 | .. automodule:: neuromllite.MDFHandler
68 | :members:
69 | :undoc-members:
70 | :show-inheritance:
71 |
72 | neuromllite.MatrixHandler module
73 | --------------------------------
74 |
75 | .. automodule:: neuromllite.MatrixHandler
76 | :members:
77 | :undoc-members:
78 | :show-inheritance:
79 |
80 | neuromllite.NetworkGenerator module
81 | -----------------------------------
82 |
83 | .. automodule:: neuromllite.NetworkGenerator
84 | :members:
85 | :undoc-members:
86 | :show-inheritance:
87 |
88 | neuromllite.NeuronHandler module
89 | --------------------------------
90 |
91 | .. automodule:: neuromllite.NeuronHandler
92 | :members:
93 | :undoc-members:
94 | :show-inheritance:
95 |
96 | neuromllite.PsyNeuLinkHandler module
97 | ------------------------------------
98 |
99 | .. automodule:: neuromllite.PsyNeuLinkHandler
100 | :members:
101 | :undoc-members:
102 | :show-inheritance:
103 |
104 | neuromllite.PsyNeuLinkReader module
105 | -----------------------------------
106 |
107 | .. automodule:: neuromllite.PsyNeuLinkReader
108 | :members:
109 | :undoc-members:
110 | :show-inheritance:
111 |
112 | neuromllite.PyNNHandler module
113 | ------------------------------
114 |
115 | .. automodule:: neuromllite.PyNNHandler
116 | :members:
117 | :undoc-members:
118 | :show-inheritance:
119 |
120 | neuromllite.SonataHandler module
121 | --------------------------------
122 |
123 | .. automodule:: neuromllite.SonataHandler
124 | :members:
125 | :undoc-members:
126 | :show-inheritance:
127 |
128 | neuromllite.SonataReader module
129 | -------------------------------
130 |
131 | .. automodule:: neuromllite.SonataReader
132 | :members:
133 | :undoc-members:
134 | :show-inheritance:
135 |
136 | neuromllite.utils module
137 | ------------------------
138 |
139 | .. automodule:: neuromllite.utils
140 | :members:
141 | :undoc-members:
142 | :show-inheritance:
143 |
144 | Module contents
145 | ---------------
146 |
147 | .. automodule:: neuromllite
148 | :members:
149 | :undoc-members:
150 | :show-inheritance:
151 |
--------------------------------------------------------------------------------
/docs/neuromllite.sweep.rst:
--------------------------------------------------------------------------------
1 | neuromllite.sweep package
2 | =========================
3 |
4 | Submodules
5 | ----------
6 |
7 | neuromllite.sweep.GenerateTests module
8 | --------------------------------------
9 |
10 | .. automodule:: neuromllite.sweep.GenerateTests
11 | :members:
12 | :undoc-members:
13 | :show-inheritance:
14 |
15 | neuromllite.sweep.ParameterSweep module
16 | ---------------------------------------
17 |
18 | .. automodule:: neuromllite.sweep.ParameterSweep
19 | :members:
20 | :undoc-members:
21 | :show-inheritance:
22 |
23 | Module contents
24 | ---------------
25 |
26 | .. automodule:: neuromllite.sweep
27 | :members:
28 | :undoc-members:
29 | :show-inheritance:
30 |
--------------------------------------------------------------------------------
/docs/refs.bib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/docs/refs.bib
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinxcontrib-bibtex
2 | #pyNN
3 | bmtk
4 | matplotlib
5 | PyQt5
6 | pyneuroml
7 | pyelectro
8 | numpy
9 | neuron
10 | h5py
11 | graphviz
12 | pylems
13 | tables
14 | arbor
15 |
--------------------------------------------------------------------------------
/examples/BBP_5percent.json:
--------------------------------------------------------------------------------
1 | {
2 | "BBP_5percent": {
3 | "version": "NeuroMLlite v0.5.3",
4 | "notes": "A network with the Blue Brain Project connectivity data (%s% of total cells)",
5 | "cells": {
6 | "hhcell": {
7 | "neuroml2_source_file": "test_files/hhcell.cell.nml"
8 | }
9 | },
10 | "synapses": {
11 | "ampa": {
12 | "neuroml2_source_file": "test_files/ampa.synapse.nml"
13 | },
14 | "gaba": {
15 | "neuroml2_source_file": "test_files/gaba.synapse.nml"
16 | }
17 | },
18 | "input_sources": {
19 | "poissonFiringSyn": {
20 | "neuroml2_source_file": "test_files/inputs.nml"
21 | }
22 | },
23 | "inputs": {
24 | "stim_L4_PC": {
25 | "input_source": "poissonFiringSyn",
26 | "population": "L4_PC",
27 | "percentage": 80.0
28 | }
29 | },
30 | "network_reader": {
31 | "type": "BBPConnectomeReader",
32 | "parameters": {
33 | "id": "BBP_5percent",
34 | "filename": "test_files/cons_locs_pathways_mc0_Column.h5",
35 | "percentage_cells_per_pop": 5,
36 | "DEFAULT_CELL_ID": "hhcell",
37 | "cell_info": {
38 | "hhcell": {
39 | "id": "hhcell",
40 | "neuroml2_source_file": "test_files/hhcell.cell.nml"
41 | }
42 | }
43 | }
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/examples/Example1.py:
--------------------------------------------------------------------------------
1 | from neuromllite import Network, Population, Projection, RandomConnectivity
2 |
3 |
4 | ################################################################################
5 | ### Build a new network
6 |
7 | net = Network(id="net0")
8 | net.notes = (
9 | "A simple network with 2 populations & projection between them. "
10 | + "No info yet on what the cells are so network can't be simulated."
11 | )
12 |
13 | print(net)
14 |
15 |
16 | ################################################################################
17 | ### Add some populations
18 |
19 | p0 = Population(id="pop0", size=5, component="iaf", properties={"color": "0 .8 0"})
20 | p1 = Population(id="pop1", size=10, component="iaf", properties={"color": "0 0 .8"})
21 |
22 | print(p1.to_json())
23 |
24 | net.populations.append(p0)
25 | net.populations.append(p1)
26 |
27 |
28 | ################################################################################
29 | ### Add a projection
30 |
31 | net.projections.append(
32 | Projection(id="proj0", presynaptic=p0.id, postsynaptic=p1.id, synapse="ampa")
33 | )
34 |
35 | net.projections[0].random_connectivity = RandomConnectivity(probability=0.5)
36 |
37 |
38 | ################################################################################
39 | ### Save to JSON format
40 |
41 | print(net)
42 | net.id = "TestNetwork"
43 |
44 | print(net.to_json())
45 | new_file = net.to_json_file("Example1_%s.json" % net.id)
46 |
47 |
48 | ################################################################################
49 | ### Export to some formats, e.g. try:
50 | ### python Example1.py -graph2
51 |
52 | from neuromllite.NetworkGenerator import check_to_generate_or_run
53 | from neuromllite import Simulation
54 | import sys
55 |
56 | check_to_generate_or_run(sys.argv, Simulation(id="SimExample1", network=new_file))
57 |
--------------------------------------------------------------------------------
/examples/Example10.py:
--------------------------------------------------------------------------------
1 | from neuromllite import Network, Cell, InputSource, Population, Synapse
2 | from neuromllite import Projection, RandomConnectivity, Input, Simulation
3 | import sys
4 |
5 | ################################################################################
6 | ### Build new network
7 |
8 | net = Network(id="Example10_Lorenz")
9 | net.notes = "Example 10: Lorenz"
10 | net.parameters = {"N": 1}
11 |
12 | cell = Cell(
13 | id="lorenzCell", lems_source_file="test_files/Lorenz1963.xml", parameters={}
14 | )
15 | net.cells.append(cell)
16 |
17 | params = {"sigma": 10, "b": 2.67, "r": 28, "x0": 1.0, "y0": 1.0, "z0": 1.0}
18 |
19 | for p in params:
20 | cell.parameters[p] = p
21 | net.parameters[p] = params[p]
22 |
23 |
24 | pop = Population(
25 | id="lorenzPop", size="1", component=cell.id, properties={"color": ".7 0 0"}
26 | )
27 | net.populations.append(pop)
28 |
29 |
30 | print(net)
31 | print(net.to_json())
32 | new_file = net.to_json_file("%s.json" % net.id)
33 |
34 |
35 | ################################################################################
36 | ### Build Simulation object & save as JSON
37 |
38 | sim = Simulation(
39 | id="SimExample10",
40 | network=new_file,
41 | duration="1e4",
42 | dt="1",
43 | record_variables={"x": {"all": "*"}, "y": {"all": "*"}, "z": {"all": "*"}},
44 | plots2D={
45 | "X-Y": {"x_axis": "lorenzPop[0]/x", "y_axis": "lorenzPop[0]/y"},
46 | "Y-Z": {"x_axis": "lorenzPop[0]/y", "y_axis": "lorenzPop[0]/z"},
47 | "X-Z": {"x_axis": "lorenzPop[0]/x", "y_axis": "lorenzPop[0]/z"},
48 | },
49 | plots3D={
50 | "X-Y-Z": {
51 | "x_axis": "lorenzPop[0]/x",
52 | "y_axis": "lorenzPop[0]/y",
53 | "z_axis": "lorenzPop[0]/z",
54 | }
55 | },
56 | )
57 |
58 | sim.to_json_file()
59 |
60 |
61 | ################################################################################
62 | ### Run in some simulators
63 |
64 | from neuromllite.NetworkGenerator import check_to_generate_or_run
65 | import sys
66 |
67 | check_to_generate_or_run(sys.argv, sim)
68 |
--------------------------------------------------------------------------------
/examples/Example10_Lorenz.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example10_Lorenz": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example 10: Lorenz",
5 | "parameters": {
6 | "N": 1,
7 | "sigma": 10,
8 | "b": 2.67,
9 | "r": 28,
10 | "x0": 1.0,
11 | "y0": 1.0,
12 | "z0": 1.0
13 | },
14 | "cells": {
15 | "lorenzCell": {
16 | "parameters": {
17 | "sigma": "sigma",
18 | "b": "b",
19 | "r": "r",
20 | "x0": "x0",
21 | "y0": "y0",
22 | "z0": "z0"
23 | },
24 | "lems_source_file": "test_files/Lorenz1963.xml"
25 | }
26 | },
27 | "populations": {
28 | "lorenzPop": {
29 | "size": "1",
30 | "component": "lorenzCell",
31 | "properties": {
32 | "color": ".7 0 0"
33 | }
34 | }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/examples/Example10_Lorenz.mdf.yaml:
--------------------------------------------------------------------------------
1 | Example10_Lorenz:
2 | format: ModECI MDF v0.4
3 | graphs:
4 | Example10_Lorenz:
5 | notes: 'Example 10: Lorenz'
6 | nodes:
7 | lorenzPop:
8 | parameters:
9 | sigma:
10 | value:
11 | - 10.0
12 | b:
13 | value:
14 | - 2.67
15 | r:
16 | value:
17 | - 28.0
18 | x0:
19 | value:
20 | - 1.0
21 | y0:
22 | value:
23 | - 1.0
24 | z0:
25 | value:
26 | - 1.0
27 | sec:
28 | value:
29 | - 1.0
30 | x:
31 | default_initial_value: x0
32 | time_derivative: ( sigma * (y - x) ) / sec
33 | y:
34 | default_initial_value: y0
35 | time_derivative: ( r * x - y - x * z ) / sec
36 | z:
37 | default_initial_value: z0
38 | time_derivative: ( x * y - b * z) / sec
39 | input_ports: {}
40 | output_ports:
41 | x:
42 | value: x
43 | y:
44 | value: y
45 | z:
46 | value: z
47 | notes: "Cell: [Cell(notes=None, id='lorenzCell', parameters={'sigma':\
48 | \ 'sigma', 'b': 'b', 'r': 'r', 'x0': 'x0', 'y0': 'y0', 'z0':\
49 | \ 'z0'}, neuroml2_source_file=None, lems_source_file='test_files/Lorenz1963.xml',\
50 | \ neuroml2_cell=None, pynn_cell=None, arbor_cell=None, bindsnet_node=None)]\
51 | \ is defined in test_files/Lorenz1963.xml and in Lems is:\
52 | \ Component, id: lorenzCell, type: lorenz,\n parameters:\
53 | \ {'sigma': '10', 'b': '2.67', 'r': '28', 'x0': '1.0', 'y0':\
54 | \ '1.0', 'z0': '1.0'}\n parent: None\n"
55 | edges: {}
56 |
--------------------------------------------------------------------------------
/examples/Example11.py:
--------------------------------------------------------------------------------
1 | from neuromllite import (
2 | Network,
3 | Cell,
4 | InputSource,
5 | Population,
6 | Synapse,
7 | RectangularRegion,
8 | RandomLayout,
9 | )
10 | from neuromllite import Projection, RandomConnectivity, Input, Simulation
11 | import sys
12 |
13 | ################################################################################
14 | ### Build new network
15 |
16 | net = Network(id="Example11_Synapses")
17 | net.notes = "Example 11: synaptic properties"
18 | net.parameters = {"input_amp": 0.23, "weight": 1.01}
19 | #'tau_syn': 2}
20 |
21 | cell = Cell(id="iafCell0", neuroml2_source_file="test_files/iaf.cell.nml")
22 | # cell.parameters = { "tau_refrac":5, "i_offset":0 }
23 | net.cells.append(cell)
24 |
25 |
26 | input_source = InputSource(
27 | id="i_clamp",
28 | pynn_input="DCSource",
29 | parameters={"amplitude": "input_amp", "start": 200.0, "stop": 800.0},
30 | )
31 | net.input_sources.append(input_source)
32 |
33 | r1 = RectangularRegion(id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000)
34 | net.regions.append(r1)
35 |
36 | p0 = Population(
37 | id="pop0",
38 | size=1,
39 | component=cell.id,
40 | properties={"color": "1 0 0"},
41 | random_layout=RandomLayout(region=r1.id),
42 | )
43 | p1 = Population(
44 | id="pop1",
45 | size=1,
46 | component=cell.id,
47 | properties={"color": "0 1 0"},
48 | random_layout=RandomLayout(region=r1.id),
49 | )
50 |
51 | net.populations.append(p0)
52 | net.populations.append(p1)
53 |
54 | ampaSyn = Synapse(id="ampa", neuroml2_source_file="test_files/ampa.synapse.nml")
55 | net.synapses.append(ampaSyn)
56 |
57 | nmdaSyn = Synapse(id="nmdaSyn", neuroml2_source_file="test_files/NMDA.synapse.nml")
58 | net.synapses.append(nmdaSyn)
59 |
60 | net.projections.append(
61 | Projection(
62 | id="proj0",
63 | presynaptic=p0.id,
64 | postsynaptic=p1.id,
65 | synapse=ampaSyn.id,
66 | delay=0,
67 | weight="weight",
68 | )
69 | )
70 | net.projections[0].random_connectivity = RandomConnectivity(probability=1)
71 |
72 | net.projections.append(
73 | Projection(
74 | id="proj1",
75 | presynaptic=p0.id,
76 | postsynaptic=p1.id,
77 | synapse=nmdaSyn.id,
78 | delay=0,
79 | weight="weight",
80 | )
81 | )
82 | net.projections[1].random_connectivity = RandomConnectivity(probability=1)
83 |
84 |
85 | net.inputs.append(
86 | Input(id="stim", input_source=input_source.id, population=p0.id, percentage=100)
87 | )
88 |
89 | print(net.to_json())
90 | new_file = net.to_json_file("%s.json" % net.id)
91 |
92 |
93 | ################################################################################
94 | ### Build Simulation object & save as JSON
95 |
96 | sim = Simulation(
97 | id="SimExample11",
98 | network=new_file,
99 | duration="1000",
100 | dt="0.01",
101 | record_traces={"all": "*"},
102 | record_variables={
103 | "synapses:%s:0/g" % ampaSyn.id: {"pop1": "*"},
104 | "synapses:%s:0/g" % nmdaSyn.id: {"pop1": "*"},
105 | },
106 | record_spikes={"pop0": "*"},
107 | )
108 |
109 | sim.to_json_file()
110 |
111 |
112 | ################################################################################
113 | ### Run in some simulators
114 |
115 | from neuromllite.NetworkGenerator import check_to_generate_or_run
116 | import sys
117 |
118 | check_to_generate_or_run(sys.argv, sim)
119 |
--------------------------------------------------------------------------------
/examples/Example11_Synapses.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example11_Synapses": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example 11: synaptic properties",
5 | "parameters": {
6 | "input_amp": 0.23,
7 | "weight": 1.01
8 | },
9 | "cells": {
10 | "iafCell0": {
11 | "neuroml2_source_file": "test_files/iaf.cell.nml"
12 | }
13 | },
14 | "synapses": {
15 | "ampa": {
16 | "neuroml2_source_file": "test_files/ampa.synapse.nml"
17 | },
18 | "nmdaSyn": {
19 | "neuroml2_source_file": "test_files/NMDA.synapse.nml"
20 | }
21 | },
22 | "input_sources": {
23 | "i_clamp": {
24 | "parameters": {
25 | "amplitude": "input_amp",
26 | "start": 200.0,
27 | "stop": 800.0
28 | },
29 | "pynn_input": "DCSource"
30 | }
31 | },
32 | "regions": {
33 | "region1": {
34 | "x": 0.0,
35 | "y": 0.0,
36 | "z": 0.0,
37 | "width": 1000.0,
38 | "height": 100.0,
39 | "depth": 1000.0
40 | }
41 | },
42 | "populations": {
43 | "pop0": {
44 | "size": 1,
45 | "component": "iafCell0",
46 | "properties": {
47 | "color": "1 0 0"
48 | },
49 | "random_layout": {
50 | "region": "region1"
51 | }
52 | },
53 | "pop1": {
54 | "size": 1,
55 | "component": "iafCell0",
56 | "properties": {
57 | "color": "0 1 0"
58 | },
59 | "random_layout": {
60 | "region": "region1"
61 | }
62 | }
63 | },
64 | "projections": {
65 | "proj0": {
66 | "presynaptic": "pop0",
67 | "postsynaptic": "pop1",
68 | "synapse": "ampa",
69 | "delay": 0,
70 | "weight": "weight",
71 | "random_connectivity": {
72 | "probability": 1
73 | }
74 | },
75 | "proj1": {
76 | "presynaptic": "pop0",
77 | "postsynaptic": "pop1",
78 | "synapse": "nmdaSyn",
79 | "delay": 0,
80 | "weight": "weight",
81 | "random_connectivity": {
82 | "probability": 1
83 | }
84 | }
85 | },
86 | "inputs": {
87 | "stim": {
88 | "input_source": "i_clamp",
89 | "population": "pop0",
90 | "percentage": 100
91 | }
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/examples/Example12_MultiComp.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example12_MultiComp": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example 12: Multicompartmental cells...",
5 | "parameters": {
6 | "N": 20,
7 | "fractionE": 0.7,
8 | "weightInput": 0.7,
9 | "prob_e_e": 0.1,
10 | "prob_e_i": 0.9,
11 | "prob_i_e": 0.8,
12 | "prob_i_i": 0.3,
13 | "global_delay": 2
14 | },
15 | "cells": {
16 | "pyr_4_sym": {
17 | "neuroml2_source_file": "test_files/acnet2/pyr_4_sym.cell.nml"
18 | },
19 | "bask": {
20 | "neuroml2_source_file": "test_files/acnet2/bask.cell.nml"
21 | }
22 | },
23 | "synapses": {
24 | "AMPA_syn": {
25 | "neuroml2_source_file": "test_files/acnet2/AMPA_syn.synapse.nml"
26 | },
27 | "AMPA_syn_inh": {
28 | "neuroml2_source_file": "test_files/acnet2/AMPA_syn_inh.synapse.nml"
29 | },
30 | "GABA_syn": {
31 | "neuroml2_source_file": "test_files/acnet2/GABA_syn.synapse.nml"
32 | },
33 | "GABA_syn_inh": {
34 | "neuroml2_source_file": "test_files/acnet2/GABA_syn_inh.synapse.nml"
35 | }
36 | },
37 | "input_sources": {
38 | "poissonFiringSyn": {
39 | "neuroml2_source_file": "test_files/inputs.nml"
40 | }
41 | },
42 | "regions": {
43 | "region1": {
44 | "x": 0.0,
45 | "y": 0.0,
46 | "z": 0.0,
47 | "width": 1000.0,
48 | "height": 100.0,
49 | "depth": 1000.0
50 | }
51 | },
52 | "populations": {
53 | "pop_pyr": {
54 | "size": "int(N*fractionE)",
55 | "component": "pyr_4_sym",
56 | "properties": {
57 | "color": ".8 0 0"
58 | },
59 | "random_layout": {
60 | "region": "region1"
61 | }
62 | },
63 | "pop_bask": {
64 | "size": "N - int(N*fractionE)",
65 | "component": "bask",
66 | "properties": {
67 | "color": "0 0 .8"
68 | },
69 | "random_layout": {
70 | "region": "region1"
71 | }
72 | }
73 | },
74 | "projections": {
75 | "projEE": {
76 | "presynaptic": "pop_pyr",
77 | "postsynaptic": "pop_pyr",
78 | "synapse": "AMPA_syn",
79 | "delay": "global_delay",
80 | "random_connectivity": {
81 | "probability": "prob_e_e"
82 | }
83 | },
84 | "projEI": {
85 | "presynaptic": "pop_pyr",
86 | "postsynaptic": "pop_bask",
87 | "synapse": "AMPA_syn_inh",
88 | "delay": "global_delay",
89 | "random_connectivity": {
90 | "probability": "prob_e_i"
91 | }
92 | },
93 | "projIE": {
94 | "presynaptic": "pop_bask",
95 | "postsynaptic": "pop_pyr",
96 | "synapse": "GABA_syn",
97 | "delay": "global_delay",
98 | "random_connectivity": {
99 | "probability": "prob_i_e"
100 | }
101 | },
102 | "projII": {
103 | "presynaptic": "pop_bask",
104 | "postsynaptic": "pop_bask",
105 | "synapse": "GABA_syn_inh",
106 | "delay": "global_delay",
107 | "random_connectivity": {
108 | "probability": "prob_i_i"
109 | }
110 | }
111 | },
112 | "inputs": {
113 | "stim": {
114 | "input_source": "poissonFiringSyn",
115 | "population": "pop_pyr",
116 | "percentage": 100,
117 | "weight": "weightInput"
118 | }
119 | },
120 | "seed": 1234,
121 | "temperature": 32.0
122 | }
123 | }
--------------------------------------------------------------------------------
/examples/Example1_TestNetwork.json:
--------------------------------------------------------------------------------
1 | {
2 | "TestNetwork": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "A simple network with 2 populations & projection between them. No info yet on what the cells are so network can't be simulated.",
5 | "populations": {
6 | "pop0": {
7 | "size": 5,
8 | "component": "iaf",
9 | "properties": {
10 | "color": "0 .8 0"
11 | }
12 | },
13 | "pop1": {
14 | "size": 10,
15 | "component": "iaf",
16 | "properties": {
17 | "color": "0 0 .8"
18 | }
19 | }
20 | },
21 | "projections": {
22 | "proj0": {
23 | "presynaptic": "pop0",
24 | "postsynaptic": "pop1",
25 | "synapse": "ampa",
26 | "random_connectivity": {
27 | "probability": 0.5
28 | }
29 | }
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/examples/Example2.py:
--------------------------------------------------------------------------------
1 | from neuromllite import (
2 | RandomLayout,
3 | Cell,
4 | Synapse,
5 | InputSource,
6 | Input,
7 | RectangularRegion,
8 | )
9 | from neuromllite.NetworkGenerator import generate_network
10 | from neuromllite.utils import load_network_json
11 | from neuromllite.DefaultNetworkHandler import DefaultNetworkHandler
12 |
13 | ################################################################################
14 | ### Reuse network from Example1
15 |
16 | net = load_network_json("Example1_TestNetwork.json")
17 | net.id = "Example2_TestNetwork"
18 |
19 | net.notes = (
20 | "A simple network with 2 populations & projection between them. "
21 | + "Cells are specified to be NeuroML 2 HH cell models & pre population "
22 | "is given a spiking input."
23 | )
24 |
25 |
26 | ################################################################################
27 | ### Add some elements to the network & save new JSON
28 |
29 | r1 = RectangularRegion(id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000)
30 | r2 = RectangularRegion(
31 | id="region2", x=0, y=200, z=0, width=1000, height=100, depth=1000
32 | )
33 | net.regions.append(r1)
34 | net.regions.append(r2)
35 |
36 | net.populations[0].random_layout = RandomLayout(region=r1.id)
37 | net.populations[1].random_layout = RandomLayout(region=r2.id)
38 |
39 | net.populations[0].component = "hhcell"
40 | net.populations[1].component = "hhcell"
41 |
42 | net.cells.append(Cell(id="hhcell", neuroml2_source_file="test_files/hhcell.cell.nml"))
43 | net.synapses.append(
44 | Synapse(id="ampa", neuroml2_source_file="test_files/ampa.synapse.nml")
45 | )
46 |
47 | input_source = InputSource(
48 | id="poissonFiringSyn", neuroml2_source_file="test_files/inputs.nml"
49 | )
50 | net.input_sources.append(input_source)
51 |
52 | net.inputs.append(
53 | Input(
54 | id="stim_%s" % net.populations[0].id,
55 | input_source=input_source.id,
56 | population=net.populations[0].id,
57 | percentage=80,
58 | )
59 | )
60 |
61 | print(net.to_json())
62 | new_file = net.to_json_file("%s.json" % net.id)
63 |
64 |
65 | ################################################################################
66 | ### Use a handler which just prints info on positions, etc.
67 |
68 | def_handler = DefaultNetworkHandler()
69 |
70 | generate_network(net, def_handler)
71 |
72 |
73 | ################################################################################
74 | ### Export to some formats, e.g. try:
75 | ### python Example2.py -graph2
76 |
77 | from neuromllite.NetworkGenerator import check_to_generate_or_run
78 | from neuromllite import Simulation
79 | import sys
80 |
81 | check_to_generate_or_run(sys.argv, Simulation(id="SimExample2", network=new_file))
82 |
--------------------------------------------------------------------------------
/examples/Example2_TestNetwork.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example2_TestNetwork": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "A simple network with 2 populations & projection between them. Cells are specified to be NeuroML 2 HH cell models & pre population is given a spiking input.",
5 | "cells": {
6 | "hhcell": {
7 | "neuroml2_source_file": "test_files/hhcell.cell.nml"
8 | }
9 | },
10 | "synapses": {
11 | "ampa": {
12 | "neuroml2_source_file": "test_files/ampa.synapse.nml"
13 | }
14 | },
15 | "input_sources": {
16 | "poissonFiringSyn": {
17 | "neuroml2_source_file": "test_files/inputs.nml"
18 | }
19 | },
20 | "regions": {
21 | "region1": {
22 | "x": 0.0,
23 | "y": 0.0,
24 | "z": 0.0,
25 | "width": 1000.0,
26 | "height": 100.0,
27 | "depth": 1000.0
28 | },
29 | "region2": {
30 | "x": 0.0,
31 | "y": 200.0,
32 | "z": 0.0,
33 | "width": 1000.0,
34 | "height": 100.0,
35 | "depth": 1000.0
36 | }
37 | },
38 | "populations": {
39 | "pop0": {
40 | "size": 5,
41 | "component": "hhcell",
42 | "properties": {
43 | "color": "0 .8 0"
44 | },
45 | "random_layout": {
46 | "region": "region1"
47 | }
48 | },
49 | "pop1": {
50 | "size": 10,
51 | "component": "hhcell",
52 | "properties": {
53 | "color": "0 0 .8"
54 | },
55 | "random_layout": {
56 | "region": "region2"
57 | }
58 | }
59 | },
60 | "projections": {
61 | "proj0": {
62 | "presynaptic": "pop0",
63 | "postsynaptic": "pop1",
64 | "synapse": "ampa",
65 | "random_connectivity": {
66 | "probability": 0.5
67 | }
68 | }
69 | },
70 | "inputs": {
71 | "stim_pop0": {
72 | "input_source": "poissonFiringSyn",
73 | "population": "pop0",
74 | "percentage": 80
75 | }
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/examples/Example3.py:
--------------------------------------------------------------------------------
1 | from neuromllite import *
2 | from neuromllite.NetworkGenerator import *
3 | from neuromllite.utils import load_network_json
4 | import sys
5 |
6 | ################################################################################
7 | ### Reuse network from Example2
8 |
9 | filename = "Example2_TestNetwork.json"
10 | net = load_network_json(filename)
11 | net.id = "Example3_Network"
12 | net.notes = "Example 3: simple network with 2 populations of NeuroML2 cells, a projection between them and spiking input."
13 | print(net)
14 |
15 | new_json_file = net.to_json_file()
16 |
17 | ################################################################################
18 | ### Build Simulation object & save as JSON
19 |
20 |
21 | sim = Simulation(
22 | id="SimExample3",
23 | network=new_json_file,
24 | duration="1000",
25 | dt="0.025",
26 | record_traces={"all": "*"},
27 | )
28 |
29 | sim.to_json_file()
30 |
31 |
32 | ################################################################################
33 | ### Run in some simulators
34 |
35 | from neuromllite.NetworkGenerator import check_to_generate_or_run
36 | import sys
37 |
38 | check_to_generate_or_run(sys.argv, sim)
39 |
--------------------------------------------------------------------------------
/examples/Example3_Network.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example3_Network": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example 3: simple network with 2 populations of NeuroML2 cells, a projection between them and spiking input.",
5 | "cells": {
6 | "hhcell": {
7 | "neuroml2_source_file": "test_files/hhcell.cell.nml"
8 | }
9 | },
10 | "synapses": {
11 | "ampa": {
12 | "neuroml2_source_file": "test_files/ampa.synapse.nml"
13 | }
14 | },
15 | "input_sources": {
16 | "poissonFiringSyn": {
17 | "neuroml2_source_file": "test_files/inputs.nml"
18 | }
19 | },
20 | "regions": {
21 | "region1": {
22 | "x": 0.0,
23 | "y": 0.0,
24 | "z": 0.0,
25 | "width": 1000.0,
26 | "height": 100.0,
27 | "depth": 1000.0
28 | },
29 | "region2": {
30 | "x": 0.0,
31 | "y": 200.0,
32 | "z": 0.0,
33 | "width": 1000.0,
34 | "height": 100.0,
35 | "depth": 1000.0
36 | }
37 | },
38 | "populations": {
39 | "pop0": {
40 | "size": 5,
41 | "component": "hhcell",
42 | "properties": {
43 | "color": "0 .8 0"
44 | },
45 | "random_layout": {
46 | "region": "region1"
47 | }
48 | },
49 | "pop1": {
50 | "size": 10,
51 | "component": "hhcell",
52 | "properties": {
53 | "color": "0 0 .8"
54 | },
55 | "random_layout": {
56 | "region": "region2"
57 | }
58 | }
59 | },
60 | "projections": {
61 | "proj0": {
62 | "presynaptic": "pop0",
63 | "postsynaptic": "pop1",
64 | "synapse": "ampa",
65 | "random_connectivity": {
66 | "probability": 0.5
67 | }
68 | }
69 | },
70 | "inputs": {
71 | "stim_pop0": {
72 | "input_source": "poissonFiringSyn",
73 | "population": "pop0",
74 | "percentage": 80
75 | }
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/examples/Example3_Network_nodes.sonata.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/Example3_Network_nodes.sonata.h5
--------------------------------------------------------------------------------
/examples/Example4.py:
--------------------------------------------------------------------------------
1 | from neuromllite import (
2 | Network,
3 | Cell,
4 | InputSource,
5 | Population,
6 | Synapse,
7 | RectangularRegion,
8 | RandomLayout,
9 | )
10 | from neuromllite import Projection, RandomConnectivity, Input, Simulation
11 | import sys
12 |
13 | ################################################################################
14 | ### Build new network
15 |
16 | net = Network(id="Example4_PyNN")
17 | net.notes = "Example 4: a network with PyNN cells & inputs"
18 | net.parameters = {"input_amp": 0.99}
19 |
20 | cell = Cell(id="testcell", pynn_cell="IF_cond_alpha")
21 | cell.parameters = {"tau_refrac": 5, "i_offset": 0.1}
22 | net.cells.append(cell)
23 |
24 | cell2 = Cell(id="testcell2", pynn_cell="IF_cond_alpha")
25 | cell2.parameters = {"tau_refrac": 5, "i_offset": -0.1}
26 | net.cells.append(cell2)
27 |
28 | input_source = InputSource(
29 | id="i_clamp",
30 | pynn_input="DCSource",
31 | parameters={"amplitude": "input_amp", "start": 200.0, "stop": 800.0},
32 | )
33 | net.input_sources.append(input_source)
34 |
35 | r1 = RectangularRegion(id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000)
36 | net.regions.append(r1)
37 |
38 | p0 = Population(
39 | id="pop0",
40 | size=2,
41 | component=cell.id,
42 | properties={"color": "1 0 0", "radius": 20},
43 | random_layout=RandomLayout(region=r1.id),
44 | )
45 | p1 = Population(
46 | id="pop1",
47 | size=2,
48 | component=cell2.id,
49 | properties={"color": "0 1 0", "radius": 20},
50 | random_layout=RandomLayout(region=r1.id),
51 | )
52 | p2 = Population(
53 | id="pop2",
54 | size=1,
55 | component=cell2.id,
56 | properties={"color": "0 0 1", "radius": 20},
57 | random_layout=RandomLayout(region=r1.id),
58 | )
59 |
60 | net.populations.append(p0)
61 | net.populations.append(p1)
62 | net.populations.append(p2)
63 |
64 | net.synapses.append(
65 | Synapse(
66 | id="ampaSyn",
67 | pynn_receptor_type="excitatory",
68 | pynn_synapse_type="cond_alpha",
69 | parameters={"e_rev": -10, "tau_syn": 2},
70 | )
71 | )
72 | net.synapses.append(
73 | Synapse(
74 | id="gabaSyn",
75 | pynn_receptor_type="inhibitory",
76 | pynn_synapse_type="cond_alpha",
77 | parameters={"e_rev": -80, "tau_syn": 10},
78 | )
79 | )
80 |
81 | net.projections.append(
82 | Projection(
83 | id="proj0",
84 | presynaptic=p0.id,
85 | postsynaptic=p1.id,
86 | synapse="ampaSyn",
87 | delay=2,
88 | weight=0.02,
89 | )
90 | )
91 | net.projections[0].random_connectivity = RandomConnectivity(probability=1)
92 |
93 | net.projections.append(
94 | Projection(
95 | id="proj1",
96 | presynaptic=p0.id,
97 | postsynaptic=p2.id,
98 | synapse="gabaSyn",
99 | delay=2,
100 | weight=0.01,
101 | )
102 | )
103 | net.projections[1].random_connectivity = RandomConnectivity(probability=1)
104 |
105 | net.inputs.append(
106 | Input(id="stim", input_source=input_source.id, population=p0.id, percentage=50)
107 | )
108 |
109 | print(net.to_json())
110 | net_json_file = net.to_json_file("%s.json" % net.id)
111 | net_yaml_file = net.to_yaml_file("%s.yaml" % net.id)
112 | net_xml_file = net.to_xml_file("%s.nmllite.xml" % net.id)
113 |
114 |
115 | ################################################################################
116 | ### Build Simulation object & save as JSON
117 |
118 | sim = Simulation(
119 | id="SimExample4",
120 | network=net_json_file,
121 | duration="1000",
122 | dt="0.01",
123 | record_traces={"all": "*"},
124 | record_spikes={"pop0": "*"},
125 | )
126 |
127 | sim.to_json_file()
128 | sim.network = net_yaml_file
129 | sim.to_yaml_file("%s.yaml" % sim.id)
130 |
131 | sim.network = net_json_file # reverting, for call below...
132 |
133 |
134 | ################################################################################
135 | ### Run in some simulators
136 |
137 | from neuromllite.NetworkGenerator import check_to_generate_or_run
138 | import sys
139 |
140 | check_to_generate_or_run(sys.argv, sim)
141 |
--------------------------------------------------------------------------------
/examples/Example4_PyNN.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example4_PyNN": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example 4: a network with PyNN cells & inputs",
5 | "parameters": {
6 | "input_amp": 0.99
7 | },
8 | "cells": {
9 | "testcell": {
10 | "parameters": {
11 | "tau_refrac": 5,
12 | "i_offset": 0.1
13 | },
14 | "pynn_cell": "IF_cond_alpha"
15 | },
16 | "testcell2": {
17 | "parameters": {
18 | "tau_refrac": 5,
19 | "i_offset": -0.1
20 | },
21 | "pynn_cell": "IF_cond_alpha"
22 | }
23 | },
24 | "synapses": {
25 | "ampaSyn": {
26 | "parameters": {
27 | "e_rev": -10,
28 | "tau_syn": 2
29 | },
30 | "pynn_synapse_type": "cond_alpha",
31 | "pynn_receptor_type": "excitatory"
32 | },
33 | "gabaSyn": {
34 | "parameters": {
35 | "e_rev": -80,
36 | "tau_syn": 10
37 | },
38 | "pynn_synapse_type": "cond_alpha",
39 | "pynn_receptor_type": "inhibitory"
40 | }
41 | },
42 | "input_sources": {
43 | "i_clamp": {
44 | "parameters": {
45 | "amplitude": "input_amp",
46 | "start": 200.0,
47 | "stop": 800.0
48 | },
49 | "pynn_input": "DCSource"
50 | }
51 | },
52 | "regions": {
53 | "region1": {
54 | "x": 0.0,
55 | "y": 0.0,
56 | "z": 0.0,
57 | "width": 1000.0,
58 | "height": 100.0,
59 | "depth": 1000.0
60 | }
61 | },
62 | "populations": {
63 | "pop0": {
64 | "size": 2,
65 | "component": "testcell",
66 | "properties": {
67 | "color": "1 0 0",
68 | "radius": 20
69 | },
70 | "random_layout": {
71 | "region": "region1"
72 | }
73 | },
74 | "pop1": {
75 | "size": 2,
76 | "component": "testcell2",
77 | "properties": {
78 | "color": "0 1 0",
79 | "radius": 20
80 | },
81 | "random_layout": {
82 | "region": "region1"
83 | }
84 | },
85 | "pop2": {
86 | "size": 1,
87 | "component": "testcell2",
88 | "properties": {
89 | "color": "0 0 1",
90 | "radius": 20
91 | },
92 | "random_layout": {
93 | "region": "region1"
94 | }
95 | }
96 | },
97 | "projections": {
98 | "proj0": {
99 | "presynaptic": "pop0",
100 | "postsynaptic": "pop1",
101 | "synapse": "ampaSyn",
102 | "delay": 2,
103 | "weight": 0.02,
104 | "random_connectivity": {
105 | "probability": 1
106 | }
107 | },
108 | "proj1": {
109 | "presynaptic": "pop0",
110 | "postsynaptic": "pop2",
111 | "synapse": "gabaSyn",
112 | "delay": 2,
113 | "weight": 0.01,
114 | "random_connectivity": {
115 | "probability": 1
116 | }
117 | }
118 | },
119 | "inputs": {
120 | "stim": {
121 | "input_source": "i_clamp",
122 | "population": "pop0",
123 | "percentage": 50
124 | }
125 | }
126 | }
127 | }
--------------------------------------------------------------------------------
/examples/Example4_PyNN.net.nml:
--------------------------------------------------------------------------------
1 |
2 | Generated by NeuroMLlite v0.6.1
3 | Generated network: Example4_PyNN
4 | Generation seed: 1234
5 | NeuroMLlite parameters:
6 | input_amp = 0.99
7 |
8 |
9 |
10 |
11 |
12 |
13 | Example 4: a network with PyNN cells & inputs
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/examples/Example4_PyNN.yaml:
--------------------------------------------------------------------------------
1 | Example4_PyNN:
2 | version: NeuroMLlite v0.6.1
3 | notes: 'Example 4: a network with PyNN cells & inputs'
4 | parameters:
5 | input_amp: 0.99
6 | cells:
7 | testcell:
8 | parameters:
9 | tau_refrac: 5
10 | i_offset: 0.1
11 | pynn_cell: IF_cond_alpha
12 | testcell2:
13 | parameters:
14 | tau_refrac: 5
15 | i_offset: -0.1
16 | pynn_cell: IF_cond_alpha
17 | synapses:
18 | ampaSyn:
19 | parameters:
20 | e_rev: -10
21 | tau_syn: 2
22 | pynn_synapse_type: cond_alpha
23 | pynn_receptor_type: excitatory
24 | gabaSyn:
25 | parameters:
26 | e_rev: -80
27 | tau_syn: 10
28 | pynn_synapse_type: cond_alpha
29 | pynn_receptor_type: inhibitory
30 | input_sources:
31 | i_clamp:
32 | parameters:
33 | amplitude: input_amp
34 | start: 200.0
35 | stop: 800.0
36 | pynn_input: DCSource
37 | regions:
38 | region1:
39 | x: 0.0
40 | y: 0.0
41 | z: 0.0
42 | width: 1000.0
43 | height: 100.0
44 | depth: 1000.0
45 | populations:
46 | pop0:
47 | size: 2
48 | component: testcell
49 | properties:
50 | color: 1 0 0
51 | radius: 20
52 | random_layout:
53 | region: region1
54 | pop1:
55 | size: 2
56 | component: testcell2
57 | properties:
58 | color: 0 1 0
59 | radius: 20
60 | random_layout:
61 | region: region1
62 | pop2:
63 | size: 1
64 | component: testcell2
65 | properties:
66 | color: 0 0 1
67 | radius: 20
68 | random_layout:
69 | region: region1
70 | projections:
71 | proj0:
72 | presynaptic: pop0
73 | postsynaptic: pop1
74 | synapse: ampaSyn
75 | delay: 2
76 | weight: 0.02
77 | random_connectivity:
78 | probability: 1
79 | proj1:
80 | presynaptic: pop0
81 | postsynaptic: pop2
82 | synapse: gabaSyn
83 | delay: 2
84 | weight: 0.01
85 | random_connectivity:
86 | probability: 1
87 | inputs:
88 | stim:
89 | input_source: i_clamp
90 | population: pop0
91 | percentage: 50
92 |
--------------------------------------------------------------------------------
/examples/Example5.py:
--------------------------------------------------------------------------------
1 | from neuromllite import Network, Cell, Synapse, NetworkReader, InputSource, Input
2 | from neuromllite.NetworkGenerator import generate_neuroml2_from_network
3 | import sys
4 |
5 |
6 | ################################################################################
7 | ### Build new network
8 |
9 | percent = 5
10 | net = Network(
11 | id="BBP_%spercent" % percent,
12 | notes="A network with the Blue Brain Project connectivity data (%s% of total cells)",
13 | )
14 |
15 | default_cell = Cell(id="hhcell", neuroml2_source_file="test_files/hhcell.cell.nml")
16 |
17 | net.network_reader = NetworkReader(
18 | type="BBPConnectomeReader",
19 | parameters={
20 | "id": net.id,
21 | "filename": "test_files/cons_locs_pathways_mc0_Column.h5",
22 | "percentage_cells_per_pop": percent,
23 | "DEFAULT_CELL_ID": default_cell.id,
24 | "cell_info": {default_cell.id: default_cell},
25 | },
26 | )
27 |
28 | net.cells.append(default_cell)
29 | net.synapses.append(
30 | Synapse(id="ampa", neuroml2_source_file="test_files/ampa.synapse.nml")
31 | )
32 | net.synapses.append(
33 | Synapse(id="gaba", neuroml2_source_file="test_files/gaba.synapse.nml")
34 | )
35 |
36 |
37 | input_source = InputSource(
38 | id="poissonFiringSyn", neuroml2_source_file="test_files/inputs.nml"
39 | )
40 | net.input_sources.append(input_source)
41 |
42 | for pop in ["L4_PC"]:
43 | net.inputs.append(
44 | Input(
45 | id="stim_%s" % pop,
46 | input_source=input_source.id,
47 | population=pop,
48 | percentage=80,
49 | )
50 | )
51 |
52 | new_file = net.to_json_file("%s.json" % net.id)
53 |
54 |
55 | ################################################################################
56 | ### Builds a NeuroML 2 representation, save as XML
57 |
58 | format_ = "xml"
59 | nml_file_name, nml_doc = generate_neuroml2_from_network(
60 | net,
61 | nml_file_name="%s.net.nml%s" % (net.id, ".h5" if format_ == "hdf5" else ""),
62 | format=format_,
63 | )
64 |
65 |
66 | from neuromllite import Simulation
67 |
68 | record_traces = {"all": "*"}
69 | record_spikes = {"all": "*"}
70 |
71 |
72 | sim = Simulation(
73 | id="SimExample5",
74 | network=new_file,
75 | duration=500,
76 | dt=0.025,
77 | record_traces=record_traces,
78 | record_spikes=record_spikes,
79 | )
80 |
81 | sim.to_json_file()
82 |
83 |
84 | ################################################################################
85 | ### Run in some simulators
86 |
87 | from neuromllite.NetworkGenerator import check_to_generate_or_run
88 | import sys
89 |
90 | check_to_generate_or_run(sys.argv, sim)
91 |
--------------------------------------------------------------------------------
/examples/Example8.py:
--------------------------------------------------------------------------------
1 | from neuromllite import Network, Cell, InputSource, Population, Synapse
2 | from neuromllite import Projection, RandomConnectivity, Input, Simulation
3 | import sys
4 |
5 | ################################################################################
6 | ### Build new network
7 |
8 | net = Network(id="Example8_Extension")
9 | net.notes = "Example 8: general testing..."
10 |
11 | net.seed = 7890
12 | net.temperature = 32
13 |
14 | net.parameters = {"N": 10, "fractionE": 0.8, "weightInput": 1}
15 |
16 | cell = Cell(id="hhcell", neuroml2_source_file="test_files/hhcell.cell.nml")
17 | net.cells.append(cell)
18 |
19 |
20 | input_source = InputSource(
21 | id="poissonFiringSyn", neuroml2_source_file="test_files/inputs.nml"
22 | )
23 | net.input_sources.append(input_source)
24 | """
25 | input_source = InputSource(id='iclamp0',
26 | pynn_input='DCSource',
27 | parameters={'amplitude':0.2, 'start':100., 'stop':900.})"""
28 |
29 | net.input_sources.append(input_source)
30 |
31 |
32 | pE = Population(
33 | id="Epop",
34 | size="int(N*fractionE)",
35 | component=cell.id,
36 | properties={"color": ".7 0 0"},
37 | )
38 | pRS = Population(
39 | id="RSpop",
40 | size="N - int(N*fractionE)",
41 | component=cell.id,
42 | properties={"color": "0 0 .7"},
43 | )
44 |
45 | net.populations.append(pE)
46 | net.populations.append(pRS)
47 |
48 | net.synapses.append(
49 | Synapse(id="ampa", neuroml2_source_file="test_files/ampa.synapse.nml")
50 | )
51 | net.synapses.append(
52 | Synapse(id="gaba", neuroml2_source_file="test_files/gaba.synapse.nml")
53 | )
54 |
55 |
56 | net.projections.append(
57 | Projection(
58 | id="projEI",
59 | presynaptic=pE.id,
60 | postsynaptic=pRS.id,
61 | synapse="ampa",
62 | delay=2,
63 | weight=0.2,
64 | random_connectivity=RandomConnectivity(probability=0.8),
65 | )
66 | )
67 |
68 |
69 | net.inputs.append(
70 | Input(
71 | id="stim",
72 | input_source=input_source.id,
73 | population=pE.id,
74 | percentage=50,
75 | weight="weightInput",
76 | )
77 | )
78 |
79 | print(net)
80 | print(net.to_json())
81 | new_file = net.to_json_file("%s.json" % net.id)
82 |
83 |
84 | ################################################################################
85 | ### Build Simulation object & save as JSON
86 |
87 | sim = Simulation(
88 | id="SimExample8",
89 | network=new_file,
90 | duration="1000",
91 | seed="1111",
92 | dt="0.025",
93 | record_traces={"all": "*"},
94 | )
95 |
96 | sim.to_json_file()
97 |
98 |
99 | ################################################################################
100 | ### Run in some simulators
101 |
102 | from neuromllite.NetworkGenerator import check_to_generate_or_run
103 | import sys
104 |
105 | check_to_generate_or_run(sys.argv, sim)
106 |
--------------------------------------------------------------------------------
/examples/Example8_Extension.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example8_Extension": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example 8: general testing...",
5 | "parameters": {
6 | "N": 10,
7 | "fractionE": 0.8,
8 | "weightInput": 1
9 | },
10 | "cells": {
11 | "hhcell": {
12 | "neuroml2_source_file": "test_files/hhcell.cell.nml"
13 | }
14 | },
15 | "synapses": {
16 | "ampa": {
17 | "neuroml2_source_file": "test_files/ampa.synapse.nml"
18 | },
19 | "gaba": {
20 | "neuroml2_source_file": "test_files/gaba.synapse.nml"
21 | }
22 | },
23 | "input_sources": {
24 | "poissonFiringSyn": {
25 | "neuroml2_source_file": "test_files/inputs.nml"
26 | }
27 | },
28 | "populations": {
29 | "Epop": {
30 | "size": "int(N*fractionE)",
31 | "component": "hhcell",
32 | "properties": {
33 | "color": ".7 0 0"
34 | }
35 | },
36 | "RSpop": {
37 | "size": "N - int(N*fractionE)",
38 | "component": "hhcell",
39 | "properties": {
40 | "color": "0 0 .7"
41 | }
42 | }
43 | },
44 | "projections": {
45 | "projEI": {
46 | "presynaptic": "Epop",
47 | "postsynaptic": "RSpop",
48 | "synapse": "ampa",
49 | "delay": 2,
50 | "weight": 0.2,
51 | "random_connectivity": {
52 | "probability": 0.8
53 | }
54 | }
55 | },
56 | "inputs": {
57 | "stim": {
58 | "input_source": "poissonFiringSyn",
59 | "population": "Epop",
60 | "percentage": 50,
61 | "weight": "weightInput"
62 | }
63 | },
64 | "seed": 7890,
65 | "temperature": 32.0
66 | }
67 | }
--------------------------------------------------------------------------------
/examples/Example9.py:
--------------------------------------------------------------------------------
1 | from neuromllite import Network, Cell, InputSource, Population, Synapse
2 | from neuromllite import Projection, RandomConnectivity, Input, Simulation
3 | import sys
4 |
5 | ################################################################################
6 | ### Build new network
7 |
8 | net = Network(id="Example9_HindmarshRose")
9 | net.notes = "Example 9: HindmarshRose"
10 | net.parameters = {"N": 1}
11 |
12 | cell = Cell(id="hrCell", lems_source_file="test_files/HindmarshRose3d.xml")
13 | cell.parameters = {}
14 |
15 | params = {
16 | "a": 1,
17 | "b": 3,
18 | "c": -3.0,
19 | "d": 5.0,
20 | "s": 4.0,
21 | "I": 5.0,
22 | "x1": -1.3,
23 | "r": 0.002,
24 | "x0": -1.3,
25 | "y0": -1.0,
26 | "z0": 1.0,
27 | }
28 |
29 | for p in params:
30 | cell.parameters[p] = p
31 | net.parameters[p] = params[p]
32 |
33 | net.cells.append(cell)
34 |
35 |
36 | pop = Population(
37 | id="hrPop", size="1", component=cell.id, properties={"color": ".7 0 0"}
38 | )
39 | net.populations.append(pop)
40 |
41 |
42 | print(net)
43 | print(net.to_json())
44 | new_file = net.to_json_file("%s.json" % net.id)
45 |
46 |
47 | ################################################################################
48 | ### Build Simulation object & save as JSON
49 |
50 | sim = Simulation(
51 | id="SimExample9",
52 | network=new_file,
53 | duration="1000000",
54 | dt="25",
55 | record_variables={"x": {"all": "*"}, "y": {"all": "*"}, "z": {"all": "*"}},
56 | plots2D={
57 | "X-Y": {"x_axis": "hrPop[0]/x", "y_axis": "hrPop[0]/y"},
58 | "Y-Z": {"x_axis": "hrPop[0]/y", "y_axis": "hrPop[0]/z"},
59 | "X-Z": {"x_axis": "hrPop[0]/x", "y_axis": "hrPop[0]/z"},
60 | },
61 | plots3D={
62 | "X-Y-Z": {
63 | "x_axis": "hrPop[0]/x",
64 | "y_axis": "hrPop[0]/y",
65 | "z_axis": "hrPop[0]/z",
66 | }
67 | },
68 | )
69 |
70 | sim.to_json_file()
71 |
72 |
73 | ################################################################################
74 | ### Run in some simulators
75 |
76 | from neuromllite.NetworkGenerator import check_to_generate_or_run
77 | import sys
78 |
79 | check_to_generate_or_run(sys.argv, sim)
80 |
--------------------------------------------------------------------------------
/examples/Example9_HindmarshRose.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example9_HindmarshRose": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example 9: HindmarshRose",
5 | "parameters": {
6 | "N": 1,
7 | "a": 1,
8 | "b": 3,
9 | "c": -3.0,
10 | "d": 5.0,
11 | "s": 4.0,
12 | "I": 5.0,
13 | "x1": -1.3,
14 | "r": 0.002,
15 | "x0": -1.3,
16 | "y0": -1.0,
17 | "z0": 1.0
18 | },
19 | "cells": {
20 | "hrCell": {
21 | "parameters": {
22 | "a": "a",
23 | "b": "b",
24 | "c": "c",
25 | "d": "d",
26 | "s": "s",
27 | "I": "I",
28 | "x1": "x1",
29 | "r": "r",
30 | "x0": "x0",
31 | "y0": "y0",
32 | "z0": "z0"
33 | },
34 | "lems_source_file": "test_files/HindmarshRose3d.xml"
35 | }
36 | },
37 | "populations": {
38 | "hrPop": {
39 | "size": "1",
40 | "component": "hrCell",
41 | "properties": {
42 | "color": ".7 0 0"
43 | }
44 | }
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/examples/LEMS_SimExample3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/examples/LEMS_SimExample4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/examples/SimExample10.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample10": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example10_Lorenz.json",
5 | "duration": 10000.0,
6 | "dt": 1.0,
7 | "record_variables": {
8 | "x": {
9 | "all": "*"
10 | },
11 | "y": {
12 | "all": "*"
13 | },
14 | "z": {
15 | "all": "*"
16 | }
17 | },
18 | "plots2D": {
19 | "X-Y": {
20 | "x_axis": "lorenzPop[0]/x",
21 | "y_axis": "lorenzPop[0]/y"
22 | },
23 | "Y-Z": {
24 | "x_axis": "lorenzPop[0]/y",
25 | "y_axis": "lorenzPop[0]/z"
26 | },
27 | "X-Z": {
28 | "x_axis": "lorenzPop[0]/x",
29 | "y_axis": "lorenzPop[0]/z"
30 | }
31 | },
32 | "plots3D": {
33 | "X-Y-Z": {
34 | "x_axis": "lorenzPop[0]/x",
35 | "y_axis": "lorenzPop[0]/y",
36 | "z_axis": "lorenzPop[0]/z"
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/examples/SimExample11.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample11": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example11_Synapses.json",
5 | "duration": 1000.0,
6 | "dt": 0.01,
7 | "record_traces": {
8 | "all": "*"
9 | },
10 | "record_spikes": {
11 | "pop0": "*"
12 | },
13 | "record_variables": {
14 | "synapses:ampa:0/g": {
15 | "pop1": "*"
16 | },
17 | "synapses:nmdaSyn:0/g": {
18 | "pop1": "*"
19 | }
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/examples/SimExample12_MultiComp.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample12_MultiComp": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example12_MultiComp.json",
5 | "duration": 1000.0,
6 | "dt": 0.025,
7 | "seed": 1111,
8 | "record_traces": {
9 | "all": "*"
10 | },
11 | "record_spikes": {
12 | "pop_pyr": "*",
13 | "pop_bask": "*"
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/examples/SimExample3.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample3": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example3_Network.json",
5 | "duration": 1000.0,
6 | "dt": 0.025,
7 | "record_traces": {
8 | "all": "*"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/examples/SimExample4.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample4": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example4_PyNN.json",
5 | "duration": 1000.0,
6 | "dt": 0.01,
7 | "record_traces": {
8 | "all": "*"
9 | },
10 | "record_spikes": {
11 | "pop0": "*"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/examples/SimExample4.yaml:
--------------------------------------------------------------------------------
1 | SimExample4:
2 | version: NeuroMLlite v0.6.1
3 | network: Example4_PyNN.yaml
4 | duration: 1000.0
5 | dt: 0.01
6 | record_traces:
7 | all: '*'
8 | record_spikes:
9 | pop0: '*'
10 |
--------------------------------------------------------------------------------
/examples/SimExample6_PyNN.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample6_PyNN": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example6_PyNN.json",
5 | "duration": 100.0,
6 | "dt": 0.025,
7 | "seed": 1234,
8 | "record_traces": {
9 | "L23_E": [
10 | 0,
11 | 1
12 | ],
13 | "L23_I": [
14 | 0,
15 | 1
16 | ],
17 | "L4_E": [
18 | 0,
19 | 1
20 | ],
21 | "L4_I": [
22 | 0,
23 | 1
24 | ],
25 | "L5_E": [
26 | 0,
27 | 1
28 | ],
29 | "L5_I": [
30 | 0,
31 | 1
32 | ],
33 | "L6_E": [
34 | 0,
35 | 1
36 | ],
37 | "L6_I": [
38 | 0,
39 | 1
40 | ]
41 | },
42 | "record_spikes": {
43 | "L23_E": "*",
44 | "L23_I": "*",
45 | "L4_E": "*",
46 | "L4_I": "*",
47 | "L5_E": "*",
48 | "L5_I": "*",
49 | "L6_E": "*",
50 | "L6_I": "*",
51 | "L23_E_input": "*",
52 | "L23_I_input": "*",
53 | "L4_E_input": "*",
54 | "L4_I_input": "*",
55 | "L5_E_input": "*",
56 | "L5_I_input": "*",
57 | "L6_E_input": "*",
58 | "L6_I_input": "*"
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/examples/SimExample7.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample7": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example7_Brunel2000.json",
5 | "duration": 1000.0,
6 | "dt": 0.025,
7 | "seed": 123,
8 | "record_traces": {
9 | "Epop": [
10 | 0,
11 | 1
12 | ],
13 | "Ipop": [
14 | 0,
15 | 1
16 | ]
17 | },
18 | "record_spikes": {
19 | "Epop": "*",
20 | "Ipop": "*",
21 | "expoisson": [
22 | 0,
23 | 1,
24 | 2,
25 | 3,
26 | 4
27 | ],
28 | "inpoisson": [
29 | 0,
30 | 1,
31 | 2,
32 | 3,
33 | 4
34 | ]
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/examples/SimExample8.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample8": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example8_Extension.json",
5 | "duration": 1000.0,
6 | "dt": 0.025,
7 | "seed": 1111,
8 | "record_traces": {
9 | "all": "*"
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/examples/SimExample9.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimExample9": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Example9_HindmarshRose.json",
5 | "duration": 1000000.0,
6 | "dt": 25.0,
7 | "record_variables": {
8 | "x": {
9 | "all": "*"
10 | },
11 | "y": {
12 | "all": "*"
13 | },
14 | "z": {
15 | "all": "*"
16 | }
17 | },
18 | "plots2D": {
19 | "X-Y": {
20 | "x_axis": "hrPop[0]/x",
21 | "y_axis": "hrPop[0]/y"
22 | },
23 | "Y-Z": {
24 | "x_axis": "hrPop[0]/y",
25 | "y_axis": "hrPop[0]/z"
26 | },
27 | "X-Z": {
28 | "x_axis": "hrPop[0]/x",
29 | "y_axis": "hrPop[0]/z"
30 | }
31 | },
32 | "plots3D": {
33 | "X-Y-Z": {
34 | "x_axis": "hrPop[0]/x",
35 | "y_axis": "hrPop[0]/y",
36 | "z_axis": "hrPop[0]/z"
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/examples/arbor/ArborExample.json:
--------------------------------------------------------------------------------
1 | {
2 | "ArborExample": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example for testing Arbor",
5 | "parameters": {
6 | "v_init": -50,
7 | "scale": 3,
8 | "input_amp": 0.01,
9 | "input_del": 50,
10 | "input_dur": 5
11 | },
12 | "cells": {
13 | "test_arbor_cell": {
14 | "parameters": {
15 | "v_init": "v_init",
16 | "radius": 3,
17 | "mechanism": "hh"
18 | },
19 | "arbor_cell": "cable_cell"
20 | }
21 | },
22 | "synapses": {
23 | "ampaSyn": {
24 | "parameters": {
25 | "e_rev": -10,
26 | "tau_syn": 2
27 | },
28 | "pynn_synapse_type": "cond_alpha",
29 | "pynn_receptor_type": "excitatory"
30 | }
31 | },
32 | "input_sources": {
33 | "i_clamp": {
34 | "parameters": {
35 | "amplitude": "input_amp",
36 | "start": "input_del",
37 | "stop": "input_del+input_dur"
38 | },
39 | "pynn_input": "DCSource"
40 | }
41 | },
42 | "regions": {
43 | "region0": {
44 | "x": 0.0,
45 | "y": 0.0,
46 | "z": 0.0,
47 | "width": 1000.0,
48 | "height": 100.0,
49 | "depth": 1000.0
50 | },
51 | "region1": {
52 | "x": 0.0,
53 | "y": 200.0,
54 | "z": 0.0,
55 | "width": 1000.0,
56 | "height": 100.0,
57 | "depth": 1000.0
58 | }
59 | },
60 | "populations": {
61 | "pop0": {
62 | "size": "scale",
63 | "component": "test_arbor_cell",
64 | "properties": {
65 | "color": "1 0 0"
66 | },
67 | "random_layout": {
68 | "region": "region0"
69 | }
70 | },
71 | "pop1": {
72 | "size": "scale",
73 | "component": "test_arbor_cell",
74 | "properties": {
75 | "color": "0 1 0"
76 | },
77 | "random_layout": {
78 | "region": "region1"
79 | }
80 | }
81 | },
82 | "projections": {
83 | "proj0": {
84 | "presynaptic": "pop0",
85 | "postsynaptic": "pop1",
86 | "synapse": "ampaSyn",
87 | "delay": "5",
88 | "weight": "0.0001*random()",
89 | "random_connectivity": {
90 | "probability": 0.5
91 | }
92 | }
93 | },
94 | "inputs": {
95 | "stim": {
96 | "input_source": "i_clamp",
97 | "population": "pop0",
98 | "cell_ids": [
99 | 1,
100 | 2
101 | ]
102 | }
103 | }
104 | }
105 | }
--------------------------------------------------------------------------------
/examples/arbor/ArborExample.yaml:
--------------------------------------------------------------------------------
1 | ArborExample:
2 | version: NeuroMLlite v0.6.1
3 | notes: Example for testing Arbor
4 | parameters:
5 | v_init: -50
6 | scale: 3
7 | input_amp: 0.01
8 | input_del: 50
9 | input_dur: 5
10 | cells:
11 | test_arbor_cell:
12 | parameters:
13 | v_init: v_init
14 | radius: 3
15 | mechanism: hh
16 | arbor_cell: cable_cell
17 | synapses:
18 | ampaSyn:
19 | parameters:
20 | e_rev: -10
21 | tau_syn: 2
22 | pynn_synapse_type: cond_alpha
23 | pynn_receptor_type: excitatory
24 | input_sources:
25 | i_clamp:
26 | parameters:
27 | amplitude: input_amp
28 | start: input_del
29 | stop: input_del+input_dur
30 | pynn_input: DCSource
31 | regions:
32 | region0:
33 | x: 0.0
34 | y: 0.0
35 | z: 0.0
36 | width: 1000.0
37 | height: 100.0
38 | depth: 1000.0
39 | region1:
40 | x: 0.0
41 | y: 200.0
42 | z: 0.0
43 | width: 1000.0
44 | height: 100.0
45 | depth: 1000.0
46 | populations:
47 | pop0:
48 | size: scale
49 | component: test_arbor_cell
50 | properties:
51 | color: 1 0 0
52 | random_layout:
53 | region: region0
54 | pop1:
55 | size: scale
56 | component: test_arbor_cell
57 | properties:
58 | color: 0 1 0
59 | random_layout:
60 | region: region1
61 | projections:
62 | proj0:
63 | presynaptic: pop0
64 | postsynaptic: pop1
65 | synapse: ampaSyn
66 | delay: '5'
67 | weight: 0.0001*random()
68 | random_connectivity:
69 | probability: 0.5
70 | inputs:
71 | stim:
72 | input_source: i_clamp
73 | population: pop0
74 | cell_ids:
75 | - 1
76 | - 2
77 |
--------------------------------------------------------------------------------
/examples/arbor/SimArborExample.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimArborExample": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "ArborExample.json",
5 | "duration": 100.0,
6 | "dt": 0.01,
7 | "record_traces": {
8 | "all": "*"
9 | },
10 | "record_spikes": {
11 | "pop0": "*"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/examples/arbor/SimArborExample.yaml:
--------------------------------------------------------------------------------
1 | SimArborExample:
2 | version: NeuroMLlite v0.6.1
3 | network: ArborExample.yaml
4 | duration: 100.0
5 | dt: 0.01
6 | record_traces:
7 | all: '*'
8 | record_spikes:
9 | pop0: '*'
10 |
--------------------------------------------------------------------------------
/examples/clean.sh:
--------------------------------------------------------------------------------
1 | mkdir ~/temp/dump
2 | mv -v report*txt *.pdf *.dat *.spikes *.gdf *.pkl *.hoc *.mod *~ *.log *nrn.py NET_*nml *brian.py *brian2.py *nest.py *pynn.py *definition.py *netpyne.py *moose.py *.nestml *.png *.ini *.svg *.pov *.gv *cell.json *synapse.json *main.json tmp* *csv *mdf.json *mdf.yaml *.mdf *eden.py ~/temp/dump
3 | rm -rf x86_64 i386 umac arm64 *.pyc *.c *.so __pycache__ *~ .*~
4 | rm -rf ./test_files/test_inputs/x86_64 ./test_files/x86_64 ./spikeratetest/x86_64
5 |
--------------------------------------------------------------------------------
/examples/images/Ex1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex1.png
--------------------------------------------------------------------------------
/examples/images/Ex2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex2.png
--------------------------------------------------------------------------------
/examples/images/Ex4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex4.png
--------------------------------------------------------------------------------
/examples/images/Ex5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex5.png
--------------------------------------------------------------------------------
/examples/images/Ex5_BBP_5percent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex5_BBP_5percent.png
--------------------------------------------------------------------------------
/examples/images/Ex6.circo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex6.circo.png
--------------------------------------------------------------------------------
/examples/images/Ex6.dot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex6.dot.png
--------------------------------------------------------------------------------
/examples/images/Ex6.fdp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex6.fdp.png
--------------------------------------------------------------------------------
/examples/images/Ex6matrix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex6matrix.png
--------------------------------------------------------------------------------
/examples/images/Ex7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/Ex7.png
--------------------------------------------------------------------------------
/examples/images/bbp1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/bbp1.png
--------------------------------------------------------------------------------
/examples/images/bbp2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/bbp2.png
--------------------------------------------------------------------------------
/examples/images/bbp3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/images/bbp3.png
--------------------------------------------------------------------------------
/examples/sonatatest/IntFireCells.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/examples/sonatatest/SimSonataExample.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimSonataExample": {
3 | "version": "NeuroMLlite v0.6.0",
4 | "network": "SonataExample.json",
5 | "duration": 1000.0,
6 | "dt": 0.01,
7 | "record_traces": {
8 | "all": "*"
9 | },
10 | "record_spikes": {
11 | "pop0": "*"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/examples/sonatatest/SonataExample.json:
--------------------------------------------------------------------------------
1 | {
2 | "SonataExample": {
3 | "version": "NeuroMLlite v0.6.0",
4 | "notes": "Example for testing Sonata",
5 | "parameters": {
6 | "input_amp": 0.19,
7 | "input_del": 100,
8 | "input_dur": 800
9 | },
10 | "cells": {
11 | "testcell": {
12 | "parameters": {
13 | "i_offset": 0,
14 | "cm": 0.117,
15 | "tau_m": 22.1,
16 | "tau_refrac": 3,
17 | "v_reset": -50,
18 | "v_rest": -78,
19 | "v_thresh": -47
20 | },
21 | "pynn_cell": "IF_cond_alpha"
22 | }
23 | },
24 | "input_sources": {
25 | "i_clamp": {
26 | "parameters": {
27 | "amplitude": "input_amp",
28 | "start": "input_del",
29 | "stop": "input_del+input_dur"
30 | },
31 | "pynn_input": "DCSource"
32 | }
33 | },
34 | "regions": {
35 | "region1": {
36 | "x": 0.0,
37 | "y": 0.0,
38 | "z": 0.0,
39 | "width": 1000.0,
40 | "height": 100.0,
41 | "depth": 1000.0
42 | }
43 | },
44 | "populations": {
45 | "pop0": {
46 | "size": 2,
47 | "component": "testcell",
48 | "properties": {
49 | "color": "1 0 0"
50 | },
51 | "random_layout": {
52 | "region": "region1"
53 | }
54 | }
55 | },
56 | "inputs": {
57 | "stim": {
58 | "input_source": "i_clamp",
59 | "population": "pop0",
60 | "percentage": 50
61 | }
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/examples/sonatatest/SonataExample.py:
--------------------------------------------------------------------------------
1 | from neuromllite import (
2 | Network,
3 | Cell,
4 | InputSource,
5 | Population,
6 | Synapse,
7 | RectangularRegion,
8 | RandomLayout,
9 | )
10 | from neuromllite import Projection, RandomConnectivity, Input, Simulation
11 | import sys
12 |
13 | ################################################################################
14 | ### Build new network
15 |
16 | net = Network(id="SonataExample")
17 | net.notes = "Example for testing Sonata"
18 | net.parameters = {"input_amp": 0.190, "input_del": 100, "input_dur": 800}
19 |
20 | cell = Cell(id="testcell", pynn_cell="IF_cond_alpha")
21 | cell.parameters = {
22 | "i_offset": 0,
23 | "cm": 0.117,
24 | "tau_m": 22.1,
25 | "tau_refrac": 3,
26 | "v_reset": -50,
27 | "v_rest": -78,
28 | "v_thresh": -47,
29 | }
30 |
31 |
32 | net.cells.append(cell)
33 | """
34 | cell2 = Cell(id='testcell2', pynn_cell='IF_cond_alpha')
35 | cell2.parameters = { "tau_refrac":5, "i_offset":-.1 }
36 | net.cells.append(cell2)"""
37 |
38 | input_source = InputSource(
39 | id="i_clamp",
40 | pynn_input="DCSource",
41 | parameters={
42 | "amplitude": "input_amp",
43 | "start": "input_del",
44 | "stop": "input_del+input_dur",
45 | },
46 | )
47 | net.input_sources.append(input_source)
48 |
49 | r1 = RectangularRegion(id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000)
50 | net.regions.append(r1)
51 |
52 | p0 = Population(
53 | id="pop0",
54 | size=2,
55 | component=cell.id,
56 | properties={"color": "1 0 0"},
57 | random_layout=RandomLayout(region=r1.id),
58 | )
59 | net.populations.append(p0)
60 | """
61 | p1 = Population(id='pop1', size=2, component=cell2.id, properties={'color':'0 1 0'},random_layout = RandomLayout(region=r1.id))
62 | p2 = Population(id='pop2', size=1, component=cell2.id, properties={'color':'0 0 1'},random_layout = RandomLayout(region=r1.id))
63 |
64 | net.populations.append(p1)
65 | net.populations.append(p2)"""
66 |
67 | """
68 | net.synapses.append(Synapse(id='ampaSyn',
69 | pynn_receptor_type='excitatory',
70 | pynn_synapse_type='cond_alpha',
71 | parameters={'e_rev':-10, 'tau_syn':2}))
72 | net.synapses.append(Synapse(id='gabaSyn',
73 | pynn_receptor_type='inhibitory',
74 | pynn_synapse_type='cond_alpha',
75 | parameters={'e_rev':-80, 'tau_syn':10}))
76 |
77 | net.projections.append(Projection(id='proj0',
78 | presynaptic=p0.id,
79 | postsynaptic=p1.id,
80 | synapse='ampaSyn',
81 | delay=2,
82 | weight=0.02))
83 | net.projections[0].random_connectivity=RandomConnectivity(probability=1)
84 |
85 | net.projections.append(Projection(id='proj1',
86 | presynaptic=p0.id,
87 | postsynaptic=p2.id,
88 | synapse='gabaSyn',
89 | delay=2,
90 | weight=0.01))
91 | net.projections[1].random_connectivity=RandomConnectivity(probability=1)"""
92 |
93 | net.inputs.append(
94 | Input(id="stim", input_source=input_source.id, population=p0.id, percentage=50)
95 | )
96 |
97 | print(net.to_json())
98 | new_file = net.to_json_file("%s.json" % net.id)
99 |
100 |
101 | ################################################################################
102 | ### Build Simulation object & save as JSON
103 |
104 | sim = Simulation(
105 | id="SimSonataExample",
106 | network=new_file,
107 | duration="1000",
108 | dt="0.01",
109 | record_traces={"all": "*"},
110 | record_spikes={"pop0": "*"},
111 | )
112 |
113 | sim.to_json_file()
114 |
115 |
116 | ################################################################################
117 | ### Run in some simulators
118 |
119 | from neuromllite.NetworkGenerator import check_to_generate_or_run
120 | import sys
121 |
122 | check_to_generate_or_run(sys.argv, sim)
123 |
--------------------------------------------------------------------------------
/examples/sonatatest/analyze_output.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from bmtk.analyzer.visualization.spikes import plot_spikes
3 |
4 |
5 | from analyze_output_utils import plot_data
6 |
7 | if __name__ == "__main__":
8 | plot_data(
9 | "output/membrane_potential.h5", "mV", "Membrane Potential", show_already=True
10 | )
11 | # plot_spikes('../input/network/pre_nodes.h5', '../input/network/pre_node_types.csv', 'output/spikes.h5')
12 | # plot_spikes('../input/network/post_nodes.h5', '../input/network/post_node_types.csv', 'output/spikes.h5')
13 |
--------------------------------------------------------------------------------
/examples/sonatatest/analyze_output_utils.py:
--------------------------------------------------------------------------------
1 | import h5py
2 | import numpy as np
3 | import matplotlib.pyplot as plt
4 |
5 |
6 | def plot_data(reports_file, y_axis, title, show_already=True, max_num_traces=None):
7 | print("Plotting data on %s (%s) from file: %s" % (title, y_axis, reports_file))
8 | cellvar_h5 = h5py.File(reports_file, "r")
9 |
10 | try:
11 | top_level = cellvar_h5["/mapping"]
12 | pop_prefixes = {"GLOBAL": "/"}
13 | except:
14 | pop_prefixes = {}
15 | for pop in cellvar_h5["/report"].keys():
16 | pop_prefixes = {pop: "/report/%s/" % pop}
17 |
18 | for pop in pop_prefixes:
19 | gids = np.array(cellvar_h5["%smapping/gids" % pop_prefixes[pop]])
20 |
21 | soma_locs = np.array(
22 | cellvar_h5["%smapping/index_pointer" % pop_prefixes[pop]]
23 | ) # location of soma
24 | t_start = cellvar_h5["%smapping/time" % pop_prefixes[pop]][0]
25 | t_stop = cellvar_h5["%smapping/time" % pop_prefixes[pop]][1]
26 | dt = cellvar_h5["%smapping/time" % pop_prefixes[pop]][2]
27 | time_steps = np.linspace(t_start, t_stop, 1 + (t_stop - t_start) / float(dt))
28 | print(
29 | "Time steps %s -> %s, dt: %s (%s points)"
30 | % (t_start, t_stop, dt, len(time_steps))
31 | )
32 |
33 | n_plots = len(gids)
34 | if max_num_traces:
35 | n_plots = min(max_num_traces, n_plots)
36 | data_table = np.array(cellvar_h5["%sdata" % pop_prefixes[pop]])
37 | f, axarr = plt.subplots(n_plots, 1)
38 | f.suptitle(title)
39 | for i, (gid, soma_index) in enumerate(zip(gids, soma_locs)):
40 | if i < n_plots:
41 | data = data_table[:, [soma_index]]
42 | ax = axarr if n_plots == 1 else axarr[i]
43 |
44 | print(
45 | "For gid %i (%s) there are %i time steps and %i data points"
46 | % (gid, pop, len(time_steps), len(data))
47 | )
48 | label = "%s: gid %i" % (pop, gid)
49 | if len(time_steps) == len(data):
50 | ax.plot(time_steps, data, label=label)
51 |
52 | fn = "output/gid_%s.dat" % gid
53 | f = open(fn, "w")
54 | print("Writing %i points to %s" % (len(time_steps), fn))
55 | for ti in range(len(time_steps)):
56 | f.write(
57 | "%s\t%s\n" % (time_steps[ti] / 1000, data[ti][0] / 1000)
58 | )
59 | f.close()
60 | else:
61 | ax.plot(data, label=label)
62 |
63 | ax.legend()
64 | ax.set_ylabel(y_axis)
65 | if i < n_plots - 1:
66 | ax.set_xticklabels([])
67 | ax.set_xlabel("ms")
68 |
69 | if show_already:
70 | plt.show()
71 |
--------------------------------------------------------------------------------
/examples/sonatatest/circuit_config.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest": {
3 | "$NETWORK_DIR": "./network",
4 | "$COMPONENT_DIR": "./components"
5 | },
6 | "components": {
7 | "synaptic_models_dir": "$COMPONENT_DIR/synaptic_models",
8 | "point_neuron_models_dir": "$COMPONENT_DIR/point_neuron_models_dir"
9 | },
10 | "networks": {
11 | "nodes": [
12 | {
13 | "nodes_file": "$NETWORK_DIR/SonataExample_nodes.sonata.h5",
14 | "node_types_file": "$NETWORK_DIR/SonataExample_node_types.csv"
15 | }
16 | ]
17 | }
18 | }
--------------------------------------------------------------------------------
/examples/sonatatest/clean.sh:
--------------------------------------------------------------------------------
1 | mkdir ~/temp/dump3
2 | mv -v report*txt *.dat *.spikes *.gdf *.hoc *.mod *~ *.log *nrn.py NET_*nml *brian.py *brian2.py *h5 *nest.py *pynn.py *definition.py *netpyne.py *moose.py *.nestml *.png *.ini *.svg *.pov *.gv *cell.json *synapse.json *main.json tmp* *csv *pyc ~/temp/dump3
3 | cd network
4 | mv -v *csv *.h5 ~/temp/dump3
5 | rm -rf x86_64 i386 umac *.pyc *~ .*~
--------------------------------------------------------------------------------
/examples/sonatatest/components/point_neuron_models_dir/testcell.json:
--------------------------------------------------------------------------------
1 | {
2 | "E_L": -78.0,
3 | "C_m": 117.0,
4 | "tau_m": 22.1,
5 | "t_ref": 3.0,
6 | "V_th": -47.0,
7 | "V_reset": -50.0,
8 | "I_e": 0.0
9 | }
--------------------------------------------------------------------------------
/examples/sonatatest/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "network": "./circuit_config.json",
3 | "simulation": "./simulation_config.json"
4 | }
--------------------------------------------------------------------------------
/examples/sonatatest/network/SonataExample_node_types.csv:
--------------------------------------------------------------------------------
1 | node_type_id pop_name model_name model_template model_type dynamics_params
2 | 100 pop0 testcell nest:iaf_psc_alpha point_process testcell.json
3 |
--------------------------------------------------------------------------------
/examples/sonatatest/network/SonataExample_nodes.sonata.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/examples/sonatatest/network/SonataExample_nodes.sonata.h5
--------------------------------------------------------------------------------
/examples/sonatatest/regenerateAndTest.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -ex
3 |
4 | python SonataExample.py -sonata
5 |
6 | python run_bmtk.py
7 |
8 | ./run_pynml.jnml.sh
9 |
--------------------------------------------------------------------------------
/examples/sonatatest/run_bmtk.py:
--------------------------------------------------------------------------------
1 | #!/bin/env python
2 |
3 | import sys
4 |
5 |
6 | def run(config_file, simulator):
7 | if simulator == "NEURON":
8 | from bmtk.simulator import bionet
9 |
10 | conf = bionet.Config.from_json(config_file, validate=True)
11 | conf.build_env()
12 | net = bionet.BioNetwork.from_config(conf)
13 | sim = bionet.BioSimulator.from_config(conf, network=net)
14 |
15 | elif simulator == "NEST":
16 | from bmtk.simulator import pointnet
17 | conf = pointnet.Config.from_json(config_file)
18 | conf.build_env()
19 | net = pointnet.PointNetwork.from_config(conf)
20 | sim = pointnet.PointSimulator.from_config(conf, net)
21 |
22 | sim.run()
23 |
24 |
25 | if __name__ == "__main__":
26 | run("config.json", "NEST")
--------------------------------------------------------------------------------
/examples/sonatatest/run_pynml.jnml.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -ex
3 |
4 | pynml-sonata Back2NML config.json -jnml
5 |
--------------------------------------------------------------------------------
/examples/sonatatest/run_pynn.py:
--------------------------------------------------------------------------------
1 | from pyNN.serialization import import_from_sonata, load_sonata_simulation_plan
2 | import pyNN.nest as sim
3 |
4 | simulation_plan = load_sonata_simulation_plan("simulation_config.json")
5 | simulation_plan.setup(sim)
6 | net = import_from_sonata("circuit_config.json", sim)
7 |
8 | simulation_plan.execute(net)
9 |
--------------------------------------------------------------------------------
/examples/sonatatest/simulation_config.json:
--------------------------------------------------------------------------------
1 | {
2 | "run": {
3 | "tstop": 1000.0,
4 | "dt": 0.01
5 | },
6 | "target_simulator": "NEST",
7 | "manifest": {
8 | "$OUTPUT_DIR": "./output",
9 | "$INPUT_DIR": "./"
10 | },
11 | "output": {
12 | "output_dir": "$OUTPUT_DIR",
13 | "log_file": "log.txt",
14 | "spikes_file": "spikes.h5",
15 | "spikes_sort_order": "time"
16 | },
17 | "node_sets": {
18 | "point_nodes": {
19 | "model_type": "point_process"
20 | },
21 | "inputset_stim_i_clamp": {
22 | "model_type": "point_process",
23 | "population": "pop0"
24 | }
25 | },
26 | "reports": {
27 | "membrane_potential": {
28 | "cells": "point_nodes",
29 | "variable_name": "V_m",
30 | "module": "multimeter_report",
31 | "sections": "soma",
32 | "enabled": true
33 | }
34 | },
35 | "inputs": {
36 | "stim": {
37 | "input_type": "current_clamp",
38 | "module": "IClamp",
39 | "amp": 190.00000000000003,
40 | "delay": 100.0,
41 | "duration": 800.0,
42 | "node_set": "inputset_stim_i_clamp"
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/examples/spikeratetest/.test.mep:
--------------------------------------------------------------------------------
1 | system: Test
2 |
3 | experiments:
4 |
5 | spike_rate_in_0:
6 | expected:
7 | spike rate: 40
8 |
9 | spike_rate_in_1:
10 | expected:
11 | spike rate: 100
12 |
--------------------------------------------------------------------------------
/examples/spikeratetest/.test.nmllite.jnml.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_jnml.py
4 | engine: PyNN_NEURON
5 | mep: .test.mep
6 | experiments:
7 |
8 | spike_rate_in_0:
9 | observables:
10 | spike rate:
11 | spiketimes file:
12 | path: SimSpikers.input_pop0.spikes
13 | format: ID_TIME
14 | ids: '*'
15 | tolerance: 0.010150624862620106
16 |
17 | spike_rate_in_1:
18 | observables:
19 | spike rate:
20 | spiketimes file:
21 | path: SimSpikers.input_pop1.spikes
22 | format: ID_TIME
23 | ids: '*'
24 | tolerance: 0.006355926459857528
--------------------------------------------------------------------------------
/examples/spikeratetest/SimSpikers.json:
--------------------------------------------------------------------------------
1 | {
2 | "SimSpikers": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "network": "Spikers.json",
5 | "duration": 10000.0,
6 | "dt": 0.025,
7 | "record_traces": {
8 | "pop0": "*",
9 | "pop1": "*",
10 | "pop2": "*"
11 | },
12 | "record_spikes": {
13 | "all": "*"
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/examples/spikeratetest/Spikers.json:
--------------------------------------------------------------------------------
1 | {
2 | "Spikers": {
3 | "version": "NeuroMLlite v0.6.1",
4 | "notes": "Example with spiking entities..",
5 | "parameters": {
6 | "N": 10,
7 | "weightInput": 10,
8 | "input_rate": 40
9 | },
10 | "cells": {
11 | "iafcell": {
12 | "parameters": {
13 | "tau_refrac": 10
14 | },
15 | "pynn_cell": "IF_cond_alpha"
16 | },
17 | "InputCell": {
18 | "parameters": {
19 | "start": 0,
20 | "duration": 10000000000,
21 | "rate": "input_rate"
22 | },
23 | "pynn_cell": "SpikeSourcePoisson"
24 | },
25 | "InputCell100": {
26 | "parameters": {
27 | "start": 0,
28 | "duration": 10000000000,
29 | "rate": 100
30 | },
31 | "pynn_cell": "SpikeSourcePoisson"
32 | }
33 | },
34 | "input_sources": {
35 | "poissonFiringSyn": {
36 | "neuroml2_source_file": "../test_files/inputs.nml"
37 | },
38 | "iclamp1": {
39 | "parameters": {
40 | "amplitude": 0.8,
41 | "start": 100.0,
42 | "stop": 900.0
43 | },
44 | "pynn_input": "DCSource"
45 | }
46 | },
47 | "populations": {
48 | "pop0": {
49 | "size": "N",
50 | "component": "iafcell",
51 | "properties": {
52 | "color": ".7 0 0"
53 | }
54 | },
55 | "pop1": {
56 | "size": "N",
57 | "component": "iafcell",
58 | "properties": {
59 | "color": "0 .7 0"
60 | }
61 | },
62 | "pop2": {
63 | "size": "N",
64 | "component": "iafcell",
65 | "properties": {
66 | "color": "0 .7 0.7"
67 | }
68 | },
69 | "input_pop0": {
70 | "size": "N",
71 | "component": "InputCell",
72 | "properties": {
73 | "color": ".7 .7 .7"
74 | }
75 | },
76 | "input_pop1": {
77 | "size": "N",
78 | "component": "InputCell100",
79 | "properties": {
80 | "color": ".7 .1 .7"
81 | }
82 | }
83 | },
84 | "inputs": {
85 | "stim0": {
86 | "input_source": "poissonFiringSyn",
87 | "population": "pop0",
88 | "percentage": 50,
89 | "weight": "weightInput"
90 | },
91 | "stim1": {
92 | "input_source": "iclamp1",
93 | "population": "pop1",
94 | "percentage": 100
95 | },
96 | "stim2": {
97 | "input_source": "iclamp1",
98 | "population": "pop2",
99 | "percentage": 50
100 | }
101 | }
102 | }
103 | }
--------------------------------------------------------------------------------
/examples/spikeratetest/Spikers.py:
--------------------------------------------------------------------------------
1 | from neuromllite import Network, Cell, InputSource, Population, Synapse
2 | from neuromllite import Projection, RandomConnectivity, Input, Simulation
3 | import sys
4 |
5 | ################################################################################
6 | ### Build new network
7 |
8 | net = Network(id="Spikers")
9 | net.notes = "Example with spiking entities.."
10 | net.parameters = {"N": 10, "weightInput": 10, "input_rate": 40}
11 |
12 | cell = Cell(id="iafcell", pynn_cell="IF_cond_alpha")
13 | cell.parameters = {"tau_refrac": 10}
14 | net.cells.append(cell)
15 |
16 | input_cell = Cell(id="InputCell", pynn_cell="SpikeSourcePoisson")
17 | input_cell.parameters = {"start": 0, "duration": 10000000000, "rate": "input_rate"}
18 | net.cells.append(input_cell)
19 |
20 | input_cell_100 = Cell(id="InputCell100", pynn_cell="SpikeSourcePoisson")
21 | input_cell_100.parameters = {"start": 0, "duration": 10000000000, "rate": 100}
22 | net.cells.append(input_cell_100)
23 |
24 |
25 | input_source_p0 = InputSource(
26 | id="poissonFiringSyn", neuroml2_source_file="../test_files/inputs.nml"
27 | )
28 | net.input_sources.append(input_source_p0)
29 |
30 | input_source1 = InputSource(
31 | id="iclamp1",
32 | pynn_input="DCSource",
33 | parameters={"amplitude": 0.8, "start": 100.0, "stop": 900.0},
34 | )
35 |
36 | net.input_sources.append(input_source1)
37 |
38 |
39 | pop0 = Population(
40 | id="pop0", size="N", component=cell.id, properties={"color": ".7 0 0"}
41 | )
42 | net.populations.append(pop0)
43 | pop1 = Population(
44 | id="pop1", size="N", component=cell.id, properties={"color": "0 .7 0"}
45 | )
46 | net.populations.append(pop1)
47 | pop2 = Population(
48 | id="pop2", size="N", component=cell.id, properties={"color": "0 .7 0.7"}
49 | )
50 | net.populations.append(pop2)
51 | #
52 |
53 | ipop0 = Population(
54 | id="input_pop0", size="N", component=input_cell.id, properties={"color": ".7 .7 .7"}
55 | )
56 | net.populations.append(ipop0)
57 | ipop1 = Population(
58 | id="input_pop1",
59 | size="N",
60 | component=input_cell_100.id,
61 | properties={"color": ".7 .1 .7"},
62 | )
63 | net.populations.append(ipop1)
64 |
65 | # pRS = Population(id='RSpop', size='N - int(N*fractionE)', component=cell.id, properties={'color':'0 0 .7'})
66 |
67 | # net.populations.append(pRS)
68 | """
69 | net.synapses.append(Synapse(id='ampa', neuroml2_source_file='test_files/ampa.synapse.nml'))
70 | #net.synapses.append(Synapse(id='gaba', neuroml2_source_file='test_files/gaba.synapse.nml'))
71 |
72 |
73 | net.projections.append(Projection(id='projEI',
74 | presynaptic=pE.id,
75 | postsynaptic=pRS.id,
76 | synapse='ampa',
77 | delay=2,
78 | weight=0.2,
79 | random_connectivity=RandomConnectivity(probability=.8)))
80 |
81 | """
82 | net.inputs.append(
83 | Input(
84 | id="stim0",
85 | input_source=input_source_p0.id,
86 | population=pop0.id,
87 | percentage=50,
88 | weight="weightInput",
89 | )
90 | )
91 |
92 | net.inputs.append(
93 | Input(id="stim1", input_source=input_source1.id, population=pop1.id, percentage=100)
94 | )
95 |
96 | net.inputs.append(
97 | Input(id="stim2", input_source=input_source1.id, population=pop2.id, percentage=50)
98 | )
99 |
100 | print(net)
101 | print(net.to_json())
102 | new_file = net.to_json_file("%s.json" % net.id)
103 |
104 |
105 | ################################################################################
106 | ### Build Simulation object & save as JSON
107 |
108 | sim = Simulation(
109 | id="SimSpikers",
110 | network=new_file,
111 | duration="10000",
112 | dt="0.025",
113 | record_traces={"pop0": "*", "pop1": "*", "pop2": "*"},
114 | record_spikes={"all": "*"},
115 | )
116 |
117 | sim.to_json_file()
118 |
119 |
120 | ################################################################################
121 | ### Run in some simulators
122 |
123 | from neuromllite.NetworkGenerator import check_to_generate_or_run
124 | import sys
125 |
126 | check_to_generate_or_run(sys.argv, sim)
127 |
--------------------------------------------------------------------------------
/examples/spikeratetest/test_jnml.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | sys.argv.append("-jnml")
4 | import Spikers
5 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex3.jnml.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample3.xml
4 | engine: jNeuroML
5 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex3.jnmleden.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample3.xml
4 | engine: jNeuroML_EDEN
5 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex3.jnmlnetpyne.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample3.xml
4 | engine: jNeuroML_NetPyNE
5 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex3.jnmlnrn.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample3.xml
4 | engine: jNeuroML_NEURON
5 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.jnml.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample4.xml
4 | engine: jNeuroML
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.0004586390927285425
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.00041250257814095143
30 |
31 | spikes0:
32 | observables:
33 | spike times:
34 | spiketimes file:
35 | path: ../SimExample4.pop0.spikes
36 | format: ID_TIME
37 | id: 0
38 | tolerance: 0.0004558156126755435
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.jnmleden.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample4.xml
4 | engine: jNeuroML_EDEN
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.00025278058645101804
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.00023269200151868833
30 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.jnmlnetpyne.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample4.xml
4 | engine: jNeuroML_NetPyNE
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.000
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.0
30 |
31 | spikes0:
32 | observables:
33 | spike times:
34 | spiketimes file:
35 | path: ../SimExample4.pop0.spikes
36 | format: ID_TIME
37 | id: 0
38 | tolerance: 0.00
39 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.jnmlnrn.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: ../LEMS_SimExample4.xml
4 | engine: jNeuroML_NEURON
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.000
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.0
30 |
31 | spikes0:
32 | observables:
33 | spike times:
34 | spiketimes file:
35 | path: ../SimExample4.pop0.spikes
36 | format: ID_TIME
37 | id: 0
38 | tolerance: 0.00
39 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.jnmlpynnnrn.omt__:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | # Are connections in the pipeline jnml -> pynn -> neuron working???
4 | # Besides, shouldn't be mapped back to IF_cond_alpha in the generated pynn???
5 |
6 | target: ../LEMS_SimExample4.xml
7 | engine: jNeuroML_PyNN_NEURON
8 | mep: .test.ex4.mep
9 | experiments:
10 | v0:
11 | observables:
12 | spike times:
13 | file:
14 | path: ../SimExample4.pop1.v.dat
15 | columns: [0,1]
16 | scaling: [1000, 1000]
17 | spike detection:
18 | method: threshold
19 | threshold: -64
20 | tolerance: 0.000
21 |
22 | v1:
23 | observables:
24 | spike times:
25 | file:
26 | path: ../SimExample4.pop2.v.dat
27 | columns: [0,1]
28 | scaling: [1000, 1000]
29 | spike detection:
30 | method: threshold
31 | threshold: -69
32 | tolerance: 0.0
33 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.mep:
--------------------------------------------------------------------------------
1 | system: Test Ex4
2 |
3 | experiments:
4 | v0:
5 | expected:
6 | spike times: [227.01, 253.61, 281.55, 309.79, 338.09, 366.4, 394.72, 423.04, 451.35999999999996, 479.68, 508.0, 536.32, 564.64, 592.96, 621.2800000000001, 649.5999999999999, 677.92, 706.24, 734.56, 762.88, 791.2]
7 | v1:
8 | expected:
9 | spike times: [305.89, 334.93, 363.38, 391.72, 420.04999999999995, 448.37, 476.69, 505.00999999999993, 533.3299999999999, 561.65, 589.97, 618.29, 646.61, 674.9300000000001, 703.25, 731.57, 759.89, 788.2099999999999, 816.53]
10 | spikes0:
11 | expected:
12 | spike times: [0.22139, 0.24971, 0.27803, 0.30635, 0.33467, 0.36299, 0.39131, 0.41963, 0.44795, 0.47627, 0.50459, 0.53291, 0.56123, 0.58955, 0.61787, 0.64619, 0.67451, 0.70283, 0.73115, 0.759469999999, 0.787789999999]
13 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.nmllite.jnml.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex4_jnml.py
4 | engine: PyNN_NEURON
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.0004586390927285425
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.00041250257814095143
30 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.nmllite.netpyne.omt_:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex4_netpyne.py
4 | engine: NetPyNE
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.0.v_cell_2.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.000
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.0.v_cell_4.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.00
30 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.nmllite.pynnbrian.omt_:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex4_pynn.py
4 | engine: PyNN_Brian1
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.00079625884732052
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.0007470637943491359
30 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.nmllite.pynnnest.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex4_pynn.py
4 | engine: PyNN_Nest
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.008722082727633224
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.006342149138579221
30 |
31 | spikes0:
32 | observables:
33 | spike times:
34 | spiketimes file:
35 | path: ../SimExample4.pop0.spikes
36 | format: ID_TIME
37 | id: 0
38 | tolerance: 0.008943493382718323
39 |
40 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex4.nmllite.pynnnrn.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex4_pynn.py
4 | engine: PyNN_NEURON
5 | mep: .test.ex4.mep
6 | experiments:
7 | v0:
8 | observables:
9 | spike times:
10 | file:
11 | path: ../SimExample4.pop1.v.dat
12 | columns: [0,1]
13 | scaling: [1000, 1000]
14 | spike detection:
15 | method: threshold
16 | threshold: -64
17 | tolerance: 0.00026541961577355457
18 |
19 | v1:
20 | observables:
21 | spike times:
22 | file:
23 | path: ../SimExample4.pop2.v.dat
24 | columns: [0,1]
25 | scaling: [1000, 1000]
26 | spike detection:
27 | method: threshold
28 | threshold: -69
29 | tolerance: 0.00024493894896688645
30 |
31 | spikes0:
32 | observables:
33 | spike times:
34 | spiketimes file:
35 | path: ../SimExample4.pop0.spikes
36 | format: ID_TIME
37 | id: 0
38 | tolerance: 0.0002538747631273211
39 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex7.mep:
--------------------------------------------------------------------------------
1 | system: Test Ex7
2 |
3 | experiments:
4 |
5 | spike_rate_e:
6 | expected:
7 | spike rate: 21.79479453574138
8 | spike_rate_i:
9 | expected:
10 | spike rate: 22.14699587483277
11 |
12 | spike_rate_exc_in:
13 | expected:
14 | spike rate: 10000
15 | spike_rate_inh_in:
16 | expected:
17 | spike rate: 10000
18 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex7.nmllite.jnml.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex7_jnml.py
4 | engine: PyNN_NEURON
5 | mep: .test.ex7.mep
6 | experiments:
7 |
8 | spike_rate_exc_in:
9 | observables:
10 | spike rate:
11 | spiketimes file:
12 | path: ../SimExample7.expoisson.spikes
13 | format: ID_TIME
14 | ids: '*'
15 | tolerance: 0.00635578875715255
16 |
17 | spike_rate_inh_in:
18 | observables:
19 | spike rate:
20 | spiketimes file:
21 | path: ../SimExample7.inpoisson.spikes
22 | format: ID_TIME
23 | ids: '*'
24 | tolerance: 0.0034404973266933666
25 |
26 | spike_rate_e:
27 | observables:
28 | spike rate:
29 | spiketimes file:
30 | path: ../SimExample7.Epop.spikes
31 | format: ID_TIME
32 | ids: '*'
33 | tolerance: 0.01572133878471689
34 |
35 | spike_rate_i:
36 | observables:
37 | spike rate:
38 | spiketimes file:
39 | path: ../SimExample7.Ipop.spikes
40 | format: ID_TIME
41 | ids: '*'
42 | tolerance: 0.006136767216696055
43 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex7.nmllite.jnmlnrn.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex7_jnmlnrn.py
4 | engine: PyNN_NEURON
5 | mep: .test.ex7.mep
6 | experiments:
7 |
8 | spike_rate_exc_in:
9 | observables:
10 | spike rate:
11 | spiketimes file:
12 | path: ../SimExample7.expoisson.spikes
13 | format: ID_TIME
14 | ids: '*'
15 | tolerance: 0.0030522052087322664
16 |
17 | spike_rate_inh_in:
18 | observables:
19 | spike rate:
20 | spiketimes file:
21 | path: ../SimExample7.inpoisson.spikes
22 | format: ID_TIME
23 | ids: '*'
24 | tolerance: 0.001275282183332274
25 |
26 | spike_rate_e:
27 | observables:
28 | spike rate:
29 | spiketimes file:
30 | path: ../SimExample7.Epop.spikes
31 | format: ID_TIME
32 | ids: '*'
33 | tolerance: 0.014409669952861828
34 |
35 | spike_rate_i:
36 | observables:
37 | spike rate:
38 | spiketimes file:
39 | path: ../SimExample7.Ipop.spikes
40 | format: ID_TIME
41 | ids: '*'
42 | tolerance: 0.008742241650064736
43 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex7.nmllite.pynnnest.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex7_pynn.py
4 | engine: PyNN_Nest
5 | mep: .test.ex7.mep
6 | experiments:
7 |
8 | spike_rate_exc_in:
9 | observables:
10 | spike rate:
11 | spiketimes file:
12 | path: ../SimExample7.expoisson.spikes
13 | format: ID_TIME
14 | ids: '*'
15 | tolerance: 0.0019478218091029704
16 |
17 | spike_rate_inh_in:
18 | observables:
19 | spike rate:
20 | spiketimes file:
21 | path: ../SimExample7.inpoisson.spikes
22 | format: ID_TIME
23 | ids: '*'
24 | tolerance: 0.004952617763644412
25 |
26 | spike_rate_e:
27 | observables:
28 | spike rate:
29 | spiketimes file:
30 | path: ../SimExample7.Epop.spikes
31 | format: ID_TIME
32 | ids: '*'
33 | tolerance: 0.02167593418697938
34 |
35 | spike_rate_i:
36 | observables:
37 | spike rate:
38 | spiketimes file:
39 | path: ../SimExample7.Ipop.spikes
40 | format: ID_TIME
41 | ids: '*'
42 | tolerance: 0.017234417194577856
43 |
--------------------------------------------------------------------------------
/examples/test_files/.test.ex7.nmllite.pynnnrn.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | target: test_ex7_pynn.py
4 | engine: PyNN_NEURON
5 | mep: .test.ex7.mep
6 | experiments:
7 |
8 | spike_rate_exc_in:
9 | observables:
10 | spike rate:
11 | spiketimes file:
12 | path: ../SimExample7.expoisson.spikes
13 | format: ID_TIME
14 | ids: '*'
15 | tolerance: 0.0021472208500741543
16 |
17 | spike_rate_inh_in:
18 | observables:
19 | spike rate:
20 | spiketimes file:
21 | path: ../SimExample7.inpoisson.spikes
22 | format: ID_TIME
23 | ids: '*'
24 | tolerance: 0.005981869596777869
25 |
26 | spike_rate_e:
27 | observables:
28 | spike rate:
29 | spiketimes file:
30 | path: ../SimExample7.Epop.spikes
31 | format: ID_TIME
32 | ids: '*'
33 | tolerance: 0.014037951384052453
34 |
35 | spike_rate_i:
36 | observables:
37 | spike rate:
38 | spiketimes file:
39 | path: ../SimExample7.Ipop.spikes
40 | format: ID_TIME
41 | ids: '*'
42 | tolerance: 0.02732787755826098
43 |
--------------------------------------------------------------------------------
/examples/test_files/.test.validate.omt:
--------------------------------------------------------------------------------
1 | # Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation
2 |
3 | # This test will validate all of the NeuroML 2 files in the current directory using: jnml -validate *.nml
4 | target: "../Example2_TestNetwork.net.nml ../Example3_Network.net.nml ../Example4_PyNN.net.nml ../Example6_PyNN.net.nml ../Example7_Brunel2000.net.nml ../Example12_MultiComp.net.nml *.nml"
5 | engine: jNeuroML_validate
6 |
--------------------------------------------------------------------------------
/examples/test_files/HindmarshRose3d.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
20 |
21 |
31 |
32 |
34 |
36 |
38 |
40 |
42 |
43 |
45 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/examples/test_files/Lorenz1963.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/examples/test_files/NMDA.synapse.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file describing a synaptic mechanism
5 |
6 |
7 |
8 | Example of an NMDA receptor synaptic mechanism, based on Maex DeSchutter 1998, Gabbiani et al, 1994
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Gabbiani F, Midtgaard J, Knopfel T. Synaptic integration in a model of cerebellar granule cells.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Maex, R and De Schutter, E.
25 | Synchronization of Golgi and Granule Cell Firing in a Detailed Network Model of the
26 | cerebellar Granule Cell Layer. J Neurophysiol, Nov 1998; 80: 2521 - 2537
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | Receptor properties
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/AMPA_syn.synapse.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ChannelML file describing a single synaptic mechanism
5 |
6 |
7 |
8 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as a double exponential function of time. Mappings exist for NEURON and GENESIS.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/AMPA_syn_inh.synapse.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ChannelML file describing a single synaptic mechanism
5 |
6 |
7 |
8 |
9 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as a double exponential function of time. Mappings exist for NEURON and GENESIS.
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/Ca_conc.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ChannelML file describing intracellular Calcium dynamics, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/Ca_pyr.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Calcium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
5 |
6 |
7 |
8 | NeuroML file containing a single Calcium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Traub, R. D., Wong, R. K., Miles, R., and Michelson, H. (1991). A model of a CA3 hippocampal pyramidal neuron incorporating voltage-clamp data on intrinsic conductances. Journal of neurophysiology, 66(2), 635-50.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Ca channels
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/GABA_syn.synapse.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ChannelML file describing a single synaptic mechanism
5 |
6 |
7 |
8 | Simple example of a synaptic mechanism, which consists of a postsynaptic conductance which changes as a double exponential function of time. Mappings exist for NEURON and GENESIS.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/GABA_syn_inh.synapse.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ChannelML file describing a single synaptic mechanism
5 |
6 |
7 |
8 | NOTE: zero conductance as per ACnet2-main.g
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/Kahp_pyr.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Calcium-dependent Potassium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
5 |
6 |
7 |
8 | NeuroML file containing a single Calcium-dependent Potassium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Traub, R. D., Wong, R. K., Miles, R., and Michelson, H. (1991). A model of a CA3 hippocampal pyramidal neuron incorporating voltage-clamp data on intrinsic conductances. Journal of neurophysiology, 66(2), 635-50.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | K channels
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/Kdr_bask.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Potassium Channel description, from the book Neuronal Networks of the Hippocampus, Traub and Miles 1991
5 |
6 |
7 |
8 | NeuroML file containing a single Potassium Channel description, from the book Neuronal Networks of the Hippocampus, Traub and Miles 1991
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Traub, R. D., & Miles, R. (1991). Neuronal Networks of the Hippocampus. Cambridge University Press.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | K channels
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/Kdr_pyr.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Potassium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
5 |
6 |
7 |
8 | NeuroML file containing a single Potassium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Traub, R. D., Wong, R. K., Miles, R., and Michelson, H. (1991). A model of a CA3 hippocampal pyramidal neuron incorporating voltage-clamp data on intrinsic conductances. Journal of neurophysiology, 66(2), 635-50.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | K channels
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/LeakConductance_bask.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Channel description
5 |
6 |
7 |
8 | Passive conductance for basket cell
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/LeakConductance_pyr.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Channel description
5 |
6 |
7 |
8 | Passive conductance for pyramidal cell
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/Na_bask.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Sodium Channel description, from the book Neuronal Networks of the Hippocampus, Traub and Miles 1991
5 |
6 |
7 |
8 | NeuroML file containing a single Sodium Channel description, from the book Neuronal Networks of the Hippocampus, Traub and Miles 1991
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Traub, R. D., & Miles, R. (1991). Neuronal Networks of the Hippocampus. Cambridge University Press.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Na channels
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/Na_pyr.channel.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | NeuroML file containing a single Sodium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
5 |
6 |
7 |
8 | NeuroML file containing a single Sodium Channel description, from the Hippocampal CA3 neuron model presented in Traub et al., 1991.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Traub, R. D., Wong, R. K., Miles, R., and Michelson, H. (1991). A model of a CA3 hippocampal pyramidal neuron incorporating voltage-clamp data on intrinsic conductances. Journal of neurophysiology, 66(2), 635-50.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Na channels
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/bask.cell.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | A simplified basket cell model with 2 compartments
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/examples/test_files/acnet2/pyr_4_sym_soma.cell.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | A single segment/compartment cell
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | |
83 |
84 |
--------------------------------------------------------------------------------
/examples/test_files/ampa.synapse.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/test_files/gaba.synapse.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/test_files/hhcell.cell.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
12 |
13 |
14 | Leak conductance
15 |
16 |
17 |
18 |
19 | Na channel
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/examples/test_files/iaf.cell.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
11 |
12 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/examples/test_files/inputs.nml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/examples/test_files/test_ex4_jnml.py:
--------------------------------------------------------------------------------
1 | import os, sys
2 |
3 | os.chdir("..")
4 | sys.path.append(".")
5 |
6 | sys.argv.append("-jnml")
7 |
8 | import Example4
9 |
--------------------------------------------------------------------------------
/examples/test_files/test_ex4_netpyne.py:
--------------------------------------------------------------------------------
1 | import os, sys
2 |
3 | os.chdir("..")
4 | sys.path.append(".")
5 |
6 | sys.argv.append("-netpyne")
7 |
8 | import Example4
9 |
--------------------------------------------------------------------------------
/examples/test_files/test_ex4_pynn.py:
--------------------------------------------------------------------------------
1 | import os, sys
2 |
3 | os.chdir("..")
4 | sys.path.append(".")
5 |
6 | print("Running PyNN Ex4 test script with %s" % sys.argv)
7 |
8 | if "nest" in sys.argv:
9 | sys.argv.append("-pynnnest")
10 | if "neuron" in sys.argv:
11 | sys.argv.append("-pynnnrn")
12 | if "brian" in sys.argv:
13 | sys.argv.append("-pynnbrian")
14 |
15 | import Example4
16 |
--------------------------------------------------------------------------------
/examples/test_files/test_ex7_jnml.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | from neuromllite.NetworkGenerator import check_to_generate_or_run
4 |
5 | os.chdir("..")
6 | sys.path.append(".")
7 |
8 | sys.argv.append("-jnml")
9 |
10 | from Example7 import generate
11 |
12 | sim, net = generate()
13 |
14 | check_to_generate_or_run(sys.argv, sim)
15 |
--------------------------------------------------------------------------------
/examples/test_files/test_ex7_jnmlnrn.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | from neuromllite.NetworkGenerator import check_to_generate_or_run
4 |
5 | os.chdir("..")
6 | sys.path.append(".")
7 |
8 | sys.argv.append("-jnmlnrn")
9 |
10 | from Example7 import generate
11 |
12 | sim, net = generate()
13 |
14 | check_to_generate_or_run(sys.argv, sim)
15 |
--------------------------------------------------------------------------------
/examples/test_files/test_ex7_pynn.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | from neuromllite.NetworkGenerator import check_to_generate_or_run
4 |
5 | os.chdir("..")
6 | sys.path.append(".")
7 |
8 | print("Running PyNN Ex7 test script with %s" % sys.argv)
9 |
10 | if "nest" in sys.argv:
11 | sys.argv.append("-pynnnest")
12 | if "neuron" in sys.argv:
13 | sys.argv.append("-pynnnrn")
14 | if "brian" in sys.argv:
15 | sys.argv.append("-pynnbrian")
16 |
17 | from Example7 import generate
18 |
19 | sim, net = generate()
20 |
21 | check_to_generate_or_run(sys.argv, sim)
22 |
--------------------------------------------------------------------------------
/examples/test_files/test_inputs/InputTest.net.nml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Test file...
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | Network..
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/examples/test_files/test_inputs/LEMS_InputTest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/images/NetworkShorthand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/images/NetworkShorthand.png
--------------------------------------------------------------------------------
/neuromllite/gui/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/neuromllite/gui/__init__.py
--------------------------------------------------------------------------------
/neuromllite/sweep/GenerateTests.py:
--------------------------------------------------------------------------------
1 | from neuromllite import *
2 | from neuromllite.NetworkGenerator import *
3 | from neuromllite.utils import create_new_model
4 | import sys
5 |
6 |
7 | if __name__ == "__main__":
8 | hhcell = Cell(
9 | id="hhcell", neuroml2_source_file="../../examples/test_files/hhcell.cell.nml"
10 | )
11 |
12 | iclamp = InputSource(
13 | id="iclamp_0",
14 | neuroml2_input="PulseGenerator",
15 | parameters={"amplitude": "stim_amp", "delay": "stim_del", "duration": "200ms"},
16 | )
17 |
18 | parameters = {"stim_amp": "100pA", "stim_del": "50ms"}
19 |
20 | sim, network = create_new_model(
21 | "HHTest",
22 | 300,
23 | parameters=parameters,
24 | cell_for_default_population=hhcell,
25 | input_for_default_population=iclamp,
26 | )
27 |
28 | """
29 | pynncell = Cell(id='pynncell',
30 | pynn_cell='IF_cond_alpha',
31 | parameters = { "tau_refrac":5, "i_offset":0 })
32 |
33 |
34 | sim, network = create_new_model('PyNNTest',
35 | 300,
36 | parameters = parameters,
37 | cell_for_default_population=pynncell,
38 | input_for_default_population=iclamp)"""
39 |
40 | check_to_generate_or_run(sys.argv, sim)
41 |
--------------------------------------------------------------------------------
/neuromllite/sweep/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeuroML/NeuroMLlite/953bdad16882028947a05da172233b7cb11d39d9/neuromllite/sweep/__init__.py
--------------------------------------------------------------------------------
/neuromllite/sweep/cleanup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -ex
3 |
4 | rm -rf ParamSweep_* *.dat *.txt *kes *.png
5 |
6 |
--------------------------------------------------------------------------------
/neuromllite/test/layout/Example_Layout.json:
--------------------------------------------------------------------------------
1 | {
2 | "Example_Layout": {
3 | "version": "NeuroMLlite v0.1.8",
4 | "notes": "....",
5 | "cells": [
6 | {
7 | "hhcell": {
8 | "neuroml2_source_file": "../../../examples/test_files/hhcell.cell.nml"
9 | }
10 | }
11 | ],
12 | "synapses": [
13 | {
14 | "ampa": {
15 | "neuroml2_source_file": "../../../examples/test_files/ampa.synapse.nml"
16 | }
17 | }
18 | ],
19 | "regions": [
20 | {
21 | "region1": {
22 | "x": 0.0,
23 | "y": 0.0,
24 | "z": 0.0,
25 | "width": 1000.0,
26 | "height": 100.0,
27 | "depth": 1000.0
28 | }
29 | },
30 | {
31 | "region2": {
32 | "x": 1000.0,
33 | "y": 1000.0,
34 | "z": 1000.0,
35 | "width": 1000.0,
36 | "height": 100.0,
37 | "depth": 1000.0
38 | }
39 | }
40 | ],
41 | "populations": [
42 | {
43 | "pop0": {
44 | "size": 1,
45 | "component": "hhcell",
46 | "properties": {
47 | "color": "0 .8 0"
48 | },
49 | "relative_layout": {
50 | "region": "region1",
51 | "x": 0.0,
52 | "y": 50.0,
53 | "z": 0.0
54 | }
55 | }
56 | },
57 | {
58 | "pop1": {
59 | "size": 1,
60 | "component": "hhcell",
61 | "properties": {
62 | "color": "0 0 .8"
63 | },
64 | "relative_layout": {
65 | "region": "region2",
66 | "x": 50.0,
67 | "y": 0.0,
68 | "z": 50.0
69 | }
70 | }
71 | }
72 | ],
73 | "projections": [
74 | {
75 | "proj0": {
76 | "presynaptic": "pop0",
77 | "postsynaptic": "pop1",
78 | "synapse": "ampa",
79 | "random_connectivity": {
80 | "probability": 0.5
81 | }
82 | }
83 | }
84 | ]
85 | }
86 | }
--------------------------------------------------------------------------------
/neuromllite/test/layout/Example_Layout.net.nml:
--------------------------------------------------------------------------------
1 |
2 | Generated by NeuroMLlite v0.1.8
3 | Generated network: Example_Layout
4 | Generation seed: 1234
5 |
6 |
7 |
8 | ....
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/neuromllite/test/layout/Layout.py:
--------------------------------------------------------------------------------
1 | from neuromllite import (
2 | RelativeLayout,
3 | Cell,
4 | Synapse,
5 | InputSource,
6 | Input,
7 | RectangularRegion,
8 | )
9 | from neuromllite.NetworkGenerator import generate_network
10 | from neuromllite.utils import load_network_json
11 | from neuromllite.DefaultNetworkHandler import DefaultNetworkHandler
12 |
13 | ################################################################################
14 | ### Reuse network from Example1
15 |
16 | net = load_network_json("../../../examples/Example1_TestNetwork.json")
17 | net.id = "Example_Layout"
18 |
19 | net.notes = "...."
20 |
21 |
22 | ################################################################################
23 | ### Add some elements to the network & save new JSON
24 |
25 | r1 = RectangularRegion(id="region1", x=0, y=0, z=0, width=1000, height=100, depth=1000)
26 | r2 = RectangularRegion(
27 | id="region2", x=1000, y=1000, z=1000, width=1000, height=100, depth=1000
28 | )
29 | net.regions.append(r1)
30 | net.regions.append(r2)
31 |
32 | net.populations[0].size = 1
33 | net.populations[0].relative_layout = RelativeLayout(x=0, y=50, z=0, region=r1.id)
34 | net.populations[1].size = 1
35 | net.populations[1].relative_layout = RelativeLayout(x=50, y=0, z=50, region=r2.id)
36 |
37 | net.populations[0].component = "hhcell"
38 | net.populations[1].component = "hhcell"
39 |
40 | net.cells.append(
41 | Cell(
42 | id="hhcell", neuroml2_source_file="../../../examples/test_files/hhcell.cell.nml"
43 | )
44 | )
45 | net.synapses.append(
46 | Synapse(
47 | id="ampa", neuroml2_source_file="../../../examples/test_files/ampa.synapse.nml"
48 | )
49 | )
50 |
51 |
52 | print(net.to_json())
53 | new_file = net.to_json_file("%s.json" % net.id)
54 |
55 |
56 | ################################################################################
57 | ### Use a handler which just prints info on positions, etc.
58 |
59 | def_handler = DefaultNetworkHandler()
60 |
61 | generate_network(net, def_handler)
62 |
63 |
64 | ################################################################################
65 | ### Export to some formats, e.g. try:
66 | ### python Example2.py -graph2
67 |
68 | from neuromllite.NetworkGenerator import check_to_generate_or_run
69 | from neuromllite import Simulation
70 | import sys
71 |
72 | check_to_generate_or_run(sys.argv, Simulation(id="Sim%s" % net.id, network=new_file))
73 |
--------------------------------------------------------------------------------
/neuromllite/test/sonata/test_sonata_reader.py:
--------------------------------------------------------------------------------
1 | from neuromllite.SonataReader import get_neuroml_from_sonata
2 |
3 |
4 | def main():
5 | ids = ["5_cells_iclamp", "9_cells", "300_intfire", "300_cells"]
6 | ids += ["sim_tests/intfire/one_cell_iclamp_nest/input"]
7 | ids += ["sim_tests/intfire/ten_cells_iclamp_nest/input"]
8 | ids += ["sim_tests/intfire/ten_cells_spikes_nest/input"]
9 | # ids = ['sim_tests/intfire/ten_cells_spikes/input']
10 | # ids = ['300_cells']
11 |
12 | # ids = ['300_intfire']
13 | # ids = ['300_pointneurons','sim_tests/intfire/one_cell_iclamp/input']
14 |
15 | # id = '300_intfire'
16 | # id =
17 | # id = 'small_iclamp'
18 | ## https://github.com/pgleeson/sonata/tree/intfire
19 |
20 | for id in ids:
21 | print("***************************************************************")
22 | filename = "../../../../git/sonatapg/examples/%s/config.json" % id
23 | if "/" in id:
24 | id = id.split("/")[-2]
25 |
26 | print("**** Testing %s (%s) \n" % (id, filename))
27 |
28 | nml_doc = get_neuroml_from_sonata(filename, id, generate_lems=True)
29 |
30 | nml_file = "%s.net.nml" % id
31 |
32 | from neuroml.utils import is_valid_neuroml2
33 |
34 | assert is_valid_neuroml2(nml_file)
35 |
36 | """
37 | nml_file_name = '%s.net.nml'%id
38 | nml_file_name += '.h5'
39 |
40 | from neuroml.writers import NeuroMLHdf5Writer
41 | NeuroMLHdf5Writer.write(nml_doc,nml_file_name)
42 | print('Written to: %s'%nml_file_name) """
43 |
44 | print("** Finished testing examples: %s **" % ids)
45 |
46 |
47 | if __name__ == "__main__":
48 | main()
49 |
--------------------------------------------------------------------------------
/neuromllite/test/temp/README.md:
--------------------------------------------------------------------------------
1 | For output of tests
--------------------------------------------------------------------------------
/neuromllite/test/test_generate.py:
--------------------------------------------------------------------------------
1 | from neuromllite import *
2 | from neuromllite.utils import *
3 | from neuromllite.NetworkGenerator import *
4 |
5 | from modelspec.utils import _parse_element
6 |
7 |
8 | try:
9 | import unittest2 as unittest
10 | except ImportError:
11 | import unittest
12 |
13 |
14 | class TestGenerate(unittest.TestCase):
15 | def get_example_simulation(self):
16 | id = "Sim3"
17 | sim = Simulation(
18 | id=id,
19 | network="../../examples/Example4_PyNN.json",
20 | duration="1000",
21 | dt="0.01",
22 | record_traces={"all": "*"},
23 | )
24 | return sim
25 |
26 | def test_generate_nml(self):
27 | sim = self.get_example_simulation()
28 | network = load_network_json(sim.network)
29 |
30 | gen_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp/nml")
31 | if not os.path.isdir(gen_dir):
32 | os.mkdir(gen_dir)
33 |
34 | generate_neuroml2_from_network(
35 | network,
36 | base_dir=os.path.abspath(os.path.dirname(sim.network)),
37 | target_dir=gen_dir,
38 | )
39 |
40 | def test_generate_jnml(self):
41 | sim = self.get_example_simulation()
42 |
43 | gen_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp/jnml")
44 | if not os.path.isdir(gen_dir):
45 | os.mkdir(gen_dir)
46 |
47 | generate_and_run(sim, simulator="jNeuroML", target_dir=gen_dir)
48 |
--------------------------------------------------------------------------------
/neuromllite/test/test_utils.py:
--------------------------------------------------------------------------------
1 | from neuromllite import *
2 | from neuromllite.utils import *
3 |
4 | from modelspec.utils import _val_info
5 | from modelspec.utils import evaluate
6 |
7 | import numpy as np
8 |
9 | from test_base import get_example_network, get_example_simulation
10 |
11 | try:
12 | import unittest2 as unittest
13 | except ImportError:
14 | import unittest
15 |
16 |
17 | class TestUtils(unittest.TestCase):
18 | def test_pops_vs_cell_indices(self):
19 | from neuromllite.utils import get_pops_vs_cell_indices_seg_ids
20 |
21 | network = get_example_network()
22 | sim = get_example_simulation()
23 | sim.record_traces = {}
24 | sim.record_spikes = {}
25 | sim.record_rates = {}
26 |
27 | for recordSpec in [sim.record_traces, sim.record_spikes, sim.record_rates]:
28 | print("Testing...")
29 | recordSpec["all"] = "*"
30 | pvi = get_pops_vs_cell_indices_seg_ids(recordSpec, network)
31 | print("Record spec: %s evaluates as %s" % (recordSpec, pvi))
32 |
33 | for pop in network.populations:
34 | assert pop.size == len(pvi[pop.id])
35 |
36 | recordSpec = {"pop1": "*"}
37 | pvi = get_pops_vs_cell_indices_seg_ids(recordSpec, network)
38 | print("Record spec: %s evaluates as %s" % (recordSpec, pvi))
39 |
40 | for pop in network.populations:
41 | if pop.id in pvi:
42 | assert len(pvi[pop.id]) == (pop.size if pop.id == "pop1" else 0)
43 |
44 | recordSpec = {"pop1": 0, "pop0": 3}
45 | pvi = get_pops_vs_cell_indices_seg_ids(recordSpec, network)
46 | print("Record spec: %s evaluates as %s" % (recordSpec, pvi))
47 |
48 | for pop in network.populations:
49 | if pop.id in pvi:
50 | assert (
51 | len(pvi[pop.id]) == 1
52 | and recordSpec[pop.id] == list(pvi[pop.id].keys())[0]
53 | )
54 |
55 | recordSpec = {"pop1": "0:3", "pop0": "0:[3]"}
56 | pvi = get_pops_vs_cell_indices_seg_ids(recordSpec, network)
57 | print("Record spec: %s evaluates as %s" % (recordSpec, pvi))
58 |
59 | for pop in network.populations:
60 | if pop.id in pvi:
61 | print(pvi[pop.id].values())
62 | assert (
63 | len(pvi[pop.id]) == 1
64 | and list(pvi[pop.id].keys())[0] == 0
65 | and list(pvi[pop.id].values())[0][0] == 3
66 | )
67 |
68 | recordSpec = {"pop1": [0, 2], "pop0": list(range(4))}
69 | pvi = get_pops_vs_cell_indices_seg_ids(recordSpec, network)
70 |
71 | print("Record spec: %s evaluates as %s" % (recordSpec, pvi))
72 | for pop in network.populations:
73 | if pop.id in pvi:
74 | assert len(pvi[pop.id]) == len(recordSpec[pop.id])
75 |
76 | return True
77 |
78 |
79 | if __name__ == "__main__":
80 | tu = TestUtils()
81 |
--------------------------------------------------------------------------------
/regenerateAndTest.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -ex
3 |
4 | # pytest
5 | cd neuromllite/test
6 | pytest -v
7 | cd -
8 |
9 |
10 | # test example in multiple simulators
11 | cd examples
12 |
13 | rm -rf *dat *nml LEMS* x86_64 *mod *hoc
14 |
15 | echo
16 | echo "**** Running Example 1 ****"
17 | python Example1.py
18 |
19 | echo
20 | echo "**** Running Example 2 ****"
21 | python Example2.py
22 | python Example2.py -nml
23 |
24 | echo
25 | echo "**** Running Example 3 ****"
26 | python Example3.py
27 | python Example3.py -netpyne
28 | python Example3.py -jnmlnrn
29 | python Example3.py -jnmlnetpyne
30 | python Example3.py -eden
31 |
32 | echo
33 | echo "**** Running Example 4 ****"
34 | python Example4.py
35 | python Example4.py -netpyne
36 | if [[ "$CI" != "true" ]]; then
37 | python Example4.py -pynnnest
38 | python Example4.py -pynnnrn
39 | fi
40 | #python Example4.py -pynnbrian # Not supported in python 3...
41 | python Example4.py -jnmlnetpyne
42 | python Example4.py -jnmlnrn
43 | python Example4.py -jnml
44 | python Example4.py -sonata
45 |
46 | echo
47 | echo "**** Running Example 5 ****"
48 |
49 | if [[ "$CI" != "true" ]]; then
50 | python Example5.py
51 | fi
52 | #python Example5.py -netpyne # Takes 2-3 mins
53 |
54 | echo
55 | echo "**** Running Example 6 ****"
56 | python Example6.py
57 | python Example6.py -nml
58 | python Example6.py -nml -noinputs
59 |
60 | echo
61 | echo "**** Running Example 7 ****"
62 | python Example7.py
63 | python Example7.py -jnmlnrn
64 | python Example7.py -jnml
65 | if [[ "$CI" != "true" ]]; then
66 | python Example7.py -pynnnest
67 | python Example7.py -pynnnrn
68 | fi
69 |
70 | echo
71 | echo "**** Running Example 8 ****"
72 | python Example8.py
73 | #python Example8.py -jnmlnrn
74 | #python Example8.py -jnml
75 |
76 | jnml -validate *nml # All until now should be valid...
77 |
78 | echo
79 | echo "**** Running Example 9 ****"
80 | python Example9.py
81 | python Example9.py -jnml
82 |
83 |
84 | echo
85 | echo "**** Running Example 10 ****"
86 | python Example10.py
87 | python Example10.py -jnml
88 | python Example10.py -mdf
89 |
90 | echo
91 | echo "**** Running Example 11 ****"
92 | python Example11.py
93 | python Example11.py -jnml
94 |
95 | echo
96 | echo "**** Running Example 12 ****"
97 | python Example12.py
98 | python Example12.py -jnmlnrn
99 |
100 | echo
101 | echo "**** Running Arbor Example ****"
102 | cd arbor
103 | python ArborExample.py
104 | python ArborExample.py -arbor
105 |
106 |
107 | echo
108 | echo "** All generated and tested! **"
109 |
110 | cd ../../docs
111 | python generate.py
112 |
113 | cd ..
114 |
--------------------------------------------------------------------------------
/requirements-extra.txt:
--------------------------------------------------------------------------------
1 | pyNN
2 | bmtk
3 | matplotlib
4 | PyQt5
5 | pyneuroml
6 | pyelectro
7 | neuron
8 | h5py
9 | graphviz
10 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | version = ""
4 | for aline in open("neuromllite/__init__.py"):
5 | if "__version__ =" in aline:
6 | version = aline.split('"')[1]
7 |
8 | setup(
9 | name="neuromllite",
10 | version=version,
11 | author="Padraig Gleeson",
12 | author_email="p.gleeson@gmail.com",
13 | packages=["neuromllite", "neuromllite.sweep", "neuromllite.gui"],
14 | entry_points={
15 | "console_scripts": ["nmllite-ui = neuromllite.gui.NMLliteUI:main"]
16 | },
17 | url="https://github.com/NeuroML/NeuroMLlite",
18 | license="LICENSE.lesser",
19 | description="A common JSON/YAML based format for compact network specification, closely tied to NeuroML v2",
20 | long_description=open("README.md").read(),
21 | long_description_content_type="text/markdown",
22 | install_requires=[
23 | "libNeuroML>=0.5.1",
24 | "pyyaml",
25 | "numpy<2.0.0",
26 | "tables",
27 | "h5py",
28 | "modelspec>=0.2.6",
29 | "ppft"
30 | ],
31 | classifiers=[
32 | "Intended Audience :: Science/Research",
33 | "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
34 | "Natural Language :: English",
35 | "Operating System :: OS Independent",
36 | "Programming Language :: Python :: 3.7",
37 | "Programming Language :: Python :: 3.8",
38 | "Programming Language :: Python :: 3.9",
39 | "Programming Language :: Python :: 3.10",
40 | "Programming Language :: Python :: 3.11",
41 | "Topic :: Scientific/Engineering",
42 | ],
43 | )
44 |
--------------------------------------------------------------------------------