def return_dat(self, chan, begsam, endsam):
        """Return the data as 2D numpy.ndarray.

        Parameters
        ----------
        chan : int or list
            index (indices) of the channels to read
        begsam : int
            index of the first sample
        endsam : int
            index of the last sample

        Returns
        -------
        numpy.ndarray
            A 2d matrix, with dimension chan X samples. To save memory, the
            data are memory-mapped, and you cannot change the values on disk.

        Notes
        -----
        When asking for an interval outside the data boundaries, it returns NaN
        for those values.
        """
        data = memmap(self.filename, dtype=self.dtype, mode='r', order='F',
                      shape=(self.n_chan, self.n_samples), offset=self.head)

        dat = data[chan, max((begsam, 0)):min((endsam, self.n_samples))].astype(float64)
        dat = (dat + self.offset[chan, :]) * self.gain[chan, :]

        if begsam < 0:

            pad = empty((dat.shape[0], 0 - begsam))
            pad.fill(NaN)
            dat = c_[pad, dat]

        if endsam >= self.n_samples:

            pad = empty((dat.shape[0], endsam - self.n_samples))
            pad.fill(NaN)
            dat = c_[dat, pad]

        return dat
Return the data as 2D numpy.ndarray.

        Parameters
        ----------
        chan : int or list
            index (indices) of the channels to read
        begsam : int
            index of the first sample
        endsam : int
            index of the last sample

        Returns
        -------
        numpy.ndarray
            A 2d matrix, with dimension chan X samples. To save memory, the
            data are memory-mapped, and you cannot change the values on disk.

        Notes
        -----
        When asking for an interval outside the data boundaries, it returns NaN
        for those values.