P-unit_model/unittests/testHelperFunctions.py
2020-03-02 16:31:45 +01:00

38 lines
913 B
Python

import unittest
import numpy as np
import helperFunctions as hF
import matplotlib.pyplot as plt
class HelperFunctionsTester(unittest.TestCase):
noise_levels = [0, 0.05, 0.1, 0.2]
frequencies = [0, 1, 5, 30, 100, 500, 750, 1000]
def setUp(self):
pass
def tearDown(self):
pass
def test__vector_strength__is_1(self):
length = 2000
rel_spike_times = np.full(length, 0.3)
eod_durations = np.full(length, 0.14)
self.assertEqual(1, round(hF.__vector_strength__(rel_spike_times,eod_durations), 2))
def test__vector_strength__is_0(self):
length = 2000
period = 0.14
rel_spike_times = np.arange(0, period, period/length)
eod_durations = np.full(length, period)
self.assertEqual(0, round(hF.__vector_strength__(rel_spike_times, eod_durations), 5))
# def test(self):
# test_distribution()