Beispiel #1
0
    def __init__(self,
                 mat_stream,
                 byte_order=None,
                 mat_dtype=False,
                 squeeze_me=False,
                 chars_as_strings=True,
                 matlab_compatible=False,
                 struct_as_record=True):
        '''
        Initializer for mat file reader

        mat_stream : file-like
            object with file API, open for reading
    %(load_args)s
        '''
        # Initialize stream
        self.mat_stream = mat_stream
        self.dtypes = {}
        if not byte_order:
            byte_order = self.guess_byte_order()
        else:
            byte_order = boc.to_numpy_code(byte_order)
        self.byte_order = byte_order
        self.struct_as_record = struct_as_record
        if matlab_compatible:
            self.set_matlab_compatible()
        else:
            self.squeeze_me = squeeze_me
            self.chars_as_strings = chars_as_strings
            self.mat_dtype = mat_dtype
Beispiel #2
0
    def __init__(
        self,
        mat_stream,
        byte_order=None,
        mat_dtype=False,
        squeeze_me=False,
        chars_as_strings=True,
        matlab_compatible=False,
        struct_as_record=True,
    ):
        """
        Initializer for mat file reader

        mat_stream : file-like
            object with file API, open for reading
    %(load_args)s
        """
        # Initialize stream
        self.mat_stream = mat_stream
        self.dtypes = {}
        if not byte_order:
            byte_order = self.guess_byte_order()
        else:
            byte_order = boc.to_numpy_code(byte_order)
        self.byte_order = byte_order
        self.struct_as_record = struct_as_record
        if matlab_compatible:
            self.set_matlab_compatible()
        else:
            self.squeeze_me = squeeze_me
            self.chars_as_strings = chars_as_strings
            self.mat_dtype = mat_dtype
Beispiel #3
0
 def set_order_code(self, order_code):
     order_code = boc.to_numpy_code(order_code)
     self._order_code = order_code
     self.set_dtypes()
Beispiel #4
0
 def get_array(self):
     dt = self.array_reader.dtypes[miINT32]
     endian = byteordercodes.to_numpy_code(dt.byteorder)
     data = self.array_flags.tostring() + self.binaryblock
     return MatlabBinaryBlock(data, endian)
Beispiel #5
0
 def set_order_code(self, order_code):
     order_code = boc.to_numpy_code(order_code)
     self._order_code = order_code
     self.set_dtypes()
Beispiel #6
0
 def get_array(self):
     dt = self.array_reader.dtypes[miINT32]
     endian = byteordercodes.to_numpy_code(dt.byteorder)
     data = self.array_flags.tostring() + self.binaryblock
     return MatlabBinaryBlock(data, endian)