code: def return_dat(self, chan, begsam, endsam):
          
          assert begsam < endsam
  
          dat = empty((len(chan), endsam - begsam))
          dat.fill(NaN)
  
          with self.filename.open('rb') as f:
  
              for i_dat, blk, i_blk in _select_blocks(self.blocks, begsam, endsam):
                  dat_in_rec = self._read_record(f, blk, chan)
                  dat[:, i_dat[0]:i_dat[1]] = dat_in_rec[:, i_blk[0]:i_blk[1]]
  
          # calibration
          dat = ((dat.astype('float64') - self.dig_min[chan, newaxis]) *
                 self.gain[chan, newaxis] + self.phys_min[chan, newaxis])
  
          return dat
docs: Read data from an EDF file.
  
          Reads channel by channel, and adjusts the values by calibration.
  
          Parameters
          ----------
          chan : list of int
              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, where the first dimension is the channels and the
              second dimension are the samples.