

def read_dtype(mat_stream, a_dtype):
    '\n    Generic get of byte stream data of known type\n\n    Parameters\n    ----------\n    mat_stream : file_like object\n        MATLAB (tm) mat file stream\n    a_dtype : dtype\n        dtype of array to read.  `a_dtype` is assumed to be correct\n        endianness.\n\n    Returns\n    -------\n    arr : ndarray\n        Array of dtype `a_dtype` read from stream.\n\n    '
    num_bytes = a_dtype.itemsize
    arr = np.ndarray(shape=(), dtype=a_dtype, buffer=mat_stream.read(num_bytes), order='F')
    return arr

dataset/ETHPy150Open scipy/scipy/scipy/io/matlab/miobase.py read_dtype/original