Top-level variables and functions¶
The PyTables version number.
The underlying HDF5 library version number.
New in version 3.0.
copy_file(srcfilename, dstfilename, overwrite=False, **kwargs)¶
An easy way of copying one PyTables file to another.
This function allows you to copy an existing PyTables file named srcfilename to another file called dstfilename. The source file must exist and be readable. The destination file can be overwritten in place if existing by asserting the overwrite argument.
This function is a shorthand for the
File.copy_file()method, which acts on an already opened file. kwargs takes keyword arguments used to customize the copying process. See the documentation of
File.copy_file()for a description of those arguments.
Determine whether a file is in the HDF5 format.
When successful, it returns a true value if the file is an HDF5 file, false otherwise. If there were problems identifying the file, an HDF5ExtError is raised.
Determine whether a file is in the PyTables format.
When successful, it returns the format version string if the file is a PyTables file, None otherwise. If there were problems identifying the file, an HDF5ExtError is raised.
open_file(filename, mode='r', title='', root_uep='/', filters=None, **kwargs)¶
Open a PyTables (or generic HDF5) file and return a File object.
- filename : str
The name of the file (supports environment variable expansion). It is suggested that file names have any of the .h5, .hdf or .hdf5 extensions, although this is not mandatory.
- mode : str
The mode to open the file. It can be one of the following:
- ‘r’: Read-only; no data can be modified.
- ‘w’: Write; a new file is created (an existing file with the same name would be deleted).
- ‘a’: Append; an existing file is opened for reading and writing, and if the file does not exist it is created.
- ‘r+’: It is similar to ‘a’, but the file must already exist.
- title : str
If the file is to be created, a TITLE string attribute will be set on the root group with the given value. Otherwise, the title will be read from disk, and this will not have any effect.
- root_uep : str
The root User Entry Point. This is a group in the HDF5 hierarchy which will be taken as the starting point to create the object tree. It can be whatever existing group in the file, named by its HDF5 path. If it does not exist, an HDF5ExtError is issued. Use this if you do not want to build the entire object tree, but rather only a subtree of it.
Changed in version 3.0: The rootUEP parameter has been renamed into root_uep.
- filters : Filters
An instance of the Filters (see The Filters class) class that provides information about the desired I/O filters applicable to the leaves that hang directly from the root group, unless other filter properties are specified for these leaves. Besides, if you do not specify filter properties for child groups, they will inherit these ones, which will in turn propagate to child nodes.
In addition, it recognizes the (lowercase) names of parameters present in
tables/parameters.pyas additional keyword arguments. See PyTables parameter files for a detailed info on the supported parameters.
If you need to deal with a large number of nodes in an efficient way, please see Getting the most from the node LRU cache for more info and advices about the integrated node cache engine.
Set the maximum number of threads that Blosc can use.
This actually overrides the
tables.parameters, so the new value will be effective until this function is called again or a new file with a different
tables.parameters.MAX_BLOSC_THREADSvalue is specified.
Returns the previous setting for maximum threads.
Print all the versions of software that PyTables relies on.
Disable all flavors except those in keep.
Providing an empty keep sequence implies disabling all flavors (but the internal one). If the sequence is not specified, only optional flavors are disabled.
Once you disable a flavor, it can not be enabled again.
Split a PyTables type into a PyTables kind and an item size.
Returns a tuple of (kind, itemsize). If no item size is present in the type (in the form of a precision), the returned item size is None:
>>> split_type('int32') ('int', 4) >>> split_type('string') ('string', None) >>> split_type('int20') Traceback (most recent call last): ... ValueError: precision must be a multiple of 8: 20 >>> split_type('foo bar') Traceback (most recent call last): ... ValueError: malformed type: 'foo bar'
Run all the tests in the test suite.
If verbose is set, the test suite will emit messages with full verbosity (not recommended unless you are looking into a certain problem).
If heavy is set, the test suite will be run in heavy mode (you should be careful with this because it can take a lot of time and resources from your computer).
Return 0 (os.EX_OK) if all tests pass, 1 in case of failure
Get version information about a C library.
If the library indicated by name is available, this function returns a 3-tuple containing the major library version as an integer, its full version as a string, and the version date as a string. If the library is not available, None is returned.
The currently supported library names are hdf5, zlib, lzo, bzip2, and blosc. If another name is given, a ValueError is raised.
Silence (or re-enable) messages from the HDF5 C library.
The silence parameter can be used control the behaviour and reset the standard HDF5 logging.
New in version 2.4.