open_table

ketos.data_handling.database_interface.open_table(h5file, table_path)[source]

Open a table from an HDF5 file.

Args:
h5file: tables.file.File object

HDF5 file handler.

table_path: str

The table’s full path.

Raises:

NoSuchNodeError if table does not exist.

Returns:
table: table.Table object or None

The table, if it exists. Otherwise, raises an exeption and returns None.

Examples:
>>> from ketos.data_handling.database_interface import open_file, open_table
>>> h5file = open_file("ketos/tests/assets/15x_same_spec.h5", 'r')
>>> data = open_table(h5file, "/train/species1")
>>> #data is a pytables 'Table' object
>>> type(data)
<class 'tables.table.Table'>
>>> # with 15 items (rows)
>>> data.nrows
15
>>> h5file.close()