def write_data(self, data, dstart=None, swap_axes=True):
        """Write ``data`` to `file`.

        Parameters
        ----------
        data : `array-like`
            Data that should be written to `file`.
        dstart : non-negative int, optional
            Offset in bytes of the start position of the written data.
            If provided, reshaping and axis swapping of ``data`` is
            skipped.
            For ``None``, `header_size` is used.
        swap_axes : bool, optional
            If ``True``, use the ``'mapc', 'mapr', 'maps'`` header entries
            to swap the axes in the ``data`` before writing. Use ``False``
            only if the data is already consistent with the final axis
            order.
        """
        if dstart is None:
            shape = self.data_shape
            dstart = int(self.header_size)
        elif dstart < 0:
            raise ValueError('`dstart` must be non-negative, got {}'
                             ''.format(dstart))
        else:
            shape = -1
            dstart = int(dstart)

        if dstart < self.header_size:
            raise ValueError('invalid `dstart`, resulting in absolute '
                             '`dstart` < `header_size` ({} < {})'
                             ''.format(dstart, self.header_size))

        data = np.asarray(data, dtype=self.data_dtype).reshape(shape)
        if swap_axes:
            # Need to argsort here since `data_axis_order` tells
            # "which axis comes from where", which is the inverse of what the
            # `transpose` function needs.
            data = np.transpose(data, axes=np.argsort(self.data_axis_order))
            assert data.shape == self.data_storage_shape

        data = data.reshape(-1, order='F')
        self.file.seek(dstart)
        data.tofile(self.file)
def write_data ( self , data , dstart = None , swap_axes = True ) : if dstart is None : shape = self . data_shape dstart = int ( self . header_size ) elif dstart < 0 : raise ValueError ( '`dstart` must be non-negative, got {}' '' . format ( dstart ) ) else : shape = - 1 dstart = int ( dstart ) if dstart < self . header_size : raise ValueError ( 'invalid `dstart`, resulting in absolute ' '`dstart` < `header_size` ({} < {})' '' . format ( dstart , self . header_size ) ) data = np . asarray ( data , dtype = self . data_dtype ) . reshape ( shape ) if swap_axes : data = np . transpose ( data , axes = np . argsort ( self . data_axis_order ) ) assert data . shape == self . data_storage_shape data = data . reshape ( - 1 , order = 'F' ) self . file . seek ( dstart ) data . tofile ( self . file )
Write ``data`` to `file`.

        Parameters
        ----------
        data : `array-like`
            Data that should be written to `file`.
        dstart : non-negative int, optional
            Offset in bytes of the start position of the written data.
            If provided, reshaping and axis swapping of ``data`` is
            skipped.
            For ``None``, `header_size` is used.
        swap_axes : bool, optional
            If ``True``, use the ``'mapc', 'mapr', 'maps'`` header entries
            to swap the axes in the ``data`` before writing. Use ``False``
            only if the data is already consistent with the final axis
            order.