bsb.placement package#
Submodules#
bsb.placement.arrays module#
- class bsb.placement.arrays.ParallelArrayPlacement(*args, _parent=None, _key=None, **kwargs)[source]#
Implementation of the placement of cells in parallel arrays.
- angle#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- get_node_name()#
- place(chunk, indicators)[source]#
Cell placement: Create a lattice of parallel arrays/lines in the layer’s surface.
- queue(pool, chunk_size)#
Specifies how to queue this placement strategy into a job pool. Can be overridden, the default implementation asks each partition to chunk itself and creates 1 placement job per chunk.
bsb.placement.distributor module#
- class bsb.placement.distributor.DistributionContext(indicator: bsb.placement.indicator.PlacementIndications, partitions: List[bsb.topology.partition.Partition])[source]#
- indicator: PlacementIndications#
- class bsb.placement.distributor.Distributor(*args, _parent=None, _key=None, **kwargs)[source]#
- abstract distribute(positions, context)[source]#
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()#
- class bsb.placement.distributor.DistributorsNode(*args, _parent=None, _key=None, **kwargs)[source]#
- get_node_name()#
- morphologies#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- properties#
- class bsb.placement.distributor.ExplicitNoRotations(*args, _parent=None, _key=None, **kwargs)[source]#
- distribute(positions, context)[source]#
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()#
- class bsb.placement.distributor.ImplicitNoRotations(*args, _parent=None, _key=None, **kwargs)[source]#
- distribute(positions, context)#
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()#
- class bsb.placement.distributor.MorphologyDistributor(*args, _parent=None, _key=None, **kwargs)[source]#
- abstract distribute(positions, morphologies, context)[source]#
Is called to distribute cell morphologies and optionally rotations.
- Parameters:
positions (numpy.ndarray) – Placed positions under consideration
morphologies – The template morphology loaders. You can decide to use them and/or generate new ones in the MorphologySet that you produce. If you produce any new morphologies, don’t forget to encapsulate them in a
StoredMorphology
loader, or better yet, use theMorphologyGenerator
.context (DistributionContext) – The placement indicator and partitions.
- Returns:
A MorphologySet with assigned morphologies, and optionally a RotationSet
- Return type:
Union[MorphologySet, Tuple[ MorphologySet, RotationSet]]
- get_node_name()#
- class bsb.placement.distributor.MorphologyGenerator(*args, _parent=None, _key=None, **kwargs)[source]#
Special case of the morphology distributor that provides extra convenience when generating new morphologies.
- distribute(positions, morphologies, context)[source]#
Is called to distribute cell morphologies and optionally rotations.
- Parameters:
positions (numpy.ndarray) – Placed positions under consideration
morphologies – The template morphology loaders. You can decide to use them and/or generate new ones in the MorphologySet that you produce. If you produce any new morphologies, don’t forget to encapsulate them in a
StoredMorphology
loader, or better yet, use theMorphologyGenerator
.context (DistributionContext) – The placement indicator and partitions.
- Returns:
A MorphologySet with assigned morphologies, and optionally a RotationSet
- Return type:
Union[MorphologySet, Tuple[ MorphologySet, RotationSet]]
- get_node_name()#
- class bsb.placement.distributor.RandomMorphologies(*args, _parent=None, _key=None, **kwargs)[source]#
Distributes selected morphologies randomly without rotating them.
{ "placement": { "place_XY": { "distribute": { "morphologies": {"strategy": "random"} } }}}
- distribute(positions, morphologies, context)[source]#
Uses the morphology selection indicators to select morphologies and returns a MorphologySet of randomly assigned morphologies
- get_node_name()#
- may_be_empty#
- class bsb.placement.distributor.RandomRotations(*args, _parent=None, _key=None, **kwargs)[source]#
- distribute(positions, context)[source]#
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()#
- class bsb.placement.distributor.RotationDistributor(*args, _parent=None, _key=None, **kwargs)[source]#
Rotates everything by nothing!
- abstract distribute(positions, context)[source]#
Is called to distribute cell properties.
- Parameters:
partitions – The partitions the cells were placed in.
- Returns:
An array with the property data
- Return type:
- get_node_name()#
- class bsb.placement.distributor.RoundRobinMorphologies(*args, _parent=None, _key=None, **kwargs)[source]#
Distributes selected morphologies round robin, values are looped and assigned one by one in order.
{ "placement": { "place_XY": { "distribute": { "morphologies": {"strategy": "roundrobin"} } }}}
- distribute(positions, morphologies, context)[source]#
Is called to distribute cell morphologies and optionally rotations.
- Parameters:
positions (numpy.ndarray) – Placed positions under consideration
morphologies – The template morphology loaders. You can decide to use them and/or generate new ones in the MorphologySet that you produce. If you produce any new morphologies, don’t forget to encapsulate them in a
StoredMorphology
loader, or better yet, use theMorphologyGenerator
.context (DistributionContext) – The placement indicator and partitions.
- Returns:
A MorphologySet with assigned morphologies, and optionally a RotationSet
- Return type:
Union[MorphologySet, Tuple[ MorphologySet, RotationSet]]
- get_node_name()#
- may_be_empty#
- class bsb.placement.distributor.VolumetricRotations(*args, _parent=None, _key=None, **kwargs)[source]#
- default_vector#
Default orientation vector of each position.
- distribute(positions, context)[source]#
Rotates according to a volumetric orientation field of specific resolution. For each position, find the equivalent voxel in the volumetric orientation field and apply the rotation from the default_vector to the corresponding orientation vector. Positions outside the orientation field will not be rotated.
- Parameters:
positions – Placed positions under consideration. Its shape is (N, 3) where N is the number of positions.
context (DistributionContext) – The placement indicator and partitions.
- Returns:
A RotationSet object containing the 3D Euler angles in degrees for the rotation of each position.
- Return type:
- get_node_name()#
- orientation_path#
Path to the nrrd file containing the volumetric orientation field. It provides a rotation for each voxel considered. Its shape should be (3, L, W, D) where L, W and D are the sizes of the field.
- orientation_resolution#
Voxel size resolution of the orientation field.
- space_origin#
Origin point for the orientation field.
bsb.placement.indicator module#
- class bsb.placement.indicator.PlacementIndications(*args, _parent=None, _key=None, **kwargs)[source]#
- count#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- count_ratio#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- density#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- density_key#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- density_ratio#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- geometry#
- get_node_name()#
- morphologies#
- planar_density#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- radius#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- relative_to#
- class bsb.placement.indicator.PlacementIndicator(strat, cell_type)[source]#
-
- property cell_type#
- guess(chunk=None, voxels=None)[source]#
Estimate the count of cell to place based on the cell_type’s PlacementIndications. Float estimates are converted to int using an acceptance-rejection method.
- Parameters:
chunk (bsb.storage.Chunk) – if provided, will estimate the number of cell within the Chunk.
voxels (bsb.voxels.VoxelSet) – if provided, will estimate the number of cell within the VoxelSet. Only for cells with the indication “density_key” set or with the indication “relative_to” set and the target cell has the indication “density_key” set.
- Returns:
Cell counts for each chunk or voxel.
- Return type:
bsb.placement.particle module#
- class bsb.placement.particle.AdaptiveNeighbourhood(track_displaced=False, scaffold=None, strat=None)[source]#
- class bsb.placement.particle.Neighbourhood(epicenter, neighbours, neighbour_radius, partners, partner_radius)[source]#
- class bsb.placement.particle.ParticlePlacement(*args, _parent=None, _key=None, **kwargs)[source]#
Place cells in random positions, then have them repel each other until there is no overlap.
- bounded#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- get_node_name()#
- place(chunk, indicators)[source]#
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold
)place_cells()
method.- Parameters:
chunk (bsb.storage.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
- class bsb.placement.particle.ParticleSystem(track_displaced=False, scaffold=None, strat=None)[source]#
-
- property positions#
- prune(at_risk_particles=None, voxels=None)[source]#
Remove particles that have been moved outside of the bounds of the voxels.
- Parameters:
at_risk_particles (
numpy.ndarray
) – Subset of particles that might’ve been moved and might need to be moved, if omitted check all particles.voxels – A subset of the voxels that the particles have to be in bounds of, if omitted all voxels are used.
- class bsb.placement.particle.RandomPlacement(*args, _parent=None, _key=None, **kwargs)[source]#
Place cells in random positions.
- get_node_name()#
- place(chunk, indicators)[source]#
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold
)place_cells()
method.- Parameters:
chunk (bsb.storage.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
- class bsb.placement.particle.SmallestNeighbourhood(track_displaced=False, scaffold=None, strat=None)[source]#
bsb.placement.satellite module#
- class bsb.placement.satellite.Satellite(*args, _parent=None, _key=None, **kwargs)[source]#
Implementation of the placement of cells in layers as satellites of existing cells
Places cells as a satellite cell to each associated cell at a random distance depending on the radius of both cells.
- get_node_name()#
- indicator_class#
alias of
SatelliteIndicator
- partitions#
- per_planet#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- place(chunk, indicators)[source]#
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold
)place_cells()
method.- Parameters:
chunk (bsb.storage.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
- planet_types#
- class bsb.placement.satellite.SatelliteIndicator(strat, cell_type)[source]#
- guess(chunk=None)[source]#
Estimate the count of cell to place based on the cell_type’s PlacementIndications. Float estimates are converted to int using an acceptance-rejection method.
- Parameters:
chunk (bsb.storage.Chunk) – if provided, will estimate the number of cell within the Chunk.
voxels (bsb.voxels.VoxelSet) – if provided, will estimate the number of cell within the VoxelSet. Only for cells with the indication “density_key” set or with the indication “relative_to” set and the target cell has the indication “density_key” set.
- Returns:
Cell counts for each chunk or voxel.
- Return type:
bsb.placement.strategy module#
- class bsb.placement.strategy.Entities(*args, _parent=None, _key=None, **kwargs)[source]#
Implementation of the placement of entities that do not have a 3D position, but that need to be connected with other cells of the network.
- entities = True#
- place(chunk, indicators)[source]#
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold
)place_cells()
method.- Parameters:
chunk (bsb.storage.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
- class bsb.placement.strategy.FixedPositions(*args, _parent=None, _key=None, **kwargs)[source]#
- get_node_name()#
- place(chunk, indicators)[source]#
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold
)place_cells()
method.- Parameters:
chunk (bsb.storage.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator
- class bsb.placement.strategy.PlacementStrategy(*args, _parent=None, _key=None, **kwargs)[source]#
Quintessential interface of the placement module. Each placement strategy defines an approach to placing neurons into a volume.
- after#
- cell_types#
- distribute#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- get_indicators()[source]#
Return indicators per cell type. Indicators collect all configuration information into objects that can produce guesses as to how many cells of a type should be placed in a volume.
- get_node_name()#
- indicator_class#
alias of
PlacementIndicator
- name#
Base implementation of all the different configuration attributes. Call the factory function
attr()
instead.
- overrides#
- partitions#
- abstract place(chunk, indicators)[source]#
Central method of each placement strategy. Given a chunk, should fill that chunk with cells by calling the scaffold’s (available as
self.scaffold
)place_cells()
method.- Parameters:
chunk (bsb.storage.Chunk) – Chunk to fill
indicators (Mapping[str, bsb.placement.indicator.PlacementIndicator]) – Dictionary of each cell type to its PlacementIndicator