bsb package¶
Subpackages¶
- bsb.cli package
- bsb.config package
- Subpackages
- Submodules
- bsb.config.refs module
- bsb.config.types module
PackageRequirementTypeHandlerWeakInverterany_()class_deg_to_radiandict()distributionevaluationfloat()fraction()function_in_()in_classmap()int()key()list()list_or_scalar()methodmethod_shortcutmut_excl()ndarraynone()number()object_or_()scalar_expand()shortform()str()voxel_size()
- Module contents
ConfigurationConfigurationAttributeConfigurationAttribute.flag_dirty()ConfigurationAttribute.flag_pristine()ConfigurationAttribute.fset()ConfigurationAttribute.get_default()ConfigurationAttribute.get_hint()ConfigurationAttribute.get_node_name()ConfigurationAttribute.get_type()ConfigurationAttribute.is_dirty()ConfigurationAttribute.is_node_type()ConfigurationAttribute.should_call_default()ConfigurationAttribute.tree()ConfigurationAttribute.tree_of()
Distributionafter()attr()before()catch_all()compose_nodes()copy_configuration_template()dict()dynamic()file()format_configuration_content()get_config_attributes()get_config_path()has_hook()list()make_configuration_diagram()node()on()parse_configuration_content()parse_configuration_content_to_dict()parse_configuration_file()pluggable()property()provide()ref()reflist()root()run_hook()slot()unset()walk_node_attributes()walk_nodes()
- Dev
- bsb.topology package
- bsb.morphologies package
- Subpackages
- Module contents
BranchBranch.as_arc()Branch.attach_child()Branch.cached_voxelize()Branch.ceil_arc_point()Branch.center()Branch.childrenBranch.close_gaps()Branch.collapse()Branch.contains_labels()Branch.copy()Branch.delete_point()Branch.detach()Branch.detach_child()Branch.endBranch.euclidean_distBranch.find_closest_point()Branch.flatten()Branch.flatten_labels()Branch.flatten_properties()Branch.flatten_radii()Branch.floor_arc_point()Branch.fractal_dimBranch.get_arc_point()Branch.get_axial_distances()Branch.get_branches()Branch.get_label_mask()Branch.get_points_labelled()Branch.insert_branch()Branch.introduce_arc_point()Branch.introduce_point()Branch.is_rootBranch.is_terminalBranch.label()Branch.labelsBranch.labelsetsBranch.list_labels()Branch.max_displacementBranch.parentBranch.path_lengthBranch.point_vectorsBranch.pointsBranch.radiiBranch.root_rotate()Branch.rotate()Branch.segmentsBranch.set_properties()Branch.simplify()Branch.simplify_branches()Branch.sizeBranch.startBranch.subtree()Branch.translate()Branch.vectorBranch.versorBranch.voxelize()Branch.walk()
MorphologyMorphology.adjacency_dictionaryMorphology.as_filtered()Morphology.copy()Morphology.empty()Morphology.get_label_mask()Morphology.is_optimizedMorphology.labelsetsMorphology.list_labels()Morphology.metaMorphology.optimize()Morphology.set_label_filter()Morphology.simplify()Morphology.swap_axes()Morphology.to_graph_array()Morphology.to_swc()
MorphologySetMorphologySet.clear_soft_cache()MorphologySet.count_morphologies()MorphologySet.count_unique()MorphologySet.empty()MorphologySet.get()MorphologySet.get_indices()MorphologySet.iter_meta()MorphologySet.iter_morphologies()MorphologySet.merge()MorphologySet.namesMorphologySet.set_label_filter()
RotationSetSubTreeSubTree.boundsSubTree.branch_adjacencySubTree.branchesSubTree.cached_voxelize()SubTree.center()SubTree.close_gaps()SubTree.collapse()SubTree.flatten()SubTree.flatten_labels()SubTree.flatten_properties()SubTree.flatten_radii()SubTree.get_branches()SubTree.label()SubTree.labelsSubTree.originSubTree.path_lengthSubTree.pointsSubTree.propertiesSubTree.radiiSubTree.root_rotate()SubTree.rotate()SubTree.simplify_branches()SubTree.sizeSubTree.subtree()SubTree.translate()SubTree.voxelize()
branch_iter()
- bsb.placement package
- bsb.connectivity package
- bsb.simulation package
- Submodules
- Module contents
- bsb.services package
- bsb.storage package
- Subpackages
- Submodules
- Module contents
chunklist()ChunkNotSupportedStorageStorage.assert_support()Storage.clear_connectivity()Storage.clear_placement()Storage.copy()Storage.create()Storage.exists()Storage.filesStorage.formatStorage.get_chunk_stats()Storage.get_connectivity_set()Storage.get_connectivity_sets()Storage.get_placement_set()Storage.init()Storage.init_placement()Storage.is_main_process()Storage.load()Storage.load_active_config()Storage.morphologiesStorage.move()Storage.preexistedStorage.read_only()Storage.remove()Storage.renew()Storage.require_connectivity_set()Storage.require_placement_set()Storage.rootStorage.root_slugStorage.store_active_config()Storage.supports()
create_engine()discover_engines()get_engine_node()get_engines()open_storage()view_support()MorphologyOperationCallableOperationCallableCodeDependencyNodeFileDependencyFileDependencyNodeFileSchemeMorphologyDependencyNodeMorphologyDependencyNode.get_morphology_name()MorphologyDependencyNode.get_node_name()MorphologyDependencyNode.load_object()MorphologyDependencyNode.nameMorphologyDependencyNode.parserMorphologyDependencyNode.pipelineMorphologyDependencyNode.queue()MorphologyDependencyNode.store_content()MorphologyDependencyNode.store_object()
MorphologyOperationNeuroMorphoSchemeNrrdDependencyNodeOperationUriSchemeUrlScheme
Submodules¶
bsb.core module¶
- class bsb.core.Scaffold(config=None, storage=None, clear=False, comm=None)[source]¶
Bases:
objectThis is the main object of the bsb package, it represents a network and puts together all the pieces that make up the model description such as the
Configurationwith the technical side like theStorage.Bootstraps a network object.
- Parameters:
config (
Configuration) – The configuration to use for this network. If it is omitted the bsb.default configuration is used.storage (
Storage) – The storage to use to read and write data for this network. If it is omitted the configuration’sStoragenode is used to construct one.clear (bool) – Start with a new network, clearing any previously stored information
comm (mpi4py.MPI.Comm) – MPI communicator that shares control over the Storage.
- Returns:
A network object
- Return type:
- property after_connectivity¶
- property after_placement¶
- attr = 'simulations'¶
- property cell_types¶
- compile(skip_placement=False, skip_connectivity=False, skip_after_placement=False, skip_after_connectivity=False, only=None, skip=None, clear=False, append=False, redo=False, force=False, fail_fast=True)[source]¶
Run reconstruction steps in the scaffold sequence to obtain a full network.
- property configuration: Configuration¶
- connect_cells(pre_set, post_set, src_locs, dest_locs, name)[source]¶
Connect cells from a presynaptic placement set to cells of a postsynaptic placement set, and into a connectivity set. The description of the hemitype (source or target cell population) connection location is stored as a list of 3 ids: the cell index (in the placement set), morphology branch index, and the morphology branch section index. If no morphology is attached to the hemitype, then the morphology indexes can be set to -1.
- Parameters:
pre_set (bsb.storage.interfaces.PlacementSet) – presynaptic placement set
post_set (bsb.storage.interfaces.PlacementSet) – postsynaptic placement set
src_locs (list[list[int, int, int]]) – list of the presynaptic connection location.
dest_locs (list[list[int, int, int]]) – list of the postsynaptic connection location.
name (str) – Name to give to the ConnectivitySet
- property connectivity¶
- create_entities(cell_type, count)[source]¶
Create entities in the simulation space.
Entities are different from cells because they have no positional data and don’t influence the placement step. They do have a representation in the connection and simulation step.
- get_connectivity(anywhere=None, presynaptic=None, postsynaptic=None, skip=None, only=None) list[ConnectivitySet][source]¶
- Return type:
- get_connectivity_set(tag=None, pre=None, post=None) ConnectivitySet[source]¶
Return a connectivity set from its name according to the output formatter. The name can be specified directly with tag or with deduced from pre and post if there is only one connectivity set matching this pair.
- Parameters:
- Returns:
A connectivity set
- Return type:
- get_connectivity_sets() list[ConnectivitySet][source]¶
Return all connectivity sets from the output formatter.
- Returns:
All connectivity sets
- Return type:
list[
ConnectivitySet]
- get_placement(cell_types=None, skip=None, only=None) list[PlacementStrategy][source]¶
- Return type:
- get_placement_of(*cell_types)[source]¶
Find all the placement strategies that involve the given cell types.
- get_placement_set(type, chunks=None, labels=None, morphology_labels=None) PlacementSet[source]¶
Return a cell type’s placement set from the output formatter.
- Parameters:
- Returns:
A placement set
- Return type:
- get_placement_sets() list[PlacementSet][source]¶
Return all the placement sets present in the network.
- Return type:
- get_simulation(sim_name: str) Simulation[source]¶
Retrieve the default single-instance adapter for a simulation.
- Parameters:
sim_name (str)
- Return type:
- property morphologies: MorphologyRepository¶
- property network¶
- property partitions¶
- place_cells(cell_type, positions, morphologies=None, rotations=None, additional=None, chunk=None)[source]¶
Place cells inside the scaffold.
# Add one granule cell at position 0, 0, 0 cell_type = scaffold.get_cell_type("granule_cell") scaffold.place_cells(cell_type, cell_type.layer_instance, [[0.0, 0.0, 0.0]])
- Parameters:
cell_type (CellType) – The type of the cells to place.
positions (Any np.concatenate type of shape (N, 3).) – A collection of xyz positions to place the cells on.
- property placement¶
- property regions¶
- register_pool_cached_item(id, cleanup)[source]¶
Registers a cleanup function for items cached during a parallel workflow. Internal use only.
- Parameters:
id – Id of the cached item. Should be unique but identical across MPI nodes
cleanup – A callable that cleans up the cached item.
- require_connectivity_set(pre, post, tag=None) ConnectivitySet[source]¶
- Return type:
- resize(x=None, y=None, z=None)[source]¶
Updates the topology boundary indicators.
Use before placement, updates only the abstract topology tree, does not rescale, prune or otherwise alter already existing placement data.
- run_after_connectivity(hooks=None, fail_fast=None, pipelines=True)[source]¶
Run after placement hooks.
- run_connectivity(strategies=None, fail_fast=True, pipelines=True)[source]¶
Run connection strategies.
- run_simulation(simulation_name: str)[source]¶
Run a simulation starting from the default single-instance adapter.
- Parameters:
simulation_name (str) – Name of the simulation in the configuration.
- property simulations¶
- property storage_cfg¶
- bsb.core.from_storage(root, comm=None)[source]¶
Load
bsb.core.Scaffoldfrom a storage object.- Parameters:
root – Root (usually path) pointing to the storage object.
comm (mpi4py.MPI.Comm) – MPI communicator that shares control over the Storage.
- Returns:
A network scaffold
- Return type:
bsb.cell_types module¶
Module for the CellType configuration node and its dependencies.
- class bsb.cell_types.CellType(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
objectInformation on a population of cells.
- clear_connections()[source]¶
Clear all the connectivity data associated with this cell type.
Any connectivity set that this cell type is a part of will be entirely removed.
- clear_placement()[source]¶
Clear all the placement data associated with this cell type.
Connectivity data will remain, but be invalid.
- entity¶
Whether this cell type is an entity type.
Entity types don’t have representations in space, but can still be connected and simulated.
- get_node_name()¶
- get_placement_set(*args, **kwargs)[source]¶
Retrieve this cell type’s placement data.
- Parameters:
chunks (list[bsb.storage._chunks.Chunk]) – When given, restricts the placement data to these chunks.
- property morphologies¶
- name¶
Name of the cell type, equivalent to the key it occurs under in the configuration.
- plotting¶
Plotting information about the cell type, such as color and labels.
- spatial¶
Spatial information about the cell type such as radius and density, and geometric or morphological information.
- class bsb.cell_types.PlacementIndications(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
object- count: int¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- count_ratio: float¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- density: float¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- density_key: str¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- density_ratio: float¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- get_node_name()¶
- local_count_ratio: float¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- morphologies: cfglist[MorphologySelector]¶
- planar_density: float¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
bsb.exceptions module¶
- exception bsb.exceptions.AdapterError(*args, **kwargs)¶
Bases:
ScaffoldErrorAdapterError exception
- exception bsb.exceptions.AllenApiError(*args, **kwargs)¶
Bases:
GatewayErrorAllenApiError exception
- exception bsb.exceptions.AttributeMissingError(*args, **kwargs)¶
Bases:
StorageErrorAttributeMissingError exception
- exception bsb.exceptions.BootError(*args, **kwargs)¶
Bases:
ConfigurationErrorBootError exception
- exception bsb.exceptions.CLIError(*args, **kwargs)¶
Bases:
ScaffoldErrorCLIError exception
- exception bsb.exceptions.CastConfigurationError(*args, **kwargs)¶
Bases:
ConfigurationErrorCastConfigurationError exception
- exception bsb.exceptions.CastError(*args, **kwargs)¶
Bases:
ConfigurationErrorCastError exception
- exception bsb.exceptions.CfgReferenceError(*args, **kwargs)¶
Bases:
ConfigurationErrorCfgReferenceError exception
- exception bsb.exceptions.ChunkError(*args, **kwargs)¶
Bases:
PlacementErrorChunkError exception
- exception bsb.exceptions.CircularMorphologyError(*args, **kwargs)¶
Bases:
MorphologyErrorCircularMorphologyError exception
- exception bsb.exceptions.ClassError(*args, **kwargs)¶
Bases:
ScaffoldErrorClassError exception
- exception bsb.exceptions.ClassMapMissingError(*args, **kwargs)¶
Bases:
DynamicClassErrorClassMapMissingError exception
- exception bsb.exceptions.CodeImportError(*args, **kwargs)¶
Bases:
ScaffoldErrorCodeImportError exception
- exception bsb.exceptions.CompartmentError(*args, **kwargs)¶
Bases:
MorphologyErrorCompartmentError exception
- exception bsb.exceptions.CompilationError(*args, **kwargs)¶
Bases:
ScaffoldErrorCompilationError exception
- exception bsb.exceptions.ConfigTemplateNotFoundError(*args, **kwargs)¶
Bases:
CLIErrorConfigTemplateNotFoundError exception
- exception bsb.exceptions.ConfigurationError(*args, **kwargs)¶
Bases:
ScaffoldErrorConfigurationError exception
- exception bsb.exceptions.ConfigurationFormatError(*args, **kwargs)¶
Bases:
ConfigurationErrorConfigurationFormatError exception
- exception bsb.exceptions.ConfigurationSyncError(*args, **kwargs)¶
Bases:
ConfigurationErrorConfigurationSyncError exception
- exception bsb.exceptions.ConfigurationWarning[source]¶
Bases:
ScaffoldWarning
- exception bsb.exceptions.ConnectivityError(*args, **kwargs)¶
Bases:
ScaffoldErrorConnectivityError exception
- exception bsb.exceptions.ConnectivityWarning[source]¶
Bases:
ScaffoldWarning
- exception bsb.exceptions.ContinuityError(*args, **kwargs)¶
Bases:
PlacementErrorContinuityError exception
- exception bsb.exceptions.DataNotFoundError(*args, **kwargs)¶
Bases:
StorageErrorDataNotFoundError exception
- exception bsb.exceptions.DataNotProvidedError(*args, **kwargs)¶
Bases:
ScaffoldErrorDataNotProvidedError exception
- exception bsb.exceptions.DatasetExistsError(*args, **kwargs)¶
Bases:
StorageErrorDatasetExistsError exception
- exception bsb.exceptions.DatasetNotFoundError(*args, **kwargs)¶
Bases:
StorageErrorDatasetNotFoundError exception
- exception bsb.exceptions.DependencyError(*args, **kwargs)¶
Bases:
ScaffoldErrorDependencyError exception
- exception bsb.exceptions.DistributionCastError(*args, **kwargs)¶
Bases:
CastErrorDistributionCastError exception
- exception bsb.exceptions.DistributorError(*args, **kwargs)¶
Bases:
CompilationErrorDistributorError exception
- exception bsb.exceptions.DynamicClassError(*args, **kwargs)¶
Bases:
ConfigurationErrorDynamicClassError exception
- exception bsb.exceptions.DynamicClassInheritanceError(*args, **kwargs)¶
Bases:
DynamicClassErrorDynamicClassInheritanceError exception
- exception bsb.exceptions.DynamicObjectNotFoundError(*args, **kwargs)¶
Bases:
DynamicClassErrorDynamicObjectNotFoundError exception
- exception bsb.exceptions.EmptyBranchError(*args, **kwargs)¶
Bases:
MorphologyErrorEmptyBranchError exception
- exception bsb.exceptions.EmptySelectionError(*args, **kwargs)¶
Bases:
MorphologyErrorEmptySelectionError exception
- exception bsb.exceptions.EmptyVoxelSetError(*args, **kwargs)¶
Bases:
VoxelSetErrorEmptyVoxelSetError exception
- exception bsb.exceptions.ExternalSourceError(*args, **kwargs)¶
Bases:
ConnectivityErrorExternalSourceError exception
- exception bsb.exceptions.FileImportError(*args, **kwargs)¶
Bases:
ParserErrorFileImportError exception
- exception bsb.exceptions.FileReferenceError(*args, **kwargs)¶
Bases:
ParserErrorFileReferenceError exception
- exception bsb.exceptions.GatewayError(*args, **kwargs)¶
Bases:
ScaffoldErrorGatewayError exception
- exception bsb.exceptions.IncompleteExternalMapError(*args, **kwargs)¶
Bases:
ExternalSourceErrorIncompleteExternalMapError exception
- exception bsb.exceptions.IncompleteMorphologyError(*args, **kwargs)¶
Bases:
MorphologyErrorIncompleteMorphologyError exception
- exception bsb.exceptions.IndicatorError(*args, **kwargs)¶
Bases:
ConfigurationErrorIndicatorError exception
- exception bsb.exceptions.IntersectionDataNotFoundError(*args, **kwargs)¶
Bases:
DatasetNotFoundErrorIntersectionDataNotFoundError exception
- exception bsb.exceptions.InvalidReferenceError(*args, **kwargs)¶
Bases:
TypeHandlingErrorInvalidReferenceError exception
- exception bsb.exceptions.JobCancelledError(*args, **kwargs)¶
Bases:
JobPoolErrorJobCancelledError exception
- exception bsb.exceptions.JobPoolContextError(*args, **kwargs)¶
Bases:
JobPoolErrorJobPoolContextError exception
- exception bsb.exceptions.JobPoolError(*args, **kwargs)¶
Bases:
ScaffoldErrorJobPoolError exception
- exception bsb.exceptions.JobSchedulingError(*args, **kwargs)¶
Bases:
JobPoolErrorJobSchedulingError exception
- exception bsb.exceptions.LayoutError(*args, **kwargs)¶
Bases:
TopologyErrorLayoutError exception
- exception bsb.exceptions.MissingActiveConfigError(*args, **kwargs)¶
Bases:
StorageErrorMissingActiveConfigError exception
- exception bsb.exceptions.MissingMorphologyError(*args, **kwargs)¶
Bases:
MorphologyErrorMissingMorphologyError exception
- exception bsb.exceptions.MissingSourceError(*args, **kwargs)¶
Bases:
ExternalSourceErrorMissingSourceError exception
- exception bsb.exceptions.MorphologyDataError(*args, **kwargs)¶
Bases:
MorphologyErrorMorphologyDataError exception
- exception bsb.exceptions.MorphologyError(*args, **kwargs)¶
Bases:
ScaffoldErrorMorphologyError exception
- exception bsb.exceptions.MorphologyRepositoryError(*args, **kwargs)¶
Bases:
MorphologyErrorMorphologyRepositoryError exception
- exception bsb.exceptions.MorphologyWarning[source]¶
Bases:
ScaffoldWarning
- exception bsb.exceptions.NoReferenceAttributeSignal(*args, **kwargs)¶
Bases:
CfgReferenceErrorNoReferenceAttributeSignal exception
- exception bsb.exceptions.NodeNotFoundError(*args, **kwargs)¶
Bases:
ScaffoldErrorNodeNotFoundError exception
- exception bsb.exceptions.NoneReferenceError(*args, **kwargs)¶
Bases:
TypeHandlingErrorNoneReferenceError exception
- exception bsb.exceptions.OptionError(*args, **kwargs)¶
Bases:
ScaffoldErrorOptionError exception
- exception bsb.exceptions.PackageRequirementWarning[source]¶
Bases:
ScaffoldWarning
- exception bsb.exceptions.PackingError(*args, **kwargs)¶
Bases:
PlacementErrorPackingError exception
- exception bsb.exceptions.PackingWarning[source]¶
Bases:
PlacementWarning
- exception bsb.exceptions.ParameterError(*args, **kwargs)¶
Bases:
SimulationErrorParameterError exception
- exception bsb.exceptions.ParserError(*args, **kwargs)¶
Bases:
ScaffoldErrorParserError exception
- exception bsb.exceptions.PlacementError(*args, **kwargs)¶
Bases:
ScaffoldErrorPlacementError exception
- exception bsb.exceptions.PlacementRelationError(*args, **kwargs)¶
Bases:
PlacementErrorPlacementRelationError exception
- exception bsb.exceptions.PlacementWarning[source]¶
Bases:
ScaffoldWarning
- exception bsb.exceptions.PluginError(*args, **kwargs)¶
Bases:
ScaffoldErrorPluginError exception
- exception bsb.exceptions.ReadOnlyOptionError(*args, **kwargs)¶
Bases:
OptionErrorReadOnlyOptionError exception
- exception bsb.exceptions.RedoError(*args, **kwargs)¶
Bases:
CompilationErrorRedoError exception
- exception bsb.exceptions.ReificationError(*args, **kwargs)¶
Bases:
ParameterErrorReificationError exception
- exception bsb.exceptions.RequirementError(*args, **kwargs)¶
Bases:
ConfigurationErrorRequirementError exception
- exception bsb.exceptions.ScaffoldError(*args, **kwargs)¶
Bases:
DetailedExceptionScaffoldError exception
- exception bsb.exceptions.ScaffoldWarning[source]¶
Bases:
UserWarning
- exception bsb.exceptions.SelectorError(*args, **kwargs)¶
Bases:
ScaffoldErrorSelectorError exception
- exception bsb.exceptions.SimulationError(*args, **kwargs)¶
Bases:
ScaffoldErrorSimulationError exception
- exception bsb.exceptions.SourceQualityError(*args, **kwargs)¶
Bases:
ExternalSourceErrorSourceQualityError exception
- exception bsb.exceptions.StorageError(*args, **kwargs)¶
Bases:
ScaffoldErrorStorageError exception
- exception bsb.exceptions.TopologyError(*args, **kwargs)¶
Bases:
ScaffoldErrorTopologyError exception
- exception bsb.exceptions.TreeError(*args, **kwargs)¶
Bases:
ScaffoldErrorTreeError exception
- exception bsb.exceptions.TypeHandlingError(*args, **kwargs)¶
Bases:
ScaffoldErrorTypeHandlingError exception
- exception bsb.exceptions.UnfitClassCastError(*args, **kwargs)¶
Bases:
CastErrorUnfitClassCastError exception
- exception bsb.exceptions.UnknownConfigAttrError(*args, **kwargs)¶
Bases:
ConfigurationErrorUnknownConfigAttrError exception
- exception bsb.exceptions.UnknownGIDError(*args, **kwargs)¶
Bases:
ConnectivityErrorUnknownGIDError exception
- exception bsb.exceptions.UnknownStorageEngineError(*args, **kwargs)¶
Bases:
StorageErrorUnknownStorageEngineError exception
- exception bsb.exceptions.UnmanagedPartitionError(*args, **kwargs)¶
Bases:
TopologyErrorUnmanagedPartitionError exception
- exception bsb.exceptions.UnresolvedClassCastError(*args, **kwargs)¶
Bases:
CastErrorUnresolvedClassCastError exception
- exception bsb.exceptions.VoxelSetError(*args, **kwargs)¶
Bases:
ScaffoldErrorVoxelSetError exception
bsb.exceptions module¶
- class bsb.mixins.HasDependencies[source]¶
Mixin class to mark that this node may depend on other nodes.
- class bsb.mixins.InvertedRoI[source]¶
This mixin inverts the perspective of the
get_region_of_interestinterface and lets you find presynaptic regions of interest for a postsynaptic chunk.Usage:
..code-block:: python
- class MyConnStrat(InvertedRoI, ConnectionStrategy):
- def get_region_of_interest(post_chunk):
return [pre_chunk1, pre_chunk2]
bsb.option module¶
This module contains the classes required to construct options.
- class bsb.option.BsbOption(positional=False)[source]¶
Bases:
objectBase option class.
Can be subclassed to create new options.
- get(prio=None)[source]¶
Get the option’s value. Cascades the script, cli, env & default descriptors together.
- Returns:
option value
- get_cli_tags()[source]¶
Return the
argparsepositional arguments from the tags.- Returns:
-xor--xxxfor each CLI tag.- Return type:
- classmethod register()[source]¶
Register this option class into the
bsb.optionsmodule.
- unregister()[source]¶
Remove this option class from the
bsb.optionsmodule, not part of the public API as removing options is undefined behavior but useful for testing.
- class bsb.option.CLIOptionDescriptor(*tags)[source]¶
Bases:
OptionDescriptorDescriptor that retrieves its value from the given CLI command arguments.
- slug = 'cli'¶
- class bsb.option.EnvOptionDescriptor(*args, flag=False)[source]¶
Bases:
OptionDescriptorDescriptor that retrieves its value from the environment variables.
- slug = 'env'¶
- class bsb.option.OptionDescriptor(*tags)[source]¶
Bases:
objectBase option property descriptor.
Can be inherited from to create a cascading property such as the default CLI, env & script descriptors.
- class bsb.option.ProjectOptionDescriptor(*tags)[source]¶
Bases:
OptionDescriptorDescriptor that retrieves and stores values in the pyproject.toml file.
Traverses up the filesystem tree until one is found.
- slug = 'project'¶
- class bsb.option.ScriptOptionDescriptor(*tags)[source]¶
Bases:
OptionDescriptorDescriptor that retrieves and sets its value from/to the
bsb.optionsmodule.- slug = 'script'¶
bsb.options module¶
This module contains the global options.
You can set options at the script level (which superceeds all other levels such as
environment variables or project settings).
import bsb.options
from bsb import BsbOption
class MyOption(
BsbOption,
cli=("my_setting",),
env=("MY_SETTING",),
script=("my_setting", "my_alias")
):
def get_default(self):
return 4
# Register the option into the `bsb.options` module
MyOption.register()
assert bsb.options.my_setting == 4
bsb.options.my_alias = 6
assert bsb.options.my_setting == 6
Your MyOption will also be available on all CLI commands as --my_setting and will
be read from the MY_SETTING environment variable.
- class bsb.options.ProfilingOption(positional=False)[source]¶
Bases:
BsbOptionEnables profiling.
- cli¶
Descriptor that retrieves its value from the given CLI command arguments.
- description = None¶
- env¶
Descriptor that retrieves its value from the environment variables.
- inverted_flag = False¶
- is_flag = True¶
- name = 'profiling'¶
- positional = False¶
- project¶
Descriptor that retrieves and stores values in the pyproject.toml file.
Traverses up the filesystem tree until one is found.
- readonly = False¶
- script¶
Descriptor that retrieves and sets its value from/to the
bsb.optionsmodule.
- use_action = False¶
- use_extend = False¶
- class bsb.options.SimulationProgress(positional=False)[source]¶
Bases:
BsbOptionActivate reports during simulations, set the time steps of the report.
- cli¶
Descriptor that retrieves its value from the given CLI command arguments.
- description = None¶
- env¶
Descriptor that retrieves its value from the environment variables.
- inverted_flag = False¶
- is_flag = False¶
- name = 'sim_console_progress'¶
- positional = False¶
- project¶
Descriptor that retrieves and stores values in the pyproject.toml file.
Traverses up the filesystem tree until one is found.
- readonly = False¶
- script¶
Descriptor that retrieves and sets its value from/to the
bsb.optionsmodule.
- use_action = False¶
- use_extend = False¶
- class bsb.options.VerbosityOption(positional=False)[source]¶
Bases:
BsbOptionSet the verbosity of the package.
Verbosity 0 is completely silent, 1 is default, 2 is verbose, 3 is progress and 4 is debug.
- cli¶
Descriptor that retrieves its value from the given CLI command arguments.
- description = None¶
- env¶
Descriptor that retrieves its value from the environment variables.
- inverted_flag = False¶
- is_flag = False¶
- name = 'verbosity'¶
- positional = False¶
- project¶
Descriptor that retrieves and stores values in the pyproject.toml file.
Traverses up the filesystem tree until one is found.
- readonly = False¶
- script¶
Descriptor that retrieves and sets its value from/to the
bsb.optionsmodule.
- use_action = False¶
- use_extend = False¶
- bsb.options.get_module_option(tag)[source]¶
Get the value of a module option. Does the same thing as
getattr(options, tag)- Parameters:
tag (str) – Name the option is registered with in the module.
- bsb.options.get_option_classes()[source]¶
Return all of the classes that are used to create singleton options from. Useful to access the option descriptors rather than the option values.
- Returns:
The classes of all the installed options by name.
- Return type:
- bsb.options.get_option_descriptor(name)[source]¶
Return an option.
- Parameters:
name (str) – Name of the option to look for.
- Returns:
The option singleton of that name.
- Return type:
- bsb.options.get_project_option(tag)[source]¶
Find a project option.
- Parameters:
tag (str) – dot-separated path of the option. e.g.
networks.config_link.- Returns:
Project option instance
- Return type:
- bsb.options.read_option(tag=None)[source]¶
Read an option value from the project settings. Returns all project settings if tag is omitted.
- Parameters:
tag (str) – Dot-separated path of the project option
- Returns:
Value for the project option
- Return type:
Any
- bsb.options.register_option(name, option)[source]¶
Register an option as a global BSB option. Options that are installed by the plugin system are automatically registered on import of the BSB.
- Parameters:
name (str) – Name for the option, used to store and retrieve its singleton.
option (
option.BsbOption) – Option instance, to be used as a singleton.
- bsb.options.set_module_option(tag, value)[source]¶
Set the value of a module option. Does the same thing as
setattr(options, tag, value).- Parameters:
tag (str) – Name the option is registered with in the module.
value (Any) – New module value for the option
- bsb.options.store_option(tag, value)[source]¶
Store an option value permanently in the project settings.
- Parameters:
tag (str) – Dot-separated path of the project option
value (Any) – New value for the project option
- bsb.options.unregister_option(option)[source]¶
Unregister a globally registered option. Also removes its script and project parts.
- Parameters:
option (
option.BsbOption) – Option singleton, to be removed.
bsb.plugins module¶
Plugins module.
Uses pkg_resources to detect installed plugins and loads them as
categories.
bsb.postprocessing module¶
- class bsb.postprocessing.AfterConnectivityHook(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ABC- get_node_name()¶
- class bsb.postprocessing.AfterPlacementHook(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ABC- get_node_name()¶
- class bsb.postprocessing.BidirectionalContact(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
AfterConnectivityHook
- class bsb.postprocessing.Relay(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
AfterConnectivityHookReplaces connections on a cell with the relayed connections to the connection targets of that cell.
Not implemented yet.
- cell_types¶
- get_node_name()¶
- class bsb.postprocessing.SpoofDetails(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
AfterConnectivityHookCreate fake morphological intersections between already connected non-detailed connection types.
- casts = {'postsynaptic': <class 'str'>, 'presynaptic': <class 'str'>}¶
bsb.reporting module¶
bsb.trees module¶
Module for binary space partitioning, to facilitate optimal runtime complexity for n-point problems.
- class bsb.trees.BoxTree(boxes)[source]¶
Tree for fast lookup of repeat queries of axis aligned rhomboids.
bsb.voxels module¶
- class bsb.voxels.VoxelData(data, keys=None)[source]¶
Bases:
ndarrayChunk identifier, consisting of chunk coordinates and size.
- property keys¶
Returns the keys, or column labels, associated to each data column.
- class bsb.voxels.VoxelSet(voxels, size, data=None, data_keys=None, irregular=False)[source]¶
Bases:
objectConstructs a voxel set from the given voxel indices or coordinates.
- Parameters:
voxels (numpy.ndarray) – The spatial coordinates, or grid indices of each voxel. Nx3 matrix
size (numpy.ndarray) – The global or individual size of the voxels. If it has 2 dimensions it needs to have the same length as voxels, and will be used as individual voxels.
data
Warning
If
numpy.ndarrayare passed, they will not be copied in order to save memory and time. You may accidentally change a voxelset if you later change the same array.- property bounds¶
The minimum and maximum coordinates of this set.
- Return type:
- property data¶
The size of the voxels. When it is 0D or 1D it counts as the size for all voxels, if it is 2D it is 1 an individual size per voxel.
- Return type:
numpy.ndarray | None
- property data_keys¶
- property of_equal_size¶
- property raw¶
- property size¶
The size of the voxels. When it is 0D or 1D it counts as the size for all voxels, if it is 2D it is 1 an individual size per voxel.
- Return type:
- property volume¶
Module contents¶
bsb-core is the backbone package contain the essential code of the BSB: A component framework for multiscale bottom-up neural modelling.
bsb-core needs to be installed alongside a bundle of desired bsb plugins, some of which are essential for bsb-core to function. First time users are recommended to install the bsb package instead.