bluepysnap.edges.edges¶
Edges access.
Classes
|
The top level Edges accessor. |
- class bluepysnap.edges.edges.Edges(circuit)¶
The top level Edges accessor.
Initialize the top level Edges accessor.
- afferent_edges(node_id, properties=None)¶
Get afferent edges for given
node_id
.- Parameters:
node_id (int) – 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
properties
is a string.A pandas DataFrame indexed by edge ID if
properties
is a list.A list of edge IDs, if
properties
is None.
- Return type:
pandas.Series/pandas.DataFrame/list
- afferent_nodes(target, unique=True)¶
Get afferent CircuitNodeIDs for given target
node_id
.Notes
Afferent nodes are nodes projecting an outgoing edge to one of the
target
node.- 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 CircuitNodeIDs for all the targets from all edge population.
- Return type:
CircuitNodeIDs
- efferent_edges(node_id, properties=None)¶
Get efferent edges for given
node_id
.- Parameters:
node_id – source node ID
properties – None / edge property name / list of edge property names
- Returns:
List of edge IDs, if
properties
is None;Pandas Series indexed by edge IDs if
properties
is string;Pandas DataFrame indexed by edge IDs if
properties
is 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
source
node.- 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=None, properties=None)¶
Edge properties as pandas DataFrame.
- Parameters:
edge_ids (int/CircuitEdgeId/CircuitEdgeIds/sequence) – same as Edges.ids().
properties (None/str/list) – an edge property name or a list of edge property names. If set to None ids are returned.
- Returns:
A pandas Series indexed by edge IDs if
properties
is scalar.A pandas DataFrame indexed by edge IDs if
properties
is list.
- Return type:
pandas.Series/pandas.DataFrame
Notes
The Edges.property_names function will give you all the usable properties for the properties argument.
- ids(group=None, sample=None, limit=None)¶
Edge CircuitEdgeIds corresponding to edges
edge_ids
.- Parameters:
group (None/int/CircuitEdgeId/CircuitEdgeIds/sequence) –
Which IDs will be returned depends on the type of the
group
argument:None
: return all CircuitEdgeIds.CircuitEdgeId
: return the ID in a CircuitEdgeIds object.CircuitEdgeIds
: return the IDs in a CircuitNodeIds object.int
: returns a CircuitEdgeIds object containing the corresponding edge ID for all populations.sequence
: returns a CircuitEdgeIds object containing the corresponding edge IDs for all populations.
sample (int) – If specified, randomly choose
sample
number of IDs from the match result. If the size of the sample is greater than the size of all the EdgePopulations then all ids are taken and shuffled.limit (int) – If specified, return the first
limit
number of IDs from the match result. If limit is greater than the size of all the populations all node IDs are returned.
- Returns:
returns a CircuitEdgeIds containing all the edge IDs and the corresponding populations. For performance reasons we do not test if the edge ids are present or not in the circuit.
- Return type:
Notes
This envision also the maybe future selection of edges on queries.
- items()¶
Returns iterator on the tuples (population name, EdgePopulations).
Made to simulate the behavior of a dict.items().
- iter_connections(source=None, target=None, return_edge_ids=False, return_edge_count=False)¶
Iterate through
source
->target
connections.- Parameters:
source (CircuitNodeIds/int/sequence/str/mapping/None) – source node group
target (CircuitNodeIds/int/sequence/str/mapping/None) – target node group
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_count
andreturn_edge_ids
are mutually exclusive.- Yields:
(source_node_id, target_node_id, edge_ids) if
return_edge_ids
is True;(source_node_id, target_node_id, edge_count) if
return_edge_count
is True;(source_node_id, target_node_id) otherwise.
- keys()¶
Returns iterator on the EdgePopulation names.
Made to simulate the behavior of a dict.keys().
- pair_edges(source_node_id, target_node_id, properties=None)¶
Get edges corresponding to
source_node_id
->target_node_id
connection.- Parameters:
source_node_id – source node ID
target_node_id – target node ID
properties – None / edge property name / list of edge property names
- Returns:
List of edge IDs, if
properties
is None;Pandas Series indexed by edge IDs if
properties
is string;Pandas DataFrame indexed by edge IDs if
properties
is list.
- pathway_edges(source=None, target=None, properties=None)¶
Get edges corresponding to
source
->target
connections.- Parameters:
source – source node group
target – target node group
properties – None / edge property name / list of edge property names
- Returns:
CircuitEdgeIDs, if
properties
is None;Pandas Series indexed by CircuitEdgeIDs if
properties
is string;Pandas DataFrame indexed by CircuitEdgeIDs if
properties
is list.
- property population_names¶
Defines all sorted edge population names from the Circuit.
- values()¶
Returns iterator on the EdgePopulations.
Made to simulate the behavior of a dict.values().