[h5py] 223/455: Remove non-working hyperslabs code

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.

commit 28ebcac1ec9d4417dab242aa94d35d136ae4eb92
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sun Feb 8 00:20:03 2009 +0000

    Remove non-working hyperslabs code
---
 ANN.txt                    |  6 ++---
 docs/source/guide/hl.rst   |  5 ++--
 h5py/highlevel.py          |  2 +-
 h5py/selections.py         | 63 ----------------------------------------------
 h5py/tests/common.py       |  3 +++
 h5py/tests/test_slicing.py | 18 ++++++++++++-
 6 files changed, 25 insertions(+), 72 deletions(-)

diff --git a/ANN.txt b/ANN.txt
index 316a69b..2316c0e 100644
--- a/ANN.txt
+++ b/ANN.txt
@@ -32,9 +32,6 @@ New features in 1.1
   - Efficient broadcasting using HDF5 hyperslab selections; for example,
     you can write to a (100 x 100 x 50) selection from a (100 x 50) array.
 
-  - High-level access to HDF5 dataspace selections, including hyperslabs
-    and point-based I/O.
-
   - Now installable via easy_install
 
   - Now supports the NumPy boolean type
@@ -54,7 +51,8 @@ Standard features
     * Array (as members of a compound type only)
     * Void
 
-  - Random access to datasets using the standard NumPy slicing syntax
+  - Random access to datasets using the standard NumPy slicing syntax,
+    including fancy indexing and point-based selection
 
   - Transparent compression of datasets using GZIP, LZF or SZIP,
     and error-detection using Fletcher32
diff --git a/docs/source/guide/hl.rst b/docs/source/guide/hl.rst
index a349fed..0ea7499 100644
--- a/docs/source/guide/hl.rst
+++ b/docs/source/guide/hl.rst
@@ -604,9 +604,8 @@ Advanced selection
 ------------------
 
 The ``selections`` module contains additional classes which provide access to
-the full range of HDF5 dataspace selection techniques, including point-based
-selection and selection via overlapping hyperslabs.  These are especially
-useful for read_direct and write_direct.
+HDF5 dataspace selection techniques, including point-based selection.  These 
+are especially useful for read_direct and write_direct.
 
 Length and iteration
 --------------------
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index f8ab1d7..cd0b92a 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -937,7 +937,7 @@ class Dataset(HLObject):
 
             # 5. Broadcast scalars if necessary
             if val.shape == () and selection.mshape != ():
-                val2 = numpy.empty(selection.mshape, dtype=val.dtype)
+                val2 = numpy.empty(selection.mshape[-1], dtype=val.dtype)
                 val2[...] = val
                 val = val2
             
diff --git a/h5py/selections.py b/h5py/selections.py
index bc6f2a2..5352222 100644
--- a/h5py/selections.py
+++ b/h5py/selections.py
@@ -162,69 +162,6 @@ class PointSelection(_Selection_1D):
         """ Replace the current selection with the given sequence of points"""
         self._perform_selection(points, h5s.SELECT_SET)
 
-class HyperSelection(_Selection_1D):
-
-    """
-        Represents multiple overlapping rectangular selections, combined
-        with set-like operators.  Result is a 1D shape, as with boolean array
-        selection.
-
-        When created, the entire dataspace is selected.  To make
-        adjustments to the selection, use the standard NumPy slicing
-        syntax::
-
-            >>> sel = HyperSelection((10,20,20))  # Initially 10 x 20 x 20
-            >>> sel[:,5:15,:] = SET               # Now 10 x 10 x 20
-            >>> sel[0:5,:,:] = AND                # Now  5 x 10 x 10
-
-        Legal operators (in the h5py.selections module) are:
-            
-        SET
-            New selection, wiping out any old one
-        
-        OR (or True), AND, XOR
-            Logical OR/AND/XOR between new and old selection
-
-        NOTA
-            Select only regions in new selection which don't intersect the old
-
-        NOTB (or False)
-            Select only regions in old selection which don't intersect the new
-  
-    """
-
-    def __getitem__(self, args):
-        self[args] = SET
-        return self
-
-    def __setitem__(self, args, op):
-
-        if not isinstance(args, tuple):
-            args = (args,)
-  
-        start, count, step = self._handle_args(args)
-
-        if not op in (SET, OR, AND, XOR, NOTB, NOTA, True, False):
-            raise ValueError("Illegal selection operator")
-
-        if op is True:
-            op = OR
-        elif op is False:
-            op = NOTB
-
-        seltype == self._id.get_select_type()
-
-        if seltype == h5s.SEL_ALL:
-            self._id.select_hyperslab((0,)*len(self.shape), self.shape, op=h5s.SELECT_SET)
-        
-        elif seltype == h5s.SEL_NONE:
-            if op in (SET, OR, XOR, NOTA):
-                op = SET
-            else:
-                return
-
-        self._id.select_hyperslab(start, count, step, op=op)
-
 
 class SimpleSelection(Selection):
 
diff --git a/h5py/tests/common.py b/h5py/tests/common.py
index 79a30ac..dafc955 100644
--- a/h5py/tests/common.py
+++ b/h5py/tests/common.py
@@ -35,6 +35,9 @@ def api_16(func):
         return func
     return None
 
+def skip(func):
+    return None
+
 test_coverage = set()
 
 def covers(*args):
diff --git a/h5py/tests/test_slicing.py b/h5py/tests/test_slicing.py
index 8b8df6f..8174912 100644
--- a/h5py/tests/test_slicing.py
+++ b/h5py/tests/test_slicing.py
@@ -2,7 +2,7 @@ import numpy as np
 import os
 from nose.tools import assert_equal
 
-from common import makehdf, delhdf, assert_arr_equal
+from common import makehdf, delhdf, assert_arr_equal, skip
 
 import h5py
 
@@ -137,6 +137,21 @@ class TestSlicing(object):
             arr[slc] = subarr
             assert_arr_equal(dset, arr)
 
+
+    @skip
+    def test_broadcast_big(self):
+
+        M = 1024*1024
+
+        dset = self.f.create_dataset('dset', (100,0.5*M), 'i')
+
+        dset[...] = 42
+
+        comprow = np.ones((0.5*M,),dtype='i')*42
+
+        for row in dset:
+            assert np.all(row == comprow)
+
     def test_slice_names(self):
         # Test slicing in conjunction with named fields
 
@@ -163,4 +178,5 @@ class TestSlicing(object):
 
 
 
+
         

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list