neocom
Package¶
_h5loader
¶
- class tvb.core.neocom._h5loader.DirLoader(base_dir: str, registry: Registry, recursive: bool = False)[source]¶
Bases:
object
A simple recursive loader. Stores all files in a directory. You refer to files by their gid
- load(gid: UUID | str | None = None, fname: str | None = None) HasTraits [source]¶
Load from file a HasTraits entity. Either gid or fname should be given, or else an error is raised.
- Parameters:
gid – optional entity GUID to search for it under self.base_dir
fname – optional file name to search for it under self.base_dir.
- Returns:
HasTraits instance read from the given location
- class tvb.core.neocom._h5loader.DtLoader(base_dir, registry)[source]¶
Bases:
ViewModelLoader
A recursive loader for datatypes (HasTraits). Stores all files in one directory specified at initialization time. Does not access the TVB database. Does not take into consideration the TVB storage folder structure. Stores every linked HasTraits object in a file (even datatypes which might already exist in the TVB storage). Intended for storing tvb-library results in H5 files.
- class tvb.core.neocom._h5loader.Loader(registry)[source]¶
Bases:
object
A default simple loader. Does not do recursive loads. Loads stores just to paths.
- class tvb.core.neocom._h5loader.TVBLoader(registry)[source]¶
Bases:
object
A loader for HasTraits objects. Works with the TVB database and the TVB storage folder structure to identify and load datatypes starting from their corresponding HasTraitsIndex or a file path. Intended for usage in tvb-framework.
- class tvb.core.neocom._h5loader.ViewModelLoader(base_dir, registry=None)[source]¶
Bases:
DirLoader
A recursive loader for ViewModel objects. Stores all files in one directory specified at initialization time. Does not access the TVB database. Does not take into consideration the TVB storage folder structure. Stores every linked HasTraits in a file, but not datatypes that are already stored in TVB storage. Intended for usage within tvb-framework to store view models in H5 files.
_registry
¶
h5
¶
- tvb.core.neocom.h5.determine_filepath(gid, base_dir)[source]¶
Find the file path containing a datatype with the given GID within the directory specified by base_dir
- tvb.core.neocom.h5.gather_references_of_view_model(gid, base_dir, only_view_models=False)[source]¶
Gather in 2 lists all file paths that are referenced by a ViewModel with the given GID stored in base_dir directory. If only_view_models=True, returns only ViewModelH5 file paths, otherwise, returns also datatype H5 file paths.
- tvb.core.neocom.h5.load(source_path: str, with_references: bool = False) HasTraits [source]¶
Load a datatype stored in the tvb h5 file found at the given path
- tvb.core.neocom.h5.load_from_dir(base_dir: str, gid: str | UUID, recursive: bool = False) HasTraits [source]¶
Loads a datatype with the requested gid from the given directory. The datatype should have been written with store_to_dir The name and location of the file is chosen for you. :param base_dir: The h5 storage directory :param gid: the gid of the to be loaded datatype :param recursive: if datatypes contained in this datatype should be loaded as well
- tvb.core.neocom.h5.load_ht(gid: UUID | str, base_dir: str) str [source]¶
Completely load any HasTraits object with the gid specified from the base_dir directory
- tvb.core.neocom.h5.load_view_model(gid: UUID | str, base_dir: str) ViewModel [source]¶
Load a ViewModel object by reading the H5 file with the given GID, from the directory specified by base_dir.
- tvb.core.neocom.h5.load_view_model_from_file(filepath: str) ViewModel [source]¶
Load a ViewModel object by reading the H5 file specified by filepath.
- tvb.core.neocom.h5.load_with_links(source_path: str)[source]¶
Load a datatype stored in the tvb h5 file found at the given path, but also create empty linked entities to hold GID
- tvb.core.neocom.h5.load_with_references(source_path: str)[source]¶
Load a datatype stored in the tvb h5 file found at the given path, but also load linked entities through GID
- tvb.core.neocom.h5.load_with_references_from_dir(base_dir: str, gid: UUID | str) HasTraits [source]¶
- tvb.core.neocom.h5.path_by_dir(base_dir: str, h5_file_class: Type[H5File], gid: str, dt_class: str | None = None) str [source]¶
- tvb.core.neocom.h5.path_for(op_id: int, h5_file_class: Type[H5File], gid: object, project_name: str, dt_class: str | None = None) str [source]¶
- tvb.core.neocom.h5.store(datatype: HasTraits, destination: str, recursive: bool = False) None [source]¶
Stores the given datatype in a tvb h5 file at the given path
- tvb.core.neocom.h5.store_complete(datatype, op_id, project_name, generic_attributes=<tvb.core.entities.generic_attributes.GenericAttributes object>)[source]¶
- tvb.core.neocom.h5.store_complete_to_dir(datatype, base_dir, generic_attributes=<tvb.core.entities.generic_attributes.GenericAttributes object>)[source]¶
- tvb.core.neocom.h5.store_ht(ht: HasTraits, base_dir: str) str [source]¶
Completely store any HasTraits object to the directory specified by base_dir
- tvb.core.neocom.h5.store_to_dir(datatype: HasTraits, base_dir: str, recursive: bool = False) str [source]¶
Stores the given datatype in the given directory. The name and location of the stored file(s) is chosen for you by this function. If recursive is true than datatypes referenced by this one are stored as well.