[python-hdf5storage] 15/84: Removed numpy.float16 support for when the h5py version is less than 2.2 since that was when support for it was introduced.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 0.1.10
in repository python-hdf5storage.
commit 392909a119d4cadd1f9c458a44c8665443e29ec4
Author: Freja Nordsiek <fnordsie at gmail.com>
Date: Thu Aug 14 17:37:36 2014 -0400
Removed numpy.float16 support for when the h5py version is less than 2.2 since that was when support for it was introduced.
---
hdf5storage/Marshallers.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 4fc5f14..5d93f61 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -474,7 +474,7 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
np.bool_, np.void,
np.uint8, np.uint16, np.uint32, np.uint64,
np.int8, np.int16, np.int32, np.int64,
- np.float16, np.float32, np.float64,
+ np.float32, np.float64,
np.complex64, np.complex128,
np.bytes_, np.unicode_, np.object_]
# Using Python 3 type strings.
@@ -486,8 +486,7 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
'numpy.uint32', 'numpy.uint64',
'numpy.int8', 'numpy.int16',
'numpy.int32', 'numpy.int64',
- 'numpy.float16', 'numpy.float32',
- 'numpy.float64',
+ 'numpy.float32', 'numpy.float64',
'numpy.complex64',
'numpy.complex128',
'numpy.bytes_', 'numpy.str_',
@@ -538,6 +537,12 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
# Set matlab_classes to the supported classes (the values).
self.matlab_classes = list(self.__MATLAB_classes.values())
+ # For h5py >= 2.2, half precisions (np.float16) are supported.
+ if distutils.version.LooseVersion(h5py.__version__) \
+ >= distutils.version.LooseVersion('2.2'):
+ self.types.append(np.float16)
+ self.python_type_strings.append('numpy.float16')
+
def write(self, f, grp, name, data, type_string, options):
# If we are doing matlab compatibility and the data type is not
# one of those that is supported for matlab, skip writing the
@@ -1403,7 +1408,7 @@ class PythonDictMarshaller(TypeMarshaller):
+ 'unicode keys are not '
+ 'supported: '
+ repr(fieldname))
-
+
# If the group doesn't exist, it needs to be created. If it
# already exists but is not a group, it needs to be deleted
# before being created.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-hdf5storage.git
More information about the debian-science-commits
mailing list