def test_iter_trajectories_ptvis_xuap(self): inName = './data/particles/xuap.%d' trjs = io.trajectories_ptvis(inName, xuap = True, traj_min_len = 2) self.failUnlessEqual(len(trjs), 332) # here it fails due to the same problem with traj_min_len trjs = io.trajectories_ptvis(inName, xuap = True, traj_min_len = None) self.failUnlessEqual(len(trjs), 332)
def test_iter_trajectories_ptvis_xuap(self): inName = './data/particles/xuap.%d' trjs = io.trajectories_ptvis(inName, xuap=True, traj_min_len=2) self.failUnlessEqual(len(trjs), 332) # here it fails due to the same problem with traj_min_len trjs = io.trajectories_ptvis(inName, xuap=True, traj_min_len=None) self.failUnlessEqual(len(trjs), 332)
def test_trajectories_ptvis(self): trjs = io.trajectories_ptvis(self.tmpl, self.first, self.last) self.failUnlessEqual(len(trjs), len(self.correct)) for trj, correct in zip(trjs, self.correct): nptest.assert_array_almost_equal(trj.pos(), correct.pos()) nptest.assert_array_almost_equal(trj.velocity(), correct.velocity()) nptest.assert_array_almost_equal(trj.accel(), correct.accel()) nptest.assert_array_almost_equal(trj.time(), correct.time()) self.failUnlessEqual(trj.trajid(), correct.trajid())
def test_trajectories_ptvis(self): trjs = io.trajectories_ptvis(self.tmpl, self.first, self.last) self.failUnlessEqual(len(trjs), len(self.correct)) for trj, correct in zip(trjs, self.correct): nptest.assert_array_almost_equal(trj.pos(), correct.pos()) nptest.assert_array_almost_equal(trj.velocity(), correct.velocity()) nptest.assert_array_almost_equal(trj.accel(), correct.accel()) nptest.assert_array_almost_equal(trj.time(), correct.time()) self.failUnlessEqual(trj.trajid(), correct.trajid())
def test_trim_hdf(self): """HDF trajectory trimming""" correct = io.trajectories_ptvis(self.tmpl, self.first+1, self.last-1) outfile = 'tests/testing_fodder/table.h5' io.save_particles_table(outfile, self.correct, trim=1) loaded = io.trajectories_table(outfile) self.compare_trajectories(loaded, correct) os.remove(outfile)
import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot from flowtracks.io import trajectories_ptvis inName = './data/particles/xuap.%d' trajects = trajectories_ptvis(inName, xuap = True) # the directory with the input files ############ # PLOTTING # ############ fig = pyplot.figure(figsize = (12, 10)) # fig.canvas.manager.window.move(900, 300) ax = Axes3D(fig) ax.view_init(35, -160) # view angle: (rotation of z-axis, rotation around z-axis) mpl.rcParams['legend.fontsize'] = 10 positions = [tr.pos() for tr in trajects] for pos in positions: trajX = [pos[k][0] for k in range(len(pos))] trajY = [pos[k][1] for k in range(len(pos))] trajZ = [pos[k][2] for k in range(len(pos))] ax.plot(trajX, trajY, trajZ, '.') #ax.plot([], [], [], '.', label = 'Trajectories') ax.legend() pyplot.show()
def test_trajectories_ptvis(self): trjs = io.trajectories_ptvis(self.tmpl, self.first, self.last) self.assertEqual(len(trjs), len(self.correct)) self.compare_trajectories(trjs, self.correct)
def test_trajectories_ptvis(self): trjs = io.trajectories_ptvis(self.tmpl, self.first, self.last) self.failUnlessEqual(len(trjs), len(self.correct)) self.compare_trajectories(trjs, self.correct)