How to use the h5py.version function in h5py

To help you get started, we’ve selected a few h5py 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 / hdf5-json / testall.py View on Github external
# Utilities.  The full HDF5 REST Server copyright notice, including       s   #
# terms governing use, modification, and redistribution, is contained in     #
# the file COPYING, which can be found at the root of the source code        #
# distribution tree.  If you do not have access to this file, you may        #
# request a copy from help@hdfgroup.org.                                     #
##############################################################################

import os
import sys
import h5py

unit_tests = ( 'hdf5dtypeTest', 'hdf5dbTest' )
integ_tests = ( 'h5tojson_test', 'jsontoh5_test' )
print(h5py.version.info)
# verify the hdf5 lib version is recent
hdf5_version = h5py.version.hdf5_version_tuple
if hdf5_version[1] < 8:
    sys.exit("Need hdf5 lib 1.8 or later")
if hdf5_version[1] == 8 and hdf5_version[2] < 4:
    sys.exit("Need hdf5 lib 1.8.4 or later")
# verify we have a recent version of h5py

h5py_version = h5py.version.version_tuple
if h5py_version[0] != 2 or h5py_version[1] < 5:
    sys.exit("Need h5py version 2.5 or later")
    
#
#
# Run all hdf5-json tests
# Run this script before running any integ tests
#
os.chdir('test/unit')
github HDFGroup / hdf5-json / testall.py View on Github external
#                                                                            #
# This file is part of H5Serv (HDF5 REST Server) Service, Libraries and      #
# Utilities.  The full HDF5 REST Server copyright notice, including       s   #
# terms governing use, modification, and redistribution, is contained in     #
# the file COPYING, which can be found at the root of the source code        #
# distribution tree.  If you do not have access to this file, you may        #
# request a copy from help@hdfgroup.org.                                     #
##############################################################################

import os
import sys
import h5py

unit_tests = ( 'hdf5dtypeTest', 'hdf5dbTest' )
integ_tests = ( 'h5tojson_test', 'jsontoh5_test' )
print(h5py.version.info)
# verify the hdf5 lib version is recent
hdf5_version = h5py.version.hdf5_version_tuple
if hdf5_version[1] < 8:
    sys.exit("Need hdf5 lib 1.8 or later")
if hdf5_version[1] == 8 and hdf5_version[2] < 4:
    sys.exit("Need hdf5 lib 1.8.4 or later")
# verify we have a recent version of h5py

h5py_version = h5py.version.version_tuple
if h5py_version[0] != 2 or h5py_version[1] < 5:
    sys.exit("Need h5py version 2.5 or later")
    
#
#
# Run all hdf5-json tests
# Run this script before running any integ tests
github activepapers / activepapers-python / lib / activepapers / storage.py View on Github external
self.history[-1] = (entry[0], ms_since_epoch()) + entry[2:]
        else:
            self.history.resize((1+len(self.history),))
            def getversion(name):
                if hasattr(sys.modules[name], '__version__'):
                    return getattr(sys.modules[name], '__version__')
                else:
                    return 'unknown'
            self.history[-1] = (ms_since_epoch(), 0,
                                sys.platform,
                                socket.getfqdn(),
                                getpass.getuser(),
                                activepapers.__version__,
                                sys.version.split()[0],
                                np.__version__,
                                h5py.version.version,
                                h5py.version.hdf5_version) \
                               + tuple(getversion(m) for m in self.dependencies)
github vasole / pymca / PyMca5 / PyMcaIO / NexusUtils.py View on Github external
def nxRootInit(h5group):
    """
    Initialize NXroot instance

    :param h5py.Group h5group:
    :raises ValueError: not root
    :raises RuntimeError: wrong Nexus class
    """
    if h5group.name != '/':
        raise ValueError('Group should be the root')
    if nxClassNeedsInit(h5group, None, u'NXroot'):
        h5group.attrs['file_time'] = timestamp()
        h5group.attrs['file_name'] = asNxChar(h5group.file.filename)
        h5group.attrs['HDF5_Version'] = asNxChar(h5py.version.hdf5_version)
        h5group.attrs['h5py_version'] = asNxChar(h5py.version.version)
        h5group.attrs['creator'] = PROGRAM_NAME
        h5group.attrs['NX_class'] = u'NXroot'
        updated(h5group)
github praxes / praxes / xpaxs / io / phynx / file.py View on Github external
raise RuntimeError(
                    'lock must be a context manager, providing __enter__ and '
                    '__exit__ methods'
                )
        self._plock = lock

        self._sorted = None
        self.sorted_with(sorted_with)

        if self.mode != 'r' and len(self) == 0:
            if 'file_name' not in self.attrs:
                self.attrs['file_name'] = name
            if 'file_time' not in self.attrs:
                self.attrs['file_time'] = getLocalTime()
            if 'HDF5_version' not in self.attrs:
                self.attrs['HDF5_version'] = h5py.version.hdf5_version
            if 'HDF5_API_version' not in self.attrs:
                self.attrs['HDF5_API_version'] = h5py.version.api_version
            if 'HDF5_version' not in self.attrs:
                self.attrs['h5py_version'] = h5py.version.version
            if 'creator' not in self.attrs:
                self.attrs['creator'] = 'phynx'
            if 'format_version' not in self.attrs and len(self) == 0:
                self.attrs['format_version'] = __format_version__
github vasole / pymca / PyMca5 / PyMcaIO / ArraySave.py View on Github external
sorted_with is a callable function like python's builtin sorted, or
    None.
    """

    h5file = h5py.File(name, mode, **kwargs)
    if h5file.mode != 'r' and len(h5file) == 0:
        if 'file_name' not in h5file.attrs:
            h5file.attrs.create('file_name', to_h5py_utf8(name))
        if 'file_time' not in h5file.attrs:
            h5file.attrs.create('file_time', to_h5py_utf8(getDate()))
        if 'HDF5_version' not in h5file.attrs:
            txt = "%s" % h5py.version.hdf5_version
            h5file.attrs.create('HDF5_version', to_h5py_utf8(txt))
        if 'HDF5_API_version' not in h5file.attrs:
            txt = "%s" % h5py.version.api_version
            h5file.attrs.create('HDF5_API_version', to_h5py_utf8(txt))
        if 'h5py_version' not in h5file.attrs:
            txt = "%s" % h5py.version.version
            h5file.attrs.create('h5py_version', to_h5py_utf8(txt))
        if 'creator' not in h5file.attrs:
            h5file.attrs.create('creator', to_h5py_utf8('PyMca'))
        # if 'format_version' not in self.attrs and len(h5file) == 0:
        #     h5file.attrs['format_version'] = __format_version__

    return h5file
github pyscf / pyscf / pyscf / lib / misc.py View on Github external
import math
import types
import ctypes
import numpy
import h5py
from threading import Thread
from multiprocessing import Queue, Process
try:
    from concurrent.futures import ThreadPoolExecutor
except ImportError:
    ThreadPoolExecutor = None

from pyscf.lib import param
from pyscf import __config__

if h5py.version.version[:4] == '2.2.':
    sys.stderr.write('h5py-%s is found in your environment. '
                     'h5py-%s has bug in threading mode.\n'
                     'Async-IO is disabled.\n' % ((h5py.version.version,)*2))
if h5py.version.version[:2] == '3.':
    h5py.get_config().default_file_mode = 'a'

c_double_p = ctypes.POINTER(ctypes.c_double)
c_int_p = ctypes.POINTER(ctypes.c_int)
c_null_ptr = ctypes.POINTER(ctypes.c_void_p)

def load_library(libname):
# numpy 1.6 has bug in ctypeslib.load_library, see numpy/distutils/misc_util.py
    if '1.6' in numpy.__version__:
        if (sys.platform.startswith('linux') or
            sys.platform.startswith('gnukfreebsd')):
            so_ext = '.so'
github praxes / praxes / xpaxs / io / phynx / file.py View on Github external
'__exit__ methods'
                )
        self._plock = lock

        self._sorted = None
        self.sorted_with(sorted_with)

        if self.mode != 'r' and len(self) == 0:
            if 'file_name' not in self.attrs:
                self.attrs['file_name'] = name
            if 'file_time' not in self.attrs:
                self.attrs['file_time'] = getLocalTime()
            if 'HDF5_version' not in self.attrs:
                self.attrs['HDF5_version'] = h5py.version.hdf5_version
            if 'HDF5_API_version' not in self.attrs:
                self.attrs['HDF5_API_version'] = h5py.version.api_version
            if 'HDF5_version' not in self.attrs:
                self.attrs['h5py_version'] = h5py.version.version
            if 'creator' not in self.attrs:
                self.attrs['creator'] = 'phynx'
            if 'format_version' not in self.attrs and len(self) == 0:
                self.attrs['format_version'] = __format_version__
github yt-project / yt / yt / funcs.py View on Github external
def get_version_stack():
    import numpy, matplotlib, h5py
    version_info = {}
    version_info['yt'] = get_yt_version()
    version_info['numpy'] = numpy.version.version
    version_info['matplotlib'] = matplotlib.__version__
    version_info['h5py'] = h5py.version.version
    return version_info
github eucall-software / simex_platform / Sources / python / SimEx / Calculators / EMCOrientation.py View on Github external
f.create_group("history")
            gg = f["history"]
            gg.create_group("intensities")
            gg.create_group("error")
            gg.create_group("angle")
            gg.create_group("mutual_info")
            gg.create_group("quaternion")
            gg.create_group("time")
            c = numpy.array([gen.qmax, gen.qmax, gen.qmax])
            f.create_dataset("data/center", data=c)
            f.create_dataset("misc/qmax", data=gen.qmax)
            f.create_dataset("misc/detector", data=gen.detector)
            f.create_dataset("misc/beamstop", data=gen.beamstop)

            f.create_dataset("version", data=h5py.version.hdf5_version)
            f.close()
        else:
            f = h5py.File(outFile, 'r')
            offset_iter = len(f["/history/intensities"].keys())
            f.close()
            msg = "Output will be appended to the results of %d iterations before this."%offset_iter
            _print_to_log(msg=msg, log_file=self._outputLog)

        ###############################################################
        # Iterate EMC
        ###############################################################
        intensL = 2*gen.qmax + 1
        iter_num = 1
        currQuat = initial_number_of_quaternions

        try: