Пример #1
0
    def test_negative_idx(self, nspikes, incorrect_spikes_p, positions):
        if nspikes == 0:
            return
        # Prepare negative times
        neg_times, neg_spike_pos = self.inject_at_random_pos(
            incorrect_spikes_p, nspikes, positions, -10, np.nan)

        # Do actual test - must be element-wise to test for NaNs
        their_spike_pos, m_i = extractSpikePositions(neg_times, positions)
        np.testing.assert_equal(their_spike_pos.x, neg_spike_pos.x)
        np.testing.assert_equal(their_spike_pos.y, neg_spike_pos.y)
Пример #2
0
    def test_out_of_bounds_idx(self, nspikes, incorrect_spikes_p, positions):
        if nspikes == 0:
            return
        # Prepare out of bound times
        out_times, out_spike_pos = self.inject_at_random_pos(
            incorrect_spikes_p, nspikes, positions,
            len(positions) * positions.dt, np.nan)

        # Do actual test - must be element-wise to test for NaNs
        their_spike_pos, m_i = extractSpikePositions(out_times, positions)
        np.testing.assert_equal(their_spike_pos.x, out_spike_pos.x)
        np.testing.assert_equal(their_spike_pos.y, out_spike_pos.y)
Пример #3
0
    def test_out_of_bounds_idx(self, nspikes, incorrect_spikes_p, positions):
        if nspikes == 0:
            return
        # Prepare out of bound times
        out_times, out_spike_pos = self.inject_at_random_pos(
            incorrect_spikes_p,
            nspikes,
            positions,
            len(positions)*positions.dt,
            np.nan)

        # Do actual test - must be element-wise to test for NaNs
        their_spike_pos, m_i = extractSpikePositions(out_times, positions)
        np.testing.assert_equal(their_spike_pos.x, out_spike_pos.x)
        np.testing.assert_equal(their_spike_pos.y, out_spike_pos.y)
Пример #4
0
    def test_negative_idx(self, nspikes, incorrect_spikes_p, positions):
        if nspikes == 0:
            return
        # Prepare negative times
        neg_times, neg_spike_pos = self.inject_at_random_pos(
            incorrect_spikes_p,
            nspikes,
            positions,
            -10,
            np.nan)

        # Do actual test - must be element-wise to test for NaNs
        their_spike_pos, m_i = extractSpikePositions(neg_times, positions)
        np.testing.assert_equal(their_spike_pos.x, neg_spike_pos.x)
        np.testing.assert_equal(their_spike_pos.y, neg_spike_pos.y)
Пример #5
0
 def test_correct_extraction(self, nspikes, positions):
     spike_times = self.get_correct_spike_times(nspikes, positions)
     spike_pos, m_i = extractSpikePositions(spike_times, positions)
     # TODO: get rid of code duplication
     ref_spike_pos = self.reference_spike_pos(spike_times, positions)
     assert spike_pos == ref_spike_pos
Пример #6
0
 def test_correct_extraction(self, nspikes, positions):
     spike_times = self.get_correct_spike_times(nspikes, positions)
     spike_pos, m_i = extractSpikePositions(spike_times, positions)
     # TODO: get rid of code duplication
     ref_spike_pos = self.reference_spike_pos(spike_times, positions)
     assert spike_pos == ref_spike_pos