bsb.simulation package¶
Submodules¶
bsb.simulation.simulation module¶
- class bsb.simulation.simulation.Simulation(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
object- after_prepare: cfgdict[str, AfterPrepareHook]¶
Dictionary of hooks to run once the simulation has been prepared, before it runs.
- after_simulation: cfgdict[str, AfterSimulationHook]¶
Dictionary of hooks to run once the simulation has finished and its results have been collected.
- connection_models: cfgdict[ConnectionModel]¶
Dictionary linking the connection sets name to its model.
- devices: cfgdict[DeviceModel]¶
Dictionary linking the device name to its model.
- get_connectivity_sets() Mapping[ConnectionModel, ConnectivitySet][source]¶
- Return type:
- get_model_of(type: CellType | ConnectionStrategy) CellModel | ConnectionModel[source]¶
- Parameters:
type (CellType | ConnectionStrategy)
- Return type:
- get_node_name()¶
bsb.simulation.adapter module¶
- class bsb.simulation.adapter.FixedStepProgressController(simulations, adapter, step=1)[source]¶
Bases:
object
- class bsb.simulation.adapter.SimulationData(simulation: Simulation, result=None, filename=None, comm=None, simulation_id=None)[source]¶
Bases:
object- Parameters:
simulation (Simulation)
- class bsb.simulation.adapter.SimulatorAdapter(comm=None)[source]¶
Bases:
ABC- Parameters:
comm – The mpi4py MPI communicator to use. Only nodes in the communicator will participate in the simulation. The first node will idle as the main node.
- collect(results)[source]¶
Collect the output the simulations that completed.
- Returns:
Collected simulation results.
- Return type:
- new_run_id() str[source]¶
One identity for a run, agreed by every rank taking part in it.
collective Every rank of
commhas to call this, which is why it belongs inprepare: preparing a simulation reads the network and builds it in the simulator, so every rank is there already. A result is handed the answer rather than agreeing one itself, since constructing a result is not collective and must not become so.- Returns:
An identity every rank of this adapter agrees on.
- Return type:
- abstractmethod prepare(simulation, filename=None)[source]¶
Reset the simulation backend and prepare for the given simulation.
- Parameters:
simulation (Simulation) – The simulation configuration to prepare.
- Returns:
Prepared simulation data.
- Return type:
- abstractmethod run(*simulations)[source]¶
Fire up the prepared adapter.
- Parameters:
simulations (Simulation) – One or a list of simulation configurations to simulate.
- Returns:
List of simulation results.
- Return type:
- run_after_prepare(simulation, simdata)[source]¶
Run the after_prepare hooks of a simulation on what was prepared.
- Parameters:
simulation (Simulation) – The simulation configuration that was prepared.
simdata (SimulationData) – What the backend built for it.
- run_after_simulation(simulations, results)[source]¶
Run the after_simulation hooks of each simulation on its own result.
- Parameters:
simulations (list[Simulation]) – The simulation configurations that were run.
results (list[SimulationResult]) – The collected result of each simulation, in the same order.
- simulate(*simulations, filename=None)[source]¶
Simulate the given simulations.
- Parameters:
simulations (Simulation) – One or a list of simulation configurations to simulate.
- Returns:
List of simulation results for each simulation run.
- Return type:
bsb.simulation.cell module¶
- class bsb.simulation.cell.CellModel(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
SimulationComponentCell models are simulator specific representations of a cell type.
- get_node_name()¶
- parameters: cfgdict[str, CellParameter]¶
Parameters of the model, computed once per cell when the simulation is loaded.
Keyed by the model parameter they set. A bare value is a constant; a node with a
strategyselects aCellParameter.
bsb.simulation.component module¶
- class bsb.simulation.component.SimulationComponent(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
RngConsumer- get_node_name()¶
- implement(adapter, simulation, simdata)[source]¶
Method called when simulation is being set up. Can be used for components to set themselves up and store the context they need to operate.
- name: str¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- property simulation¶
bsb.simulation.connection module¶
- class bsb.simulation.connection.ConnectionModel(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
SimulationComponent- get_node_name()¶
- parameters: cfgdict[str, ConnectionParameter]¶
Parameters of the model, computed once per connection when the simulation is loaded.
Keyed by the model parameter they set. A bare value is a constant; a node with a
strategyselects aConnectionParameter.
bsb.simulation.device module¶
- class bsb.simulation.device.DeviceModel(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
SimulationComponent- get_node_name()¶
bsb.simulation.parameter module¶
- class bsb.simulation.parameter.CellParameter(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ParameterA parameter computed once per cell of a placement set.
- abstractmethod compute(simulation: Simulation, ps: PlacementSet) ndarray[source]¶
Compute one value per cell in
ps, in placement set order.- Parameters:
simulation (Simulation) – The simulation being prepared.
ps (PlacementSet) – The placement set of the cell model this is configured on.
- Returns:
One value per cell.
- Return type:
- get_node_name()¶
- class bsb.simulation.parameter.ConnectionParameter(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ParameterA parameter computed once per connection of a connectivity set.
- abstractmethod compute(simulation: Simulation, cs: ConnectivitySet, pre_locs: ndarray, post_locs: ndarray) ndarray[source]¶
Compute one value per connection, in the order the locations are given.
- Parameters:
simulation (Simulation) – The simulation being prepared.
cs (ConnectivitySet) – The connectivity set of the connection model this is configured on.
pre_locs (ndarray) – Presynaptic locations, as
(cell, branch, point)rows.post_locs (ndarray) – Postsynaptic locations, as
(cell, branch, point)rows.
- Returns:
One value per connection.
- Return type:
- get_node_name()¶
- class bsb.simulation.parameter.Constant(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ParameterA parameter that yields one value, whatever it is asked to compute over.
Written as a bare value (
{"C_m": 250.0}) rather than as a node, and accepted wherever a parameter of any arity is; it ignores the arguments it is handed.- get_node_name()¶
- value¶
The value to assign.
- class bsb.simulation.parameter.DistanceDelayParameter(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ConnectionParameterTransmission delay derived from the distance between the connected somata.
The delay is the soma-to-soma distance divided by the axonal conduction speed, floored at the simulation’s resolution so no connection is asked to deliver faster than the simulation can step.
- compute(simulation, cs, pre_locs, post_locs)[source]¶
Compute one value per connection, in the order the locations are given.
- Parameters:
simulation – The simulation being prepared.
cs – The connectivity set of the connection model this is configured on.
pre_locs – Presynaptic locations, as
(cell, branch, point)rows.post_locs – Postsynaptic locations, as
(cell, branch, point)rows.
- Returns:
One value per connection.
- get_node_name()¶
- property simulation¶
The simulation this parameter is configured on.
Walked by type rather than by counting parents, because how deeply a parameter sits is the model’s business, not this parameter’s.
- class bsb.simulation.parameter.Parameter(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ABCBase class for anything that answers “what is the value of this model parameter?”.
A parameter is configured like any other node and computes its values when the simulation is loaded. What it is computed over is what varies, so this base declares no
computesignature; each arity below declares its own, and a parameter is only accepted where its arity fits.It is an
abc.ABCwithout abstract methods on purpose: subclasses need the abstract machinery for thecomputethey each declare, and inheriting it from here is what keeps one metaclass across the whole hierarchy.- get_node_name()¶
- class bsb.simulation.parameter.PointParameter(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ParameterA parameter computed once per point of a cell’s morphology.
Points are addressed the way BSB addresses morphologies everywhere else, as
(branch, point). How a simulator discretises a morphology is its own concern; an adapter maps points onto whatever its backend builds.- abstractmethod compute(simulation: Simulation, ps: PlacementSet, cell_id: int, morphology: Morphology) ndarray[source]¶
Compute one value per point of
morphology, in flattened branch order.- Parameters:
simulation (Simulation) – The simulation being prepared.
ps (PlacementSet) – The placement set the cell belongs to.
cell_id (int) – Index of the cell within
ps.morphology (Morphology) – The cell’s morphology.
- Returns:
One value per morphology point.
- Return type:
- get_node_name()¶
- class bsb.simulation.parameter.constant_parameter[source]¶
Bases:
TypeHandlerCast a configuration value to a
Constant.The narrow counterpart of
parameters_of_type, for notations documented as holding constants. It refuses a computed parameter rather than silently accepting one, soconstantskeeps meaning what it says and the widerparametersblock is the one place a strategy belongs.
- bsb.simulation.parameter.expand_to(n, value)[source]¶
One value for each of
n, out of whatever a parameter computed.A parameter that yields a single value stands for that value repeated, which is all a constant is: the degenerate case of a parameter that does not vary. Anything that already has a length has to have the right one.
- Parameters:
n – How many values are needed.
value – What the parameter computed.
- Returns:
nvalues.- Raises:
ValueError – If
valueis neither one value nornof them.
- class bsb.simulation.parameter.parameters_of_type(base=<class 'bsb.simulation.parameter.Parameter'>)[source]¶
Bases:
TypeHandlerCast a configuration value to a
Parameterof a given arity.Keeps the shorthands a value can be written in, and homogenizes them into parameter nodes so consumers only ever deal with one thing:
a bare value becomes a
Constant;a node with a
strategykey is cast to that strategy ofbase;an already-constructed parameter passes through.
Casting through a type handler, rather than typing the attribute as
baseitself, is what lets oneConstantbe accepted at every arity without needing a separate constant class per arity.
bsb.simulation.postprocessing module¶
- class bsb.simulation.postprocessing.AfterPrepareHook(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ABC,RngConsumerHook that runs once the simulation it is configured on has been prepared, before it is run.
Its counterpart to
AfterSimulationHook: this one sees the simulation the backend has just built and can still change it, where that one sees what the run produced.The hook runs on every node that took part in preparing the simulation, so a hook that writes output is responsible for its own MPI awareness, through
adapter.comm.- get_node_name()¶
- name: str¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- abstractmethod postprocess(adapter: SimulatorAdapter, simulation: Simulation, simdata: SimulationData)[source]¶
Process the prepared simulation.
- Parameters:
adapter (SimulatorAdapter) – Adapter that prepared the simulation.
simulation (Simulation) – Simulation configuration that was prepared.
simdata (SimulationData) – What the backend built for it: its populations, connections and devices.
- class bsb.simulation.postprocessing.AfterSimulationHook(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
ABC,RngConsumerHook that runs after the simulation it is configured on has finished and its results have been collected.
The hook runs on every node that took part in the simulation, so hooks that write output are responsible for their own MPI awareness, through
adapter.comm.- get_node_name()¶
- name: str¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- abstractmethod postprocess(adapter: SimulatorAdapter, simulation: Simulation, result: SimulationResult)[source]¶
Process the outcome of the simulation.
- Parameters:
adapter (SimulatorAdapter) – Adapter that ran the simulation. The simulator is still set up at this point, so backend state can be inspected here.
simulation (Simulation) – Simulation configuration that was run.
result (SimulationResult) – Collected results of the simulation.
bsb.simulation.results module¶
- class bsb.simulation.results.NetworkRecording(device: str | None, kind: str | None, direction: str | None, signal: Any, target: RecordedCell | RecordedPoint | RecordedSynapse | RecordedDevice | None = None, run: SimulationRun | None = None)[source]¶
Bases:
RecordingA recording traced back to the network it was simulated on.
- Parameters:
device (str | None)
kind (str | None)
direction (str | None)
signal (Any)
target (RecordedCell | RecordedPoint | RecordedSynapse | RecordedDevice | None)
run (SimulationRun | None)
- run: SimulationRun | None = None¶
The run that made the recording.
- target: RecordedCell | RecordedPoint | RecordedSynapse | RecordedDevice | None = None¶
What was recorded: a
RecordedCell,RecordedPoint,RecordedSynapseorRecordedDevice, depending on the recording’skind.Nonefor a kind this BSB does not know.
- class bsb.simulation.results.RecordedCell(id: int, model: str, _placement: Any)[source]¶
Bases:
objectA cell of the network, as a recording addresses it.
- property morphology: Morphology | None¶
The morphology of the cell as it is in the network: rotated by the cell’s rotation and moved to its position. A copy, so changing it changes nothing in the network.
Nonewhen its placement set stores no morphologies.
- property placement_set: PlacementSet¶
The placement set of that cell type.
- property position: numpy.ndarray | None¶
Position of the cell, or
Nonewhen its placement set stores none.
- property rotation: scipy.spatial.transform.Rotation | None¶
The rotation of the cell’s morphology in the network, or
Nonewhen its placement set stores no rotations.
- class bsb.simulation.results.RecordedDevice(name: str, kind: str | None, configuration: dict | None)[source]¶
Bases:
objectThe device a recording of the device itself belongs to.
- class bsb.simulation.results.RecordedPoint(cell: RecordedCell, branch: int, point: int, arc: float | None = None)[source]¶
Bases:
objectA point on the morphology of a cell of the network, as a recording addresses it.
- Parameters:
cell (RecordedCell)
branch (int)
point (int)
arc (float | None)
- arc: float | None = None¶
Where on the branch, as a fraction of the branch’s length, or
Nonewhen the location is the point itself.
- cell: RecordedCell¶
The cell the point is on.
- property position: numpy.ndarray | None¶
Where the location is in the network, on the cell’s morphology as the cell is placed.
Nonewhen the network stores no morphologies or positions for the cell.
- class bsb.simulation.results.RecordedSynapse(post: RecordedPoint, pre: RecordedPoint | None, synapse_type: str, connectivity_set: str | None)[source]¶
Bases:
objectA synapse between two cells of the network, as a recording addresses it.
- Parameters:
post (RecordedPoint)
pre (RecordedPoint | None)
synapse_type (str)
connectivity_set (str | None)
- property position: numpy.ndarray | None¶
Where the synapse is in the network: its location on the postsynaptic cell.
- post: RecordedPoint¶
Where the synapse is on its postsynaptic cell.
- pre: RecordedPoint | None¶
Where the connection the synapse belongs to starts on its presynaptic cell, or
Nonefor a synapse that belongs to no connection.
- class bsb.simulation.results.Recording(device: str | None, kind: str | None, direction: str | None, signal: Any)[source]¶
Bases:
objectOne recorded Neo object and what it says about itself.
Every recording names the device that made it, what kind of thing it recorded, and whether the device observed it or injected it, whatever backend ran the simulation and whichever Neo container it landed in. What it recorded is addressed by the annotations of its kind, never by a simulator’s own ids.
- class bsb.simulation.results.ResultsReader(network: Scaffold, blocks: list[neo.core.Block])[source]¶
Bases:
objectThe results in a file, read together with the network they were simulated on.
Made by
read_results(), which verifies every run in the file against the network before handing one out.- Parameters:
network (Scaffold)
blocks (list[neo.core.Block])
- property configuration: dict | None¶
The configuration of the simulation, when the file holds a single run.
- network¶
The network the simulations ran on.
- recordings(device: str | None = None, kind: str | None = None) Iterator[NetworkRecording][source]¶
Iterate the recordings of every run, each with what it recorded in the network, and the run that made it.
- Parameters:
- Returns:
The recordings, run by run, in the order they were written.
- Return type:
- runs¶
The runs in the file, in the order they were written.
- property simulation: Simulation | None¶
The network’s simulation that ran, when the file holds a single run.
- class bsb.simulation.results.SimulationRecorder(device)[source]¶
Bases:
object- property device_kind¶
The kind of device this recorder belongs to, as it is configured.
- property device_name¶
The name of the device this recorder belongs to.
- flush(segment: neo.core.Segment)[source]¶
- Parameters:
segment (neo.core.Segment)
- class bsb.simulation.results.SimulationResult(simulation, filename=None, comm=None, simulation_id=None)[source]¶
Bases:
objectThe results of one simulation, and the provenance of the run that made them.
Under MPI each rank writes its own part and rank 0 merges them into the file that was asked for, because neither
nixionor an HDF5 attribute supports concurrent writers. The parts are an implementation detail: a run ends with one file, andfinalizeis what makes that true.- Parameters:
comm – The communicator whose ranks share this run, which is the adapter’s. It decides who takes part in
finalizeand which parts it expects to find, so an adapter given a sub-communicator has to hand it on rather than let this fall back to the world.simulation_id – The identity of the run, which every rank writing a part of it has to agree on, or the parts cannot be recognised as belonging together. An adapter agrees one with
SimulatorAdapter.new_run_idand passes it here. Constructing this without one is for a result that stands alone: a fresh identity is made up locally, since there is nobody to agree with.
- add(recorder)[source]¶
Add a recorder, which every checkpoint asks to flush what it recorded.
- Parameters:
recorder (SimulationRecorder) – The recorder. It has to belong to a device, which is what every one of its recordings names as the device that made it.
- property block¶
- create_recorder(flush: Callable[[neo.core.Segment], None], device)[source]¶
Add a recorder that flushes with a function.
- Parameters:
flush (Callable[[neo.core.Segment], None]) – Appends what was recorded since the last checkpoint to the segment it is given, annotated with what it recorded.
device – The device the recordings belong to.
- Returns:
The recorder.
- Return type:
- class bsb.simulation.results.SimulationRun(reader: ResultsReader, block: neo.core.Block)[source]¶
Bases:
objectOne run of a simulation in a results file, read with the network it ran on.
- Parameters:
reader (ResultsReader)
block (neo.core.Block)
- block¶
The Neo block holding the results of the run.
- configuration¶
The configuration tree of the simulation, as it ran.
- devices¶
Names of the devices that recorded, in the order they were first written.
- provenance¶
The provenance of the run: its seed, duration, resolution, ranks, …
- recordings(device: str | None = None, kind: str | None = None) Iterator[NetworkRecording][source]¶
Iterate the recordings of the run, each with what it recorded in the network.
- Parameters:
- Returns:
The recordings, in the order they were written.
- Return type:
- property simulation: Simulation | None¶
The network’s simulation of this name, or
Noneif the network has none.The network’s configuration may have been changed since the run; the configuration the simulation ran with is
configuration.
- bsb.simulation.results.cell_annotations(cell_model, cell_id: int, direction: str) dict[source]¶
Annotations of a recording of a whole cell.
- Parameters:
- Returns:
The annotations to pass to the Neo object.
- Return type:
- bsb.simulation.results.device_annotations(direction: str) dict[source]¶
Annotations of a recording of the device itself, which addresses nothing in the network: a signal the device computes, rather than one it takes from a cell.
- bsb.simulation.results.iter_recordings(source, device: str | None = None, kind: str | None = None, cell_model: str | None = None, cell_id: int | None = None) Iterator[Recording][source]¶
Iterate the recordings of a block, a segment, or a list of either.
- Parameters:
source – What to read: a
neo.core.Block, aneo.core.Segment, or an iterable of either.device (str | None) – Only yield recordings made by this device.
kind (str | None) – Only yield recordings of this kind.
cell_model (str | None) – Only yield recordings on cells of this cell model. A synapse is on its postsynaptic cell.
cell_id (int | None) – Only yield recordings on cells with this id. A cell id is only unique within its cell model, so pass
cell_modelalong to single out one cell.
- Returns:
The recordings, in the order they were written.
- Return type:
- bsb.simulation.results.merge_rank_results(parts, filename) None[source]¶
Concatenate per-rank results into one file.
Ranks record disjoint cells, so a merge is a concatenation and never has to reconcile two accounts of the same recording. Segments are matched on their
checkpoint_index, which is what makes them line up across parts: a checkpoint is one segment holding every rank’s share of it.That matching is why this holds a simulation’s merged recordings in memory before writing them: a segment cannot be written until every part that has a share of it has been read. Peak memory is therefore one simulation’s results, not the whole file, and each part is closed as soon as it has been merged.
- Parameters:
parts – The per-rank files, in rank order.
filename – The file to write.
- Return type:
None
- bsb.simulation.results.multiplex_channels(targets: list[dict]) tuple[dict, dict][source]¶
Annotations for a single analog signal recording every target in
targetsas one channel each, in the same order.
- bsb.simulation.results.multiplex_targets(targets: list[dict]) dict[source]¶
Annotations for a single spike train recording every target in
targets, as a roster: one flat list per key that varies across targets, encoded as a single annotation. Pair with absb_target_indexarray annotation, one entry per spike, indexing into the roster in the order given, so a singleSpikeTraincan speak for every target it watches – including ones that never fire, which the roster still names.The roster is encoded with
encode_annotation()rather than written as one flat-list annotation per key:nixiocollapses a property holding a single value back to a bare scalar on read, which a roster of exactly one target would trip on if its lists were written directly.- Parameters:
targets (list[dict]) – Per-target annotations, as
cell_annotations(),point_annotations()orsynapse_annotations()give them, one call per target, in roster order.- Returns:
Annotations to pass to the multiplexed
SpikeTrain.- Return type:
- bsb.simulation.results.point_annotations(cell_model, cell_id: int, branch: int, point: int, arc: float, direction: str) dict[source]¶
Annotations of a recording at a point on a cell’s morphology.
- Parameters:
cell_model (CellModel) – The cell model the cell was simulated with.
cell_id (int) – Id of the cell in the placement set of the cell model’s cell type.
branch (int) – Index of the branch in the cell’s morphology.
point (int) – Index of the point on that branch.
arc (float) – Where on the stretch following that point the recording is, as a fraction of the branch’s length.
direction (str) –
"record"when the device observes what it records, or"stimulate"when it injects it.
- Returns:
The annotations to pass to the Neo object.
- Return type:
- bsb.simulation.results.rank_part_path(filename, rank: int) Path[source]¶
Where one rank writes its share of a run’s results.
Parts live in a sibling directory of the file they will become, so the finished result keeps the path it was asked for.
- bsb.simulation.results.read_provenance(block: neo.core.Block) dict | None[source]¶
Read the provenance of the run that produced a block of results.
An unrecognised schema version warns and returns what is there rather than refusing: the recordings themselves are plain neo and readable regardless, and refusing a file over metadata written by a newer BSB would keep someone from results that are perfectly intact.
- Parameters:
block (neo.core.Block) – Block of results.
- Returns:
The provenance bundle, or
Noneif the block carries none.- Return type:
dict | None
- bsb.simulation.results.read_results(network: str | os.PathLike | Scaffold, results: str | os.PathLike) ResultsReader[source]¶
Read a results file together with the network it was simulated on.
Every run in the file is verified before anything is returned. A run of another network raises a
ResultsMismatchError: analysed against the wrong network it would give plausible nonsense. A network that was written to after a run warns, because its positions or labels may have moved since, and a run that recorded no network identity warns that it cannot be verified.- Parameters:
network (str | os.PathLike | Scaffold) – Path of the network file, or an opened network. A path is opened like
from_storage()opens it, which every rank of an MPI run takes part in: under MPI, read on every rank or pass an opened network.results (str | os.PathLike) – Path of the results file.
- Returns:
A reader of the results, whose recordings name the network’s cells.
- Raises:
ResultsMismatchError – A run was not produced by this network.
ResultsError – The file holds no results.
- Return type:
- bsb.simulation.results.read_simulation_config(block: neo.core.Block) dict | None[source]¶
Read the configuration of the simulation that produced a block of results.
- Parameters:
block (neo.core.Block) – Block of results, either taken from a
SimulationResultor read back out of a results file.- Returns:
The configuration tree of the simulation, or
Noneif the block carries none. A file written before the configuration was encoded carries only the tree’s top-level keys, which are returned as they were found, after a warning: the values were never written and cannot be recovered.- Return type:
dict | None
- bsb.simulation.results.synapse_annotations(post, synapse_type: str, direction: str, pre=None, connectivity_set=None) dict[source]¶
Annotations of a recording of a synapse, between the cell it is on and the cell of the connection it belongs to.
- Parameters:
post (tuple[CellModel, int, int, int, float]) – Where the synapse is: the cell model, cell id, branch, point, and arc of the location on the postsynaptic cell.
synapse_type (str) – Name of the synapse type.
direction (str) –
"record"when the device observes what it records, or"stimulate"when it injects it.pre (tuple[CellModel, int, int, int] | None) – Where the connection starts: the cell model, cell id, branch and point of the location on the presynaptic cell.
Nonefor a synapse that belongs to no connection.connectivity_set – Name of the connectivity set of the connection.
- Returns:
The annotations to pass to the Neo object.
- Return type:
bsb.simulation.targetting module¶
- class bsb.simulation.targetting.BranchLocTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
LabelTargetting- get_node_name()¶
- class bsb.simulation.targetting.ByIdTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
FractionFilter,CellTargettingTargets all given identifiers.
- get_node_name()¶
- class bsb.simulation.targetting.ByLabelTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
CellModelFilter,FractionFilter,CellTargettingTargets all given labels.
- get_node_name()¶
- class bsb.simulation.targetting.CellModelTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
CellModelFilter,FractionFilter,CellTargettingTargets all cells of certain cell models.
- get_node_name()¶
- class bsb.simulation.targetting.CellTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
Targetting- get_node_name()¶
- class bsb.simulation.targetting.ConnectionTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
Targetting- get_node_name()¶
- class bsb.simulation.targetting.CylindricalTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
CellModelFilter,FractionFilter,CellTargettingTargets all cells in a cylinder along specified axis.
- get_node_name()¶
- class bsb.simulation.targetting.FractionFilter[source]¶
Bases:
object- count¶
Base implementation of all the different configuration attributes.
Call the factory function
attr()instead.
- class bsb.simulation.targetting.LabelTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
LocationTargetting- get_node_name()¶
- labels¶
- class bsb.simulation.targetting.LocationTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
object- get_node_name()¶
- class bsb.simulation.targetting.RepresentativesTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
CellModelFilter,FractionFilter,CellTargettingTargets all identifiers of certain cell types.
- get_node_name()¶
- class bsb.simulation.targetting.SomaTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
LocationTargettingTargets every location of a cell that its morphology labels
soma.- get_node_name()¶
- class bsb.simulation.targetting.SphericalTargetting(*args, _parent=None, _key=None, **kwargs)[source]¶
Bases:
CellModelFilter,FractionFilter,CellTargettingTargets all cells in a sphere.
- get_node_name()¶
- get_targets(adapter, simulation, simdata)[source]¶
Target all or certain cells within a sphere of specified radius.
Module contents¶
- class bsb.simulation.SimulationBackendPlugin(Adapter: bsb.simulation.adapter.SimulatorAdapter, Simulation: bsb.simulation.simulation.Simulation)[source]¶
Bases:
object- Parameters:
Adapter (SimulatorAdapter)
Simulation (Simulation)
- Adapter: SimulatorAdapter¶
- Simulation: Simulation¶
- bsb.simulation.get_simulation_adapter(name: str, comm=None)[source]¶
Return the adapter corresponding to the given simulator name.
- Parameters:
name (str) – Name of the simulator.
comm – The mpi4py MPI communicator to use. Only nodes in the communicator will participate in the simulation. The first node will idle as the main node.