code: def to_neo(self,index_label='N',time_label=0,name='segment of exported spikes',index=0):
          
          import neo
          from quantities import s
          seq = neo.Segment(name=name,index=index)
          t_start = None
          t_stop = None
          if self.min_t is not None:
              t_start = convert_time(self.min_t,from_units=self.units,to_units='s')*s
          if self.max_t is not None:
              t_stop = convert_time(self.max_t,from_units=self.units,to_units='s')*s
          for train in self.generate(index_label):
              seq.spiketrains.append(neo.SpikeTrain(train.spike_times.get_converted(time_label,'s')[1]*s,t_start=t_start,t_stop=t_stop))
          return seq
docs: Returns a `neo` Segment containing the spike trains.
  
              Example usage::
  
                  import quantities as pq
  
                  seg = sp.to_neo()
  
                  fig = pyplot.figure()
                  trains = [st.rescale('s').magnitude for st in seg.spiketrains]
                  colors = pyplot.cm.jet(np.linspace(0, 1, len(seg.spiketrains)))
                  gca().eventplot(trains, colors=colors)
                  gca().set_title(seg.file_origin)
  
                  f = neo.io.AsciiSpikeTrainIO('a_spike_file.txt')
                  f.write_segment(seg)