Morphology repositories¶
Morphology repositories (MRs) are an interface of the storage
module and can be
supported by the Engine
so that morphologies can be stored
inside the network storage.
To access an MR, a 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 save()
method to store
Morphologies
. If you don’t immediately need the whole
morphology, you can preload()
it,
otherwise you can load the entire thing with
load()
.
- class bsb.storage.interfaces.MorphologyRepository(engine)[source]
- abstract all()[source]
Fetch all the stored morphologies.
- Returns:
List of the stored morphologies.
- Return type:
List[StoredMorphology]
- abstract get_all_meta()[source]
Get the metadata of all stored morphologies. :returns: Metadata dictionary :rtype: dict
- abstract get_meta(name)[source]
Get the metadata of a stored morphology.
- abstract has(name)[source]
Check whether a morphology under the given name exists
- list()[source]
List all the names of the morphologies in the repository.
- abstract 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:
- abstract 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:
- abstract 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:
- abstract 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:
List[StoredMorphology]
- abstract set_all_meta(all_meta)[source]
Set the metadata of all stored morphologies. :param all_meta: Metadata dictionary. :type all_meta: dict