code: def read_data(self, chan=None, begtime=None, endtime=None, begsam=None,
                    endsam=None, s_freq=None):
          data = ChanTime()
          data.start_time = self.header['start_time']
          data.s_freq = s_freq = s_freq if s_freq else self.header['s_freq']
          if chan is None:
              chan = self.header['chan_name']
          if not (isinstance(chan, list) or isinstance(chan, tuple)):
              raise TypeError('Parameter "chan" should be a list')
          add_ref = False
          if '_REF' in chan:
              add_ref = True
              chan[:] = [x for x in chan if x != '_REF']
          idx_chan = [self.header['chan_name'].index(x) for x in chan]
          if begtime is None and begsam is None:
              begsam = 0
          if endtime is None and endsam is None:
              endsam = self.header['n_samples']
          if begtime is not None:
              if not isinstance(begtime, list):
                  begtime = [begtime]
              begsam = []
              for one_begtime in begtime:
                  begsam.append(_convert_time_to_sample(one_begtime, self))
          if endtime is not None:
              if not isinstance(endtime, list):
                  endtime = [endtime]
              endsam = []
              for one_endtime in endtime:
                  endsam.append(_convert_time_to_sample(one_endtime, self))
          if not isinstance(begsam, list):
              begsam = [begsam]
          if not isinstance(endsam, list):
              endsam = [endsam]
          if len(begsam) != len(endsam):
              raise ValueError('There should be the same number of start and ' +
                               'end point')
          n_trl = len(begsam)
          data.axis['chan'] = empty(n_trl, dtype='O')
          data.axis['time'] = empty(n_trl, dtype='O')
          data.data = empty(n_trl, dtype='O')
          for i, one_begsam, one_endsam in zip(range(n_trl), begsam, endsam):            
              dataset = self.dataset
              lg.debug('begsam {0: 6}, endsam {1: 6}'.format(one_begsam,
                       one_endsam))
              dat = dataset.return_dat(idx_chan, one_begsam, one_endsam)
              chan_in_dat = chan
              if add_ref:
                  zero_ref = zeros((1, one_endsam - one_begsam))
                  dat = concatenate((dat, zero_ref), axis=0)
                  chan_in_dat.append('_REF')
              data.data[i] = dat
              data.axis['chan'][i] = asarray(chan_in_dat, dtype='U')
              data.axis['time'][i] = (arange(one_begsam, one_endsam) / s_freq)
          return data