diff --git a/tests/test_base.py b/tests/test_base.py index 95c56fc925c6e3fc02bbbed0dee48cff4af6380c..23d1ebf18736a831b28e64cf3c9813c253ea60bd 100755 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -137,19 +137,21 @@ def acceleration_test(c): acc = d['particles/tracers4/acceleration'].value num_acc1 = (- vel[ :-2] + vel[2:])/(2*d['parameters/dt'].value*d['parameters/niter_part'].value) - num_vel = (- pos[ :-2] + pos[2:])/(2*d['parameters/dt'].value*d['parameters/niter_part'].value) num_acc2 = (pos[ :-2] - 2*pos[1:-1] + pos[2:])/((d['parameters/dt'].value*d['parameters/niter_part'].value)**2) num_acc3 = (-vel[4:] + 8*vel[3:-1] - 8*vel[1:-3] + vel[:-4])/(12*d['parameters/dt'].value*d['parameters/niter_part'].value) + num_acc4 = (-pos[4:] + 16*pos[3:-1] - 30*pos[2:-2] + 16*pos[1:-3] - pos[:-4])/(12*(d['parameters/dt'].value*d['parameters/niter_part'].value)**2) + num_vel = (- pos[ :-2] + pos[2:])/(2*d['parameters/dt'].value*d['parameters/niter_part'].value) pid = np.unravel_index(np.argmax(np.abs(num_acc3 - acc[2:-2])), dims = num_acc3.shape)[1] fig = plt.figure() a = fig.add_subplot(111) col = ['red', 'green', 'blue'] for cc in range(3): - a.plot(num_acc1[1:, pid, cc], color = col[cc]) - a.plot(num_acc2[1:, pid, cc], color = col[cc], dashes = (2, 2)) - a.plot(num_acc3[1:, pid, cc], color = col[cc], dashes = (3, 4)) - a.plot(acc[2:, pid, cc], color = col[cc], dashes = (1, 1)) + a.plot(num_acc1[2:, pid, cc], color = col[cc], dashes = (3, 4)) + a.plot(num_acc2[2:, pid, cc], color = col[cc], dashes = (2, 2)) + a.plot(num_acc3[1:, pid, cc], color = col[cc]) + a.plot(num_acc4[1:, pid, cc], color = col[cc], dashes = (3, 5)) + a.plot(acc[3:, pid, cc], color = col[cc], dashes = (1, 1)) fig.savefig(os.path.join(c.work_dir, 'acc_test_{0}.pdf'.format(c.simname))) return None