コード例 #1
0
ファイル: io.py プロジェクト: JuergenNeubauer/NeuroTools
 def read_spikes(self, params):
     self.__read_metadata()
     p    = self.__check_params(params)
     from NeuroTools.signals import spikes
     data   = self.get_data()
     result = spikes.SpikeList(data, p['id_list'], p['t_start'], p['t_stop'], p['dims'])
     del data
     return result
コード例 #2
0
ファイル: test_spikes.py プロジェクト: nosratullah/NeuroTools
 def setUp(self):
     self.spikes = []
     nb_cells = 10
     frequencies = [nb_cells for _ in xrange(10)]
     for idx in xrange(nb_cells):
         param = 1. / frequencies[idx]
         isi = numpy.random.exponential(param, 1000)
         pspikes = numpy.cumsum(isi) * 1000.  # convert to ms
         for spike in pspikes:
             self.spikes.append((idx, spike))
     self.spk = spikes.SpikeList(self.spikes, range(10))
コード例 #3
0
ファイル: test_spikes.py プロジェクト: nosratullah/NeuroTools
 def testSelect_Ids(self):
     spks = []
     nb_cells = 3
     frequencies = [5, 40, 40]
     for idx in xrange(nb_cells):
         param = 1. / frequencies[idx]
         isi = numpy.random.exponential(param, 100)
         pspikes = numpy.cumsum(isi) * 1000.  # convert to ms
         for spike in pspikes:
             spks.append((idx, spike))
     spk = spikes.SpikeList(spks, range(3), 0, 1000)
     assert len(spk.select_ids("cell.mean_rate() < 20")) == 1
コード例 #4
0
ファイル: io.py プロジェクト: JuergenNeubauer/NeuroTools
 def read_spikes(self, params):
     from NeuroTools.signals import spikes
     contents = numpy.load(self.fileobj)
     spike_data = contents['data'][:, (1,0)]
     self.metadata = M = {}
     for k,v in contents['metadata']:
         M[k] = eval(v)
     id_list = range(M['first_id'], M['last_id'])
     t_stop = params['t_stop']
     # really need to check the agreement between file metadata and
     # params for all metadata items
     return spikes.SpikeList(spike_data, id_list, t_start=0.0, t_stop=t_stop,
                             dims=M['dimensions'])
コード例 #5
0
ファイル: test_spikes.py プロジェクト: nosratullah/NeuroTools
 def setUp(self):
     self.spikes = []
     nb_cells = 50
     frequencies = numpy.random.uniform(0, 50, nb_cells)
     for idx in xrange(nb_cells):
         param = 1. / frequencies[idx]
         isi = numpy.random.exponential(param, 100)
         pspikes = numpy.cumsum(
             isi) * 1000.  # To convert the spikes_time in ms
         for spike in pspikes:
             self.spikes.append((idx, spike))
     self.spk = spikes.SpikeList(self.spikes, range(nb_cells), 0, 4000)
     self.spk.save("tmp2.txt")
コード例 #6
0
ファイル: test_spikes.py プロジェクト: nosratullah/NeuroTools
 def setUp(self):
     self.spikes = []
     nb_cells = 50
     frequencies = numpy.random.uniform(0, 50, 50)
     for idx in xrange(nb_cells):
         param = 1. / frequencies[idx]
         isi = numpy.random.exponential(param, 100)
         pspikes = numpy.cumsum(
             isi) * 1000.  # To convert the spikes_time in ms
         for spike in pspikes:
             self.spikes.append((idx, spike))
     self.spk = spikes.SpikeList(self.spikes, range(50), 0, 4000)
     try:
         os.mkdir("Plots")
     except Exception:
         pass
コード例 #7
0
ファイル: test_spikes.py プロジェクト: nosratullah/NeuroTools
 def testTime_Slice(self):
     spk = spikes.SpikeList(self.spikes, range(10), t_start=0)
     new_spk = spk.time_slice(0, 1000.)
     assert (new_spk.t_start == spk.t_start) and (new_spk.t_stop == 1000.)
コード例 #8
0
ファイル: test_spikes.py プロジェクト: nosratullah/NeuroTools
 def testMerge(self):
     spk2 = spikes.SpikeList(self.spikes, range(50, 60))
     self.spk.merge(spk2)
     assert len(self.spk) == 20