Output module

class bsb.output.HDF5Formatter[source]

Stores the output of the scaffold as a single HDF5 file. Is also a MorphologyRepository and an HDF5TreeHandler.

exists()[source]

Check if the resource exists.

get_cells_of_type(name, entity=False)[source]

Return the position matrix for a specific cell type.

get_connectivity_set(tag)[source]

Return a connectivity set.

Parameters

tag (string) – Key of the connectivity set in the connections group.

Returns

The connectivity set.

Return type

ConnectivitySet

Raises

DatasetNotFoundError

get_connectivity_set_connection_types(tag)[source]

Return all the ConnectionStrategies that contributed to the creation of this connectivity set.

get_connectivity_set_meta(tag)[source]

Return the metadata associated with this connectivity set.

get_connectivity_sets()[source]

Return all the ConnectivitySets present in the network file.

get_simulator_output_path(simulator_name)[source]

Return the path where a simulator can dump preliminary output.

has_cells_of_type(name, entity=False)[source]

Check whether the position matrix for a certain cell type is present.

init_scaffold()[source]

Initialize the scaffold when it has been loaded from an output file.

validate()[source]

Must be implemented by child classes. Raise exceptions when invalid configuration parameters are received.

class bsb.output.HDF5ResourceHandler[source]
get_handle(mode='r')[source]

Open an HDF5 resource.

release_handle(handle)[source]

Close the MorphologyRepository storage resource.

class bsb.output.HDF5TreeHandler[source]

TreeHandler that uses HDF5 as resource storage

class bsb.output.MorphologyCache(morphology_repository)[source]

Loads and caches morphologies so that each morphology is loaded only once and its instance is shared among all cells with that Morphology. Saves a lot on memory, but the Morphology should be treated as read only.

rotate_all_morphologies(phi_step, theta_step=None)[source]

Extracts all unrotated morphologies from a morphology_repository and creates rotated versions, at sampled orientations in the 3D space

Parameters
  • phi_step (int, optional) – Resolution of azimuth angle sampling, in degrees

  • theta_step – Resolution of elevation angle sampling, in degrees

class bsb.output.MorphologyRepository(file=None)[source]
get_handle(mode='r')[source]

Open the HDF5 storage resource and initialise the MorphologyRepository structure.

get_morphology(name, scaffold=None)[source]

Load a morphology from repository data

import_arbz(name, cls, overwrite=False)[source]

Import an Arborize model as a morphology.

Arborize models make some assumptions about morphologies, inherited from how NEURON deals with it: There is only 1 root, and the soma is at the beginning of this root. This is not necesarily so for morphologies in general in the BSB that can have as many roots as they want.

import_swc(file, name, tags=[], overwrite=False)[source]

Import and store .swc file contents as a morphology in the repository.

list_morphologies(include_rotations=False, only_rotations=False, cell_type=None)[source]

Return a list of morphologies in a morphology repository, filtered by rotation and/or cell type.

Parameters
  • include_rotations (bool) – Include each cached rotation of each morphology.

  • only_rotations (bool) – Get only the rotated caches of the morphologies.

  • cell_type – Specify the cell type for which you want to extract the morphologies.

  • cell_type – CellType

Returns

List of morphology names

Return type

list

class bsb.output.OutputFormatter[source]
abstract exists()[source]

Check if the resource exists.

abstract get_cells_of_type(name)[source]

Return the position matrix for a specific cell type.

abstract get_connectivity_set(tag)[source]

Return a connectivity set.

Parameters

tag (string) – Key of the connectivity set in the connections group.

Returns

The connectivity set.

Return type

ConnectivitySet

Raises

DatasetNotFoundError

abstract get_connectivity_set_connection_types(tag)[source]

Return the connection types that contributed to this connectivity set.

abstract get_connectivity_set_meta(tag)[source]

Return the meta dictionary of this connectivity set.

abstract get_connectivity_sets()[source]

Return all connectivity sets.

Returns

List of connectivity sets.

Return type

ConnectivitySet

abstract get_simulator_output_path(simulator_name)[source]

Return the path where a simulator can dump preliminary output.

abstract has_cells_of_type(name)[source]

Check whether the position matrix for a certain cell type is present.

abstract init_scaffold()[source]

Initialize the scaffold when it has been loaded from an output file.

class bsb.output.ResourceHandler[source]
abstract get_handle(mode=None)[source]

Open the output resource and return a handle.

abstract release_handle(handle)[source]

Close the open output resource and release the handle.

class bsb.output.TreeHandler[source]

Interface that allows a ResourceHandler to handle storage of TreeCollections.