Ejemplo n.º 1
0
 def test_allows_to_pass_additional_args(self):
     st_dict = {
         'a': [arange_spikes(5 * pq.s),
               arange_spikes(4 * pq.s)],
         'b': [arange_spikes(7 * pq.s)]
     }
     expected = {'a': [8, 6], 'b': [12]}
     actual = tools.apply_to_dict(self.fn, st_dict, 2)
     self.assertEqual(expected, actual)
Ejemplo n.º 2
0
 def test_maps_function_to_each_spike_train(self):
     st_dict = {
         'a': [arange_spikes(5 * pq.s),
               arange_spikes(4 * pq.s)],
         'b': [arange_spikes(7 * pq.s)]
     }
     expected = {'a': [4, 3], 'b': [6]}
     actual = tools.apply_to_dict(self.fn, st_dict)
     self.assertEqual(expected, actual)
Ejemplo n.º 3
0
 def test_works_on_empty_dict(self):
     st_dict = {}
     expected = {}
     actual = tools.apply_to_dict(self.fn, st_dict)
     self.assertEqual(expected, actual)
Ejemplo n.º 4
0
 def test_works_on_empty_lists(self):
     st_dict = {'a': [], 'b': []}
     expected = {'a': [], 'b': []}
     actual = tools.apply_to_dict(self.fn, st_dict)
     self.assertEqual(expected, actual)
Ejemplo n.º 5
0
 def test_allows_to_pass_additional_args(self):
     st_dict = {'a': [arange_spikes(5 * pq.s), arange_spikes(4 * pq.s)],
                'b': [arange_spikes(7 * pq.s)]}
     expected = {'a': [8, 6], 'b': [12]}
     actual = tools.apply_to_dict(self.fn, st_dict, 2)
     self.assertEqual(expected, actual)
Ejemplo n.º 6
0
 def test_works_on_empty_dict(self):
     st_dict = {}
     expected = {}
     actual = tools.apply_to_dict(self.fn, st_dict)
     self.assertEqual(expected, actual)
Ejemplo n.º 7
0
 def test_works_on_empty_lists(self):
     st_dict = {'a': [], 'b': []}
     expected = {'a': [], 'b': []}
     actual = tools.apply_to_dict(self.fn, st_dict)
     self.assertEqual(expected, actual)
Ejemplo n.º 8
0
 def test_maps_function_to_each_spike_train(self):
     st_dict = {'a': [arange_spikes(5 * pq.s), arange_spikes(4 * pq.s)],
                'b': [arange_spikes(7 * pq.s)]}
     expected = {'a': [4, 3], 'b': [6]}
     actual = tools.apply_to_dict(self.fn, st_dict)
     self.assertEqual(expected, actual)