bluepysnap.edges.edge_population¶
Edge population access.
Classes
|
Edge population access. |
- class bluepysnap.edges.edge_population.EdgePopulation(circuit, population_name)¶
Edge population access.
Initializes a EdgePopulation object from a EdgeStorage and a population name.
- Parameters:
circuit (bluepysnap.Circuit) – the circuit object containing the edge population
population_name (str) – the name of the edge population
- Returns:
An EdgePopulation object.
- Return type:
- afferent_edges(node_id, properties=None)¶
Get afferent edges for given
node_id.- Parameters:
node_id (CircuitNodeIds/int/sequence/str/mapping/None) – Target node ID.
properties – An edge property name, a list of edge property names, or None.
- Returns:
A pandas Series indexed by edge ID if
propertiesis a string.A pandas DataFrame indexed by edge ID if
propertiesis a list.A list of edge IDs, if
propertiesis None.
- Return type:
pandas.Series/pandas.DataFrame/list
- afferent_nodes(target, unique=True)¶
Get afferent node IDs for given target
node_id.Notes
Afferent nodes are nodes projecting an outgoing edge to one of the
targetnode.- Parameters:
target (CircuitNodeIds/int/sequence/str/mapping/None) – the target you want to resolve
nodes. (and use as target)
unique (bool) – If
True, return only unique afferent node IDs.
- Returns:
Afferent node IDs for all the targets.
- Return type:
numpy.ndarray
- property config¶
Access the configuration for the population.
This configuration is extended with:
‘components’ of the circuit config
‘edges_file’: the path the h5 file containing the population.
- container_property_names(container)¶
Lists the ConstContainer properties shared with the EdgePopulation.
- Parameters:
container (ConstContainer) – a container class for edge properties.
- Returns:
A list of strings corresponding to the properties that you can use from the container class
- Return type:
list
Examples
>>> from bluepysnap.sonata_constants import Edge >>> print(my_edge_population.container_property_names(Edge)) >>> ["AXONAL_DELAY", "SYN_WEIGHT"] # values you can use with my_edge_population
- efferent_edges(node_id, properties=None)¶
Get efferent edges for given
node_id.- Parameters:
node_id (CircuitNodeIds/int/sequence/str/mapping/None) – source node ID
properties – None / edge property name / list of edge property names
- Returns:
List of edge IDs, if
propertiesis None;Pandas Series indexed by edge IDs if
propertiesis string;Pandas DataFrame indexed by edge IDs if
propertiesis list.
- efferent_nodes(source, unique=True)¶
Get efferent node IDs for given source
node_id.Notes
Efferent nodes are nodes receiving an incoming edge from one of the
sourcenode.- Parameters:
source (CircuitNodeIds/int/sequence/str/mapping/None) – the source you want to resolve and use as source nodes.
unique (bool) – If
True, return only unique afferent node IDs.
- Returns:
Efferent node IDs for all the sources.
- Return type:
numpy.ndarray
- get(edge_ids, properties=None)¶
Edge properties as pandas DataFrame.
- Parameters:
edge_ids (array-like) – array-like of edge IDs
properties (str/list) – an edge property name or a list of edge property names
- Returns:
A pandas Series indexed by edge IDs if
propertiesis scalar.A pandas DataFrame indexed by edge IDs if
propertiesis list.
- Return type:
pandas.Series/pandas.DataFrame
Notes
The EdgePopulation.property_names function will give you all the usable properties for the properties argument.
- property h5_filepath¶
Get the H5 edges file associated with population.
- ids(group=None, limit=None, sample=None, raise_missing_property=True)¶
Edge IDs corresponding to edges
edge_ids.- Parameters:
group (None/int/CircuitEdgeId/CircuitEdgeIds/sequence) –
Which IDs will be returned depends on the type of the
groupargument:None: return all IDs.int,CircuitEdgeId: return a single edge ID.CircuitEdgeIdsreturn IDs of edges the edge population in an array.sequence: return IDs of edges in an array.
sample (int) – If specified, randomly choose
samplenumber of IDs from the match result. If the size of the sample is greater than the size of the EdgePopulation then all ids are taken and shuffled.limit (int) – If specified, return the first
limitnumber of IDs from the match result. If limit is greater than the size of the population all node IDs are returned.raise_missing_property (bool) – if True, raises if a property is not listed in this population. Otherwise the ids are just not selected if a property is missing.
- Returns:
A numpy array of IDs.
- Return type:
numpy.array
- iter_connections(source=None, target=None, unique_node_ids=False, shuffle=False, return_edge_ids=False, return_edge_count=False)¶
Iterate through
source->targetconnections.- Parameters:
source (CircuitNodeIds/int/sequence/str/mapping/None) – source node group
target (CircuitNodeIds/int/sequence/str/mapping/None) – target node group
unique_node_ids – if True, no node ID will be used more than once as source or target for edges. Careful, this flag does not provide unique (source, target) pairs but unique node IDs.
shuffle – if True, result order would be (somewhat) randomized
return_edge_count – if True, edge count is added to yield result
return_edge_ids – if True, edge ID list is added to yield result
return_edge_countandreturn_edge_idsare mutually exclusive.- Yields:
(source_node_id, target_node_id, edge_ids) if
return_edge_idsis True;(source_node_id, target_node_id, edge_count) if
return_edge_countis True;(source_node_id, target_node_id) otherwise.
- pair_edges(source_node_id, target_node_id, properties=None)¶
Get edges corresponding to
source_node_id->target_node_idconnection.- Parameters:
source_node_id (CircuitNodeIds/int/sequence/str/mapping/None) – source node ID
target_node_id (CircuitNodeIds/int/sequence/str/mapping/None) – target node ID
properties – None / edge property name / list of edge property names
- Returns:
List of edge IDs, if
propertiesis None;Pandas Series indexed by edge IDs if
propertiesis string;Pandas DataFrame indexed by edge IDs if
propertiesis list.
- pathway_edges(source=None, target=None, properties=None)¶
Get edges corresponding to
source->targetconnections.- Parameters:
source (CircuitNodeIds/int/sequence/str/mapping/None) – source node group
target (CircuitNodeIds/int/sequence/str/mapping/None) – target node group
properties – None / edge property name / list of edge property names
- Returns:
List of edge IDs, if
propertiesis None;Pandas Series indexed by edge IDs if
propertiesis string;Pandas DataFrame indexed by edge IDs if
propertiesis list.
- positions(edge_ids, side, kind)¶
Edge positions as a pandas DataFrame.
- Parameters:
edge_ids (array-like) – array-like of edge IDs
side (str) –
afferentorefferentkind (str) –
centerorsurface
- Returns:
Pandas Dataframe with (‘x’, ‘y’, ‘z’) columns indexed by edge IDs.
- property_dtypes¶
Returns the dtypes of all the properties.
- Returns:
series indexed by field name with the corresponding dtype as value.
- Return type:
pandas.Series
- property property_names¶
Set of available edge properties.
Notes
Properties are a combination of the group attributes, the dynamics_params and the topology properties.
- property size¶
Population size.
- source¶
Source NodePopulation.
- spatial_synapse_index¶
Access to edges spatial index.
- stats¶
Access edge population stats methods.
- target¶
Target NodePopulation.
- property type¶
Population type.