Skip to content

Commit

Permalink
make h5 path accessible from (Node|Edge)Population (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeplf committed May 31, 2022
1 parent 58f7667 commit 134e6ad
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bluepysnap/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,3 +901,8 @@ def iter_connections(
else:
omit_edge_count = lambda x: x[:2]
return map(omit_edge_count, it)

@property
def h5_filepath(self):
"""Get the H5 edges file associated with population."""
return self._edge_storage.h5_filepath
5 changes: 5 additions & 0 deletions bluepysnap/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,3 +758,8 @@ def models(self):
from bluepysnap.neuron_models import NeuronModelsHelper

return NeuronModelsHelper(self.config, self)

@property
def h5_filepath(self):
"""Get the H5 nodes file associated with population."""
return self._node_storage.h5_filepath
3 changes: 3 additions & 0 deletions tests/test_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,3 +1333,6 @@ def test_iter_connection_unique(self):

it = test_obj.iter_connections([0, 1, 2], [1, 2], unique_node_ids=True)
assert sorted(it) == [(0, 1), (1, 2)]

def test_h5_filepath(self):
assert self.test_obj.h5_filepath == str(TEST_DATA_DIR / "edges.h5")
3 changes: 3 additions & 0 deletions tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ def test_get(self):
with pytest.raises(BluepySnapError):
self.test_obj.get(properties="unknown")

def test_h5_filepath(self):
assert self.test_obj["default"].h5_filepath == str(TEST_DATA_DIR / "nodes.h5")


class TestNodeStorage:
def setup(self):
Expand Down

0 comments on commit 134e6ad

Please sign in to comment.