Morphology repositories¶
Morphology repositories (MRs) are an interface of the bsb.storage module and can be
supported by the bsb.storage.interfaces.Engine so that morphologies can be stored
inside the network storage.
To access an MR, a bsb.storage.Storage object is required:
from bsb import Storage
store = Storage("hdf5", "morphologies.hdf5")
mr = store.morphologies
print(mr.all())
Similarly, the built-in MR of a network is accessible as network.morphologies:
from bsb import from_storage
network = from_hdf("my_existing_model.hdf5")
mr = network.morphologies
You can use the bsb.storage.interfaces.MorphologyRepository.save() method to store
Morphologies. If you don’t immediately need the whole
morphology, you can bsb.storage.interfaces.MorphologyRepository.preload() it,
otherwise you can load the entire thing with
bsb.storage.interfaces.MorphologyRepository.load().
- class bsb.storage.interfaces.MorphologyRepository(engine)[source]
- abstractmethod all()[source]
Fetch all the stored morphologies.
- Returns:
List of the stored morphologies.
- Return type:
- abstractmethod get_all_meta()[source]
Get the metadata of all stored morphologies.
- Returns:
Metadata dictionary
- Return type:
- abstractmethod get_meta(name)[source]
Get the metadata of a stored morphology.
- abstractmethod has(name)[source]
Check whether a morphology under the given name exists.
- list()[source]
List all the names of the morphologies in the repository.
- abstractmethod load(name)[source]
Load a stored morphology as a constructed morphology object.
- Parameters:
name (str) – Key of the stored morphology.
- Returns:
A morphology
- Return type:
- abstractmethod preload(name)[source]
Load a stored morphology as a morphology loader.
- Parameters:
name (str) – Key of the stored morphology.
- Returns:
The stored morphology
- Return type:
- abstractmethod save(name, morphology, overwrite=False)[source]
Store a morphology.
- Parameters:
name (str) – Key to store the morphology under.
morphology (bsb.morphologies.Morphology) – Morphology to store
overwrite (bool) – Overwrite any stored morphology that already exists under that name
- Returns:
The stored morphology
- Return type:
- abstractmethod select(*selectors)[source]
Select stored morphologies.
- Parameters:
selectors (list[bsb.morphologies.selector.MorphologySelector]) – Any number of morphology selectors.
- Returns:
All stored morphologies that match at least one selector.
- Return type: