Get array from file with specified shape, dtype and file offset
Parameters : | shape : sequence
in_dtype : numpy dtype
infile : file-like
offset : int, optional
order : {‘F’, ‘C’} string
|
---|---|
Returns : | arr : array-like
|
Examples
>>> import StringIO
>>> str_io = StringIO.StringIO()
>>> arr = np.arange(6).reshape(1,2,3)
>>> str_io.write(arr.tostring('F'))
>>> arr2 = array_from_file((1,2,3), arr.dtype, str_io)
>>> np.all(arr == arr2)
True
>>> str_io = StringIO.StringIO()
>>> str_io.write(' ' * 10)
>>> str_io.write(arr.tostring('F'))
>>> arr2 = array_from_file((1,2,3), arr.dtype, str_io, 10)
>>> np.all(arr == arr2)
True