nanshe.io.hdf5.search module

The module search provides glob paths to search for content in a HDF5 file.

Overview

The module implements a strategy similar to Python’s glob module for HDF5 files. In short, it uses regex patterns to match as many possible paths as it can.

API

nanshe.io.hdf5.search.get_matching_grouped_paths(*args, **kwargs)[source]

Looks for existing paths that match the full provide pattern path. Returns a list of matches as keys and whether they are found in the HDF5 file or not.

Parameters:
  • a_filehandle (h5py.File) – an HDF5 file.
  • a_path_pattern (str) – an internal path (with patterns for each group) for the HDF5 file.
Returns:

an ordered dictionary with possible

paths that fit the pattern and whether they are found.

Return type:

(list)

nanshe.io.hdf5.search.get_matching_grouped_paths_found(*args, **kwargs)[source]

Looks for existing paths that match the full provide pattern path. Returns a list of matches as keys and whether they are found in the HDF5 file or not.

Parameters:
  • a_filehandle (h5py.File) – an HDF5 file.
  • a_path_pattern (str) – an internal path (with patterns for each group) for the HDF5 file.
Returns:

an ordered dictionary with possible

paths that fit the pattern and whether they are found.

Return type:

(collections.OrderedDict)

nanshe.io.hdf5.search.get_matching_paths(*args, **kwargs)[source]

Looks for existing paths that match the full provide pattern path. Returns a list of matches for the given file handle.

Parameters:
  • a_filehandle (h5py.File) – an HDF5 file.
  • a_path_pattern (str) – an internal path (with patterns for each group) for the HDF5 file.
Returns:

a list of matching paths.

Return type:

(list)

nanshe.io.hdf5.search.get_matching_paths_groups(*args, **kwargs)[source]

Looks for parts of the path pattern and tries to match them in order. Returns a list of matches that can be combined to yield acceptable matches for the given file handle.

Note

This works best when a tree structure is created systematically in HDF5. Then, this will recreate what the tree structure could and may contain.

Parameters:
  • a_filehandle (h5py.File) – an HDF5 file.
  • a_path_pattern (str) – an internal path (with patterns for each group) for the HDF5 file.
Returns:

a list of matching paths.

Return type:

(list)