def read_record(self, dtype=None):
if dtype is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>dtype = np.dtype(dtype)<EOL>firstSize = self._read_size()<EOL>if firstSize % dtype.itemsize != <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(firstSize, dtype.itemsize))<EOL><DEDENT>data = np.fromfile(self._fp, dtype=dtype, count=firstSize//dtype.itemsize)<EOL>secondSize = self._read_size()<EOL>if firstSize != secondSize:<EOL><INDENT>raise IOError('<STR_LIT>')<EOL><DEDENT>return data<EOL>
Reads a record of a given type from the file.

Parameters
----------
dtype : data-type
    Data type specifying the size and endiness of the data.

Returns
-------
data : ndarray
    A one-dimensional array object.

Notes
-----
If the record contains a multi-dimensional array, calling reshape or
resize will restructure the array to the correct size.
Since Fortran multidimensional arrays are stored in column-major format,
this may have some non-intuitive consequences. If the variable was
declared as 'INTEGER var(5,4)', for example, var could be read with
'read_record(dtype=np.integer).reshape( (4,5) )' since Python uses
row-major ordering of indices.

One can transpose to obtain the indices in the same order as in Fortran.

For records that contain several variables or mixed types (as opposed
to single scalar or array types), it is possible to specify a dtype
with mixed types:

>>> record = f.read_record([('a', '<f4'), ('b', '<i4')])
>>> record['a']  # access the variable 'a'
5.6

and if any of the variables are arrays, the shape can be specified as
the third item in the relevant tuple:

>>> record = f.read_record([('a', '<f4'), ('b', '<i4', (3,3))])

Numpy also supports a short syntax for this kind of type:

>>> record = f.read_record('<f4,(3,3)<i4')
>>> record['f0']  # variables are called f0, f1, ...
5.6


See Also
--------
read_reals
read_ints