Skip to content

Commit

Permalink
Adding the h5 and csv files as properties from Storage (#139)
Browse files Browse the repository at this point in the history
* Adding the h5 and csv file accessors to the Node/EdgeStorage classes.
  • Loading branch information
tomdele committed Jun 14, 2021
1 parent ce650f2 commit dd2c2db
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

Version v0.12.1
---------------

New Features
~~~~~~~~~~~~~
- Adding the h5 and csv file accessors to the Node/EdgeStorage classes.


Version v0.12.0
---------------

Expand Down
10 changes: 10 additions & 0 deletions bluepysnap/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ def population_names(self):
"""Returns all population names inside this file."""
return self.storage.population_names

@property
def h5_filepath(self):
"""Returns the filepath of the Storage."""
return self._h5_filepath

@property
def csv_filepath(self):
"""Returns the csv filepath of the Storage."""
return self._csv_filepath

@property
def circuit(self):
"""Returns the circuit object containing this storage."""
Expand Down
10 changes: 10 additions & 0 deletions bluepysnap/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ def population_names(self):
"""Returns all population names inside this file."""
return self.storage.population_names

@property
def h5_filepath(self):
"""Returns the filepath of the Storage."""
return self._h5_filepath

@property
def csv_filepath(self):
"""Returns the csv filepath of the Storage."""
return self._csv_filepath

@property
def circuit(self):
"""Returns the circuit object containing this storage."""
Expand Down
6 changes: 6 additions & 0 deletions tests/test_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,12 @@ def setup(self):
def test_storage(self):
assert isinstance(self.test_obj.storage, libsonata.EdgeStorage)

def test_h5_filepath(self):
assert self.test_obj.h5_filepath == str(TEST_DATA_DIR / 'edges.h5')

def test_csv_filepath(self):
assert self.test_obj.csv_filepath is None

def test_population_names(self):
assert sorted(list(self.test_obj.population_names)) == ["default", "default2"]

Expand Down
6 changes: 6 additions & 0 deletions tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ def test_storage(self):
def test_population_names(self):
assert sorted(list(self.test_obj.population_names)) == ["default", "default2"]

def test_h5_filepath(self):
assert self.test_obj.h5_filepath == str(TEST_DATA_DIR / 'nodes.h5')

def test_csv_filepath(self):
assert self.test_obj.csv_filepath is None

def test_circuit(self):
assert self.test_obj.circuit is self.circuit

Expand Down

0 comments on commit dd2c2db

Please sign in to comment.