-
-
-
diff --git a/docs/autodocs/source/_templates/version.html b/docs/autodocs/source/_templates/version.html
deleted file mode 100644
index 458e7e026..000000000
--- a/docs/autodocs/source/_templates/version.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-4.3.2
\ No newline at end of file
diff --git a/docs/autodocs/source/ad_tutorials.rst b/docs/autodocs/source/ad_tutorials.rst
index ebd161002..4a0232ddc 100644
--- a/docs/autodocs/source/ad_tutorials.rst
+++ b/docs/autodocs/source/ad_tutorials.rst
@@ -3,6 +3,14 @@ Additional Tutorials
These tutorials cover in more detail advanced or specialized topics that may be of interest to users.
+.. toctree::
+ :maxdepth: 2
+ :titlesonly:
+
+ Cell placement: Functions for spatially distributing units
+ Accessing synapse models in NEST to model dynamic synapses
+ Creating spike trains with refractory periods
+ Replaying disconnected simulations in BioNet
diff --git a/docs/autodocs/source/aibs_sphinx/theme.conf b/docs/autodocs/source/aibs_sphinx/theme.conf
index 5fa5685f7..1e93ee12f 100644
--- a/docs/autodocs/source/aibs_sphinx/theme.conf
+++ b/docs/autodocs/source/aibs_sphinx/theme.conf
@@ -1,5 +1,4 @@
# see http://sphinx-doc.org/templating.html
[theme]
inherit = basic
-stylesheet = aibs_sphinx.css
-
+stylesheet = aibs_sphinx.css
\ No newline at end of file
diff --git a/docs/autodocs/source/bionet.rst b/docs/autodocs/source/bionet.rst
index 295d21580..ce2167fcb 100644
--- a/docs/autodocs/source/bionet.rst
+++ b/docs/autodocs/source/bionet.rst
@@ -1,18 +1,5 @@
-######
BioNet
-######
-
-******
-Basics
-******
-
-
-
-
-
-
-
-
+======
.. figure:: _static/images/bmtk_architecture_bionet_highlight.jpg
:scale: 40%
diff --git a/docs/autodocs/source/builder.rst b/docs/autodocs/source/builder.rst
index 2cb503e9a..a5f31d286 100644
--- a/docs/autodocs/source/builder.rst
+++ b/docs/autodocs/source/builder.rst
@@ -1,5 +1,5 @@
-Building brain network models with BMTK Network Builder
-=======================================================
+The Network Builder
+===================
.. figure:: _static/images/bmtk_architecture_builder_highlight.jpg
:scale: 40%
diff --git a/docs/autodocs/source/conf.py b/docs/autodocs/source/conf.py
index 879554eb1..a20bbeb73 100644
--- a/docs/autodocs/source/conf.py
+++ b/docs/autodocs/source/conf.py
@@ -41,13 +41,12 @@
'numpydoc',
'sphinx.ext.autosummary',
'nbsphinx',
- 'IPython.sphinxext.ipython_console_highlighting',
- 'sphinx_design'
+ 'IPython.sphinxext.ipython_console_highlighting'
]
# Add any paths that contain templates here, relative to this directory.
-# templates_path = ['_templates', 'aibs_sphinx/templates']
-templates_path = ['_templates']
+#templates_path = ['_templates', 'aibs_sphinx/templates']
+templates_path = ['aibs_sphinx/templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
@@ -101,41 +100,10 @@
# a list of builtin themes.
#
# html_theme = 'alabaster'
-# html_theme = 'pydata'
-
-html_css_files = [
- 'custom.css',
-]
html_theme_path = ['.']
-# html_theme = 'aibs_sphinx'
+html_theme = 'aibs_sphinx'
# html_theme = 'alabaster'
-html_theme = 'pydata_sphinx_theme'
-html_logo = "_static/images/allen-logo.svg"
-html_theme_options = {
- "show_prev_next": False, # Do not show the prev & next buttons at the bottom of the page
- "header_links_before_dropdown": 8, # By default pyshinx will only show 5 items in navbar then a "more" dropdown. Increase num of items to show all top pages
- "logo": {
- "link": "https://alleninstitute.org/",
- }
-}
-
-
-html_sidebars = {
- # '**': ["sbt-sidebar-nav.html"]
- # '**': ['custom_sidebar.html', 'localtoc.html', 'searchbox.html'],
- # '**': ['user_guide'],
- # "simulators_guide": ["user_guide.html"],
- "news_and_events": [],
- "contact_us": [],
-}
-
-# html_sidebars = {
-# '**': [
-# 'globaltoc.html',
-# # 'searchbox.html'
-# ],
-# }
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -146,28 +114,23 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-# html_static_path = ['_static', 'aibs_sphinx/static']
-html_static_path = ['_static']
+html_static_path = ['_static', 'aibs_sphinx/static']
html_extra_path = ['../.nojekyll']
-# html_theme_options = {
-# # "sidebarwidth": "300",
-# "navbar_align": "left",
-# }
+html_theme_options = {
+ "sidebarwidth": "300"
+}
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
-# html_sidebars = {
-# # '**': [
-# # 'globaltoc.html',
-# # 'searchbox.html'
-# # ],
-# # "simulators_guide": []
-# }
-
-
+html_sidebars = {
+ '**': [
+ 'globaltoc.html',
+ 'searchbox.html'
+ ]
+}
# -- Options for HTMLHelp output ------------------------------------------
diff --git a/docs/autodocs/source/contact_us.rst b/docs/autodocs/source/contact_us.rst
deleted file mode 100644
index 77b462c74..000000000
--- a/docs/autodocs/source/contact_us.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-##########
-Contact Us
-##########
\ No newline at end of file
diff --git a/docs/autodocs/source/developers_guide.rst b/docs/autodocs/source/developers_guide.rst
deleted file mode 100644
index 88f329760..000000000
--- a/docs/autodocs/source/developers_guide.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-##############
-For Developers
-##############
\ No newline at end of file
diff --git a/docs/autodocs/source/documentation.rst b/docs/autodocs/source/documentation.rst
deleted file mode 100644
index 8f8483095..000000000
--- a/docs/autodocs/source/documentation.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-.. toctree
- :hidden:
-
- installation
-
- user_guide
\ No newline at end of file
diff --git a/docs/autodocs/source/example_bionetwork/config.bionet.json b/docs/autodocs/source/example_bionetwork/config.bionet.json
deleted file mode 100644
index 5eb875b27..000000000
--- a/docs/autodocs/source/example_bionetwork/config.bionet.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{
- "manifest": {
- "$BASE_DIR": "/local1/workspace/bmtk/docs/autodocs/source/example_bionetwork",
- "$OUTPUT_DIR": "$BASE_DIR/output",
- "$NETWORK_DIR": "$BASE_DIR/network",
- "$COMPONENTS_DIR": "$BASE_DIR/components"
- },
- "target_simulator": "NEURON",
- "run": {
- "tstart": 0.0,
- "tstop": 1000.0,
- "dt": null,
- "dL": 20.0,
- "spike_threshold": -15.0,
- "nsteps_block": 5000
- },
- "conditions": {
- "celsius": 34.0,
- "v_init": -80.0
- },
- "components": {
- "mechanisms_dir": "$COMPONENTS_DIR/mechanisms",
- "synaptic_models_dir": "$COMPONENTS_DIR/synaptic_models",
- "biophysical_neuron_models_dir": "$COMPONENTS_DIR/biophysical_neuron_models",
- "morphologies_dir": "$COMPONENTS_DIR/morphologies",
- "point_neuron_models_dir": "$COMPONENTS_DIR/point_neuron_models",
- "templates_dir": "$COMPONENTS_DIR/templates",
- "filter_models_dir": "$COMPONENTS_DIR/filter_models"
- },
- "output": {
- "log_file": "log.txt",
- "output_dir": "$OUTPUT_DIR",
- "spikes_file": "spikes.h5"
- },
- "reports": {},
- "networks": {
- "nodes": [
- {
- "node_types_file": "$NETWORK_DIR/external_node_types.csv",
- "nodes_file": "$NETWORK_DIR/external_nodes.h5"
- },
- {
- "node_types_file": "$NETWORK_DIR/internal_node_types.csv",
- "nodes_file": "$NETWORK_DIR/internal_nodes.h5"
- }
- ],
- "edges": [
- {
- "edge_types_file": "$NETWORK_DIR/external_internal_edge_types.csv",
- "edges_file": "$NETWORK_DIR/external_internal_edges.h5"
- },
- {
- "edge_types_file": "$NETWORK_DIR/internal_internal_edge_types.csv",
- "edges_file": "$NETWORK_DIR/internal_internal_edges.h5"
- }
- ],
- "gap_juncs": []
- }
-}
\ No newline at end of file
diff --git a/docs/autodocs/source/example_bionetwork/network/external_internal_edge_types.csv b/docs/autodocs/source/example_bionetwork/network/external_internal_edge_types.csv
deleted file mode 100644
index 386f631b7..000000000
--- a/docs/autodocs/source/example_bionetwork/network/external_internal_edge_types.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-edge_type_id target_query source_query delay dynamics_params model_template
-100 ei=='e'&model_type=='biophysical' * 2.0 AMPA_ExcToExc.json Exp2Syn
-101 ei=='i'&model_type=='biophysical' * 2.0 AMPA_ExcToInh.json Exp2Syn
-102 model_type=='point_neuron' * 2.0 instantaneousExc.json NULL
diff --git a/docs/autodocs/source/example_bionetwork/network/external_internal_edges.h5 b/docs/autodocs/source/example_bionetwork/network/external_internal_edges.h5
deleted file mode 100644
index 131f0a216..000000000
Binary files a/docs/autodocs/source/example_bionetwork/network/external_internal_edges.h5 and /dev/null differ
diff --git a/docs/autodocs/source/example_bionetwork/network/external_node_types.csv b/docs/autodocs/source/example_bionetwork/network/external_node_types.csv
deleted file mode 100644
index 07b459334..000000000
--- a/docs/autodocs/source/example_bionetwork/network/external_node_types.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-node_type_id model_type ei
-100 virtual e
diff --git a/docs/autodocs/source/example_bionetwork/network/external_nodes.h5 b/docs/autodocs/source/example_bionetwork/network/external_nodes.h5
deleted file mode 100644
index ae2fd890d..000000000
Binary files a/docs/autodocs/source/example_bionetwork/network/external_nodes.h5 and /dev/null differ
diff --git a/docs/autodocs/source/example_bionetwork/network/internal_internal_edge_types.csv b/docs/autodocs/source/example_bionetwork/network/internal_internal_edge_types.csv
deleted file mode 100644
index d912021a7..000000000
--- a/docs/autodocs/source/example_bionetwork/network/internal_internal_edge_types.csv
+++ /dev/null
@@ -1,7 +0,0 @@
-edge_type_id target_query source_query delay dynamics_params model_template
-100 ei=='e'&model_type=='biophysical' ei=='e' 2.0 AMPA_ExcToExc.json Exp2Syn
-101 ei=='i'&model_type=='biophysical' ei=='e' 2.0 AMPA_ExcToInh.json Exp2Syn
-102 ei=='e'&model_type=='biophysical' ei=='i' 2.0 GABA_InhToExc.json Exp2Syn
-103 ei=='i'&model_type=='biophysical' ei=='i' 2.0 GABA_InhToInh.json Exp2Syn
-104 model_type=='point_neuron' ei=='e' 2.0 instantaneousExc.json NULL
-105 model_type=='point_neuron' ei=='i' 2.0 instantaneousInh.json NULL
diff --git a/docs/autodocs/source/example_bionetwork/network/internal_internal_edges.h5 b/docs/autodocs/source/example_bionetwork/network/internal_internal_edges.h5
deleted file mode 100644
index 75f583fce..000000000
Binary files a/docs/autodocs/source/example_bionetwork/network/internal_internal_edges.h5 and /dev/null differ
diff --git a/docs/autodocs/source/example_bionetwork/network/internal_node_types.csv b/docs/autodocs/source/example_bionetwork/network/internal_node_types.csv
deleted file mode 100644
index a31890f5c..000000000
--- a/docs/autodocs/source/example_bionetwork/network/internal_node_types.csv
+++ /dev/null
@@ -1,8 +0,0 @@
-node_type_id model_name morphology ei model_processing dynamics_params model_type model_template
-100 Scnn1a Scnn1a_473845048_m.swc e aibs_perisomatic NULL biophysical nml:Cell_472363762.cell.nml
-101 Rorb Rorb_325404214_m.swc e aibs_perisomatic NULL biophysical nml:Cell_473863510.cell.nml
-102 Nr5a1 Nr5a1_471087815_m.swc e aibs_perisomatic NULL biophysical nml:Cell_473863035.cell.nml
-103 PV1 Pvalb_470522102_m.swc i aibs_perisomatic NULL biophysical nml:Cell_472912177.cell.nml
-104 PV2 Pvalb_469628681_m.swc i aibs_perisomatic NULL biophysical nml:Cell_473862421.cell.nml
-105 LIF_exc NULL e NULL IntFire1_exc_1.json point_neuron nrn:IntFire1
-106 LIF_inh NULL i NULL IntFire1_inh_1.json point_neuron nrn:IntFire1
diff --git a/docs/autodocs/source/example_bionetwork/network/internal_nodes.h5 b/docs/autodocs/source/example_bionetwork/network/internal_nodes.h5
deleted file mode 100644
index 218b31fe8..000000000
Binary files a/docs/autodocs/source/example_bionetwork/network/internal_nodes.h5 and /dev/null differ
diff --git a/docs/autodocs/source/example_bionetwork/run_bionet.py b/docs/autodocs/source/example_bionetwork/run_bionet.py
deleted file mode 100644
index 844ddde76..000000000
--- a/docs/autodocs/source/example_bionetwork/run_bionet.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-import os, sys
-from bmtk.simulator import bionet
-
-
-def run(config_file):
- conf = bionet.Config.from_json(config_file, validate=True)
- conf.build_env()
-
- graph = bionet.BioNetwork.from_config(conf)
- sim = bionet.BioSimulator.from_config(conf, network=graph)
- sim.run()
- bionet.nrn.quit_execution()
-
-
-if __name__ == '__main__':
- if __file__ != sys.argv[-1]:
- run(sys.argv[-1])
- else:
- run('/local1/workspace/bmtk/docs/autodocs/source/example_bionetwork/config.bionet.json')
diff --git a/docs/autodocs/source/index.rst b/docs/autodocs/source/index.rst
index 758f0a9e3..aa9f60398 100644
--- a/docs/autodocs/source/index.rst
+++ b/docs/autodocs/source/index.rst
@@ -1,57 +1,113 @@
-############################################
-Welcome to the Brain Modeling Toolkit (BMTK)
-############################################
+.. Brain Modeling Toolkit documentation master file, created by
+ sphinx-quickstart on Tue Sep 26 10:33:33 2017.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
-.. toctree::
- :hidden:
-
- About BMTK
+Welcome to the Brain Modeling Toolkit
+=====================================
.. toctree::
- :maxdepth: 1
+ :maxdepth: 2
+ :titlesonly:
:hidden:
- About BMTK
- news_and_events
- contact_us
- installation
- user_guide
+ Installation Guide
+ Building Networks
+ simulators
+ analyzer
tutorials
- developers_guide
-
-
-
-.. card:: News and Events
- :img-background: _static/images/blue_banner.jpg
- :class-card: sd-text-black
-
- **Come and See us at SFN** :
-
- Find us at `here `_
+ ad_tutorials
+ Example Networks
+ Github Profile
+ workshop
+ registration
+ contributors
+ how_to_cite
+ Source Documentation
-#######################################
-About the Brain Modeling Toolkit (BMTK)
-#######################################
+The Brain Modeling Toolkit (BMTK) is a python-based software package for building, simulating and analyzing large-scale
+neural network models. It supports the building and simulation of models of varying levels-of-resolution; from
+multi-compartment biophysically detailed networks, to point-neuron models, to filter-based models, and even
+population-level firing rate models.
-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi est metus, blandit et metus eu, porttitor rutrum enim. Ut vel maximus massa, ac blandit purus. Duis lacus tellus, congue in velit in, tincidunt ornare ante. Proin aliquet aliquam dui nec gravida. Cras pellentesque elit in gravida fringilla. Donec eleifend dapibus faucibus. Cras posuere dapibus nibh, vitae ornare libero tincidunt nec.
.. figure:: _static/images/levels_of_resolution_noml.png
:scale: 70%
-Sed finibus arcu mi. Vestibulum tincidunt volutpat ligula imperdiet vulputate. Nam quis gravida neque. Quisque fringilla dui et orci aliquet, nec finibus velit egestas. In interdum ligula massa, quis suscipit tortor cursus id. Suspendisse tempus risus id massa dapibus, vel viverra dolor lobortis. Donec porttitor ex mauris, sit amet sodales ex fringilla ac. Vestibulum congue vel risus sit amet eleifend.
+The BMTK is not itself a simulator and will utilize existing simulators, like NEURON and NEST, to run different types of
+models. What BMTK does provide:
+
+* A unified inteferce across different simulators, so that modelers can work with and study their own network models
+ across different simulators without having to learn how to use each tool.
+* An easy way to setup and initialize network simulations with little-to-no programming necessary
+* Automatic integration of parallelization when running on HPC.
+* Extra built-in features which the native simulators may not support out-of-the-box.
+
+The BMTK was developed and is supported at the `Allen Institute for Brain Science `_ and
+released under a BSD 3-clause license. We encourage others to use the BMTK for their own research, and suggestions and
+contributions to the BMTK are welcome.
+
+The latest release, previous releases, and current development can be found at ``_
+
+
+The BMTK Workflow and architecture
+----------------------------------
+BMTK can readily scale to run models of single neurons, and even single compartments, and for all different types of
+neuronal networks. However BMTK was designed for very-large, highly optimized mammalian cortical network models.
+Generating the connectivity matrix could take hours or even days to complete. Plus once we had the base-line model we
+wanted to run against a large variety of conditions and stimuli, so that we could directly compare with existing in-vivo
+recordings (see Allen Brain Observatory).
+
+.. figure:: _static/images/bmtk_workflow.jpg
+ :scale: 100%
+
+Unlike other simulators, BMTK separates the process of building, simulating, and analyzing the results. First a fully
+instantiated base-line version of the model is built and saved to a file so each time a simulation is ran it takes only
+a small fraction of the time to instantiate the simulation. Results are also automatically saved to a disk. BMTK and
+the format it uses (SONATA, see below) makes it easy to dynamically adjust cell and synaptic parameters so that multiple
+iterations of a simulation be done as fast as possible
+
+As such BMTK can be broken into three major components:
+
+* The Network Builder [:py:mod:`bmtk.builder`] - Used to build network models
+* The Simulation Engines [:py:mod:`bmtk.simulator`] - Interfaces for simulating the network
+* Analysis and Visualization Tools [:py:mod:`bmtk.analyzer`] - Python functions for analyzing and visualizing the
+ network and simulation results
.. figure:: _static/images/bmtk_architecture.jpg
:scale: 45%
-Nulla auctor, nibh id accumsan vehicula, leo nisl vestibulum ex, eget dapibus neque lacus sit amet nibh. Mauris rutrum lectus ex, a interdum erat molestie sit amet. Donec ornare cursus tortor molestie gravida. Quisque vitae nisl a eros convallis imperdiet porta eu nulla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum non pharetra tellus, id hendrerit mauris. Aenean eget ipsum semper magna posuere lacinia nec ut urna. Curabitur auctor, erat at vehicula luctus, lectus lacus pharetra urna, id interdum elit enim ut nisi. Pellentesque nulla risus, sagittis ut leo ac, pellentesque ullamcorper ante.
+The components can be as one workflow or separately by themselves. BMTK utilizes the SONATA Data format (see next section)
+to allow sharing of large-scale network data. As such, it is possible to use the Network Builder to build the model but
+another tool to run the model. Or if another model has been built by someone else and saved in SONATA format BMTK will
+be able to simulate it.
+
+
+SONATA
+------
+SONATA is a multi-institutional developed standardized, cross-platform data format for storing large scale networks and
+simulation results. The BMTK utilizes SONATA when building and simulating networks, so much of what is being described
+in the documentation and tutorials will be based on SONATA. For more information see the
+`SONATA github page `_.
+
+
+VND
+---
+`Visual Neuronal Dynamics `_ is a software package for 3D visualization of neuronal network models. VND can be used to check and inspect models, such as those created by BMTK, as well as to visualize the activity output. Images and movies made in VND can also be used to showcase or schematize models for presentations and publications. VND is developed in a collaboration between researchers at the University of Illinois at Urbana-Champaign and Allen Institute.
+
+
+References
+----------
+See the paper about BMTK: `link `_.
+
+For information on how to cite BMTK, please see: `link `_.
+
+
-################
Acknowledgements
-################
+----------------
We wish to thank the Allen Institute for Brain Science founder, Paul G. Allen, for their vision, encouragement, and support.
-
-Grant Number
\ No newline at end of file
diff --git a/docs/autodocs/source/installation.rst b/docs/autodocs/source/installation.rst
index 283250ce6..452b9691a 100644
--- a/docs/autodocs/source/installation.rst
+++ b/docs/autodocs/source/installation.rst
@@ -1,6 +1,5 @@
-##################
-Installation Guide
-##################
+Installing the BMTK
+===================
**Users are encouraged to register** `here `_
**to receive updates and other communications, but registration is not required to use the package.**
diff --git a/docs/autodocs/source/news_and_events.rst b/docs/autodocs/source/news_and_events.rst
deleted file mode 100644
index 8b55711bc..000000000
--- a/docs/autodocs/source/news_and_events.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-###############
-News and Events
-###############
-
diff --git a/docs/autodocs/source/simulators.rst b/docs/autodocs/source/simulators.rst
index cf6364cad..9908f67bc 100644
--- a/docs/autodocs/source/simulators.rst
+++ b/docs/autodocs/source/simulators.rst
@@ -1,5 +1,3 @@
-:orphan:
-
Simulation Engines
==================
.. toctree::
diff --git a/docs/autodocs/source/simulators_guide.rst b/docs/autodocs/source/simulators_guide.rst
deleted file mode 100644
index 0cd3ca8f1..000000000
--- a/docs/autodocs/source/simulators_guide.rst
+++ /dev/null
@@ -1,1342 +0,0 @@
-#####################################
-Running Network Simulations with BMTK
-#####################################
-
-In this section we will show how to use BMTK and SONATA to run simulation(s) on a brain network model.
-
-Unlike other neural simulation tools which will create and simulate a network in one script, BMTK workflow design is to
-to split up these two parts of the process. So before we can run a simulation we must first procure a network model
-(typically store using `SONATA circuit format `_).
-We can either download an existing model, or alternatively use a tool like the BMTK Network Builder to create one from
-scratch.
-
-Once we have our network to run simulations on, we typically need to complete the following steps:
-
-1. **Setup the enviornment**. For most networks, this entails downloading or creating any auxiliary files required for
- network instantiation (morphology files, cell parameters, mod files, etc) and inputs (spikes, electrodes).
-
-2. **Setup the SONATA configuration file(s)**. We use a json based SONATA configuration file to instruct BMTK how to
- instiante a network (including location of circuits and any auxiliary files), run-time parameters, and what stimuli
- to use as input and what variables to record for our output. We can create a SONATA config file from scratch, or
- download and edit an existing one using any prefered text-editor.
-
-3. **Run the simulation(s)**. The majority of BMTK simulation can be fully defined in the SONATA config (although for
- advanced users BMTK allows extensive customization using Python). Thus we just need to execute an pre-generated
- python script with the above SONATA config file and let our simulation finish.
-
-Once the simulation has completed it will automatically generate and save the results as specified in the SONATA
-configuration file. Although BMTK can run network models of different levels-of-resolutions, this is abstracted from
-the user will use the appropiate underlying simulator library, eg. **Simulation Engine**, depending on the cell models.
-So no matter if the network is ran using NEURON, NEST, DiPDE, or any other engine; the expected inputs and outputs
-are the same format
-
-.. figure:: _static/images/bmtk-workflow-v2-simulation-highlighted.png
- :scale: 60%
-
-
-The rest of this guide will go through each of the above steps in detail.
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- To help make the concepts for concrete we will also be referencing the **example** network simulation found
- `here `_.
- This is a biophysically detailed network containing a 450 cells with a mixture of both multicompartment biophysically
- detailed cells with parameters and morphologies download form the Allen Cell Database, surrounded by a ring of
- point integrate and fire neuron. For the main configuration will feedforward synaptic stimuli emerging from virtual
- cells firing at a randomized rate.
-
-
-1. Setting up the Environment
-=============================
-
-First step is to download and/or create neccesary files required to instiate network and execute the simulation. At
-miniumum we require the SONATA circuit file(s), simulation configuration, and a BMTK run script. But depending on the
-model and simulation we may also need the following:
-
-* template files used to build the cell or synapse models (*Hoc Templates*, *NeuroML*, *NESTML*)
-* cell and synaptic dynamics attribute values,
-* cell morphologies (*SWC*, *Neuralucdia*),
-* simulation input and stimuli (*spike-trains*, *current wave-form*, *movie and auditory files*),
-* NEURON .mod files.
-
-We can put these files wherever we want as long as they are accessable during simulation execution. Although best
-practices is to put them inside a single directory with the following structure.
-
-.. figure:: _static/images/bmtk_sim_env.2024.png
- :scale: 40%
-
-
-BMTK includes the `create_environment `_ tool that can help new users generate an environmental directory from
-scratch. Another option we recommend, especially if running simulations on an already existing model, is to download an
-existing simulation environment and make changes as necessary.
-
-
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- When creating the `BioNet example`_ we used the `build_network.py` python script to build and save the network model
- into the **network/** sub-directory (see `BMTK Builder Guide`_ for more information on that process). With the network
- built we then used the following command to generate baseline strucutre plus `config.simulation.json` configuration and
- the `run_bionet.py` script used to execute the simulation:
-
-
- .. code:: bash
-
- $ python -m bmtk.utils.create_environment \
- --config-file config.iclamp.json \
- --overwrite \
- --network-dir network \
- --output-dir output_iclamp \
- --tstop 3000.0 \
- --dt 0.1 \
- --report-vars v \
- --iclamp 0.150,500,2000 \
- --compile-mechanisms \
- bionet .
-
- This script will create the **components/** directory to place any auxiliary files for network instiation, but unless
- explicity defined, the corresponding subfolders will be empty. In particular out model's various cell-types require
- SWC morphology and dynamics parameters files that can be downloaded from the Allen Cell Types Database, renamed and
- placed into their corresponding folders.
-
- .. figure:: _static/images/ctdb2bmtk_model_download.png
- :scale: 80%
-
- For simulation input our network will be stimulated by feed-forwar pre-generated spike-trains that will save into
- the **inputs/** folder using the `create_inputs.py` script
-
- .. code:: bash
-
- $ python create_inputs.py
-
-
-
-
-2. Setting up Sonata Config file(s)
-===================================
-
-The primary interface thorugh which most users will run a simulation is through the **SONATA confiugration** file(s).
-Each simulation will have its own json config file that can be opened and modified by any text editor, allowing users
-to readily adjust simulation, network, input, and output of any given simulation without any required coding or having
-to learn the API for a specific simulator.
-
-The config file is segmented into sections for the various aspects of running a full simulation. We will go into depth
-of each section below.
-
-
-"run"
-^^^^^
-
-The "run" section allows us set run-time parameters for the simulation. At minimum this includes
-the **tstop** parameter that determines the time step (in ms) when the simulation will stop. Other options, including
-**tstart** (time at start of simulation, ms) and **dt** (time step interval, ms), may or may not be optional or even
-used depending on the simulation.
-
-The following attributes can be used by BMTK to set to time course of a given simulation.
-
-.. dropdown:: "run" simulation attributes
- :open:
-
- .. list-table::
- :header-rows: 1
-
- * - name
- - description
- - required
- * - tstart
- - Start time of simulation in ms (default 0.0)
- - False
- * - tstop
- - Stop time of simulation (default 0.0)
- - True
- * - dt
- - The time step of a simulation; ms
- - True
- * - dL
- - For networks with morphological models, is a global parameter used to indicate to the simulator the maximum length
- of each compartmental segment, in microns. If "dL" parameter is explicitly defined for a specific cell or cell-type,
- then BMTK will default to the more grainular option.
- - False
- * - spike_threshold
- - For networks using conductance based model, is a global paramter to indicate the threshold in mV at which a cell undergoes
- an action potential. Will not apply to integrate-and-fire type models. Value will be overwritten for any cell or cell-type
- that explicity defines "spike_threshold" parameter in network attribute.
- - False
- * - nsteps_block
- - Used by certain input/report modules to indicate time processing of timestep in blocks of every n time-steps. In particular
- for recording of spike-trains, membrane variables, or extraceullar potential; tells the simulation when to flush data
- out of memory and onto the disk.
- - False
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- The "run" section for our example simulation contains the following:
-
- .. code:: json
-
-
- "run": {
- "tstop": 3000.0,
- "dt": 0.1,
- "dL": 20.0,
- "spike_threshold": -15,
- "nsteps_block": 5000
- },
-
- This will tell our simulation to run for 3,000 ms (3 seconds) with 0.1 ms timesteps, block process all the data every
- 5000 steps (eg. 500 ms). The "dL" makes sure that for morphologically detailed cells each branch segment is no more
- than 20 microns in lenght. And to record a spike when a cell reaches threshold of -15.0 mV.
-
-
-
-
-"inputs"
-^^^^^^^^
-
-The "inputs" section of the SONATA config file is used to specify stimlus to apply to the network. It will contain one
-or more independent stimuli blocks of the format
-
-.. code:: json
-
- {
- "": {
- "input_type": "",
- "module": "",
- "node_set": "",
- "param1": "",
- "param2": "",
- "paramN": "value"
-
- }
- }
-
-* The **** is the name of the stimuli block, users can choose whatever name they want to identify a specific stimuli.
-* **input_type** specifies the nature of the stimlulation, eg. if cell activity is being generated by synaptic events, current clamps, etc. The available options will depend of the resolution of the model and the type of cell models used. The options will depend on the input_type
-* **module** is used to indicate the format of the stimuli. For example in trying to stimulate network with virtual spiking activity file, the individual spike times may be stored in a SONATA spikes file, a NWB file, a CSV, etc.
-* **node_set** is a dictionary or reference used to select which cells to apply current stimuli to.
-* Most stimuli will have one or more **parameters** options, depending on the input_type + module.
-
-
-The following is a list of inputs types supported in BMTK. For further detail about how to implement a given input in
-a simulation please see the respective documentation.
-
-.. dropdown:: Available "input_type" stimuli
- :open:
-
- .. list-table::
- :header-rows: 1
-
- * - input_type
- - module
- - description
- - available
- * - current_clamp
- - | IClamp
- | csv
- | nwb
- | allen
- - Directly injects current into one or more cells in the network. Shape of stimulus may be a simple block, or user may specify more advanced current form using a csv, nwb, or hdf5 file.
- - BioNet, PointNet
- * - spikes
- - | sonata
- | csv
- | ecephys_probe
- | function
- - Reads a table of spike train events into one or more virtual cells in the network.
- - BioNet, PointNet
- * - voltage_clamp
- - SEClamp
- - Applys a voltage clamping block onto one or more cells.
- - BioNet
- * - extracellular
- - | xstim
- | comsol
- - Provides an extracellular potential to alter the membrane comptanence of a selected set of cells in the network. Can replicate extracellular stimulation coming from an electrode (xstim) or field can pre-generated (comsol).
- - BioNet
- * - replay
- - replay
- - Allows users "replay" the recurrent activity of a previous recorded simulation with a selected subset of cells and/or connections. Useful for when looking at summative properties of contributions in large networks.
- - BioNet, PointNet
- * - syn_activity
- - | syn_activity
- | function
- | list
- - Provides spontaneous firing of a select subset of recurrently connected synapses. Users may pre-specify firing times or let bmtk generate them randomly.
- - BioNet
- * - movie
- - movie
- - Plays a movie (eg a numpy matrix file) onto the receptive field of a grid of neurons to mimic LGN reaction.
- - FilterNet
- * - movie
- - | grating
- | full_field_flash
- | spontaneous
- | looming
- - Automatically generate a movie of one of a number of well-known experimental stimuli and use it to play onto the receptive field of a set of neurons.
- - FilterNet
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- The "inputs" section for our 400 cell example looks like the following:
-
- .. code:: json
-
- "inputs": {
- "external_spikes": {
- "input_type": "spikes",
- "module": "sonata",
- "input_file": "./inputs/external_spikes.h5",
- "node_set": "external-cell"
- }
- }
-
- The "external_spikes" block tells BMTK that it will stimulate our network using SONATA spike-trains. The input spike
- trains were generated by running
-
- .. code:: bash
-
- $ python create_inputs.py
-
- which will create a SONATA spike-trains file in **inputs/external_spikes.h5**. The node-set parameter, explained
- below, tells the module which cells we want to assign our spike-trains.
-
-
-
-"components"
-^^^^^^^^^^^^
-
-The "components" section is used to indicate the paths to various auxiliary files required for instantiating our
-simulation; like morphology swc files, NEURON mod files, NESTML or NeuroML cell models. BMTK will use these paths to
-find neccesary files required to instantiate the network for simulation.
-
-the different directories are defined using the format
-
-.. code:: json
-
- "components": {
- "": "/path/to/components/dir/"
- }
-
-
-
-.. dropdown:: Recognized "components" directories
- :open:
-
- .. list-table::
- :header-rows: 1
-
- * - name
- - description
- - utilized by
- * - biophysical_neuron_models_dir
- - Directory containing files for instantiation of biophysically detailed models. Typically containing json
- cell model files downloaded from the Allen Cell-Types Database.
- - **dynamics_params**
- * - point_neuron_models_dir
- - Directory containing files for instantiation of point-neuron models. Typically json parameter files, or with
- PointNet may be model files downloaded from the Allen Cell-Types Database to instantiate optimized "glif"
- models.
- - **dynamics_params**
- * - filters_dir
- - Directory containing parameters files for instiating models used by FilterNet.
- - **dynamics_params**
- * - morphologies_dir
- - Directory containing any morphological reconstruction files (ex. swc, neuralucdia).
- - **morphology**
- * - synpatic_models_dir
- - Directory containing files for specific synaptic parameters.
- - **dynamics_params**
- * - mechanisms_dir
- - Directory containing any morphological reconstruction files (ex. swc, neuralucdia)
- -
- * - templates_dir
- - Contains NEURON Hoc template files or NeuroML cell or synapse models.
- - **model_template**
-
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- For our example network,
-
- .. code:: json
-
- "components": {
- "morphologies_dir": "$COMPONENT_DIR/morphologies",
- "synaptic_models_dir": "$COMPONENT_DIR/synaptic_models",
- "mechanisms_dir":"$COMPONENT_DIR/mechanisms",
- "biophysical_neuron_models_dir": "$COMPONENT_DIR/biophysical_neuron_templates/nml",
- "point_neuron_models_dir": "$COMPONENT_DIR/point_neuron_templates"
- }
-
-
-
-
-"output" and "reports"
-^^^^^^^^^^^^^^^^^^^^^^
-
-The "outputs" section is where we define basic information about where and how to we will save any simulation results. Most importantly is the
-**output_dir** attribute that defines default location of any files generated during the simulation. We also define the **spikes_file** attribute
-which is the file name (relative to the **output_dir** path) where BMTK will save any non-virtual spikes generated during the simulation in a
-SONATA hdf5 formated file.
-
-.. dropdown:: "output" attributes
- :open:
-
- .. list-table::
- :header-rows: 1
-
- * - name
- - description
- - default value
- * - output_dir
- - Path of output folder where simulation results and temp files will be saved in. BMTK will create the folder if it does not already
- exists. If value is not an absolute path, then will assume to be relative to location where BMTK simulation is being executed (eg `os.getcwd()`)
- - `.`
- * - overwrite_output_dir
- - If set to True then BMTK will overwrite any previous output files stored in **output_dir**. If set to False and files exists before run time then
- BMTK may throw an error and exit simulation.
- - True
- * - log_file
- - Name of file where any BMTK messages will be written to. If the file name has a relative path then file will be saved underneath **output_dir**.
- If value is set to `false` or `none` then no log file will be created during simulation.
- - `none`
- * - log_level
- - Level of logging information that will be included during simulation (`DEBUG`, `INFO`, `WARNING`, `ERROR`).
- - `DEBUG`
- * - log_format
- - The format string for how BMTK will save loggnig messages. It uses the `LogRecord attributes `_ options
- set by python's logging module.
- - `%(asctime)s [%(levelname)s] %(message)s`
- * - log_to_console
- - If `true` then will also log output to default **standard output (stdout)**, if `false` then will disable **stdout** logging. Note: if both **log_to_console** and
- **log_file** are set to `false` then BMTK will not log any simulation messages (simulation will still run and produce results).
- - `true`
- * - quiet_simulator
- - Can be set `true` to turn off any extermporaneous messages generated by the underlying simulator (NEURON, NEST, DiPDE)
- - `false`.
- * - spikes_file
- - location of hdf5 file where spikes will be saved. If location is a relative path file will be saved under the **output_dir** directory. If set to `none` then no
- SONATA spikes file will be created during simulation.
- - `none`
- * - spikes_file_csv
- - Location of space separated csv file where spikes will be saved. If location is a relative path file will be saved under the **output_dir** directory. If set to `none`
- then no csv spikes file will be created during simulation.
- - `none`
- * - sort_by
- -
- - `none`
-
-By default BMTK will save non-virtual spike-trains of the simulation. BMTK is also capable of saving many other cell, synapse, and even network wide parameters
-and attributes during a simulation, like membrane potential, Calcium concentration, or local field potentials. To instruct BMTK to record a extra parameter we
-must add one or more blocks to the "reports" subsection to config, which will have the following format:
-
-.. code:: json
-
- "reports": {
- "": {
- "module": "",
- "input_type": "",
- "cells": "",
- "file_name": "",
- "param1": "",
- "param2": ""
-
- }
- }
-
-The **** is a user-given identifier for a different report, each different block assumed to be independent of each other.
-
-* **module** is used to indicate the report type and nature.
-* **variable_name** indicates the specific variable in the simulation being recorded.
-* **cells** is a node-set to indicate which cells are being targeted in recording.
-* **file_name** is an *optional* path for where module will save output. If path is relative then it will assume to be saved under the **output_dir**
- path specified in "output" block. If not specified, then BMTK will attempt to infer the correct path (usually under **output_dir/.h5**
-
-Different modules may also have different required/optional parameters. The following is a list of BMTK supported "report" modules:
-
-
-.. dropdown:: Available "report" modules
- :open:
-
- .. list-table::
- :header-rows: 1
-
- * - module
- - description
- - available
- * - membrane_report
- - Used to record a contingous time trace of a cell ion or parameter, like membrane voltage or calcium concentration
- - BioNet, PointNet
- * - syn_report
- - Used to record a contingous time trace of variables for the synapses of a given set of cells
- - BioNet, PointNet
- * - syn_weight
- - Record of synaptic weight changes for a given set of cells.
- - BioNet, PointNet
- * - extracellular
- - Used to record a contingous time trace of variables for the synapses of a given set of cells
- - BioNet
-
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- For our 400 cell example we will want to have all the output generated by BMTK to be written to the **output/** folder,
- including the logging which will be written to **output/log.txt**. It will also create two spike-train files on the
- (non-virtual) cells recorded from all cells during the simulation, **output/spikes.h5** and **output/spikes.csv**. Both
- files will contain the exact same data, only one will be stored in a SONATA hdf5 file and another in a space-separated
- csv file.
-
- .. code:: json
-
- "output":{
- "output_dir": "./output",
- "overwrite_output_dir": true,
- "log_file": "log.txt",
- "spikes_file": "spikes.h5",
- "spikes_file_csv": "spikes.csv"
- }
-
- Besides recording spikes, we also want to record the local field potentials of all cells plus the membrane voltage
- traces for a select number of cells, which we do through the following two blocks in the "reports" section,
- respectively.
-
- .. code:: json
-
- "reports": {
- "vm_report": {
- "cells": "scnn1a-bio-cells",
- "variable_name": "v",
- "module": "membrane_report",
- "file_name": "vm_report.h5",
- "sections": "all"
- },
-
- "ecp": {
- "cells": "biophysical-cells",
- "variable_name": "v",
- "module": "extracellular",
- "electrode_positions": "./components/recXelectrodes/linear_electrode.csv",
- "file_name": "ecp.h5",
- "electrode_channels": "all",
- "contributions_dir": "ecp_contributions"
- }
- }
-
- The "vm_report" block will instruct BMTK to record membrane traces from all "scnn1a" type cells and save them in the
- SONATA formated **output/vm_report.h5** file. If you wanted to record membrane potential from other cell types you
- have the option of either modifying the "vm_report" block to save the membrane traces of other cells to the same
- output/vm_report.h5 file. Or alternatively create another block that will independently save a different set of cell
- voltage traces into a different file.
-
- The "ecp" block will record the local field potential (LFP) and save it to the file **output/ecp.h5**.
-
- Note that recording LFP and membrane voltages at every time step can signficantly decrease simulation time and their
- resulting output files can become very large. So if you only care about spikes and firing rates then you can either
- remove these "report" blocks from the configuration file, or set attribute `"enabled: false`
-
-
-"networks"
-^^^^^^^^^^
-
-The "networks" section contains path to any SONATA network files, cells and connections, used during our simulation. By
-default it is divided into two subsection, one containing any nodes (cells) files used during the simulation, and the
-other containing and edges (synapses) files used, with the following format
-
-.. code:: json
-
- "networks": {
- "nodes": [
- {
- "nodes_file": "",
- "node_types_file": ""
- }
- ],
- "edges": [
- {
- "edges_file": "",
- "edge_types_file": ""
- }
- ]
- }
-
-BMTK will go through each nodes.h5 and edges.h5 file and import all nodes and edges population found, respectively If a
-file contains both nodes and edges populations then said file must be added to the "nodes" list and the "edges" list to
-include the total network.
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- The main set of cells we want to simulate our example is saved under file name **intenral_nodes.h5**, with the
- recurrent connections between the cells are saved in the file **internal_internal_edges.h5**. If we wanted to run
- simulation on these and only these cells either with no input, spontaneous input, or some form of clamp we specify
- using the "inputs" section; then we could do the following in our configuration file
-
- .. code:: json
-
- "networks": {
- "nodes": [
- {
- "nodes_file": "$NETWORK_DIR/internal_nodes.h5",
- "node_types_file": "$NETWORK_DIR/internal_node_types.csv"
- }
- ],
-
- "edges": [
- {
- "edges_file": "$NETWORK_DIR/internal_internal_edges.h5",
- "edge_types_file": "$NETWORK_DIR/internal_internal_edge_types.csv"
- }
- ]
- }
-
- But in this example we explicity want to synaptically stimulate the "internal", which we can do using a separate
- population of virtual cells we name "external". The **external_nodes.h5** contain a cell population of virtual cells
- while the **external_internal_edges.h5** file is used to synaptically connect the "external" virtual cells to our
- "internal" cells in a pre-determined manner.
-
- .. code:: json
-
- "networks": {
- "nodes": [
- {
- "nodes_file": "$NETWORK_DIR/internal_nodes.h5",
- "node_types_file": "$NETWORK_DIR/internal_node_types.csv"
- },
- {
- "nodes_file": "$NETWORK_DIR/external_nodes.h5",
- "node_types_file": "$NETWORK_DIR/external_node_types.csv"
- }
- ],
-
- "edges": [
- {
- "edges_file": "$NETWORK_DIR/internal_internal_edges.h5",
- "edge_types_file": "$NETWORK_DIR/internal_internal_edge_types.csv"
- },
- {
- "edges_file": "$NETWORK_DIR/external_internal_edges.h5",
- "edge_types_file": "$NETWORK_DIR/external_internal_edge_types.csv"
- }
- ]
- }
-
- When BMTK runs it will create both the "internal" and "external" population of cells and generate all external -->
- internal and internal <--> internal synaptic connections. The "inputs" section of the configuration will assign
- firing patterns to the "external" cells creating stimuli to our network.
-
-
-"node_sets"
-^^^^^^^^^^^
-
-During a simulation we often want to apply an input or report to only a specific subset of cells. For example, we may
-want voltage traces from only pyramidal cells. We can do this can use the "node_sets" subsection to create subsets of
-our network model that can be referenced by the rest of the config
-
-.. code:: json
-
- "node_sets": {
- "": {
- "population": "cortical",
- "node_id": [100, 101, 103, 104]
- },
- "": {
- "model_type": "biophysical",
- "cell_description": "pyramidal",
- "cell_location": "L23"
- }
- },
-
- "reports": {
- "vm_report": {
- "module": "membrane_report",
- "variable_name": "v",
- "cells": "",
- ...
- },
-
- "inputs": {
- "iclamp_stimulus": {
- "input_type": "current_clamp",
- "module": "ICLAMP",
- "node_set": "",
- ...
- }
- }
-
-For ****, the node-set will tell BMTK to record from only those cells with with specified node ids. If you
-don't know the exact node_ids, or if there are too many to feasibly write down, you can filter by cell attributes. In
-**** we are directing BMTK to apply current clamp to all biophysical pyramidal cells found in L23.
-
-Users also have the option of embedding the "node-set" query parameters directly. The below example will apply inputs
-to the exact same subset of cells as done in the above.
-
-.. code:: json
-
- "inputs": {
- "iclamp_stimulus": {
- "input_type": "current_clamp",
- "module": "ICLAMP",
- "node_set": {
- "model_type": "biophysical",
- "cell_description": "pyramidal",
- "cell_location": "L23"
- },
- ...
- }
- }
-
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- For our 400 cell example we need 3 different node-steps
-
- .. code:: json
-
- "node_sets": {
- "external-cells": {
- "population": "external",
- "model_type": "virtual"
- },
- "bio-cells": {
- "model_type": "biophysical"
- }
- "scnn1a-bio-cells": {
- "population": "internal",
- "model_name": "scnn1a"
- }
-
- }
-
- * The **external-cells** set will contain all cells in our "external" population of virtual cells that will
- be used in the "inputs" so that spike trains are not applied to the "internal" cells.
-
- * The **bio-cells** set is required by "ecp" recording block. Our model contains both morpholigcally detailed
- and point-neuron models, but only the former can be used to record the local field potential. Passing "node_set":
- "bio-cells" to the ecp module will make sure the module doesn't try (and crash) trying to record from cell models
- that don't produce extracellular potential.
-
- * The **scnn1a-bio-cells** set is used by the "vm_report" recording block so that it knows only to record voltage
- traces that have their "model_name" attribute set to value "scnn1a". Although we could record "v" varaible from
- all cells, doing so would increase simulation time and generate a lot of extra data we don't need.
-
-
-"manifest" **[OPTIONAL]**
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The "manifest" section lets users define variables and special directives to be used throughout the rest of the
-configuration file. SONATA uses the standard "$" posix prefix for differentiating a constant versus a varaible.
-
-For example, we use the manifest in the following manner to create custom variable "$NETWORK_DIR"
-
-.. code:: json
-
- "manifest": {
- "$NETWORK_DIR": "$/path/to/my/models/network/"
- },
-
- "networks": {
- "nodes": [
- {
- "nodes_file": "$NETWORK_DIR/network1_nodes.h5",
- "node_types_file": "$NETWORK_DIR/network1_types.csv"
- },
- {
- "nodes_file": "$NETWORK_DIR/network2_nodes.h5",
- "node_types_file": "$NETWORK_DIR/network2_types.csv"
- }
- ]
- }
-
-This way if we need to change the location of our network files or copy it to a new drive we can simply update the
-manifest in one single place.
-
-
-Splitting the config **[OPTIONAL]**
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Sometimes it is convient to think of the SONATA configuration as two parts; the *simulation* section with the "run",
-"inputs", and "reports" section, and the *network* section with the "networks" and "components" sections. BMTK allows
-configuration file to be split up along these lines, first by splitting them up into respective json files, for
-example called *./path/to/config.simulation.json* and *./path/to/config.network.json* (you can use whatever name and
-path you choose). Then to import these two sections into one file just use the following:
-
-.. code:: json
-
- {
- "simulation": "./path/to/config.simulation.json",
- "network": "./path/to/config.network.json"
- }
-
-And when BMTK runs it will locate and combine both configuration into one json dictionary.
-
-If you want to reduce the number of files you can also import a separate "network" config into a "simulation" config
-(or vice-versa).
-
-.. code:: json
-
- {
- "run": {...},
- "inputs": {...},
- "reports": {...},
-
- "network": "./path/to/config.network.json"
- }
-
-
-This can be useful if you have multiple simulations on the same network with different input regimens. It insures that
-each simulation configs all use the same model. And if you have to update the model and/or component paths then you
-only need to do so once.
-
-
-
-3. Run the Simulation
-=====================
-
-Now that we have all the files we need to instantiate the model, along with a configuration that specifies the run-time,
-inputs, and reporting conditions of our simulation; we can go ahead an execute the simulation using the following
-command:
-
-
-.. code:: bash
-
- $ python run_simulation.py config.simulation.json
-
-
-If you have a machine or cluster with multiple cores BMTK will automatically parallize the simulation. The only change
-the user will have to make is to change the way python is called to comply with your setup.
-
-.. code:: bash
-
- $ mpirun -np N python run_simulation.py config.simulation.json
-
-
-The simulation can also be executed inside Jupyter notebook/lab if prefered. Just copy the contents of the run_script
-(see below) into the cell and execute as you would a normal notebook.
-
-There are numerious other options for ways to execute BMTK; including using:
-
-* **Docker Image**: The BMTK Docker image allows users to run BMTK through a virtual machine containing a pre-generated
- environment will BMTK and all dependencies installed. You can use `docker run` command to run a simulation on your
- machine, or even spin up a Jupyter lab server (that will include BMTK tutorials and examples).
-
- See `Using Docker with BMTK` guide for more information.
-
-* **Neuroscience Gateway (NSG)**
-
-* **singularity**
-
-run script
-^^^^^^^^^^
-
-The for majority of use-cases users will not need to do any programming, as most simulation options can be set using
-the SONATA simulation configuration file. But BMTK does makes available for users to insert customized code and data
-into any simulation. To do so you will need to interface with and add to the default run_simulation script used to
-execute and simulate a network.
-
-If you want to modify the way BMTK executes, and/or run a BMTK simulation from a Jupyter cell or within another
-piece of code, use the code within the **run()** function . **note**: there is slight differences in the run script
-depending on the underlying "simulation engine" used, although they all follow the same structure.
-
-.. tab-set::
-
- .. tab-item:: BioNet
-
- .. code:: python
- :linenos:
-
- import sys
- from bmtk.simulator import bionet
-
- def run(config_path):
- config = bionet.Config.from_json(config_path)
- config.build_env()
-
- graph = bionet.BioNetwork.from_config(config)
- sim = bionet.BioSimulator.from_config(config, network=graph)
- sim.run()
-
- bionet.nrn.quit_execution()
-
- if __name__ == '__main__':
- run(sys.argv[-1])
-
- **description of run() function by lines #**
-
- 5. Loads in the **config.simulation.json** file into python a dictionary-like object, resolving any variables,
- paths, and directives.
-
- 6. Sets up logging and creates and validates any directories/files to be used for recording simulation output.
-
- 8. Initializes the network using the SONATA configuration file's "networks" section.
-
- 9. Initialize the simulation.
-
- 10. Runs the simulation.
-
- 11. Because BioNet runs within a NEURON console, we must explicity exit() it.
-
-
- .. tab-item:: PointNet
-
- .. code:: python
- :linenos:
-
- import sys
- from bmtk.simulator import pointnet
-
- def run(config_path):
- config = pointnet.Config.from_json(config_path)
- config.build_env()
-
- network = pointnet.PointNetwork.from_config(config)
- sim = pointnet.PointSimulator.from_config(config, network)
- sim.run()
-
- if __name__ == '__main__':
- run(sys.argv[-1])
-
- **description of run() function by lines #**
-
- 5. Loads in the **config.simulation.json** file into python a dictionary-like object, resolving any variables,
- paths, and directives.
-
- 6. Sets up logging and creates and validates any directories/files to be used for recording simulation output.
-
- 8. Initializes the network using the SONATA configuration file's "networks" section.
-
- 9. Initialize the simulation.
-
- 10. Runs the simulation.
-
-
- .. tab-item:: FilterNet
-
- .. code:: python
- :linenos:
-
- import sys
- from bmtk.simulator import filternet
-
- def run(config_path):
- config = filternet.Config.from_json(config_path)
- config.build_env()
-
- net = filternet.FilterNetwork.from_config(config)
- sim = filternet.FilterSimulator.from_config(config, net)
- sim.run()
-
- if __name__ == '__main__':
- run(sys.argv[-1])
-
- **description of run() function by lines #**
-
- 5. Loads in the **config.simulation.json** file into python a dictionary-like object, resolving any variables,
- paths, and directives.
-
- 6. Sets up logging and creates and validates any directories/files to be used for recording simulation output.
-
- 8. Initializes the network using the SONATA configuration file's "networks" section.
-
- 9. Initialize the simulation.
-
- 10. Runs the simulation.
-
-
- .. tab-item:: PopNet
-
- .. code:: python
- :linenos:
-
- import sys
- from bmtk.simulator import popnet
-
- def run(config_path):
- configure = popnet.config.from_json(config_path)
- configure.build_env()
-
- network = popnet.PopNetwork.from_config(configure)
- sim = popnet.PopSimulator.from_config(configure, network)
- sim.run()
-
- if __name__ == '__main__':
- run(sys.argv[-1])
-
-
- **description of run() function by lines #**
-
- 5. Loads in the **config.simulation.json** file into python a dictionary-like object, resolving any variables,
- paths, and directives.
-
- 6. Sets up logging and creates and validates any directories/files to be used for recording simulation output.
-
- 8. Initializes the network using the SONATA configuration file's "networks" section.
-
- 9. Initialize the simulation.
-
- 10. Runs the simulation.
-
-
-simulation results
-^^^^^^^^^^^^^^^^^^
-
-Depending on the complexity of the model and inputs and reports, a simulation may take anywhere between a few seconds
-to a few days to complete. By default, BMTK will automically save the any results and "reports" as set up in the
-SONATA config. Once completed and results are saved we can go ahead and analyze our results, which we go into Further
-details in the `NEST `_ section of the user guide.
-
-
-.. card:: example network
- :class-card: .user-guide-example sd-border-2
-
- We can go ahead and simply run our 400 cell network simulation using the **run_simulation.py** script found in our
- working folder.
-
- .. tab-set::
-
- .. tab-item:: single core
-
- The simplest way to run the simulation in a command line using a single core.
-
- .. code:: bash
-
- $ python run_simulation.py config.simulation.json
-
- .. tab-item:: multiple-cores using MPI
-
- If you have MPI (Message Passing interface) installed on you machine use the following to split the simulation up
- between *N* cores (replace *N* with the number of cores/ranks).
-
- .. code:: bash
-
- $ mpirun -np N nrniv -mpi -python run_simulation.py config.simulation.json
-
-
- .. tab-item:: In a jupyter lab cell
-
- To run the simulation inside jupyter notebook, add the following lines to a cell and execute:
-
- .. code:: python
-
- from bmtk.simulator import bionet
- config = bionet.Config.from_json("config.simulation.json")
- config.build_env()
- graph = bionet.BioNetwork.from_config(config)
- sim = bionet.BioSimulator.from_config(config, network=graph)
- sim.run()
-
- .. tab-item:: Docker
-
- If you have docker client installed on your machine, you can use the following to execute the simulation
-
- .. code:: bash
-
- $ docker run alleninstitute/bmtk -v local/path:/home/shared/workspace python run_simulation.py config.simulation.json
-
-
-
- When it starts the first thing it will do is create (or overwrite) the **output/** folder along with
- **output/log.txt** log file that we can use to keep track of progress of the simulation. Although the network is
- small enough to run on any modern computer or laptop, it will still take anywhere 5 to 30 minutes to complete
- depending on the hardware.
-
- Once completed it will create the following files:
-
- * **output/spikes.h5** and **output/spikes.csv** contain spike trains for all non-virtual cells. (Both files have the
- same data but in different file formats).
-
- * **output/vm_reports.h5** contains membrane traces of selected cells in SONATA formated hdf5 file.
-
- * **ouput/ecp.h5** contains local field potential (LFP) recordings from all the biophysically detailed cells, as
- recorded from a simulated electroded, and saved in SONATA hdf5 format.
-
-
-
-Simulation Engines
-==================
-
-As mentioned before, BMTK is capable of simulating a wide variety of different network models across multiple levels
-of cell resolutions. To do this BMTK utilizes different backend simulator libraries, or "Simulation Engines", depending
-on the nature of the model (ie. compartmental models, point models, filter models, rates based models, etc).
-
-BMTK standarizes and abstracts the simulation process so that users can easily switch between models types with having
-to learn a whole new API, however there are still important differences between the varying Simulation Engines. Some
-may excpect certain parameters and attributes (e.g. compartmental models will expect cells to have a defined morphology).
-Similarily some may contain extra features and capabilities.
-
-To learn more about the requirements and capabilities for the model(s) of your attention please see their respective
-user guides.
-
-
-.. grid:: 1 1 4 4
- :gutter: 1
-
- .. grid-item-card::
- :link: builder_guide
- :img-bottom: _static/images/bionet_rep_morpholgy_network.png
-
- **BioNet** - Multicompartment Biophysicaly Detailed Simulation
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- *BioNet* utilizes the NEURON simulator tool to allow simulation of multicompartment cell models. It can
- encorporate a cells full morphology into model and the simulation; allowing you to simulate apects including ion
- flow, intracellular and extracellular membrane comptanence, and synaptic location and density.
-
- .. grid-item-card::
- :link: analzer
- :img-bottom: _static/images/pointnet_figure.png
-
- **PointNet** - point-neuron based models
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- *PointNet* utlizes the NEST simulator for simulation of networks of point-neuron models, including Allen's
- glif models, izhieckcih models, hodgkin-huxley, and many more. Most PointNet network models run faster with
- less overhead than BioNet and is a good starting point.
-
- .. grid-item-card::
- :link: analzer
- :img-bottom: _static/images/filternet_rep_filter_models.png
-
- **FilterNet** - Receptive Field Filter Models
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- *FilterNet* allows modelers to play visual or auditory onto a receptive field model to generate realistic
- firing rates and spike trains based on the spatio-temporal properties of the stimuli. The results of which can
- be used by compartmental and point models as realistic stimuli.
-
-
- .. grid-item-card::
- :link: analzer
- :img-bottom: _static/images/dipde_figure.png
-
- **PopNet** - Population Wide Firing Rates Models
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- *PopNet* - Use's Allen's DiPDE solver to look at population level firing rate dyanmics.
-
-
-
-Additional Resources and Guides
-===============================
-
-Exectuion and Run Options
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The following guides and tutorials for setting up and running simulations across a wide variety of different
-computing environments.
-
-.. grid:: 1 1 4 5
- :gutter: 1
-
- .. grid-item-card:: Running BMTK on the on HPC.
- :link: builder_guide
-
- Guides, tips and tricks for running bmtk using high-performance computing resources with Message Passing
- Interface (MPI). Including tips for installing MPI, running on slurm, and using singularity container.
-
- .. grid-item-card:: Running BMTK on the Neuroscience Gateway (NSG)
- :link: builder_guide
-
- The Neuroscience Gateway is a tool for neuroscientists to access HPC resources for free. Guide shows how to
- use BMTK with the NSG web and API interface to build networks and run large simulations.
-
- .. grid-item-card:: Cybershuttle
- :link: builder_guide
-
- Comming Soon.
-
- .. grid-item-card:: Using BMTK Images and Applications
- :link: builder_guide
-
- How to setup and run BMTK using pre-built applications and images; including with Docker, AppImage, and Snap.
-
- .. grid-item-card:: Parallel and Serial Simulations
- :link: builder_guide
-
- How to run multiple simulations in parallel and/or serial; including grid searching, evolutionary, and gradient
- search methods for optimizing network and simulations.
-
-
-Inputs
-^^^^^^
-
-BMTK supports using a wide variety of inputs and stimulus when running a simulation. Please see the following guides
-for built-in "inputs" types and how to use them in your simulations.
-
-.. grid:: 2 2 5 5
- :gutter: 1
-
- .. grid-item-card:: Spiking inputs
- :link: builder_guide
-
- Demonstrates various ways which one can drive network using synaptic spikes (eg. action potentials) including:
-
- * Using PoissonSpikesGenerater to pre-generate spike trains for network stimulus.
-
- * Dynamically insert custom spike train files and functions into a simulation.
-
- * Inject in-vivo spike-train recordings into a simulation with Dandi and NWB 2.0.
-
- .. grid-item-card:: Current clamp
- :link: builder_guide
-
- Inject positve or negative current into one or more cells.
-
- * Using simple block stimuli, or complex current wave-form injection from a list, file or function.
-
- * Inject in-virtro current-clamp sweeps using Allen Cell-Types experiments.
-
- * How to create optogenetic like polarization and depolarization of selected cells.
-
- .. grid-item-card:: Voltage clamps
- :link: builder_guide
-
- Insert single or mulitelectrode voltage clamping into one or more cells in a network.
-
- .. grid-item-card:: extracellular stimulation
- :link: builder_guide
-
- Simulate the placement of an extracellular electrode into a network that can change polarization of the
- cell membranes. Create custom wave forms, or use COMSOL to grainular alter extracellular field.
-
- .. grid-item-card:: spontaneous activity
- :link: builder_guide
-
- Allows you to selectively induce spontaneous synaptic activity between a subset of cells. Users can choose
- which synapses to target based on the synaptic, pre- or post-synaptic cell atrributes. The activity can be
- random or predetermined from a list or function.
-
- .. grid-item-card:: replaying previous simulation activity
- :link: builder_guide
-
- Users can take a subset of the results from a previously generated network results and inject them into a
- current simulation. Can target specific subsets of cells or synapses to replay. Useful in isolating activity
- of a subset or motif of cells within a much larger network.
-
- .. grid-item-card:: Visual stimuli
- :link: builder_guide
-
- Play an image, movie, drifting-grating, or one of a number of visual stimuli onto a network to see how cells
- encode sensory information into firing rates and spike trains.
-
- .. grid-item-card:: Auditory stimuli.
- :link: builder_guide
-
- Convert auditory wave files into firing rates and spike trains.
-
-
-Reports
-^^^^^^^
-
-Modelers can choose which variables and changes in a simulation to record using the "reports" section. See following
-guides for further information how to implement such output.
-
-.. grid:: 2 2 5 5
- :gutter: 1
-
- .. grid-item-card:: Spike Train Recording
- :link: builder_guide
-
- Advanced options for recording spikes (eg. action potential) events during the simulation.
-
- .. grid-item-card:: Membrane and Ion Recording
- :link: builder_guide
-
- Recording a contingous time-trace for one or more cell variable, such as membrane voltage, calcium
- concentration, or any number of other ion or channel variables.
-
- .. grid-item-card:: Synapse Recording
- :link: builder_guide
-
- Allows users to gather changes in synaptic strength and other variables over the time course of a simualtion.
-
- .. grid-item-card:: Firing Rates
- :link: builder_guide
-
- Recording individual cell or even population level wide firing rate changes over teh course of a simulation.
-
- .. grid-item-card:: Local Field Potentials (LFP)
- :link: builder_guide
-
- Allows modelers to simulate the injection of multi-channel electrodes into a network to record dynamics of the
- extraceullar electrical field. Allows modelers to see the full field, or even the contribution of single cells.
- Also capable of generate curren source densities (CSD) maps to see the location of major sources and sinks
- within a network.
-
-
-Useful Options and Scripts
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. grid:: 2 2 5 5
- :gutter: 1
-
- .. grid-item-card:: environmental setup (create_environment) script.
- :link: builder_guide
-
- A useful tool for generating simulation environments from the ground up.
-
- .. grid-item-card:: Network and Simulation validation
- :link: builder_guide
-
- Tools and recommendation for checking on a network and setup before running a simulation. Includes tools and
- guides for fetching network statistics and how one can compare multiple models.
-
- .. grid-item-card:: Advanced Configuration options.
- :link: builder_guide
-
- Advance options and directives for the SONATA simulation configuration file.
-
- .. grid-item-card:: Advanced Population Querying and Filtering
- :link: builder_guide
-
- Advance options and tricks for selecting sub populations (or "node_sets").
-
-
-Advanced Features
-^^^^^^^^^^^^^^^^^
-
-.. grid:: 2 2 4 4
- :gutter: 2
-
- .. grid-item-card::
- :link: builder_guide
- :class-header: sd-d-flex-column sd-align-minor-center
- :class-body: sd-card-body-custom
-
- Customized Modules for Simulation
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- Allows users to create modules to alter the setup, control flow, and output of a given simulation.
-
- .. grid-item-card::
- :link: builder_guide
- :class-header: sd-d-flex-column sd-align-minor-center
-
- Custom Cell Models and Instantiation.
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- How to create and alter cell models using Python, NEURON or NEST.
-
- .. grid-item-card::
- :link: builder_guide
- :class-header: sd-d-flex-row sd-align-minor-center
-
- Adjust Synaptic Weights
- ^^^^^^^^^^^^^^^^^^^^^^^
-
- Update synaptic weights before a simulation.
-
- .. grid-item-card::
- :link: builder_guide
- :class-header: sd-d-flex-row sd-align-minor-center
-
- Custom Synaptic Models
- ^^^^^^^^^^^^^^^^^^^^^^
-
- Update and alter synaptic models, their parameters and/or instantiation.
\ No newline at end of file
diff --git a/docs/autodocs/source/tutorials.rst b/docs/autodocs/source/tutorials.rst
index 8901aafc1..05e01b5e7 100644
--- a/docs/autodocs/source/tutorials.rst
+++ b/docs/autodocs/source/tutorials.rst
@@ -1,107 +1,63 @@
-######################
-Tutorials and Examples
-######################
+Main Tutorials
+==============
.. toctree::
- :hidden:
- :maxdepth: 1
-
- Builder: Using the Network Builder
- BioNet: Single cell with current injection
- BioNet: Single with with synaptic input
- BioNet: Multiple Nodes with single cell-type
- BioNet: Heterogeneous network
- PointNet: Point-neuron modeling
- FilterNet: Full-field flashing movie
- Auditory FilterNet: Generating stimuli from auditory input
- PopNet: Population-based firing rate models
+ :maxdepth: 2
+ :titlesonly:
+ Builder: Using the Network Builder
+ BioNet: Single cell with current injection
+ BioNet: Single with with synaptic input
+ BioNet: Multiple Nodes with single cell-type
+ BioNet: Heterogeneous network
+ PointNet: Point-neuron modeling
+ FilterNet: Full-field flashing movie
+ Auditory FilterNet: Generating stimuli from auditory input
+ PopNet: Population-based firing rate models
+
-
+Also check out the tutorial series from our `annual workshop `_.
-Basic Usage
-===========
+Prerequisites
+-------------
-.. grid:: 1 1 3 3
- :gutter: 1
+Running with Docker
++++++++++++++++++++
- .. grid-item-card:: Overview
+If you have Docker installed on your machine then there is a Docker Image with all the prerequists installed - including
+a jupyter notebook server with the tutorials installed. Just run:
- A high level look at the BMTK workflow, SONATA data-format, and how to
- create an environment for network modeling and simulation
+.. code:: bash
+ $ docker pull alleninstitute/bmtk
+ $ docker run -v /path/to/local/directory:/home/shared/workspace -p 8888:8888 alleninstitute/bmtk jupyter
- .. grid-item-card:: Building Networks models with the BMTK NetworkBuilder
- :link: tutorial_NetworkBuilder_Intro.html
+and then open a browser to 127.0.0.1:8888/. The tutorials folder will contain the jupyter notebook tutorials for you to
+follow along and modify. However, if you want to save the work permentately make sure to save it in the workspace
+folder. The tutorials and examples folder will be deleted once the docker container has stopped.
- Using the BMTK NetworkBuilder to create SONATA based network models for use in simulation and analysis
+you can also use the Docker image to run bmtk build and run scripts. Just replace the python