Skip to content

Commit

Permalink
docs: add connectivity-set page
Browse files Browse the repository at this point in the history
  • Loading branch information
filimarc committed Oct 30, 2024
1 parent 0b62f84 commit 25f5c8d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
53 changes: 53 additions & 0 deletions docs/connectivity/connectivity-set.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#################
Connectivity sets
#################

The :class:`ConnectivitySet <.storage.interfaces.ConnectivitySet>` represents the
ensemble of all connections established in your network.
It is constructed from the :class:`~.storage.Storage` and can be used to retrieve
information about pre- and post-cell types, as well as the connections between them.

Retrieving a ConnectivitySet
============================

It is possible to retrieve the ``ConnectivitySet`` stored in our network, for example,
from the network file "my_network.hdf5":

.. code-block:: python
from bsb import from_storage
network = from_storage("my_network.hdf5")
cs_list = network.get_connectivity_sets()
for cs in cs_list: # Print the name of all
print ("ConnectivitySet found:",cs.tag) # the ConnectivitySets stored
Alternatively, is possible to load the set by its name:

.. code-block:: python
cs = network.get_connectivity_set("my_CS")
The cell type information is accessible through the attributes :guilabel:`pre_type` and :guilabel:`post_type`:

.. code-block:: python
ct_pre = cs.pre_type # Load the pre-synaptic cell type
ct_pos = cs.pos_type # Load the post-synaptic cell type
print("My pre-type is", cs.pre_type_name) # Access the name of the pre-synaptic cell type
print("My post-type is", cs.post_type_name) # Access the name of the post-synaptic cell type
Connections
===========

A list of all the cell pairs for every ``ConnectivitySet`` can be loaded with the
method :meth:`~.storage.interfaces.ConnectivitySet.load_connections`.

.. code-block:: python
connection_pairs = []
for pair in cs.load_connections():
connection_pairs.append(pair)
1 change: 1 addition & 0 deletions docs/connectivity/connectivity-toc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Connectivity
component
connection-strategies
geometric
connectivity-set
6 changes: 3 additions & 3 deletions docs/getting-started/getting-started_reconstruction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Here, the ``verbosity`` flag increases the amount of output (logs) that is gener
to follow along or troubleshoot.

When BSB compiles a `Scaffold`, it extracts and runs the reconstruction pipeline defined in the `Configuration` and
stores each step's results into the `Storage` (as explained in the `previous section`).
stores each step's results into the `Storage` (as explained in the :ref:`previous section <get-started>`).

The compile command (or python script) should produce a file ``"network.hdf5"`` located in your project
folder if BSB could parse the configuration file and complete the reconstruction. This file should
Expand Down Expand Up @@ -212,7 +212,7 @@ You should now try to compile your network to check if you did no mistake:
:ref:`storage_control` for more flags to deal with existing data.

Each placement strategy generates a `PlacementSet` in the `Storage` that you can access from the `Scaffold` object
(see `this section` for more info).
(see :doc:`this section </placement/placement-set>` for more info).


Connectivity
Expand Down Expand Up @@ -244,7 +244,7 @@ cells and connections in place, you are ready to move to the next stage.
once the configuration is complete.

Each connection strategy generates a `ConnectivitySet` in the `Storage` for each pair of neurons
that you can access from the `Scaffold` object (see `this section` for more info).
that you can access from the `Scaffold` object (see :doc:`this section </connectivity/connectivity-set>` for more info).
Here, the name of the `ConnectivitySet` corresponds to the connection component (``A_to_B``) because
there is only one pair of :guilabel:`cell_type`.

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/guide_simulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Connection Models

For each connection type of your network, you also need to define a model describing its synapses' dynamics.
Similar to the :guilabel:`cell_models` block, each :guilabel:`connection_model` you define should use a key
that corresponds to a ``ConnectivitySet`` created during reconstruction (as explained in the previous `section`).
that corresponds to a ``ConnectivitySet`` created during reconstruction (as explained in the previous :doc:`section </getting-started/getting-started_reconstruction>`).
In this example, we assign the ``static_synapse`` model to the connections :guilabel:`A_to_B`.

.. tab-set-code::
Expand Down

0 comments on commit 25f5c8d

Please sign in to comment.