Skip to main content

hdf_pointer

BasePointer

Pointer to a location in an hdf5 file. The constructor takes a :class:`~.file_handler.FileHandler` and the in-file path to the object. The base class represents a generic group in the file

BasePointer (
file_handler: bamboost.common.file_handler.FileHandler,
path_to_data: str
)
Parameters:
Variables:
  • path_to_data :

  • obj :

    The object this BasePointer points to. File needs to be open for access.

  • attrs :

new_pointer

new_pointer (
cls,
file_handler: bamboost.common.file_handler.FileHandler,
path_to_data: str
) -> bamboost.common.hdf_pointer.BasePointer

Returns a new pointer object.

Parameters:
  • cls : Any

  • file_handler : <class 'bamboost.common.file_handler.FileHandler'>

  • path_to_data : <class 'str'>

BasePointer[key]

__getitem__ (self, key)

None

Parameters:
  • self : Any

  • key : Any

Returns:
    <class 'inspect._empty'>

Group

Pointer to a location in an hdf5 file. The constructor takes a :class:`~.file_handler.FileHandler` and the in-file path to the object. The base class represents a generic group in the file

Group (
file_handler: bamboost.common.file_handler.FileHandler,
path_to_data: str
)
Parameters:
Variables:

    iter(Group)

    __iter__ (self)

    None

    Parameters:
    • self : Any

    Returns:
      <class 'inspect._empty'>

    keys

    keys (self) -> set

    None

    Parameters:
    • self : Any

    Returns:
      <class 'set'>

    groups

    groups (self) -> set

    None

    Parameters:
    • self : Any

    Returns:
      <class 'set'>

    datasets

    datasets (self) -> set

    None

    Parameters:
    • self : Any

    Returns:
      <class 'set'>

    MutableGroup

    Used for the `userdata` group.

    MutableGroup (
    file_handler: bamboost.common.file_handler.FileHandler,
    path_to_data: str
    )
    Parameters:
    Variables:

      MutableGroup[key]

      __getitem__ (self, key) -> Any

      Used to access datasets (:class:`~bamboost.common.hdf_pointer.Dataset`) or groups inside this group (:class:`~bamboost.common.hdf_pointer.MutableGroup`)

      Parameters:
      • self : Any

      • key : Any

      Returns:
        typing.Any

      MutableGroup[key] = ...

      __setitem__ (self, key, newvalue)

      Used to set an attribute. Will be written as an attribute to the group.

      Parameters:
      • self : Any

      • key : Any

      • newvalue : Any

      Returns:
        <class 'inspect._empty'>

      update_attrs

      update_attrs (self, attrs: dict) -> None

      Update the attributes of the group.

      Parameters:
      • self : Any

      • attrs : <class 'dict'>

        the dictionary to write as attributes

      Returns:
        None

      add_dataset

      add_dataset (
      self,
      name: str,
      vector: numpy.ndarray,
      attrs: dict = None,
      dtype: str = None
      ) -> None

      Add a dataset to the group. Error is thrown if attempting to overwrite with different shape than before. If same shape, data is overwritten (this is inherited from h5py -> require_dataset)

      Parameters:
      • self : Any

      • name : <class 'str'>

        Name for the dataset

      • vector : <class 'numpy.ndarray'>

        Data to write (max 2d)

      • attrs : <class 'dict'>

        Optional. Attributes of dataset.

      • dtype : <class 'str'>

        Optional. dtype of dataset. If not specified, uses dtype of inpyt array

      Returns:
        None

      require_group

      require_group (self, name: str) -> bamboost.common.hdf_pointer.Group

      Add a new group to the current group. If exists, return existing.

      Parameters:
      • self : Any

      • name : <class 'str'>

      Dataset

      Pointer to a location in an hdf5 file. The constructor takes a :class:`~.file_handler.FileHandler` and the in-file path to the object. The base class represents a generic group in the file

      Dataset (
      file_handler: bamboost.common.file_handler.FileHandler,
      path_to_data: str
      )
      Parameters:
      Variables:
      • attrs :

      • shape :

      • dtype :

      Dataset[key]

      __getitem__ (self, slice)

      None

      Parameters:
      • self : Any

      • slice : Any

      Returns:
        <class 'inspect._empty'>