[med-svn] [Git][med-team/hdmf][master] 4 commits: New upstream version 2.5.8

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Tue Jun 22 04:26:13 BST 2021



Nilesh Patra pushed to branch master at Debian Med / hdmf


Commits:
859451d4 by Nilesh Patra at 2021-06-22T08:49:37+05:30
New upstream version 2.5.8
- - - - -
e33a0732 by Nilesh Patra at 2021-06-22T08:49:40+05:30
Update upstream source from tag 'upstream/2.5.8'

Update to upstream version '2.5.8'
with Debian dir 7b31e896d48e6f8fded320ae9b353fc5aed171d5
- - - - -
589bb93f by Nilesh Patra at 2021-06-22T03:22:21+00:00
Update manpage (minor update)

- - - - -
cce58b69 by Nilesh Patra at 2021-06-22T03:22:33+00:00
Interim changelog entry

- - - - -


7 changed files:

- PKG-INFO
- debian/changelog
- debian/validate_hdmf_spec.1
- src/hdmf.egg-info/PKG-INFO
- src/hdmf/_version.py
- src/hdmf/common/table.py
- tests/unit/common/test_table.py


Changes:

=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: hdmf
-Version: 2.5.7
+Version: 2.5.8
 Summary: A package for standardizing hierarchical object data
 Home-page: https://github.com/hdmf-dev/hdmf
 Author: Andrew Tritt


=====================================
debian/changelog
=====================================
@@ -1,11 +1,11 @@
-hdmf (2.5.7-1) UNRELEASED; urgency=medium
+hdmf (2.5.8-1) UNRELEASED; urgency=medium
 
   * Team Upload.
-  * New upstream version 2.5.7
   * Fix copyright
   * d/rules: set LC_ALL to C.UTF-8 to make build reproducible
+  * New upstream version 2.5.8
 
- -- Nilesh Patra <nilesh at debian.org>  Fri, 11 Jun 2021 00:30:31 +0530
+ -- Nilesh Patra <nilesh at debian.org>  Tue, 22 Jun 2021 03:21:41 +0000
 
 hdmf (2.3.0-1) unstable; urgency=medium
 


=====================================
debian/validate_hdmf_spec.1
=====================================
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.16.
-.TH VALIDATE_HDMF_SPEC "1" "September 2020" "validate_hdmf_spec 2.2.0" "User Commands"
+.TH VALIDATE_HDMF_SPEC "1" "June 2021" "validate_hdmf_spec 2.5.8" "User Commands"
 .SH NAME
 validate_hdmf_spec \- Hierarchical Data Modeling Framework
 .SH DESCRIPTION


=====================================
src/hdmf.egg-info/PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: hdmf
-Version: 2.5.7
+Version: 2.5.8
 Summary: A package for standardizing hierarchical object data
 Home-page: https://github.com/hdmf-dev/hdmf
 Author: Andrew Tritt


=====================================
src/hdmf/_version.py
=====================================
@@ -8,11 +8,11 @@ import json
 
 version_json = '''
 {
- "date": "2021-06-04T18:02:01-0700",
+ "date": "2021-06-16T13:54:41-0700",
  "dirty": false,
  "error": null,
- "full-revisionid": "1b084d56ca66d73ed05fd83b5657c0824f4b72c5",
- "version": "2.5.7"
+ "full-revisionid": "929ec93232bfa1069c764abc7b3b280ab0fc0c1e",
+ "version": "2.5.8"
 }
 '''  # END VERSION_JSON
 


=====================================
src/hdmf/common/table.py
=====================================
@@ -107,28 +107,33 @@ class VectorIndex(VectorData):
 
     def __check_precision(self, idx):
         """
-        Check precision of current dataset and, if
-        necessary, adjust precision to accommodate new value.
+        Check precision of current dataset and, if necessary, adjust precision to accommodate new value.
 
         Returns:
             unsigned integer encoding of idx
         """
         if idx > self.__maxval:
-            nbits = (np.log2(self.__maxval + 1) * 2)
+            while idx > self.__maxval:
+                nbits = (np.log2(self.__maxval + 1) * 2)  # 8->16, 16->32, 32->64
+                if nbits == 128:  # pragma: no cover
+                    msg = ('Cannot store more than 18446744073709551615 elements in a VectorData. Largest dtype '
+                           'allowed for VectorIndex is uint64.')
+                    raise ValueError(msg)
+                self.__maxval = 2 ** nbits - 1
             self.__uint = np.dtype('uint%d' % nbits).type
-            self.__maxval = 2 ** nbits - 1
             self.__adjust_precision(self.__uint)
         return self.__uint(idx)
 
     def __adjust_precision(self, uint):
         """
-        Adjust precision of data to specificied unsigned integer precision
+        Adjust precision of data to specificied unsigned integer precision.
         """
         if isinstance(self.data, list):
             for i in range(len(self.data)):
                 self.data[i] = uint(self.data[i])
         elif isinstance(self.data, np.ndarray):
-            self._VectorIndex__data = self.data.astype(uint)
+            # use self._Data__data to work around restriction on resetting self.data
+            self._Data__data = self.data.astype(uint)
         else:
             raise ValueError("cannot adjust precision of type %s to %s", (type(self.data), uint))
 


=====================================
tests/unit/common/test_table.py
=====================================
@@ -1838,3 +1838,66 @@ class TestDTRReferences(TestCase):
                                      'y': [read_group1, read_group2]},
                                     index=pd.Index(data=[102, 103], name='id'))
             pd.testing.assert_frame_equal(ret, expected)
+
+
+class TestVectorIndexDtype(TestCase):
+
+    def set_up_array_index(self):
+        data = VectorData(name='data', description='desc')
+        index = VectorIndex(name='index', data=np.array([]), target=data)
+        return index
+
+    def set_up_list_index(self):
+        data = VectorData(name='data', description='desc')
+        index = VectorIndex(name='index', data=[], target=data)
+        return index
+
+    def test_array_inc_precision(self):
+        index = self.set_up_array_index()
+        index.add_vector(np.empty((255, )))
+        self.assertEqual(index.data[0], 255)
+        self.assertEqual(index.data.dtype, np.uint8)
+
+    def test_array_inc_precision_1step(self):
+        index = self.set_up_array_index()
+        index.add_vector(np.empty((65535, )))
+        self.assertEqual(index.data[0], 65535)
+        self.assertEqual(index.data.dtype, np.uint16)
+
+    def test_array_inc_precision_2steps(self):
+        index = self.set_up_array_index()
+        index.add_vector(np.empty((65536, )))
+        self.assertEqual(index.data[0], 65536)
+        self.assertEqual(index.data.dtype, np.uint32)
+
+    def test_array_prev_data_inc_precision_2steps(self):
+        index = self.set_up_array_index()
+        index.add_vector(np.empty((255, )))  # dtype is still uint8
+        index.add_vector(np.empty((65536, )))
+        self.assertEqual(index.data[0], 255)  # make sure the 255 is upgraded
+        self.assertEqual(index.data.dtype, np.uint32)
+
+    def test_list_inc_precision(self):
+        index = self.set_up_list_index()
+        index.add_vector(list(range(255)))
+        self.assertEqual(index.data[0], 255)
+        self.assertEqual(type(index.data[0]), np.uint8)
+
+    def test_list_inc_precision_1step(self):
+        index = self.set_up_list_index()
+        index.add_vector(list(range(65535)))
+        self.assertEqual(index.data[0], 65535)
+        self.assertEqual(type(index.data[0]), np.uint16)
+
+    def test_list_inc_precision_2steps(self):
+        index = self.set_up_list_index()
+        index.add_vector(list(range(65536)))
+        self.assertEqual(index.data[0], 65536)
+        self.assertEqual(type(index.data[0]), np.uint32)
+
+    def test_list_prev_data_inc_precision_2steps(self):
+        index = self.set_up_list_index()
+        index.add_vector(list(range(255)))
+        index.add_vector(list(range(65536 - 255)))
+        self.assertEqual(index.data[0], 255)  # make sure the 255 is upgraded
+        self.assertEqual(type(index.data[0]), np.uint32)



View it on GitLab: https://salsa.debian.org/med-team/hdmf/-/compare/5832a59d1ec6f5a455d83ce29abde38446b30230...cce58b69a29292a9eb46ad82569a9a075143d0e2

-- 
View it on GitLab: https://salsa.debian.org/med-team/hdmf/-/compare/5832a59d1ec6f5a455d83ce29abde38446b30230...cce58b69a29292a9eb46ad82569a9a075143d0e2
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210622/b487fb17/attachment-0001.htm>


More information about the debian-med-commit mailing list