diff --git a/docs/connectivity/connectivity-set.rst b/docs/connectivity/connectivity-set.rst new file mode 100644 index 00000000..4a161450 --- /dev/null +++ b/docs/connectivity/connectivity-set.rst @@ -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) + diff --git a/docs/connectivity/connectivity-toc.rst b/docs/connectivity/connectivity-toc.rst index d9a562a4..66483aa0 100644 --- a/docs/connectivity/connectivity-toc.rst +++ b/docs/connectivity/connectivity-toc.rst @@ -9,3 +9,4 @@ Connectivity component connection-strategies geometric + connectivity-set diff --git a/docs/getting-started/getting-started_reconstruction.rst b/docs/getting-started/getting-started_reconstruction.rst index ef64fcbe..a20df6b3 100644 --- a/docs/getting-started/getting-started_reconstruction.rst +++ b/docs/getting-started/getting-started_reconstruction.rst @@ -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 `). 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 @@ -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 ` for more info). Connectivity @@ -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 ` 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`. diff --git a/docs/getting-started/guide_simulation.rst b/docs/getting-started/guide_simulation.rst index 9a1cded6..0914d5b4 100644 --- a/docs/getting-started/guide_simulation.rst +++ b/docs/getting-started/guide_simulation.rst @@ -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 `). In this example, we assign the ``static_synapse`` model to the connections :guilabel:`A_to_B`. .. tab-set-code::