Пример #1
0
 def test_array(self):
     """ Test all array-specific features """
     htype = h5t.array_create(h5t.STD_I32LE, (4, 5))
     self.assertEqual(htype.get_array_ndims(), 2)
     self.assertEqual(htype.get_array_dims(), (4, 5))
     self.assertEqual(htype.dtype, dtype(('<i4', (4, 5))))
Пример #2
0
 def test(dt):
     """ Check get_super for a given dtype """
     htype = h5t.py_create(dt)
     atype = h5t.array_create(htype, (4, 5))
     self.assert_(htype.equal(atype.get_super()))
Пример #3
0
 def test(dt):
     """ Check get_super for a given dtype """
     htype = h5t.py_create(dt)
     atype = h5t.array_create(htype, (4,5))
     self.assert_(htype.equal(atype.get_super()))
Пример #4
0
 def test_array(self):
     """ Test all array-specific features """
     htype = h5t.array_create(h5t.STD_I32LE,(4,5))
     self.assertEqual(htype.get_array_ndims(), 2)
     self.assertEqual(htype.get_array_dims(), (4,5))
     self.assertEqual(htype.dtype, dtype(('<i4',(4,5))))
Пример #5
0
from numpy import array, int32, float32, dtype, float64, ones
from h5py import h5t, h5f, h5d, h5s, File, Datatype
from typing import List

from src.utils.HDF5Utils import H5FileHandler

array_3_int32 = h5t.array_create(h5t.STD_I32LE, (3, ))
array_7_float32 = h5t.array_create(h5t.IEEE_F32LE, (7, ))


class H5CompoundType:
    def __init__(self, types: List, lengths: List[int], names: List[str]):
        """
        @param name: name of the type
        @param types: types within the compuond type
        @param names:  names of each type within the compound type
        """
        self.types = types
        self.names = names
        self.lengths = lengths
        self.create_type()

    def create_type(self):
        self.type = dtype([
            (name, t, (l, ))
            for name, t, l in zip(self.names, self.types, self.lengths)
        ])


class DetPulseCoord(H5CompoundType):
    def __init__(self):