def test_calc_pos_and_dir_along_movement(): time, disp, speed, acc = fm.generate_ballistic_profiles() start = np.array((0., 0., 0.)) stop = np.array((1., 1., 1.)) pos, drn = fm.calc_pos_and_dir_along_movement(disp, stop) # check start and end at the right place assert_almost_equal(pos[...,0], start) assert_almost_equal(pos[...,-1], stop)
def test_generate_firing_rate(): time, disp, speed, acc = fm.generate_ballistic_profiles() #start = np.array((0., 0., 0.)) stop = np.array((1., 1., 1.)) pos, drn = fm.calc_pos_and_dir_along_movement(disp, stop) PD, PG = fm.generate_cell_properties() k = fm.generate_firing_rate(pos, drn, speed, acc, time, \ PD, PG, model='k') assert_(np.all(k == 1.)) ds = fm.generate_firing_rate(pos, drn, speed, acc, time, \ PD, PG, model='ds') kds = fm.generate_firing_rate(pos, drn, speed, acc, time, \ PD, PG, model='kds') assert_(np.allclose(ds + k, kds)) assert_(kds.size == pos.shape[1] - 1) assert_(kds.argmax() == speed.argmax())
def test_generate_ballistic_profiles(): t,d,s,a = fm.generate_ballistic_profiles() assert t[0] == 0 assert t[-1] == 1. assert d.max() == 1.