Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create aliases for {a,e}fferent_{edges,nodes} #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bluepysnap/edges/edge_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,12 @@ def spatial_synapse_index(self):
raise BluepySnapError(f"It appears {self.name} does not have synapse indices")
return open_index(index_dir)

# ALIASES
edges_by_source = efferent_edges
edges_by_target = afferent_edges
target_nodes_by_source = efferent_nodes
source_nodes_by_target = afferent_nodes
Comment on lines +631 to +634
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the naming a bit clunky. outgoing_edges and incoming_edges would be IMO more intuitive for eff and aff edges.

target_nodes_by_source also sounds very confusing!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the naming a bit clunky. outgoing_edges and incoming_edges would be IMO more intuitive for eff and aff edges.

Sure, whatever makes sense to everybody is fine by me.

target_nodes_by_source also sounds very confusing!

What would you suggest? I can always elaborate it with get_target_nodes_of_source_nodes or whatever. I just want something that people will immediately understand so they don't accidentally choose the incorrect function for their purposes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just target_nodes and source_nodes?
They would match the names of the underlying libsonata edges population target_nodes and source_nodes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In libsonata, they expect edge ids as input (as opposed to node ids), right? Wouldn't that be even more confusing?


def __getstate__(self):
"""Make EdgePopulation pickle-able, without storing state of caches."""
return self._circuit, self.name
Expand Down
6 changes: 6 additions & 0 deletions bluepysnap/edges/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ def iter_connections(
return_edge_count=return_edge_count,
)

# ALIASES
edges_by_source = efferent_edges
edges_by_target = afferent_edges
target_nodes_by_source = efferent_nodes
source_nodes_by_target = afferent_nodes

def __getstate__(self):
"""Make Edges pickle-able, without storing state of caches."""
return self._circuit
Expand Down
Loading