Configuration reference#

Root nodes#

from bsb.config import Configuration

Configuration(
  name='example',
  components=[],
  packages=[
    {
  ],
  morphologies=[
    {
  ],
  storage={},
  network={},
  regions={},
  partitions={},
  cell_types={},
  placement={},
  after_placement={},
  connectivity={},
  after_connectivity={},
  simulations={},
)
{
    "name": "example",
    "components": [],
    "packages": [
        [
            "u",
            "u"
        ]
    ],
    "morphologies": [
        [
            "i",
            "i",
            "a",
            "a"
        ]
    ],
    "storage": {},
    "network": {},
    "regions": {},
    "partitions": {},
    "cell_types": {},
    "placement": {},
    "after_placement": {},
    "connectivity": {},
    "after_connectivity": {},
    "simulations": {}
}
after_connectivity: {}
after_placement: {}
cell_types: {}
components: []
connectivity: {}
morphologies:
- - i
  - i
  - a
  - a
name: example
network: {}
packages:
- - u
  - u
partitions: {}
placement: {}
regions: {}
simulations: {}
storage: {}

Storage#

Note

Storage nodes host plugins and can contain plugin-specific configuration.

from bsb.storage.interfaces import StorageNode

StorageNode(
  root='example',
  engine='example',
)
{
    "root": "example",
    "engine": "example"
}
engine: example
root: example
  • engine: The name of the storage engine to use.

  • root: The storage engine specific identifier of the location of the storage.

Network#

NetworkNode(
  x=3.14,
  y=3.14,
  z=3.14,
  origin=[0, 0, 0],
  chunk_size=[100.0, 100.0, 100.0],
)
{
    "x": 3.14,
    "y": 3.14,
    "z": 3.14,
    "origin": [
        0,
        0,
        0
    ],
    "chunk_size": [
        100.0,
        100.0,
        100.0
    ]
}
chunk_size:
- 100.0
- 100.0
- 100.0
origin:
- 0
- 0
- 0
x: 3.14
y: 3.14
z: 3.14
  • x, y and z: Loose indicators of the scale of the network. They are handed to the topology of the network to scale itself. They do not restrict cell placement.

  • chunk_size: The size used to parallelize the topology into multiple rhomboids. Can be a list of 3 floats for a rhomboid or 1 float for cubes.

Components#

CodeDependencyNode(
  file=True,
  module='example',
  attr='example',
)
{
    "file": true,
    "module": "example",
    "attr": "example"
}
attr: example
file: true
module: example

Morphologies#

from bsb.morphologies.parsers.parser import MorphologyParser

MorphologyDependencyNode(
  file='example',
  pipeline=[
    {
      'func': None,
      'parameters': None,
    },
  ],
  name='example',
  parser=MorphologyParser(
    cls='builtins.str',
    branch_cls='builtins.str',
    parser='bsb',
  ),
)
{
    "file": "example",
    "pipeline": [
        {
            "func": null,
            "parameters": null
        }
    ],
    "name": "example",
    "parser": {
        "cls": "builtins.str",
        "branch_cls": "builtins.str",
        "parser": "bsb"
    }
}
file: example
name: example
parser:
  branch_cls: builtins.str
  cls: builtins.str
  parser: bsb
pipeline:
- func: null
  parameters: null

Regions#

Note

Region nodes are components and can contain additional component-specific attributes.

from bsb.topology.region import Region

Region(
  name='example',
  children=[],
  type='group',
)
{
    "name": "example",
    "children": [],
    "type": "group"
}
children: []
name: example
type: group
  • type: Type of the region, determines what kind of structure it imposes on its children.

  • offset: Offset of this region to its parent in the topology.

Partitions#

Note

Partition nodes are components and can contain additional component-specific attributes.

from bsb.topology.partition import Partition

Partition(
  name='example',
  type='layer',
)
{
    "name": "example",
    "type": "layer"
}
name: example
type: layer
  • type: Name of the partition component, or its class.

  • region: By-name reference to a region.

Cell types#

from bsb.cell_types import CellType, Plotting
from bsb.placement.indicator import PlacementIndications
from bsb.morphologies.selector import MorphologySelector

CellType(
  name='example',
  spatial=PlacementIndications(
    radius=3.14,
    density=3.14,
    planar_density=3.14,
    count_ratio=3.14,
    density_ratio=3.14,
    relative_to=None,
    count=42,
    geometry=True,
    morphologies=[
      {
        select='by_name',
      ),
    ],
    density_key='example',
  ),
  plotting=Plotting(
    display_name='example',
    color='example',
    opacity=1.0,
  ),
  entity=False,
)
{
    "name": "example",
    "spatial": {
        "radius": 3.14,
        "density": 3.14,
        "planar_density": 3.14,
        "count_ratio": 3.14,
        "density_ratio": 3.14,
        "relative_to": null,
        "count": 42,
        "geometry": {
            "name_of_the_thing": true
        },
        "morphologies": [
            {
                "select": "by_name"
            }
        ],
        "density_key": "example"
    },
    "plotting": {
        "display_name": "example",
        "color": "example",
        "opacity": 1.0
    },
    "entity": false
}
entity: false
name: example
plotting:
  color: example
  display_name: example
  opacity: 1.0
spatial:
  count: 42
  count_ratio: 3.14
  density: 3.14
  density_key: example
  density_ratio: 3.14
  geometry:
    name_of_the_thing: true
  morphologies:
  - select: by_name
  planar_density: 3.14
  radius: 3.14
  relative_to: null
  • entity: Indicates whether this cell type is an abstract entity, or a regular cell.

  • spatial: Node for spatial information about the cell.

    • radius: Radius of the indicative cell soma (μm).

    • count: Fixed number of cells to place.

    • density: Volumetric density of cells (1/(μm^3))

    • planar_density: Planar density of cells (1/(μm^2))

    • density_key: Key of the data column that holds the per voxel density information when this cell type is placed in a voxel partition.

    • relative_to: Reference to another cell type whose spatial information determines this cell type’s number.

    • density_ratio: Ratio of densities to maintain with the related cell type.

    • count_ratio: Ratio of counts to maintain with the related cell type.

    • geometry: Node for geometric information about the cell. This node may contain arbitrary keys and values, useful for cascading custom placement strategy attributes.

  • morphologies: List of morphology selectors.

  • plotting:

    • display_name: Name used for this cell type when plotting it.

    • color: Color used for the cell type when plotting it.

    • opacity: Opacity (non-transparency) of the color

Placement#

Note

Placement nodes are components and can contain additional component-specific attributes.

from bsb.placement.strategy import PlacementStrategy
from bsb.placement.indicator import PlacementIndications
from bsb.morphologies.selector import MorphologySelector
from bsb.placement.distributor import RotationDistributor, DistributorsNode, MorphologyDistributor, Distributor

PlacementStrategy(
  name='example',
  cell_types=[],
  partitions=[],
  overrides=PlacementIndications(
    radius=3.14,
    density=3.14,
    planar_density=3.14,
    count_ratio=3.14,
    density_ratio=3.14,
    relative_to=None,
    count=42,
    geometry=True,
    morphologies=[
      {
        select='by_name',
      ),
    ],
    density_key='example',
  ),
  depends_on=[],
  distribute=DistributorsNode(
    morphologies=MorphologyDistributor(
      strategy='random',
      may_be_empty=False,
    ),
    rotations=RotationDistributor(
      strategy='none',
    ),
    properties=Distributor(
      strategy='example',
    ),
  ),
  strategy='example',
)
{
    "name": "example",
    "cell_types": [],
    "partitions": [],
    "overrides": {
        "name_of_the_thing": {
            "radius": 3.14,
            "density": 3.14,
            "planar_density": 3.14,
            "count_ratio": 3.14,
            "density_ratio": 3.14,
            "relative_to": null,
            "count": 42,
            "geometry": {
                "name_of_the_thing": true
            },
            "morphologies": [
                {
                    "select": "by_name"
                }
            ],
            "density_key": "example"
        }
    },
    "depends_on": [],
    "distribute": {
        "morphologies": {
            "strategy": "random",
            "may_be_empty": false
        },
        "rotations": {
            "strategy": "none"
        },
        "properties": {
            "strategy": "example"
        }
    },
    "strategy": "example"
}
cell_types: []
depends_on: []
distribute:
  morphologies:
    may_be_empty: false
    strategy: random
  properties:
    strategy: example
  rotations:
    strategy: none
name: example
overrides:
  name_of_the_thing:
    count: 42
    count_ratio: 3.14
    density: 3.14
    density_key: example
    density_ratio: 3.14
    geometry:
      name_of_the_thing: true
    morphologies:
    - select: by_name
    planar_density: 3.14
    radius: 3.14
    relative_to: null
partitions: []
strategy: example
  • strategy: Class name of the placement strategy algorithm to import.

  • cell_types: List of cell type references. This list is used to gather placement indications for the underlying strategy. It is the underlying strategy that determines how they will interact, so check the component documentation. For most strategies, passing multiple cell types won’t yield functional differences from having more cells in a single type.

  • partitions: List of partitions to place the cell types in. Each strategy has their own way of dealing with partitions, but most will try to voxelize them (using chunk_to_voxels()), and combine the voxelsets of each partition. When using multiple partitions, you can save memory if all partitions voxelize into regular same-size voxelsets.

  • overrides: Cell types define their own placement indications in the spatial node, but they might differ depending on the location they appear in. For this reason, each placement strategy may override the information per cell type. Specify the name of the cell types as the key, and provide a dictionary as value. Each key in the dictionary will override the corresponding cell type key.

Connectivity#

Note

Connectivity nodes are components and can contain additional component-specific attributes.

from bsb.connectivity.strategy import Hemitype, ConnectionStrategy

ConnectionStrategy(
  name='example',
  presynaptic=Hemitype(
    cell_types=[],
    labels=[],
    morphology_labels=[],
    morpho_loader='bsb.connectivity.strategy.<lambda>',
  ),
  postsynaptic=Hemitype(
    cell_types=[],
    labels=[],
    morphology_labels=[],
    morpho_loader='bsb.connectivity.strategy.<lambda>',
  ),
  depends_on=[],
  output_naming={},
  strategy='example',
)
{
    "name": "example",
    "presynaptic": {
        "cell_types": [],
        "labels": [],
        "morphology_labels": [],
        "morpho_loader": "bsb.connectivity.strategy.<lambda>"
    },
    "postsynaptic": {
        "cell_types": [],
        "labels": [],
        "morphology_labels": [],
        "morpho_loader": "bsb.connectivity.strategy.<lambda>"
    },
    "depends_on": [],
    "output_naming": {},
    "strategy": "example"
}
depends_on: []
name: example
output_naming: {}
postsynaptic:
  cell_types: []
  labels: []
  morpho_loader: bsb.connectivity.strategy.<lambda>
  morphology_labels: []
presynaptic:
  cell_types: []
  labels: []
  morpho_loader: bsb.connectivity.strategy.<lambda>
  morphology_labels: []
strategy: example
  • strategy: Class name of the connectivity strategy algorithm to import.

  • presynaptic/postsynaptic: Hemitype node specificatiosn for the pre/post synaptic side of the synapse.

    • cell_types: List of cell type references. It is the underlying strategy that determines how they will interact, so check the component documentation. For most strategies, all the presynaptic cell types will be cross combined with all the postsynaptic cell types.

Simulations#

from bsb.simulation.simulation import Simulation
from bsb.simulation.cell import CellModel
from bsb.simulation.parameter import Parameter, ParameterValue
from bsb.simulation.connection import ConnectionModel
from bsb.simulation.device import DeviceModel

Simulation(
  name='example',
  duration=3.14,
  cell_models=CellModel(
    name='example',
    cell_type=None,
    parameters=[
      {
        value=ParameterValue(
          type='example',
        ),
        type='example',
      ),
    ],
  ),
  connection_models=ConnectionModel(
    name='example',
    tag='example',
  ),
  devices=DeviceModel(
    name='example',
  ),
  post_prepare=[
    {
  ],
  simulator='example',
)
{
    "name": "example",
    "duration": 3.14,
    "cell_models": {
        "name": "example",
        "cell_type": null,
        "parameters": [
            {
                "value": {
                    "type": "example"
                },
                "type": "example"
            }
        ]
    },
    "connection_models": {
        "name": "example",
        "tag": "example"
    },
    "devices": {
        "name": "example"
    },
    "post_prepare": [
        null
    ],
    "simulator": "example"
}
cell_models:
  cell_type: null
  name: example
  parameters:
  - type: example
    value:
      type: example
connection_models:
  name: example
  tag: example
devices:
  name: example
duration: 3.14
name: example
post_prepare:
- null
simulator: example