h5 Package

annotation_h5

class tvb.adapters.datatypes.h5.annotation_h5.ConnectivityAnnotations(**kwargs)[source]

Bases: HasTraits

Traited class [tvb.adapters.datatypes.h5.annotation_h5.ConnectivityAnnotations]

Ontology annotations for a Connectivity.

Attributes declared

connectivity : tvb.adapters.datatypes.h5.annotation_h5.ConnectivityAnnotations.connectivity = Attr(field_type=<class ‘tvb.datatypes.connectivity.Connectivity’>, default=None, required=True)

region_annotationstvb.adapters.datatypes.h5.annotation_h5.ConnectivityAnnotations.region_annotations = NArray(label=’Region Annotations’, dtype=[(‘id’, ‘<i4’), (‘parent_id’, ‘<i4’), (‘parent_left’, ‘<i4’), (‘parent_right’, ‘<i4’), (‘relation’, ‘O’), (‘label’, ‘O’), (‘definition’, ‘O’), (‘synonym’, ‘O’), (‘uri’, ‘O’), (‘synonym_tvb_left’, ‘<i4’), (‘synonym_tvb_right’, ‘<i4’)], default=array([],

dtype=[(‘id’, ‘<i4’), (‘parent_id’, ‘<i4’), (‘parent_left’, ‘<i4’), (‘parent_right’, ‘<i4’), (‘relation’, ‘O’), (‘label’, ‘O’), (‘definition’, ‘O’), (‘synonym’, ‘O’), (‘uri’, ‘O’), (‘synonym_tvb_left’, ‘<i4’), (‘synonym_tvb_right’, ‘<i4’)]), dim_names=(), ndim=None, required=True)

Flat tree of annotations for every connectivity region.

gid : tvb.basic.neotraits._core.HasTraits.gid = Attr(field_type=<class ‘uuid.UUID’>, default=None, required=True)

connectivity

Holds a flatten form for the annotations for a full connectivity. Each region in the connectivity can have None, or a tree of AnnotationTerms To be stored in a compound DS in H5.

get_activation_patterns()[source]

Group Annotation terms by URI. :return: map {brco_id: list of TVB regions IDs in which the same term is being subclass}

region_annotations

Declares a numpy array. dtype enforces the dtype. The default dtype is float64. An optional symbolic shape can be given, as a tuple of Dim attributes from the owning class. The shape will be enforced, but no broadcasting will be done. domain declares what values are allowed in this array. It can be any object that can be checked for membership Defaults are checked if they are in the declared domain. For performance reasons this does not happen on every attribute set.

set_annotations(annotation_terms)[source]
class tvb.adapters.datatypes.h5.annotation_h5.ConnectivityAnnotationsH5(path)[source]

Bases: H5File

Ontology annotations for a Connectivity.

store(datatype: ConnectivityAnnotations, scalars_only: bool = False, store_references: bool = True) None[source]

connectivity_h5

class tvb.adapters.datatypes.h5.connectivity_h5.ConnectivityH5(path)[source]

Bases: H5File

get_centres()[source]
get_region_labels()[source]
load_into(datatype: Connectivity) None[source]
store(datatype: Connectivity, scalars_only: bool = False, store_references: bool = True) None[source]

fcd_h5

class tvb.adapters.datatypes.h5.fcd_h5.FcdH5(path)[source]

Bases: DataTypeMatrixH5

graph_h5

class tvb.adapters.datatypes.h5.graph_h5.ConnectivityMeasureH5(path)[source]

Bases: DataTypeMatrixH5

get_array_data()[source]
load_into(datatype: ConnectivityMeasure) None[source]
store(datatype: ConnectivityMeasure, scalars_only: bool = False, store_references: bool = True) None[source]
class tvb.adapters.datatypes.h5.graph_h5.CorrelationCoefficientsH5(path)[source]

Bases: DataTypeMatrixH5

get_correlation_data(selected_state, selected_mode)[source]
class tvb.adapters.datatypes.h5.graph_h5.CovarianceH5(path)[source]

Bases: DataTypeMatrixH5

write_data_slice(partial_result)[source]

Append chunk.

local_connectivity_h5

class tvb.adapters.datatypes.h5.local_connectivity_h5.LocalConnectivityH5(path)[source]

Bases: H5File

get_min_max_values()[source]
load_into(datatype: LocalConnectivity) None[source]
store(datatype: LocalConnectivity, scalars_only: bool = False, store_references: bool = True) None[source]

mapped_value_h5

class tvb.adapters.datatypes.h5.mapped_value_h5.ValueWrapper(**kwargs)[source]

Bases: HasTraits

Traited class [tvb.adapters.datatypes.h5.mapped_value_h5.ValueWrapper]

Attributes declared

data_value : tvb.adapters.datatypes.h5.mapped_value_h5.ValueWrapper.data_value = Attr(field_type=<class ‘str’>, default=None, required=True)

data_type : tvb.adapters.datatypes.h5.mapped_value_h5.ValueWrapper.data_type = Attr(field_type=<class ‘str’>, default=None, required=True)

data_name : tvb.adapters.datatypes.h5.mapped_value_h5.ValueWrapper.data_name = Attr(field_type=<class ‘str’>, default=None, required=True)

gid : tvb.basic.neotraits._core.HasTraits.gid = Attr(field_type=<class ‘uuid.UUID’>, default=None, required=True)

data_name

An Attr declares the following about the attribute it describes: * the type * a default value shared by all instances * if the value might be missing * documentation It will resolve to attributes on the instance.

data_type

An Attr declares the following about the attribute it describes: * the type * a default value shared by all instances * if the value might be missing * documentation It will resolve to attributes on the instance.

data_value

An Attr declares the following about the attribute it describes: * the type * a default value shared by all instances * if the value might be missing * documentation It will resolve to attributes on the instance.

property value
class tvb.adapters.datatypes.h5.mapped_value_h5.ValueWrapperH5(path)[source]

Bases: H5File

mode_decompositions_h5

class tvb.adapters.datatypes.h5.mode_decompositions_h5.IndependentComponentsH5(path)[source]

Bases: H5File

write_data_slice(partial_result)[source]

Append chunk.

class tvb.adapters.datatypes.h5.mode_decompositions_h5.PrincipalComponentsH5(path)[source]

Bases: H5File

read_fractions_data(from_comp, to_comp)[source]

Return a list with fractions for components in interval from_comp, to_comp and in addition have in position n the sum of the fractions for the rest of the components.

read_weights_data(from_comp, to_comp)[source]

Return the weights data for the components in the interval [from_comp, to_comp].

write_data_slice(partial_result)[source]

Append chunk.

patterns_h5

class tvb.adapters.datatypes.h5.patterns_h5.StimuliRegionH5(path)[source]

Bases: H5File

store(datatype, scalars_only=False, store_references=True)[source]
class tvb.adapters.datatypes.h5.patterns_h5.StimuliSurfaceH5(path)[source]

Bases: H5File

store(datatype, scalars_only=False, store_references=True)[source]

projections_h5

class tvb.adapters.datatypes.h5.projections_h5.ProjectionMatrixH5(path)[source]

Bases: H5File

read_subtype_attr()[source]

region_mapping_h5

class tvb.adapters.datatypes.h5.region_mapping_h5.RegionMappingH5(path)[source]

Bases: H5File

get_region_mapping_slice(start_idx, end_idx)[source]

Get a slice of the region mapping as used by the region viewers. For each vertex on the surface, alpha-indices will be the closest region-index :param start_idx: vertex index on the surface :param end_idx: vertex index on the surface :return: NumPy array with [closest_reg_idx …]

class tvb.adapters.datatypes.h5.region_mapping_h5.RegionVolumeMappingH5(path)[source]

Bases: VolumetricDataMixin, DataTypeMatrixH5

read_data_shape()[source]

The shape of the data

read_data_slice(data_slice)[source]

Expose chunked-data access.

sensors_h5

class tvb.adapters.datatypes.h5.sensors_h5.SensorsH5(path)[source]

Bases: H5File

get_labels()[source]
get_locations()[source]
load_into(datatype: Sensors) None[source]
read_subtype_attr()[source]
store(datatype: Sensors, scalars_only: bool = False, store_references: bool = True) None[source]

spectral_h5

class tvb.adapters.datatypes.h5.spectral_h5.CoherenceSpectrumH5(path)[source]

Bases: DataTypeMatrixH5

write_data_slice(partial_result)[source]

Append chunk.

class tvb.adapters.datatypes.h5.spectral_h5.ComplexCoherenceSpectrumH5(path)[source]

Bases: DataTypeMatrixH5

get_spectrum_data(selected_spectrum)[source]
spectrum_types = ['Imaginary', 'Real', 'Absolute']
write_data_slice(partial_result)[source]

Append chunk.

class tvb.adapters.datatypes.h5.spectral_h5.DataTypeMatrixH5(path: str)[source]

Bases: H5File

get_min_max_values()[source]

Retrieve the minimum and maximum values from the metadata. :returns: (minimum_value, maximum_value)

class tvb.adapters.datatypes.h5.spectral_h5.FourierSpectrumH5(path)[source]

Bases: DataTypeMatrixH5

get_fourier_data(selected_state, selected_mode, normalized)[source]
write_data_slice(partial_result)[source]

Append chunk.

class tvb.adapters.datatypes.h5.spectral_h5.WaveletCoefficientsH5(path)[source]

Bases: DataTypeMatrixH5

write_data_slice(partial_result)[source]

Append chunk.

structural_h5

class tvb.adapters.datatypes.h5.structural_h5.StructuralMRIH5(path)[source]

Bases: VolumetricDataMixin, DataTypeMatrixH5

class tvb.adapters.datatypes.h5.structural_h5.VolumetricDataMixin[source]

Bases: object

Provides subclasses with useful methods for volumes.

array_data: DataSet = None
get_volume_slice(x_plane, y_plane, z_plane)[source]
get_volume_view(x_plane, y_plane, z_plane, **kwargs)[source]
write_data_slice(data)[source]

We are using here the same signature as in TS, just to allow easier parsing code. This is not a chunked write.

surface_h5

class tvb.adapters.datatypes.h5.surface_h5.SurfaceH5(path)[source]

Bases: H5File

center()[source]

Compute the center of the surface as the mean spot on all the three axes.

get_lines_slice(slice_number=0)[source]

Read the gl lines values for the current slice number.

get_number_of_split_slices()[source]
get_pick_triangles_slice(slice_number=0)[source]

Read triangles slice, to be used by WebGL visualizer with pick.

get_pick_vertex_normals_slice(slice_number=0)[source]

Read vertex-normals slice, to be used by WebGL visualizer with pick.

get_pick_vertices_slice(slice_number=0)[source]

Read vertices slice, to be used by WebGL visualizer with pick.

get_slice_vertex_boundaries(slice_idx)[source]
get_slices_to_hemisphere_mask()[source]
Returns:

a vector af length number_of_slices, with 1 when current chunk belongs to the Right hemisphere

get_triangles_slice(slice_number=0)[source]

Read split-triangles slice, to be used by WebGL visualizer.

get_vertex_normals_slice(slice_number=0)[source]

Read vertex-normal slice, to be used by WebGL visualizer.

get_vertices_slice(slice_number=0)[source]

Read vertices slice, to be used by WebGL visualizer.

prepare_slices(datatype)[source]

Before storing Surface in H5, make sure vertices/triangles are split in slices that are readable by WebGL. WebGL only supports triangle indices in interval [0…. 2^16]

read_subtype_attr()[source]
store(datatype: Surface, scalars_only: bool = False, store_references: bool = True) None[source]

temporal_correlations_h5

class tvb.adapters.datatypes.h5.temporal_correlations_h5.CrossCorrelationH5(path)[source]

Bases: DataTypeMatrixH5

read_data_shape()[source]

The shape of the data

read_data_slice(data_slice)[source]

Expose chunked-data access.

write_data_slice(partial_result)[source]

Append chunk.

time_series_h5

class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesEEGH5(path)[source]

Bases: TimeSeriesSensorsH5

store_references(ts)[source]
class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesH5(path)[source]

Bases: H5File

get_default_selection()[source]
Returns:

The measure point indices that have to be shown by default. By default show all.

get_grouped_space_labels()[source]
Returns:

A list of label groups. A label group is a tuple (name, [(label_idx, label)…]). Default all labels in a group named ‘’

get_measure_points_selection_gid()[source]
Returns:

a datatype gid with which to obtain al valid measure point selection for this time series We have to decide if the default should be all selections or none

get_min_max_values()[source]

Retrieve the minimum and maximum values from the metadata. :returns: (minimum_value, maximum_value)

get_space_labels()[source]

It assumes that we want to select in the 3’rd dimension, and generates labels for each point in that dimension. Subclasses are more specific. :return: An array of strings.

read_channels_page(from_idx, to_idx, step=None, specific_slices=None, channels_list=None)[source]

Read and return only the data page for the specified channels list.

Parameters:
  • from_idx – the starting time idx from which to read data

  • to_idx – the end time idx up until to which you read data

  • step – increments in which to read the data. Optional, default to 1.

  • specific_slices – optional parameter. If speficied slices the data accordingly.

  • channels_list – the list of channels for which we want data

read_data_page(from_idx, to_idx, step=None, specific_slices=None)[source]

Retrieve one page of data (paging done based on time).

read_data_shape()[source]
read_data_slice(data_slice)[source]

Expose chunked-data access.

read_time_page(current_page, page_size, max_size=None)[source]

Compute time for current page. :param current_page: Starting from 0

store_references(ts)[source]
write_data_slice(partial_result)[source]

Append a chunk of time-series data to the data attribute.

write_data_slice_on_grow_dimension(partial_result, grow_dimension=0)[source]
write_time_slice(partial_result)[source]

Append a new value to the time attribute.

class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesMEGH5(path)[source]

Bases: TimeSeriesSensorsH5

store_references(ts)[source]
class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesRegionH5(path)[source]

Bases: TimeSeriesH5

get_measure_points_selection_gid()[source]
Returns:

the associated connectivity gid

static out_of_range(min_value)[source]
store_references(ts)[source]
class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesSEEGH5(path)[source]

Bases: TimeSeriesSensorsH5

store_references(ts)[source]
class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesSensorsH5(path)[source]

Bases: TimeSeriesH5

get_measure_points_selection_gid()[source]
Returns:

a datatype gid with which to obtain al valid measure point selection for this time series We have to decide if the default should be all selections or none

store_references(ts)[source]
class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesSurfaceH5(path)[source]

Bases: TimeSeriesH5

SELECTION_LIMIT = 100
get_space_labels()[source]

Return only the first SELECTION_LIMIT vertices/channels

store_references(ts)[source]
class tvb.adapters.datatypes.h5.time_series_h5.TimeSeriesVolumeH5(path)[source]

Bases: TimeSeriesH5

get_volume_view(from_idx, to_idx, x_plane, y_plane, z_plane, **kwargs)[source]

Retrieve 3 slices through the Volume TS, at the given X, y and Z coordinates, and in time [from_idx .. to_idx].

Parameters:
  • from_idx – int This will be the limit on the first dimension (time)

  • to_idx – int Also limit on the first Dimension (time)

  • x_plane – int coordinate

  • y_plane – int coordinate

  • z_plane – int coordinate

Returns:

An array of 3 Matrices 2D, each containing the values to display in planes xy, yz and xy.

get_voxel_time_series(x_plane, y_plane, z_plane, **kwargs)[source]

Retrieve for a given voxel (x,y,z) the entire timeline.

Parameters:
  • x – int coordinate

  • y – int coordinate

  • z – int coordinate

Returns:

A complex dictionary with information about current voxel. The main part will be a vector with all the values over time from the x,y,z coordinates.

store_references(ts)[source]

tracts_h5

class tvb.adapters.datatypes.h5.tracts_h5.TractsH5(path)[source]

Bases: H5File

MAX_N_VERTICES = 65536
get_line_starts(region_id)[source]

Returns a compact representation of the element buffers required to draw the streams via gl.drawElements A list of indices that describe where the first vertex for a tract is in the vertex array returned by get_tract_vertices_starting_in_region

get_tract(i)[source]

get a tract by index

get_vertices(region_id, slice_number=0)[source]

Concatenates the vertices for all tracts starting in region_id. Returns a completely flat array as required by gl.bindBuffer apis

write_vertices_slice(partial_result)[source]

Append a new value to the vertices attribute.

volumes_h5

class tvb.adapters.datatypes.h5.volumes_h5.VolumeH5(path)[source]

Bases: H5File