Skip to content

Commit

Permalink
docs: Add section for analyze neuron results | update neuron parts of gs
Browse files Browse the repository at this point in the history
  • Loading branch information
filimarc committed Nov 14, 2024
1 parent f54ffa3 commit 3b547b2
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 122 deletions.
251 changes: 130 additions & 121 deletions docs/getting-started/data/Stellate.py
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
from arborize import define_model

definitionStellate = define_model({
"synapse_types" : {
"AMPA": {
"mechanism": "AMPA",
"parameters": {
"tau_facil": 10.8,
"tau_rec": 35.1,
"tau_1": 10,
"gmax": 2300,
"U": 0.15,
},
},
"NMDA": {
"mechanism": ("NMDA", "stellate"),
"parameters": {
"tau_facil": 5,
"tau_rec": 8,
"tau_1": 1,
"gmax": 10000,
"U": 0.15,
},
},
"GABA": {
"mechanism": "GABA",
"parameters": {
"tau_facil": 0,
"tau_rec": 38.7,
"tau_1": 1,
"gmaxA1": 3230,
"U": 0.42,
"Erev": -65,
definitionStellate = define_model(
{
"synapse_types": {
"AMPA": {
"mechanism": "AMPA",
"parameters": {
"tau_facil": 10.8,
"tau_rec": 35.1,
"tau_1": 10,
"gmax": 2300,
"U": 0.15,
},
},
},
},

"cable_types" : {
"soma": {
"cable": {"Ra": 110, "cm": 1},
"ions": {
"na": {"rev_pot": 60},
"k": {"rev_pot": -84},
"ca": {"rev_pot": 137.5},
"h": {"rev_pot": -34},
"NMDA": {
"mechanism": ("NMDA", "stellate"),
"parameters": {
"tau_facil": 5,
"tau_rec": 8,
"tau_1": 1,
"gmax": 10000,
"U": 0.15,
},
},
"mechanisms": {
"Leak": {"e": -52, "gmax": 3e-05},
"Nav1_1": {"gbar": 0.2},
"Cav3_2": {"gcabar": 0.00163912063769},
"Cav3_3": {"pcabar": 1.615552993e-05},
"Kir2_3": {"gkbar": 1.093425575e-05},
"Kv1_1": {"gbar": 0.00107430134923},
"Kv3_4": {"gkbar": 0.008},
"Kv4_3": {"gkbar": 0.00404228168138},
"Kca1_1": {"gbar": 0.00518036298671},
"Kca2_2": {"gkbar": 0.00054166094878},
"Cav2_1": {"pcabar": 0.0005},
"HCN1": {"gbar": 0.00058451678362},
"cdp5": {"TotalPump": 7e-09},
"GABA": {
"mechanism": "GABA",
"parameters": {
"tau_facil": 0,
"tau_rec": 38.7,
"tau_1": 1,
"gmaxA1": 3230,
"U": 0.42,
"Erev": -65,
},
},
},
"dendrites": {"cable": {}, "ions": {}, "mechanisms": {}},
"proximal_dendrites": {
"cable": {"Ra": 110, "cm": 1.5},
"ions": {"k": {"rev_pot": -84}, "ca": {"rev_pot": 137.5}},
"mechanisms": {
"Leak": {"e": -48, "gmax": 8e-06},
"Cav3_2": {"gcabar": 0.00070661092763},
"Cav3_3": {"pcabar": 1.526216781e-05},
"Kv1_1": {"gbar": 0.0090681056165},
"Kv4_3": {"gkbar": 0.0026420471354},
"Kca1_1": {"gbar": 0.00499205404769},
"Kca2_2": {"gkbar": 3.26194117e-06},
"Cav2_1": {"pcabar": 0.0008},
"cdp5": {"TotalPump": 1e-09},
"cable_types": {
"soma": {
"cable": {"Ra": 110, "cm": 1},
"ions": {
"na": {"rev_pot": 60},
"k": {"rev_pot": -84},
"ca": {"rev_pot": 137.5},
"h": {"rev_pot": -34},
},
"mechanisms": {
"Leak": {"e": -52, "gmax": 3e-05},
"Nav1_1": {"gbar": 0.2},
"Cav3_2": {"gcabar": 0.00163912063769},
"Cav3_3": {"pcabar": 1.615552993e-05},
"Kir2_3": {"gkbar": 1.093425575e-05},
"Kv1_1": {"gbar": 0.00107430134923},
"Kv3_4": {"gkbar": 0.008},
"Kv4_3": {"gkbar": 0.00404228168138},
"Kca1_1": {"gbar": 0.00518036298671},
"Kca2_2": {"gkbar": 0.00054166094878},
"Cav2_1": {"pcabar": 0.0005},
"HCN1": {"gbar": 0.00058451678362},
"cdp5": {"TotalPump": 7e-09},
},
},
"synapses": {
"AMPA": {
"dendrites": {"cable": {}, "ions": {}, "mechanisms": {}},
"proximal_dendrites": {
"cable": {"Ra": 110, "cm": 1.5},
"ions": {"k": {"rev_pot": -84}, "ca": {"rev_pot": 137.5}},
"mechanisms": {
"Leak": {"e": -48, "gmax": 8e-06},
"Cav3_2": {"gcabar": 0.00070661092763},
"Cav3_3": {"pcabar": 1.526216781e-05},
"Kv1_1": {"gbar": 0.0090681056165},
"Kv4_3": {"gkbar": 0.0026420471354},
"Kca1_1": {"gbar": 0.00499205404769},
"Kca2_2": {"gkbar": 3.26194117e-06},
"Cav2_1": {"pcabar": 0.0008},
"cdp5": {"TotalPump": 1e-09},
},
"synapses": {
"AMPA": {
"mechanism": "AMPA",
"attributes": {
"tau_facil": 10.8,
Expand All @@ -96,60 +96,68 @@
"U": 0.15,
},
},
},
},
},
"distal_dendrites": {
"cable": {"Ra": 110, "cm": 1.5},
"ions": {"k": {"rev_pot": -84}, "ca": {"rev_pot": 137.5}},
"mechanisms": {
"Leak": {"e": -48, "gmax": 8e-06},
"Kv1_1": {"gbar": 0.00237825442906},
"Kca1_1": {"gbar": 0.00226329455766},
"Kca2_2": {"gkbar": 1.079984416e-05},
"Cav2_1": {"pcabar": 0.00025},
"cdp5": {"TotalPump": 1e-09},
},
"synapses": {
"AMPA": {
"mechanism": "AMPA",
"attributes": {
"tau_facil": 10.8,
"tau_rec": 35.1,
"tau_1": 10,
"gmax": 2300,
"U": 0.15,
},
"distal_dendrites": {
"cable": {"Ra": 110, "cm": 1.5},
"ions": {"k": {"rev_pot": -84}, "ca": {"rev_pot": 137.5}},
"mechanisms": {
"Leak": {"e": -48, "gmax": 8e-06},
"Kv1_1": {"gbar": 0.00237825442906},
"Kca1_1": {"gbar": 0.00226329455766},
"Kca2_2": {"gkbar": 1.079984416e-05},
"Cav2_1": {"pcabar": 0.00025},
"cdp5": {"TotalPump": 1e-09},
},
"NMDA": {
"mechanism": ("NMDA", "stellate"),
"attributes": {
"tau_facil": 5,
"tau_rec": 8,
"tau_1": 1,
"gmax": 10000,
"U": 0.15,
"synapses": {
"AMPA": {
"mechanism": "AMPA",
"attributes": {
"tau_facil": 10.8,
"tau_rec": 35.1,
"tau_1": 10,
"gmax": 2300,
"U": 0.15,
},
},
"NMDA": {
"mechanism": ("NMDA", "stellate"),
"attributes": {
"tau_facil": 5,
"tau_rec": 8,
"tau_1": 1,
"gmax": 10000,
"U": 0.15,
},
},
},
},
},
"axon": {
"cable": {
"Ra": 110,
"cm": 1,
},
"ions": {"na": {"rev_pot": 60}, "k": {"rev_pot": -84}, "h": {"rev_pot": -34}},
"mechanisms": {
"Leak": {"e": -48, "gmax": 0.000008},
"Kv1_1": {"gbar": 0.00271359229578},
"Nav1_6": {"gbar": 0.00835931586458},
"Kv3_4": {"gkbar": 0.01153520393521},
"HCN1": {"gbar": 0.00070017344082},
"cdp5": {},
"axon": {
"cable": {
"Ra": 110,
"cm": 1,
},
"ions": {
"na": {"rev_pot": 60},
"k": {"rev_pot": -84},
"h": {"rev_pot": -34},
},
"mechanisms": {
"Leak": {"e": -48, "gmax": 0.000008},
"Kv1_1": {"gbar": 0.00271359229578},
"Nav1_6": {"gbar": 0.00835931586458},
"Kv3_4": {"gkbar": 0.01153520393521},
"HCN1": {"gbar": 0.00070017344082},
"cdp5": {},
},
},
},
"axon_initial_segment": {
"axon_initial_segment": {
"cable": {"Ra": 110, "cm": 1},
"ions": {"na": {"rev_pot": 60}, "k": {"rev_pot": -84}, "h": {"rev_pot": -34}},
"ions": {
"na": {"rev_pot": 60},
"k": {"rev_pot": -84},
"h": {"rev_pot": -34},
},
"mechanisms": {
"Leak": {"e": -48, "gmax": 8e-06},
"HCN1": {"gbar": 0.00099184971498},
Expand All @@ -160,8 +168,9 @@
"cdp5": {},
},
},
},
})
},
}
)

tagsSt = {
16: ["dendrites", "proximal_dendrites"],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/getting-started/data/vrecorder_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions docs/getting-started/simulations/analyze_analog_signals.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
.. _guide_analyze_analog:

########################################
Analyze multi-compartment neuron results
########################################

.. note::

This guide is a continuation of the
:doc:`Simulation guide <guide_neuron>`.

After a simulation, BSB will write its outcomes in ``.nio`` files. These files leverage the HDF5
(Hierarchical Data Format version 5) format, which is widely employed in scientific computing,
engineering, and data analysis. HDF5 files store data in groups (or blocks), in a dictionary
fashion, which allows for efficient management and organization of large datasets.

The content is read/written using the :doc:`Neo Python package <neo:index>`, a library designed
for handling electrophysiology data.

In our case, we have only one ``block`` of data since we only ran one simulation. We also have a
unique ``segment`` since all our data is recorded with the same time frame (see
:doc:`Neo docs <neo:read_and_analyze>` for more details).
Let's extract the simulation block data produced by your last simulation. First, load the content from
your ``simulation-results/NAME_OF_YOUR_NEO_FILE.nio`` file, use the following code:

.. literalinclude:: /../examples/tutorials/analyze_analog_results.py
:language: python
:lines: 1-7

If you followed the previous simulation example, the :guilabel:`analogsignals` attribute in the block
should contain a list of all measured signals: the membrane potential recorded by the
:guilabel:`vrecorder` device and the synapse current obtained from the :guilabel:`synapses_rec` device.

Each :class:`AnalogSignal <neo.core.AnalogSignal>` object contains information about the device name,
the sampling rate, and an array of the simulated measurement values.
Additional information is available through the annotations attribute.

.. literalinclude:: /../examples/tutorials/analyze_analog_results.py
:language: python
:lines: 10-49

This code generates one plot for each analog signal recorded, meaning one plot per device for each
cell or synapse recorded. The resulting figures are saved in the ``simulation-results`` folder.

Here are some example of the figures that are produced:

.. figure:: /getting-started/data/vrecorder_example.png
:figwidth: 90%

Example of the membrane potential recorded for the cell with 0 ID.

.. figure:: /getting-started/data/synapse_recorder_example.png
:figwidth: 90%

Example of the AMPA synapse current recoded for the cell with 2 ID.

.. rubric:: Next steps:

.. grid:: 1 1 1 2
:gutter: 1


.. grid-item-card:: :octicon:`tools;1em;sd-text-warning` Make custom components
:link: guide_components
:link-type: ref

Learn how to write your own components to e.g. place or connect cells.

.. grid-item-card:: :octicon:`repo-clone;1em;sd-text-warning` Command-Line Interface
:link: cli-guide
:link-type: ref

Familiarize yourself with BSB's CLI.

.. grid-item-card:: :octicon:`gear;1em;sd-text-warning` Learn about components
:link: main-components
:link-type: ref

Explore more about the main components.

.. grid-item-card:: :octicon:`device-camera-video;1em;sd-text-warning` Examples
:link: examples
:link-type: ref

Explore more advanced examples
Loading

0 comments on commit 3b547b2

Please sign in to comment.