TheVirtualBrain:

TheDocumentationwebsite.

Table Of Contents

Previous topic

transient Package

Next topic

neotraits Package

This Page

neocom Package

_h5loader

class tvb.core.neocom._h5loader.DirLoader(base_dir, registry, recursive=False)[source]

Bases: builtins.object

A simple recursive loader. Stores all files in a directory. You refer to files by their gid

find_file_by_gid(gid)[source]
find_file_for_has_traits_type(has_traits_class)[source]
load(gid=None, fname=None)[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

path_for(h5_file_class, gid)[source]

where will this Loader expect to find a file of this format and with this gid

path_for_has_traits(has_traits_class, gid)[source]
store(datatype, fname=None)[source]
class tvb.core.neocom._h5loader.Loader(registry)[source]

Bases: builtins.object

A default simple loader. Does not do recursive loads. Loads stores just to paths.

load(source)[source]
store(datatype, destination)[source]
class tvb.core.neocom._h5loader.TVBLoader(registry)[source]

Bases: builtins.object

load_complete_by_function(file_path, load_ht_function)[source]
load_from_index(dt_index)[source]
load_with_references(file_path)[source]
path_for(operation_dir, h5_file_class, gid, dt_class=None)[source]
path_for_stored_index(dt_index_instance)[source]

Given a Datatype(HasTraitsIndex) instance, build where the corresponding H5 should be or is stored

class tvb.core.neocom._h5loader.ViewModelLoader(base_dir)[source]

Bases: tvb.core.neocom._h5loader.DirLoader

gather_reference_files(gid, vm_ref_files, dt_ref_files, load_dts=None)[source]
get_class_path(vm)[source]
load(gid=None, fname=None)[source]

Load a ViewModel object by reading the H5 file with the given GID, from the directory self.base_dir

store(view_model, fname=None)[source]

Completely store any ViewModel object to the directory specified by self.base_dir. Works recursively for view models that are serialized in multiple files (eg. SimulatorAdapterModel)

tvb.core.neocom._h5loader.get_h5_filename(class_name, gid)[source]

_registry

class tvb.core.neocom._registry.Registry[source]

Bases: builtins.object

A configuration class that holds the one to one relationship between datatypes and H5Files that can read/write them to disk

get_base_datatype_for_h5file(h5file_class)[source]
get_datatype_for_h5file(h5file)[source]
get_datatype_for_index(index)[source]
get_h5file_for_datatype(datatype_class)[source]
get_h5file_for_index(index_class)[source]
get_index_for_datatype(datatype_class)[source]
get_index_for_h5file(h5file_class)[source]
register_datatype(datatype_class, h5file_class, datatype_index, subtype_factory=None)[source]

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_all_references_by_index(h5_file, ref_files)[source]
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.h5_file_for_gid(data_gid)[source]
tvb.core.neocom.h5.h5_file_for_index(dt_index_instance)[source]
tvb.core.neocom.h5.index_for_h5_file(source_path)[source]
tvb.core.neocom.h5.load(source_path, with_references=False)[source]

Load a datatype stored in the tvb h5 file found at the given path

tvb.core.neocom.h5.load_from_dir(base_dir, gid, recursive=False)[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_from_gid(data_gid)[source]
tvb.core.neocom.h5.load_from_index(dt_index)[source]
tvb.core.neocom.h5.load_view_model(gid, base_dir)[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)[source]

Load a ViewModel object by reading the H5 file specified by filepath.

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)[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, gid)[source]
tvb.core.neocom.h5.path_for(base_dir, h5_file_class, gid, dt_class=None)[source]
tvb.core.neocom.h5.path_for_stored_index(dt_index_instance)[source]
tvb.core.neocom.h5.store(datatype, destination, recursive=False)[source]

Stores the given datatype in a tvb h5 file at the given path

tvb.core.neocom.h5.store_complete(datatype, base_dir, generic_attributes=<tvb.core.entities.generic_attributes.GenericAttributes object at 0x7f00a8da1590>)[source]

Stores the given HasTraits instance in a h5 file, and fill the Index entity for later storage in DB

tvb.core.neocom.h5.store_to_dir(datatype, base_dir, recursive=False)[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.

tvb.core.neocom.h5.store_view_model(view_model, base_dir)[source]

Completely store any ViewModel object to the directory specified by base_dir.