Developer modules#

bsb.services#

Provides several services for optional dependencies.

bsb.services.MPI = <bsb.services.mpi.MPIService object>#

MPI service

bsb.services.MPILock = <bsb.services.mpilock.MPILockModule object>#

MPILock service

Service module. Register or access interfaces that may be provided, mocked or missing, but should always behave neatly on import.

exception bsb.services.WorkflowError(_ExceptionGroup__message: str, _ExceptionGroup__exceptions: Sequence[_ExceptionT_co])[source]#

Bases: ExceptionGroup

bsb.services.register_service(attr, provider)[source]#

bsb.topology._layout module#

Internal layout module. Makes sure regions and partitions don’t mutate during layout.

class bsb.topology._layout.Layout(data, owner=None, children=None, frozen=False)[source]#

Bases: object

Container class for all types of partition data. The layout swaps the data of the partition with temporary layout associated data, and tries out experimental changes to the partition data, if the layout process fails, the original partition data is reinstated.

accept()[source]#
property children#
copy()[source]#
property data#
swap()[source]#
class bsb.topology._layout.PartitionData[source]#

Bases: ABC

The partition data is a class that stores the description of a partition for a partition. This allows the Partition interface to define mutating operations such as translate, rotate, scale; for a dry-run we only have to swap out the actual data with temporary data, and the mutation is prevented.

abstract copy()[source]#
class bsb.topology._layout.RhomboidData(ldc, mdc)[source]#

Bases: PartitionData

copy()[source]#

Copy this boundary to a new instance.

property depth#
property dimensions#
property height#
property width#
property x#
property y#
property z#
bsb.topology._layout.box_layout(ldc, mdc)[source]#

bsb._util#

Global internal utility module.

bsb._util.assert_samelen(*args)[source]#

Assert that all input arguments have the same length.

bsb._util.get_qualified_class_name(x)[source]#

Return an object’s module and class name

bsb._util.ichain(iterable, /)#

Alternative chain() constructor taking a single iterable argument that evaluates lazily.

bsb._util.immutable()[source]#

Decorator to mark a method as immutable, so that any calls to it return, and are performed on, a copy of the instance.

bsb._util.listify_input(value)[source]#

Turn any non-list values into a list containing the value. Sequences will be converted to a list using list(), None will be replaced by an empty list.

bsb._util.merge_dicts(a, b)[source]#

Merge 2 dictionaries and their subdictionaries

bsb._util.obj_str_insert(__str__)[source]#

Decorator to insert the return value of __str__ into ‘<classname {returnvalue} at 0x…>’

bsb._util.rotation_matrix_from_vectors(vec1, vec2)[source]#

Find the rotation matrix that aligns vec1 to vec2

Parameters:
  • vec1 – A 3d “source” vector

  • vec2 – A 3d “destination” vector

Return mat:

A transform matrix (3x3) which when applied to vec1, aligns it with vec2.

bsb._util.sanitize_ndarray(arr_input, shape, dtype=None)[source]#

Convert an object to an ndarray and shape, avoiding to copy it wherever possible.

bsb._util.suppress_stdout()[source]#

Context manager that attempts to silence regular stdout and stderr. Some binary components may yet circumvene this if they access the underlying OS’s stdout directly, like streaming to /dev/stdout.

bsb._util.unique(iter_: Iterable[Any])[source]#

Return a new list containing all the unique elements of an iterator