Skip to content

Commit

Permalink
Add function to update MorphologyRepository metadata. Use this functi… (
Browse files Browse the repository at this point in the history
#743)

* Add function to update MorphologyRepository metadata. Use this function to store new metadata instead of loading all metadata.

* bump bsb-hdf5

* Update setup.py

* Update plugins.txt

---------

Co-authored-by: Robin De Schepper <robin.deschepper93@gmail.com>
  • Loading branch information
drodarie and Helveg committed Jul 31, 2023
1 parent 05fd0c9 commit 5eebfb2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bsb/placement/distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,13 @@ def _specials(self, partitions, indicator, positions):
mr = self.scaffold.morphologies
uid = uuid.uuid4()
loaders = []
all_meta = mr.get_all_meta()
all_meta = {}
for gen_morpho, i in generated.items():
name = f"{prefix}-{uid}-{i}"
saved = mr.save(name, gen_morpho, update_meta=False)
all_meta[name] = saved.get_meta()
loaders.append(saved)
mr.set_all_meta(all_meta)
mr.update_all_meta(all_meta)
morphologies = MorphologySet(loaders, indices)
if not isinstance(morphologies, MorphologySet) and morphologies is not None:
morphologies = MorphologySet(loaders, morphologies)
Expand Down
10 changes: 10 additions & 0 deletions bsb/storage/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,16 @@ def set_all_meta(self, all_meta):
:type all_meta: dict
"""
pass

@abc.abstractmethod
def update_all_meta(self, meta):
"""
Update the metadata of stored morphologies with the provided key values
:param meta: Metadata dictionary.
:type meta: str
"""
pass

def import_swc(self, file, name=None, overwrite=False):
"""
Expand Down
2 changes: 1 addition & 1 deletion plugins.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Plugins
bsb-hdf5==0.8.1
bsb-hdf5==0.8.3

# Plugin dependencies
shortuuid
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
long_description = fh.read()

requires = [
"bsb-hdf5~=0.8.1",
"bsb-hdf5~=0.8.3",
"h5py~=3.0",
"numpy~=1.19",
"scipy~=1.5",
Expand Down

0 comments on commit 5eebfb2

Please sign in to comment.