8.6.1.2. pymodaq_data.h5modules.backends module
Created the 15/11/2022
@author: Sebastien Weber
- class pymodaq_data.h5modules.backends.Attributes(node, backend='tables')[source]
Bases:
object- Attributes:
- attrs_name
- node
Methods
to_dict()Returns attributes name/value as a dict
- property attrs_name
- property node
- class pymodaq_data.h5modules.backends.CARRAY(node, backend)[source]
Bases:
Node- Attributes:
- array
Methods
read
- property array
- class pymodaq_data.h5modules.backends.EARRAY(array, backend)[source]
Bases:
CARRAYMethods
append(data[, expand])appends a ndarray after the current data in the enlargeable array
append_backend
- append(data, expand=True)[source]
appends a ndarray after the current data in the enlargeable array
Considering the shape length of the enlargeable array is n+1
The data to append could be:
a single element (without the enlargeable shape index that is always the first
index, that is of shape length n). In that case the first index of the enlargeable array is increased by one. * an ensemble of elements (a ndarray) of shape length of (n+1).
- Parameters:
data (
ndarray) – the data array to append to the enlargeable nodeexpand (
bool) – If True the data array will have its shape expanded by one dim
- class pymodaq_data.h5modules.backends.GROUP(node, backend)[source]
Bases:
NodeMethods
children()Get a dict containing all children node hanging from self whith their name as keys
Gets the sorted list of children name hanging from self
get_child
remove_children
- children()[source]
Get a dict containing all children node hanging from self whith their name as keys
See also
- class pymodaq_data.h5modules.backends.GroupType(*values)[source]
Bases:
BaseEnum- actuator = 1
- ch = 3
- data = 2
- data_dim = 6
- data_logger = 7
- detector = 0
- external_h5 = 5
- scan = 4
- class pymodaq_data.h5modules.backends.H5Backend(backend='tables')[source]
Bases:
object- Attributes:
- filename
- h5file
Methods
add_group(group_name, group_type, where[, ...])Add a node in the h5 file tree of the group type :type group_name:
(str) a custom name for this group:param group_name: :type group_name:(str) a custom name for this group:param group_type: one of the possible values of GroupType, should be enforced by higher level modules not here :type group_type:Union[GroupType,str] :type where:(strornode) parent node wheretocreate the new group:param where: :type where:(strornode) parent node wheretocreate the new group:type metadata:(dict) extra metadatatobe saved with this new group node:param metadata: :type metadata:(dict) extra metadatatobe saved with this new group nodeFlush data and close the h5file
create_earray(where, name, dtype[, ...])create enlargeable arrays from data with a given shape and of a given type.
create_vlarray(where, name, dtype[, title])create variable data length and type and enlargeable 1D arrays
define_compression(compression, compression_opts)Define cmpression library and level of compression :type compression:
(str) either gzipandzlib are supported here as they are compatible:param compression: but zlib is used by pytables while gzip is used by h5py :type compression:(str) either gzipandzlib are supported here as they are compatible:param compression_opts (int): :type compression_opts (int):0to9 0:None,9:maximum compressionget_children(where)Get a dict containing all children node hanging from where with their name as keys and types among Node, CARRAY, EARRAY, VLARRAY or StringARRAY
get_node_name(node)return node name :param node (str or node instance): :param see h5py and pytables documentation on nodes:
get_node_path(node)return node path :param node (str or node instance): :param see h5py and pytables documentation on nodes:
get_set_group(where, name[, title])Retrieve or create (if absent) a node group Get attributed to the class attribute
current_groupis_node_in_group(where, name)Check if a given node with name is in the group defined by where (comparison on lower case strings) :type where:
(strornode):param where: path or parent node instance :type where:(strornode):type name:(str):param name: group node name :type name:(str)create_carray
flush
get_attr
get_group_by_title
get_node
get_parent_node
has_attr
isopen
open_file
read
root
save_file_as
set_attr
walk_groups
walk_nodes
- add_group(group_name, group_type, where, title='', metadata={})[source]
Add a node in the h5 file tree of the group type :type group_name:
(str) a custom name for this group:param group_name: :type group_name:(str) a custom name for this group:param group_type: one of the possible values of GroupType, should be enforced by higher level modules not here :type group_type:Union[GroupType,str] :type where:(strornode) parent node wheretocreate the new group:param where: :type where:(strornode) parent node wheretocreate the new group:type metadata:(dict) extra metadatatobe saved with this new group node:param metadata: :type metadata:(dict) extra metadatatobe saved with this new group node- Returns:
(node)
- Return type:
- create_earray(where, name, dtype, data_shape=None, title='')[source]
create enlargeable arrays from data with a given shape and of a given type. The array is enlargeable along the first dimension
- create_vlarray(where, name, dtype, title='')[source]
create variable data length and type and enlargeable 1D arrays
- Parameters:
where (
(str) group location in the file wheretocreate the array node)name (
(str) nameofthe array)dtype (
(dtype) numpy dtype style,for particular caseofstrings,use dtype=``’string’``)title (
(str) node title attribute (written in capitals))
- Return type:
array
- define_compression(compression, compression_opts)[source]
Define cmpression library and level of compression :type compression:
(str) either gzipandzlib are supported here as they are compatible:param compression: but zlib is used by pytables while gzip is used by h5py :type compression:(str) either gzipandzlib are supported here as they are compatible:param compression_opts (int): :type compression_opts (int):0to9 0:None,9:maximum compression
- get_children(where)[source]
Get a dict containing all children node hanging from where with their name as keys and types among Node, CARRAY, EARRAY, VLARRAY or StringARRAY
- Parameters:
instance) (where (str or node) – see h5py and pytables documentation on nodes, and Node objects of this module
- Returns:
dict
- Return type:
keys are children node names,values are the children nodes
See also
- get_node_name(node)[source]
return node name :param node (str or node instance): :param see h5py and pytables documentation on nodes:
- Returns:
str
- Return type:
nameofthe node
- get_node_path(node)[source]
return node path :param node (str or node instance): :param see h5py and pytables documentation on nodes:
- Returns:
str
- Return type:
full pathofthe node
- get_set_group(where, name, title='', **kwargs)[source]
Retrieve or create (if absent) a node group Get attributed to the class attribute
current_group
- is_node_in_group(where, name)[source]
Check if a given node with name is in the group defined by where (comparison on lower case strings) :type where:
(strornode):param where: path or parent node instance :type where:(strornode):type name:(str):param name: group node name :type name:(str)- Returns:
True if node exists, False otherwise
- Return type:
- property filename
- property h5file
- class pymodaq_data.h5modules.backends.Node(node, backend)[source]
Bases:
objectMethods
get_attr
set_attr
to_h5_backend
- property attrs
- property h5file
- property name
return node name
- property node
- property path
return node path :param node (str or node instance): :param see h5py and pytables documentation on nodes:
- Returns:
str
- Return type:
full pathofthe node
- property title
- class pymodaq_data.h5modules.backends.SaveType(*values)[source]
Bases:
BaseEnum- actuator = 4
- custom = 3
- detector = 1
- logger = 2
- optimizer = 5
- scan = 0
- class pymodaq_data.h5modules.backends.StringARRAY(array, backend)[source]
Bases:
VLARRAYMethods
append(string)array_to_string
read
string_to_array
- class pymodaq_data.h5modules.backends.VLARRAY(array, backend)[source]
Bases:
EARRAYMethods
append(data)