Neurodamus Sub-Modules¶
neurodamus.cell_distributor¶
Mechanisms to load and balance cells across the computing resources.
Classes
|
Manages a group of cells for BBP simulations, V5 and V6 |
|
Class handling the several types of load_balance info, including generating and loading the various files. |
|
An enumeration, inc parser, of the load balance modes. |
- class neurodamus.cell_distributor.CellDistributor(circuit_conf, target_manager, _run_conf=None, **_kw)¶
Manages a group of cells for BBP simulations, V5 and V6
Instantiated cells are stored locally (.cells property)
- load_nodes(load_balancer=None, **kw)¶
gets gids from target, splits and returns a GidSet with all metadata
- class neurodamus.cell_distributor.CellManagerBase(circuit_conf, target_manager, _run_conf=None, **_kw)¶
- CellType = NotImplemented¶
The underlying Cell type class
- signature:
__init__(self, gid, cell_info, circuit_conf)
- property cells¶
- property circuit_name¶
- property circuit_target¶
- property connection_managers¶
- enable_report(report_conf, target_name, use_coreneuron)¶
Placeholder for Engines implementing their own reporting
- Parameters:
report_conf – The dict containing the report configuration
target_name – The target of the report
use_coreneuron – Whether the simulator is CoreNeuron
- finalize(**opts)¶
Instantiates cells and initializes the network in the simulator.
- Note: it should be called after all cell distributors have done load_nodes()
so gids offsets are final.
- getGidListForProcessor()¶
- get_cell(gid)¶
- get_cellref(gid)¶
Retrieve a cell object given its gid. Note that this function handles multisplit cases incl converting to an spgid automatically
Returns: Cell object
- get_final_gids()¶
- property gid2cell¶
- property is_default¶
- is_initialized()¶
- property is_virtual¶
- load_artificial_cell(gid, artificial_cell)¶
- load_nodes(load_balancer=None, *, _loader=None, loader_opts=None)¶
Top-level loader of nodes.
- property local_nodes¶
- property pc¶
- property population_name¶
- post_stdinit()¶
Post stdinit actions
- record_spikes(gids=None, append_spike_vecs=None)¶
Setup recording of spike events (crossing of threshold) for cells on this node
- register_connection_manager(conn_manager: ConnectionManagerBase)¶
- property target_manager¶
- property total_cells¶
- class neurodamus.cell_distributor.GlobalCellManager¶
GlobalCellManager is a wrapper over all Cell Managers so that we can query any cell from its global gid
- finalize()¶
- getGidListForProcessor()¶
- getPopulationInfo(gid)¶
- getSpGid(gid)¶
Retrieve the spgid from a gid (provided we are using loadbalancing)
- Parameters:
gid – The base gid (as read from start.ncs)
Returns: The gid as it appears on this cpu (if this is the same as the base gid, then that is the soma piece)
- get_cell(gid)¶
- get_cellref(gid)¶
Retrieve a cell object given its gid. Note that this function handles multisplit cases incl converting to an spgid automatically
Returns: Cell object
- get_final_gids()¶
- register_manager(cell_manager)¶
- class neurodamus.cell_distributor.LoadBalance(balance_mode, nodes_path, pop, target_manager, target_cpu_count=None)¶
Class handling the several types of load_balance info, including generating and loading the various files.
LoadBalance instances target the current system (cpu count) and circuit BUT check/create load distribution for any given target. The circuit is identified by the nodes file AND population.
NOTE: Given the heavy costs of computing load balance, some state files are created which allow the balance info to be reused. These are
cx_{TARGET}.dat: File with complexity information for the cells of a given target
cx_{TARGET}.{CPU_COUNT}.dat: The file assigning cells/pieces to individual CPUs ranks.
For more information refer to the developer documentation.
- generate_load_balance(target_spec, cell_distributor)¶
Context manager that creates load balance for the circuit instantiated within
- Parameters:
target_str – a string representation of the target.
cell_distributor – the cell distributor object to which we can query the cells to be load balanced
- load_balance_info(target_spec)¶
Loads a load-balance info for a given target. NOTE: Please ensure the load balance exists or is derived before calling this function
- static select_lb_mode(sim_config, run_conf, target)¶
A method which selects the load balance mode according to run config
- valid_load_distribution(target_spec: TargetSpec) bool ¶
Checks whether we have valid load-balance files, attempting to derive from larger target distributions if possible.
- class neurodamus.cell_distributor.VirtualCellPopulation(population_name, gids=None, circuit_target=None)¶
A virtual cell population offers a compatible interface with Cell Manager, however it doesnt instantiate cells. It is mostly used as source of projections
- property is_default¶
- property is_virtual¶
neurodamus.connection¶
Implementation of the core Connection classes
Classes
|
NetCon Type |
|
Replay instantiation mode. |
|
The Base implementation for cell connections identified by src-dst gids |
|
A Connection object serves as a container for synapses formed from a presynaptic and a postsynaptic gid, including Points where those synapses are placed (stored in TPointList) |
Base class for artificial Stims, namely Replay and Minis |
|
|
A class creating/holding spont minis of a connection |
|
Extends SpontMinis to handle two spont rates: Inhibitory & Excitatory |
A class creating/holding replays of a connection |
- class neurodamus.connection.ArtificialStim¶
Base class for artificial Stims, namely Replay and Minis
- netcons¶
- netstims¶
- restart_events()¶
- class neurodamus.connection.Connection(sgid, tgid, src_pop_id=0, dst_pop_id=0, weight_factor=1.0, minis_spont_rate=None, configuration=None, mod_override=None, **kwargs)¶
A Connection object serves as a container for synapses formed from a presynaptic and a postsynaptic gid, including Points where those synapses are placed (stored in TPointList)
- ConnUtils = None¶
- add_synapse(syn_tpoints, params_obj, syn_id=None)¶
Adds a synapse in given location to this Connection. NOTE: This procedure can have a significant impact when called multiple times. Consider add_synapses to add multiple synapses in bulk
- Parameters:
syn_tpoints – TPointList with one point on the tgid where the associated synapse exists
params_obj – Parameters object for the Synapse to be placed
syn_id – Optional id for the synapse to be used for seeding rng
- add_synapse_configuration(configuration)¶
Add a synapse configuration command to the list. All commands are executed on synapse creation
- add_synapses(target_manager, synapses_params, base_id=0)¶
Adds synapses in bulk.
- Parameters:
synapses_params (-) – A SynapseParameters array (possibly view) for this conn synapses
base_id (-) – The synapse base id, usually absolute offset
- configure_synapses(configuration)¶
Helper function to execute a configuration statement (hoc) on all connection synapses.
- disable(set_zero_conductance=False)¶
Deactivates a connection.
The connection synapses are inhibited by disabling the netcons. Additionally can also set conductance to zero so that the point process has no contribution whatsoever to the simulation.
- Parameters:
set_zero_conductance – (bool) Sets synapses’ conductance to zero [default: False]
- enable()¶
(Re)enables connections. It will activate all netcons and restore conductance values had they been set to zero
- finalize(cell, base_seed=0, *, skip_disabled=False, replay_mode=ReplayMode.AS_REQUIRED, attach_src_cell=True)¶
When all parameters are set, create synapses and netcons
- Parameters:
cell – The cell to create synapses and netcons on.
base_seed – base seed value (Default: None - no adjustment)
skip_disabled – Dont instantiate at all if conn was disabled. Mostly useful for CoreNeuron
replay_mode – Policy to initialize replay in this conection
- finalize_gap_junctions(cell, offset, end_offset)¶
When all parameters are set, create synapses and netcons
- Parameters:
cell – The cell to create synapses and netcons on.
offset – offset for this cell’s gap junctions
end_offset – offset for the other cell’s gap junctions
- minis_spont_rate¶
- override_mod(mod_override)¶
- replay(tvec, start_delay=0.0)¶
The synapses connecting these gids are to be activated using predetermined timings.
- Parameters:
tvec – time for spike events from the sgid
start_delay – When the events may start to be delivered
- restart_events()¶
Restart the artificial events, coming from Replay or Spont-Minis
- property sections_with_synapses¶
Generator over all sections containing synapses, yielding pairs (section_index, section)
- update_weights(weight, update_also_replay_netcons=False)¶
Change the weights of the existing netcons
- Parameters:
weight – The new weight
update_also_replay_netcons – Whether weights shall be applied to replay netcons as well
- class neurodamus.connection.ConnectionBase(sgid, tgid, src_pop_id=0, dst_pop_id=0, weight_factor=1, syndelay_override=None, synapses_offset=0)¶
The Base implementation for cell connections identified by src-dst gids
- add_delayed_weight(delay, weight)¶
Update the delayed connection vectors in the synapse.
- Parameters:
delay – the delay time for the new weight
weight – the weight to adjust to at this time
- disable()¶
Deactivates a connection. The connection synapses are inhibited by disabling the netcons.
- enable()¶
(Re)enables connections, by activating all netcons
- finalize(cell, base_seed=0, *args, **kw)¶
- locked¶
- classmethod netcon_set_type(netcon, syn_obj, nc_type)¶
Find nc_type_param from the synapse global variable and set via the netcon weight
- property population_id¶
- sgid¶
- property synapse_params¶
- property synapses¶
- property synapses_offset¶
- syndelay_override¶
- tgid¶
- update_conductance(new_g)¶
Updates all synapses conductance
- update_synapse_parameters(**params)¶
A generic function to update several parameters of all synapses
- update_weights(weight)¶
Change the weights of the netcons generated when connecting the source and target gids represented in this connection
- weight_factor¶
- class neurodamus.connection.InhExcSpontMinis(spont_rate_inh, spont_rate_exc)¶
Extends SpontMinis to handle two spont rates: Inhibitory & Excitatory
- create_on(conn, sec, position, syn_obj, syn_params, *args)¶
Inserts a SpontMini stim into the given synapse
- get_rate()¶
- has_data()¶
- rate_vec¶
- property rate_vec_inh¶
The inhibitory spont rate vector (alias to base class .rate_vec)
- class neurodamus.connection.NetConType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
NetCon Type
- NC_NEUROMODULATOR = 10¶
- NC_PRESYN = 0¶
- NC_REPLAY = 2¶
- NC_SPONTMINI = 1¶
- class neurodamus.connection.ReplayMode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Replay instantiation mode.
- AS_REQUIRED = 1¶
Instantiate Replay netcons as required for this run. Subsequent Save-Restore may not work
- COMPLETE = 2¶
Instantiate Replay Netcons on all Connections so that users may add arbitrary new replays in Restore phases
- NONE = 0¶
Instantiate no replay NetCons
- class neurodamus.connection.ReplayStim¶
A class creating/holding replays of a connection
- add_spikes(hoc_tvec)¶
Appends replay spikes from a time vector to the main replay vector
- create_on(conn, sec, syn_obj, syn_params)¶
Inserts a replay stim into the given synapse
- has_data()¶
- time_vec¶
- class neurodamus.connection.SpontMinis(minis_spont_rate)¶
A class creating/holding spont minis of a connection
- create_on(conn, sec, position, syn_obj, syn_params, base_seed, _rate_vec=None)¶
Inserts a SpontMini stim into the given synapse
- get_rate()¶
- has_data()¶
- property rate¶
- rate_vec¶
- set_rate(rate)¶
- tbins_vec = None¶
Neurodamus uses a constant rate, so tbin is always containing only 0
neurodamus.connection_manager¶
Main module for handling and instantiating synaptical connections and gap-junctions
Classes
|
A dataset of connections. |
|
An abstract base class common to Synapse and GapJunction connections |
|
The SynapseRuleManager is designed to encapsulate the creation of synapses for BlueBrain simulations, handling the data coming from the circuit file. |
|
Find/decides the node populations names from several edge configurations |
- class neurodamus.connection_manager.SynapseRuleManager(circuit_conf, target_manager, cell_manager, src_cell_manager=None, **kw)
The SynapseRuleManager is designed to encapsulate the creation of synapses for BlueBrain simulations, handling the data coming from the circuit file. If the config file provides any Connection Rules, those override which synapses are created.
Note that the Connection rules are processed with the assumption that they come in the config file from more general to more specific. E.g.: A column->column connection should come before layer 4 -> layer 2 which should come before L4PC -> L2PC.
Once all synapses are prepared with final weights, the Netcons can be created.
- CONNECTIONS_TYPE = 'Synaptic'
The type of connections subclasses handle
- class ConnectionSet(src_id, dst_id, conn_factory=<class 'neurodamus.connection.Connection'>)
A dataset of connections. Several populations may exist with different seeds
- all_connections()
Get an iterator over all the connections.
- delete(sgid, tgid)
Removes a given connection from the population.
- delete_group(post_gids, pre_gids=None)
Removes a set of connections from the population.
- get_connection(sgid, tgid)
Retrieves a connection from the pre and post gids.
- Returns:
A connection object if it exists. None otherwise
- Return type:
- get_connections(post_gids, pre_gids=None)
Get all connections between groups of gids.
- get_or_create_connection(sgid, tgid, **kwargs)
Returns a connection by pre-post gid, creating if required.
- get_synapse_params_gid(target_gid)
Get an iterator over all the synapse parameters of a target cell connections.
- ids_match(population_ids, dst_second=None)
Whereas a given population_id selector matches population
- items()
Iterate over the population as tuples (dst_gid, [connections])
- store_connection(conn)
When we have created a new connection (sgid->tgid), store it in order in our structure for faster retrieval later
- Parameters:
conn – The connection object to be stored
- target_gids()
Get the list of all targets gids in this Population
- class SynapseReader(src, population=None, *_, **kw)
Synapse Readers base class. Factory create() will instantiate a SONATA reader.
- classmethod create(syn_src, population=None, *args, **kw)
Instantiates a synapse reader, by default SonataReader. syn_src must point to a SONATA edge file.
- get_synapse_parameters(gid)
Obtains the synapse parameters record for a given gid.
- abstract has_nrrp()
Checks whether source data has the nrrp field.
- abstract has_property(field_name)
Checks whether source data has the given additional field.
- all_connections()
Retrieves all the existing connections
- configure_connections(conn_conf)
Configure-only circuit connections according to a config Connection block
- Parameters:
conn_conf – The configuration block (dict)
- configure_group(conn_config, gidvec=None)
Configure connections according to a config Connection block
- Parameters:
conn_config – The connection configuration dict
gidvec – A restricted set of gids to configure (original, w/o offsetting)
- configure_group_delayed(conn_config, gidvec=None)
Update instantiated connections with configuration from a ‘Delayed Connection’ blocks.
- conn_factory
alias of
Connection
- connect_all(weight_factor=1, only_gids=None)
For every gid access its synapse parameters and instantiate all synapses.
- Parameters:
weight_factor – Factor to scale all netcon weights (default: 1)
only_gids – Create connections only for these tgids (default: Off)
- connect_group(conn_source, conn_destination, synapse_type_restrict=None, mod_override=None)
Instantiates pathway connections & synapses given src-dst
- Parameters:
conn_source (str) – The target name of the source cells
conn_destination (str) – The target of the destination cells
synapse_type_restrict (int) – Create only given synType synapses
mod_override (str) – ModOverride given for this connection group
- create_connections(src_target=None, dst_target=None)
Creates connections according to loaded parameters in ‘Connection’ blocks of the config in the currently active ConnectionSet.
If no Connection block relates to the current population, then load all edges. If a single blocks exists with Weight=0, skip creation entirely.
NOTE: All connections respecting the src_target are retrieved and created, even if they use src cells which are NOT instantiated. This is to support replay and other stimulus which dont need the src cell. If only a subset of connections is wanted, they can be filtered by specifying the “source” attribute of the respective connection blocks.
- Parameters:
src_target – Target name to restrict creating connections coming from it
dst_target – Target name to restrict creating connections going into it
- delete(sgid, tgid, population_ids=None)
Deletes a connection given source and target gids.
NOTE: Contrary to disable(), deleting a connection cannot be undone, however it may help saving computational resources.
- Parameters:
sgid – The pre-gid of the cell
tgid – The post-gid of the cell
population_ids – The population selector. Default: all
- delete_group(post_gids, pre_gids=None, population_ids=None)
- Delete a number of connections given pre and post gid lists.
Note: None is neutral and will match all gids.
- Parameters:
post_gids – The target gids of the connections to be disabled Use None for all post-gids
pre_gids – idem for pre-gids. [Default: None -> all)
population_ids – A int/tuple of populations ids. Default: all
- disable(sgid, tgid, also_zero_conductance=False, population_ids=None)
Disable a connection, its netcons and optionally synapses.
NOTE: Disabling a connection before calling init() prevents it from being instantiated in CoreNeuron.
- Parameters:
sgid – The pre-gid of the cell
tgid – The post-gid of the cell
also_zero_conductance – Also sets synapses’ conductances to zero. Default: False
population_ids – The population selector. Default: all
- disable_group(post_gids, pre_gids=None, also_zero_conductance=False, population_ids=None)
Disable a number of connections given pre and post gid lists.
- Parameters:
post_gids – The target gids of the connections to be deleted
pre_gids – idem for pre-gids. [Default: None -> all)
also_zero_conductance – Also sets synapse conductance to 0
population_ids – A int/tuple of populations ids. Default: all
- finalize(base_seed=0, sim_corenrn=False, **kwargs)
Create the actual synapses and netcons. See super() docstring
- find_populations(population_ids)
Finds the populations that match a given population selector.
- Parameters:
population_ids –
A population ids selector. Accepted formats:
None: All
int: selects matching source population id.
tuple(src: Any, dst: Any): Specify source and dest. Each value can also be None, e.g.: (None, 1) selects all populations having post id 1
- get_connections(post_gids, pre_gids=None, population_ids=None)
Retrieves all connections that match post and pre gids eventually in a subset of the populations.
Note: Due to multi-population, a connection may not be unique for a given pre-post gid pair. As such get_connection() doesn’t make sense anymore and this method shall be used instead.
- Parameters:
post_gids – The target gids of the connections to search (None = All)
pre_gids – idem for pre-gids. [Default: all)
population_ids – A int/tuple of populations ids. Default: all
- get_disabled(post_gid=None)
Returns the list of disabled connections, optionally for a given post-gid.
- get_population(src_pop_id, dst_pop_id=0)
Retrieves a connection set given node src and dst pop ids
- get_target_connections(src_target_name, dst_target_name, selected_gids=None, conn_population=None)
Retrives the connections between src-dst cell targets
- Parameters:
selected_gids – (optional) post gids to select (original, w/o offsetting)
conn_population – restrict the set of connections to be returned
- open_synapse_file(synapse_file, edge_population, *, src_pop_id=None, src_name=None, **_kw)
Initializes a reader for Synapses config objects and associated population
- Parameters:
synapse_file – The nrn/edge file. For old nrn files it may be a dir.
edge_population – The population of the edges
src_pop_id – (compat) Allow overriding the src population ID
src_name – The source pop name, normally matching that of the source cell manager
- reenable(sgid, tgid, population_ids=None)
(Re)enable a connection from given populations.
- reenable_all(post_gids=None)
Re-enables all disabled connections
- Parameters:
post_gids – The list of target gids to enable (Default: all)
- reenable_group(post_gids, pre_gids=None, population_ids=None)
Enable a number of connections given lists of pre and post gids. Note: None will match all gids.
- replay(spike_manager, src_target_name, dst_target_name, start_delay=0.0)
Create special netcons to trigger timed spikes on those synapses.
- Parameters:
spike_manager – map of gids (pre-synaptic) with spike times
src_target_name – Source population:target of the replay connections
dst_target_name – Target whose gids should be replayed
start_delay – Dont deliver events before t=start_delay
- restart_events()
After restore, restart the artificial events (replay and spont minis)
- select_connection_set(src_pop_id, dst_pop_id)
Select the active population of connections given src and dst node pop ids. connect_all() and connect_group() will apply only to the active population.
Returns: The selected ConnectionSet, eventually created
- setup_delayed_connection(conn_config)
Setup delayed connection weights for synapse initialization.
Find source and target gids and the associated connection, and add the delay and weight to their delay vectors.
- Parameters:
conn_config – Connection configuration parsed from sonata config
- update_connections(src_target, dst_target, gidvec=None, syn_configure=None, weight=None, **syn_params)
Update params on connections that are already instantiated.
- Parameters:
src_target – Name of Source Target
dst_target – Name of Destination Target
gidvec – A list of gids to apply configuration. Default: all
syn_configure – A hoc configuration string to apply to the synapses
weight – new weights for the netcons
**syn_params – Keyword arguments of synapse properties to be changed e.g. conductance: g=xyz
- class neurodamus.connection_manager.ConnectionManagerBase(circuit_conf, target_manager, cell_manager, src_cell_manager=None, **kw)¶
An abstract base class common to Synapse and GapJunction connections
Connection Managers hold and manage connectivity among cell populations. For every src-dst pop pairs a new ConnectionManahger is created. The only case it holds several ConnectionSets is for old-style projections (no population names)
- CONNECTIONS_TYPE = None¶
The type of connections subclasses handle
- class ConnectionSet(src_id, dst_id, conn_factory=<class 'neurodamus.connection.Connection'>)¶
A dataset of connections. Several populations may exist with different seeds
- all_connections()¶
Get an iterator over all the connections.
- count()¶
- delete(sgid, tgid)¶
Removes a given connection from the population.
- delete_group(post_gids, pre_gids=None)¶
Removes a set of connections from the population.
- get(item)¶
- get_connection(sgid, tgid)¶
Retrieves a connection from the pre and post gids.
- Returns:
A connection object if it exists. None otherwise
- Return type:
- get_connections(post_gids, pre_gids=None)¶
Get all connections between groups of gids.
- get_or_create_connection(sgid, tgid, **kwargs)¶
Returns a connection by pre-post gid, creating if required.
- get_synapse_params_gid(target_gid)¶
Get an iterator over all the synapse parameters of a target cell connections.
- ids_match(population_ids, dst_second=None)¶
Whereas a given population_id selector matches population
- is_default()¶
- items()¶
Iterate over the population as tuples (dst_gid, [connections])
- store_connection(conn)¶
When we have created a new connection (sgid->tgid), store it in order in our structure for faster retrieval later
- Parameters:
conn – The connection object to be stored
- target_gids()¶
Get the list of all targets gids in this Population
- class SynapseReader(src, population=None, *_, **kw)¶
Synapse Readers base class. Factory create() will instantiate a SONATA reader.
- configure_override(mod_override)¶
- classmethod create(syn_src, population=None, *args, **kw)¶
Instantiates a synapse reader, by default SonataReader. syn_src must point to a SONATA edge file.
- get_synapse_parameters(gid)¶
Obtains the synapse parameters record for a given gid.
- abstract has_nrrp()¶
Checks whether source data has the nrrp field.
- abstract has_property(field_name)¶
Checks whether source data has the given additional field.
- preload_data(ids)¶
- all_connections()¶
Retrieves all the existing connections
- property cell_manager¶
- configure_connections(conn_conf)¶
Configure-only circuit connections according to a config Connection block
- Parameters:
conn_conf – The configuration block (dict)
- configure_group(conn_config, gidvec=None)¶
Configure connections according to a config Connection block
- Parameters:
conn_config – The connection configuration dict
gidvec – A restricted set of gids to configure (original, w/o offsetting)
- configure_group_delayed(conn_config, gidvec=None)¶
Update instantiated connections with configuration from a ‘Delayed Connection’ blocks.
- conn_factory¶
alias of
Connection
- connect_all(weight_factor=1, only_gids=None)¶
For every gid access its synapse parameters and instantiate all synapses.
- Parameters:
weight_factor – Factor to scale all netcon weights (default: 1)
only_gids – Create connections only for these tgids (default: Off)
- connect_group(conn_source, conn_destination, synapse_type_restrict=None, mod_override=None)¶
Instantiates pathway connections & synapses given src-dst
- Parameters:
conn_source (str) – The target name of the source cells
conn_destination (str) – The target of the destination cells
synapse_type_restrict (int) – Create only given synType synapses
mod_override (str) – ModOverride given for this connection group
- property connection_count¶
- create_connections(src_target=None, dst_target=None)¶
Creates connections according to loaded parameters in ‘Connection’ blocks of the config in the currently active ConnectionSet.
If no Connection block relates to the current population, then load all edges. If a single blocks exists with Weight=0, skip creation entirely.
NOTE: All connections respecting the src_target are retrieved and created, even if they use src cells which are NOT instantiated. This is to support replay and other stimulus which dont need the src cell. If only a subset of connections is wanted, they can be filtered by specifying the “source” attribute of the respective connection blocks.
- Parameters:
src_target – Target name to restrict creating connections coming from it
dst_target – Target name to restrict creating connections going into it
- property current_population¶
- delete(sgid, tgid, population_ids=None)¶
Deletes a connection given source and target gids.
NOTE: Contrary to disable(), deleting a connection cannot be undone, however it may help saving computational resources.
- Parameters:
sgid – The pre-gid of the cell
tgid – The post-gid of the cell
population_ids – The population selector. Default: all
- delete_group(post_gids, pre_gids=None, population_ids=None)¶
- Delete a number of connections given pre and post gid lists.
Note: None is neutral and will match all gids.
- Parameters:
post_gids – The target gids of the connections to be disabled Use None for all post-gids
pre_gids – idem for pre-gids. [Default: None -> all)
population_ids – A int/tuple of populations ids. Default: all
- disable(sgid, tgid, also_zero_conductance=False, population_ids=None)¶
Disable a connection, its netcons and optionally synapses.
NOTE: Disabling a connection before calling init() prevents it from being instantiated in CoreNeuron.
- Parameters:
sgid – The pre-gid of the cell
tgid – The post-gid of the cell
also_zero_conductance – Also sets synapses’ conductances to zero. Default: False
population_ids – The population selector. Default: all
- disable_group(post_gids, pre_gids=None, also_zero_conductance=False, population_ids=None)¶
Disable a number of connections given pre and post gid lists.
- Parameters:
post_gids – The target gids of the connections to be deleted
pre_gids – idem for pre-gids. [Default: None -> all)
also_zero_conductance – Also sets synapse conductance to 0
population_ids – A int/tuple of populations ids. Default: all
- finalize(base_seed=0, sim_corenrn=False, *, _conn_type='synapses', **conn_params)¶
Instantiates the netcons and Synapses for all connections.
Note: All weight scalars should have their final values.
- Parameters:
base_seed – optional argument to adjust synapse RNGs (default=0)
sim_corenrn – Finalize accordingly in case we target CoreNeuron
_conn_type – (Internal) A string repr of the connectivity type
conn_params – Additional finalize parameters for the specific _finalize_conns E.g. replay_mode (Default: Auto-Detect) Use DISABLED to skip replay and COMPLETE to instantiate VecStims in all synapses
- find_populations(population_ids)¶
Finds the populations that match a given population selector.
- Parameters:
population_ids –
A population ids selector. Accepted formats:
None: All
int: selects matching source population id.
tuple(src: Any, dst: Any): Specify source and dest. Each value can also be None, e.g.: (None, 1) selects all populations having post id 1
- get_connections(post_gids, pre_gids=None, population_ids=None)¶
Retrieves all connections that match post and pre gids eventually in a subset of the populations.
Note: Due to multi-population, a connection may not be unique for a given pre-post gid pair. As such get_connection() doesn’t make sense anymore and this method shall be used instead.
- Parameters:
post_gids – The target gids of the connections to search (None = All)
pre_gids – idem for pre-gids. [Default: all)
population_ids – A int/tuple of populations ids. Default: all
- get_disabled(post_gid=None)¶
Returns the list of disabled connections, optionally for a given post-gid.
- get_population(src_pop_id, dst_pop_id=0)¶
Retrieves a connection set given node src and dst pop ids
- get_population_offsets()¶
- get_target_connections(src_target_name, dst_target_name, selected_gids=None, conn_population=None)¶
Retrives the connections between src-dst cell targets
- Parameters:
selected_gids – (optional) post gids to select (original, w/o offsetting)
conn_population – restrict the set of connections to be returned
- property is_file_open¶
- open_edge_location(syn_source, circuit_conf, **kw)¶
- open_synapse_file(synapse_file, edge_population, *, src_pop_id=None, src_name=None, **_kw)¶
Initializes a reader for Synapses config objects and associated population
- Parameters:
synapse_file – The nrn/edge file. For old nrn files it may be a dir.
edge_population – The population of the edges
src_pop_id – (compat) Allow overriding the src population ID
src_name – The source pop name, normally matching that of the source cell manager
- reenable(sgid, tgid, population_ids=None)¶
(Re)enable a connection from given populations.
- reenable_all(post_gids=None)¶
Re-enables all disabled connections
- Parameters:
post_gids – The list of target gids to enable (Default: all)
- reenable_group(post_gids, pre_gids=None, population_ids=None)¶
Enable a number of connections given lists of pre and post gids. Note: None will match all gids.
- replay(*_, **_kw)¶
- restart_events()¶
After restore, restart the artificial events (replay and spont minis)
- select_connection_set(src_pop_id, dst_pop_id)¶
Select the active population of connections given src and dst node pop ids. connect_all() and connect_group() will apply only to the active population.
Returns: The selected ConnectionSet, eventually created
- setup_delayed_connection(conn_config)¶
- property src_cell_manager¶
- property src_pop_offset¶
- property target_pop_offset¶
- update_connections(src_target, dst_target, gidvec=None, syn_configure=None, weight=None, **syn_params)¶
Update params on connections that are already instantiated.
- Parameters:
src_target – Name of Source Target
dst_target – Name of Destination Target
gidvec – A list of gids to apply configuration. Default: all
syn_configure – A hoc configuration string to apply to the synapses
weight – new weights for the netcons
**syn_params – Keyword arguments of synapse properties to be changed e.g. conductance: g=xyz
- class neurodamus.connection_manager.ConnectionSet(src_id, dst_id, conn_factory=<class 'neurodamus.connection.Connection'>)¶
A dataset of connections. Several populations may exist with different seeds
- all_connections()¶
Get an iterator over all the connections.
- count()¶
- delete(sgid, tgid)¶
Removes a given connection from the population.
- delete_group(post_gids, pre_gids=None)¶
Removes a set of connections from the population.
- get(item)¶
- get_connection(sgid, tgid)¶
Retrieves a connection from the pre and post gids.
- Returns:
A connection object if it exists. None otherwise
- Return type:
- get_connections(post_gids, pre_gids=None)¶
Get all connections between groups of gids.
- get_or_create_connection(sgid, tgid, **kwargs)¶
Returns a connection by pre-post gid, creating if required.
- get_synapse_params_gid(target_gid)¶
Get an iterator over all the synapse parameters of a target cell connections.
- ids_match(population_ids, dst_second=None)¶
Whereas a given population_id selector matches population
- is_default()¶
- items()¶
Iterate over the population as tuples (dst_gid, [connections])
- store_connection(conn)¶
When we have created a new connection (sgid->tgid), store it in order in our structure for faster retrieval later
- Parameters:
conn – The connection object to be stored
- target_gids()¶
Get the list of all targets gids in this Population
- class neurodamus.connection_manager.SynapseRuleManager(circuit_conf, target_manager, cell_manager, src_cell_manager=None, **kw)¶
The SynapseRuleManager is designed to encapsulate the creation of synapses for BlueBrain simulations, handling the data coming from the circuit file. If the config file provides any Connection Rules, those override which synapses are created.
Note that the Connection rules are processed with the assumption that they come in the config file from more general to more specific. E.g.: A column->column connection should come before layer 4 -> layer 2 which should come before L4PC -> L2PC.
Once all synapses are prepared with final weights, the Netcons can be created.
- CONNECTIONS_TYPE = 'Synaptic'¶
The type of connections subclasses handle
- finalize(base_seed=0, sim_corenrn=False, **kwargs)¶
Create the actual synapses and netcons. See super() docstring
- replay(spike_manager, src_target_name, dst_target_name, start_delay=0.0)¶
Create special netcons to trigger timed spikes on those synapses.
- Parameters:
spike_manager – map of gids (pre-synaptic) with spike times
src_target_name – Source population:target of the replay connections
dst_target_name – Target whose gids should be replayed
start_delay – Dont deliver events before t=start_delay
- setup_delayed_connection(conn_config)¶
Setup delayed connection weights for synapse initialization.
Find source and target gids and the associated connection, and add the delay and weight to their delay vectors.
- Parameters:
conn_config – Connection configuration parsed from sonata config
- neurodamus.connection_manager.edge_node_pop_names(edge_file, edge_pop_name, src_pop_name=None, dst_pop_name=None)¶
Find/decides the node populations names from several edge configurations
- Parameters:
edge_file – The edge file to extract the population names from
edge_pop_name – The name of the edge population
src_pop_name – Overriding source pop name
dst_pop_name – Overriding target population name
Returns: tuple of the src-dst population names. Any can be None if not available
neurodamus.metype¶
Module which defines and handles METypes config (v5/v6 cells)
Classes
|
Class representing an METype. |
Map to hold specific METype info and provide retrieval by gid |
- class neurodamus.metype.BaseCell(gid, cell_info, circuit_info)¶
Class representing an basic cell, e.g. an artificial cell
- property CCell¶
- property CellRef¶
- connect2target(target_pp=None)¶
Connects empty cell to target
- raw_gid¶
- re_init_rng(ion_seed)¶
- class neurodamus.metype.Cell_V6(gid, meinfo, circuit_conf)¶
- delete_axon()¶
- local_to_global_coord_mapping(points)¶
- local_to_global_matrix¶
- class neurodamus.metype.EmptyCell(gid, cell)¶
Class representing an empty cell, e.g. an artificial cell Workaround for the neuron issue https://github.com/neuronsimulator/nrn/issues/635
- gid¶
- class neurodamus.metype.METype(gid, etype_path, emodel, morpho_path, meinfos=None, detailed_axon=False)¶
Class representing an METype. Will instantiate a Hoc-level cell as well
- KEEP_AXON_FLAG = 400¶
- connect2target(target_pp=None)¶
Connects MEtype cell to target
- Parameters:
target_pp – target point process [default: None]
Returns: NetCon obj
- delete_axon()¶
- exc_mini_frequency¶
- extra_attrs¶
- getHypAmp()¶
- getThreshold()¶
- static getVersion()¶
- property gid¶
- inh_mini_frequency¶
- morpho_extension = 'asc'¶
The extension to be applied to morphology files
- re_init_rng(ion_seed)¶
Re-Init RNG for cell
- Parameters:
ion_seed – ion channel seed
- setHypAmp(value)¶
- setThreshold(value)¶
- property synlist¶
- class neurodamus.metype.METypeItem(morph_name, layer=None, fullmtype=None, etype=None, emodel_tpl=None, combo_name=None, mtype=None, threshold_current=0, holding_current=0, exc_mini_frequency=0, inh_mini_frequency=0, add_params=None, position=None, rotation=None, scale=1.0)¶
Metadata about an METype, each possibly used by several cells.
- add_params¶
- combo_name¶
- emodel_tpl¶
- etype¶
- exc_mini_frequency¶
- extra_attrs¶
- fullmtype¶
- holding_current¶
- inh_mini_frequency¶
- layer¶
- local_to_global_coord_mapping(points)¶
- local_to_global_matrix¶
- morph_name¶
- mtype¶
- threshold_current¶
- class neurodamus.metype.METypeManager¶
Map to hold specific METype info and provide retrieval by gid
- property gids¶
- insert(gid, morph_name, *me_data, **kwargs)¶
Function to add an METypeItem to internal data structure
- load_infoNP(gidvec, morph_list, model_templates, mtypes, etypes, threshold_currents=None, holding_currents=None, exc_mini_freqs=None, inh_mini_freqs=None, positions=None, rotations=None, add_params_list=None)¶
Loads METype information in bulk from Numpy arrays
- retrieve_info(gid)¶
- neurodamus.metype.vector_rotate_translate(points, transform_matrix)¶
Rotate/translate a vector of 3D points according to a transformation matrix.
- Note: Rotation is done directly using the Einstein Sum method, similarly to scipy,
avoiding intermediate states.
neurodamus.replay¶
Stimulus implementation where incoming synaptic events are replayed for a single gid
Classes
|
Holds and manages gid spike time information, specially for Replay. |
- exception neurodamus.replay.MissingSpikesPopulationError¶
An exception triggered when a given node population is not found, we may want to handle
- class neurodamus.replay.SpikeManager(spike_filename, delay=0, population=None)¶
Holds and manages gid spike time information, specially for Replay.
A SynapseReplay stim can be used for a single gid that has all the synapses instantiated. Given a spikes file from a previous run, this object uses a NetStim object to retrigger the synapses at the appropriate time as though the presynaptic cells were present and active.
Internally the spikes are stored in a
neurodamus.utils.multimap.GroupedMultiMap
- dump_ascii(f, gid_offset=None)¶
Writes the spikes out, in compat ascii format.
- Parameters:
f – The file name or handle
- filter_map(pre_gids)¶
Returns a raw dict of pre_gid->spikes for the given pre gids.
- get_map()¶
Returns the
GroupedMultiMap
with all the spikes.
- open_spike_file(filename, delay, population=None)¶
Opens a given spike file.
- Parameters:
filename – path to spike out file. Interpret as binary or ascii according to extension
delay – delay to apply to spike times