Skip to content

Commit

Permalink
changed animating color scale
Browse files Browse the repository at this point in the history
  • Loading branch information
ronshnapp committed Oct 29, 2024
1 parent 703046b commit e393c4c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions myptv/makePlots/plot_trajectories.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""

from pandas import read_csv
from numpy import ptp, array, arange, amin, amax
from numpy import ptp, array, arange, amin, amax, percentile
import matplotlib.pyplot as plt

from moviepy.video.io.bindings import mplfig_to_npimage
Expand Down Expand Up @@ -216,13 +216,16 @@ def animate(self):
'''
#self.prepare_for_animation()

self.vscale = 0
v_lst = []
for i in self.longs:
tr = self.trajectories[i]
dt = int(self.min_length/2)
dx = sum([(tr[dt,j] - tr[0,j])**2 for j in [1,2,3]])**0.5
if self.vscale<dx/dt:
self.vscale = dx/dt
#if self.vscale<dx/dt:
# self.vscale = dx/dt
v_lst.append(dx/dt)

self.vscale = percentile(v_lst, 95)

self.fig = plt.figure(figsize=(9,9))
self.ax = self.fig.add_subplot(projection='3d')
Expand Down

0 comments on commit e393c4c

Please sign in to comment.