Skip to content

Commit

Permalink
added view angles and rotation to the animation
Browse files Browse the repository at this point in the history
  • Loading branch information
ronshnapp committed Oct 24, 2024
1 parent cd9378c commit 94a7dd5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions example/params_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
f_end: None
fps: 25
tail_length: 3
elevation: 15
azimoth: 70
rotation_rate: 0.2

- run_extension:
path_to_extention: the_absolute_path_to_the_script_containing_the_code
Expand Down
8 changes: 7 additions & 1 deletion example/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,10 +1443,16 @@ def do_animate_trajectories(self):
fe = self.get_param('animate_trajectories', 'f_end')
fps = self.get_param('animate_trajectories', 'fps')
tail_length = self.get_param('animate_trajectories', 'tail_length')
elevation = self.get_param('animate_trajectories', 'elevation')
azimoth = self.get_param('animate_trajectories', 'azimoth')
rotation_rate= self.get_param('animate_trajectories', 'rotation_rate')


at = animate_trajectories(fname, min_length, fps=fps,
tail_length=tail_length,
f0=f0, fe=fe)
f0=f0, fe=fe,
view_angles = (elevation, azimoth),
rotation_rate = rotation_rate)
at.animate()

print('')
Expand Down
9 changes: 7 additions & 2 deletions myptv/makePlots/plot_trajectories.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def plot_trajectories(fname, min_length, write_trajID=False, t0=0, te=-1):
class animate_trajectories(object):

def __init__(self, fname, min_length, f0=None, fe=None, fps=25,
tail_length=4):
tail_length=4, view_angles = (15,70), rotation_rate=0.1):



Expand Down Expand Up @@ -156,7 +156,8 @@ def __init__(self, fname, min_length, f0=None, fe=None, fps=25,
self.duration = (len(self.frames)-1)/self.fps
self.tl = tail_length
self.min_length = min_length

self.angles = view_angles
self.rotation = rotation_rate



Expand Down Expand Up @@ -193,6 +194,10 @@ def update(self, frame):

self.ax.grid(False)

self.ax.view_init(elev=self.angles[0],
azim=self.angles[1] + self.rotation*self.counter)


self.ax.set_box_aspect((self.xmax-self.xmin,
self.zmax-self.zmin,
self.ymax-self.ymin))
Expand Down

0 comments on commit 94a7dd5

Please sign in to comment.