nixio.hdf5 package — Python reimplementation of NIXIO (http://g-node.github.io/nix/) 1.5.0 Development documentation

# nixio.hdf5 package

## Submodules

## nixio.hdf5.h5dataset module

class nixio.hdf5.h5dataset.H5DataSet(parent, name, dtype=None, shape=None, compression=False)

  Bases: `object`

  classmethod create_from_h5obj(h5obj)
  property dtype
  get_attr(name)
  read_data(slc=None)
  set_attr(name, value)
  property shape
  write_data(data, slc=None)

## nixio.hdf5.h5group module

class nixio.hdf5.h5group.H5Group(parent, name, create=False)

  Bases: `object`

  copy(source, dest, name=None, cls=None, shallow=False, keep_id=True)
  create_dataset(name, shape, dtype, compression=False)

    Creates a dataset object under the current group with a given name, shape, and type.

    Parameters

      - name – the name of the dataset

      - shape – tuple representing the shape of the dataset

      - dtype – the type of the data for this dataset (DataType)

      - compression – whether to compress the data (default: False)

    Returns

      a new H5DataSet object

  classmethod create_from_h5obj(h5obj)
  create_link(target, name)
  delete(id_or_name, delete_if_empty=True)

    Deletes the child HDF5 group that matches the given name or id.

  delete_all(eid)

    Deletes all references to a given list of objects, identified by their entity_id, below the current object.

  find_children(filtr=None, limit=None)
  get_attr(name)
  get_by_id(id_)
  get_by_id_or_name(id_or_name)
  get_by_name(name)
  get_by_pos(pos)
  get_data(name)

    Returns the data contained in the dataset identified by ‘name’, or an empty list if a dataset of that name does not exist in the Group.

    Parameters

      name – The name of the dataset

    Returns

      The data contained in the dataset as a numpy array or None

  get_dataset(name)

    Returns a contained H5DataSet object.

    Parameters

      name – name of the dataset

    Returns

      H5DataSet object

  property group
  has_by_id(id_or_name)
  has_data(name)

    Return True if the Group contains a Dataset object with the given name.

    Parameters

      name – name of Dataset

    Returns

      True if Dataset exists in Group, False if it does not exist,

    or exists and is not a Dataset

  open_group(name, create=False)

    Returns a new H5Group with the given name contained in the current group. If the current group does not exist in the file, it is automatically created.

    Parameters

      - name – the name of the group

      - create – creates the child group in the file if it does not exist

    Returns

      a new H5Group object

  property parent
  set_attr(name, value)
  write_data(name, data, dtype=None, compression=False)

    Writes the data to a Dataset contained in the group with the given name. Creates the Dataset if necessary.

    Parameters

      - name – name of the Dataset object

      - data – the data to write

      - dtype – optionally specify the data type, otherwise it will be

    automatically determined by the data :param compression: whether to compress the data (default: False)

## Module contents