Python API¶
Note
The whole library is accessible by importing the h5features
module.
import h5features
Item¶
- class h5features.Item(self, name: str, features: ndarray[dtype=float64, shape=(*, *), order='C', writable=False], times: ndarray[dtype=float64, order='C', writable=False], properties: dict | None = None)¶
Handle the features of a single item (e.g. a speech signal).
- features(self) numpy.ndarray[dtype=float64, shape=(*, *), order='C'] ¶
The item’s features.
- times(self) numpy.ndarray[dtype=float64, shape=(*, *), order='C'] ¶
The item’s timestamps.
- property name str ¶
The name of the item.
- property dim int ¶
The dimension of the features.
- property size int ¶
The number of vectors in the features.
- property properties dict ¶
The item’s properties.
Writer¶
- class h5features.Writer(self, filename: str | os.PathLike, *, group: str = 'features', overwrite: bool = False, compress: bool = False, version: Version = Version.v2_0)¶
Write
Item
instances to an HDF5 file.- write(self, item: Item) None ¶
- write(self, items: collections.abc.Sequence[Item]) None
Overloaded function.
write(self, item: h5features._core.Item) -> None
Write an
Item
to disk.write(self, items: collections.abc.Sequence[h5features._core.Item]) -> None
Write a sequence of
Item
to disk in parallel.
- property filename str ¶
The HDF5 file name.
- property groupname str ¶
The HDF5 group name.
Reader¶
- class h5features.Reader(self, filename: str | os.PathLike, *, group: str = 'features')¶
Read
Item
instances from an HDF5 file.- read_all(self, *, ignore_properties: bool = False) list[Item] ¶
Read all the items stored in the file.
- read_partial(self, name: str, start: float, stop: float, *, ignore_properties: bool = False) Item ¶
Partial read of an
Item
within the time interval[start, stop]
.
- items(self) list[str] ¶
The name of stored items.
- list_groups(filename: str | os.PathLike) list[str] ¶
Return the list of groups in the specified HDF5 file.
- property filename str ¶
The name of the file being read.
- property groupname str ¶
The name of the group being read in the file.