How to use the h5pyd._hl.base.HLObject function in h5pyd

To help you get started, we’ve selected a few h5pyd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HDFGroup / h5pyd / h5pyd / _hl / dataset.py View on Github external
class AstypeContext(object):
    def __init__(self, dset, dtype):
        self._dset = dset
        self._dtype = numpy.dtype(dtype)

    def __enter__(self):
        self._dset._local.astype = self._dtype

    def __exit__(self, *args):
        self._dset._local.astype = None


class Dataset(HLObject):

    """
        Represents an HDF5 dataset
    """

    def astype(self, dtype):
        """ Get a context manager allowing you to perform reads to a
        different destination type, e.g.:

        >>> with dataset.astype('f8'):
        ...     double_precision = dataset[0:100:2]
        """
        pass
        #return AstypeContext(self, dtype)

    @property
github HDFGroup / h5pyd / h5pyd / _hl / datatype.py View on Github external
#           and contributor agreement.

"""
    Implements high-level access to committed datatypes in the file. """

from __future__ import absolute_import

import posixpath as pp

#from ..h5t import TypeID
from .base import HLObject

from .objectid import  TypeID
from .h5type import createDataType

class Datatype(HLObject):

    """
        Represents an HDF5 named datatype stored in a file.

        To store a datatype, simply assign it to a name in a group:

        >>> MyGroup["name"] = numpy.dtype("f")
        >>> named_type = MyGroup["name"]
        >>> assert named_type.dtype == numpy.dtype("f")  """

    @property
    def dtype(self):
        """Numpy dtype equivalent for this datatype"""
        return self._dtype

    def __init__(self, bind):
github HDFGroup / h5pyd / h5pyd / _hl / group.py View on Github external
import os.path as op
import numpy
import collections

from .base import HLObject, MutableMappingHDF5, guess_dtype
from .objectid import TypeID, GroupID, DatasetID
from . import dataset
from .dataset import Dataset
from . import table
from .table import Table
from .datatype import Datatype
from . import h5type


class Group(HLObject, MutableMappingHDF5):

    """ Represents an HDF5 group.
    """

    def __init__(self, bind, **kwargs):
        #print "group init, bind:", bind

        """ Create a new Group object by binding to a low-level GroupID.
        """

        if not isinstance(bind, GroupID):
            raise ValueError("%s is not a GroupID" % bind)
        HLObject.__init__(self, bind, **kwargs)
        self._req_prefix = "/groups/" + self.id.uuid
        self._link_db = {}  # cache for links