Accessing network data#


The configuration of a network is available as network.configuration, the root nodes such as cell_types, placement and others are available on network as well.

from bsb.core import from_storage

network = from_storage("network.hdf5")
print("My network was configured with", network.configuration)
print("My network has", len(network.configuration.cell_types), "cell types")
    # But to avoid some needless typing and repetition,
    network.cell_types is network.configuration.cell_types
    and network.placement is network.configuration.placement
    and "so on"

Placement data#

The placement data is available through the storage.interfaces.PlacementSet interface. This example shows how to access the cell positions of each population:

from bsb.core import from_storage
import numpy as np

network = from_storage("network.hdf5")
for cell_type in network.cell_types:
    ps = cell_type.get_placement_set()
    pos = ps.load_positions()
    print(len(pos),, "placed")
    # The positions are an (Nx3) numpy array
    print("The median cell is located at", np.median(pos, axis=0))


Document best ways to interact with the morphology data