scipy/io/_fortran.py
def read_record(self, dtype=None):
        """
        Reads a record of a given type from the file.

        Parameters
        ----------
        dtype : dtype, optional
            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'

        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, ...


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

        """
        if dtype is None:
            raise ValueError('Must specify dtype')
        dtype = np.dtype(dtype)

        firstSize = self._read_size()
        if firstSize % dtype.itemsize != 0:
            raise ValueError('Size obtained ({0}) is not a multiple of the '
                             'dtype given ({1}).'.format(firstSize, dtype.itemsize))

        data = np.fromfile(self._fp, dtype=dtype, count=firstSize//dtype.itemsize)
        secondSize = self._read_size()
        if firstSize != secondSize:
            raise IOError('Sizes do not agree in the header and footer for '
                          'this record - check header dtype')
        return data

        Reads a record of a given type from the file.

        Parameters
        ----------
        dtype : dtype, optional
            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'

        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, ...


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

        
Reads a record of a given type from the file.
Parameters

dtype : dtype, optional
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:.



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



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



See Also


Reads a record of a given type from the file . Parameters dtype : dtype optional 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 : . and if any of the variables are arrays the shape can be specified as the third item in the relevant tuple : . Numpy also supports a short syntax for this kind of type : . See Also
def read_record(self, dtype=None):
        if dtype is None:
            raise ValueError('Must specify dtype')
        dtype = np.dtype(dtype)
        firstSize = self._read_size()
        if firstSize % dtype.itemsize != 0:
            raise ValueError('Size obtained ({0}) is not a multiple of the '
                             'dtype given ({1}).'.format(firstSize, dtype.itemsize))
        data = np.fromfile(self._fp, dtype=dtype, count=firstSize//dtype.itemsize)
        secondSize = self._read_size()
        if firstSize != secondSize:
            raise IOError('Sizes do not agree in the header and footer for '
                          'this record - check header dtype')
        return data
def read_record ( self , dtype = None ) : if dtype is None : raise ValueError ( 'Must specify dtype' ) dtype = np . dtype ( dtype ) firstSize = self . _read_size ( ) if firstSize % dtype . itemsize != 0 : raise ValueError ( 'Size obtained ({0}) is not a multiple of the ' 'dtype given ({1}).' . format ( firstSize , dtype . itemsize ) ) data = np . fromfile ( self . _fp , dtype = dtype , count = firstSize // dtype . itemsize ) secondSize = self . _read_size ( ) if firstSize != secondSize : raise IOError ( 'Sizes do not agree in the header and footer for ' 'this record - check header dtype' ) return data
Reads a record of a given type from the file.
Reads a record of a given type from the file .
"""
        Reads a record of a given type from the file.

        Parameters
        ----------
        dtype : dtype, optional
            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'

        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, ...


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

        """
self
dtype