Skip to content
Snippets Groups Projects
Commit 18cb198b authored by Olivier Bertrand's avatar Olivier Bertrand
Browse files

Speed up velocity calculation

The calculation skip null diff euler angles and thus skip many iteration in the loop
parent 3724cbec
No related branches found
No related tags found
No related merge requests found
...@@ -641,7 +641,13 @@ class Trajectory(pd.DataFrame): ...@@ -641,7 +641,13 @@ class Trajectory(pd.DataFrame):
dtype=float) dtype=float)
diffrow = self.diff() diffrow = self.diff()
velocity.loc[:, ['dx', 'dy', 'dz']] = diffrow.loc[:, 'location'].values velocity.loc[:, ['dx', 'dy', 'dz']] = diffrow.loc[:, 'location'].values
for index_i, row in self.iterrows(): # Look for true zeros in order to save time
true_zeros = diffrow == 0
diffrow[true_zeros] = np.nan
velocity[true_zeros[self.rotation_mode]] = 0
# Loop only on non true zeros
for index_i in diffrow.loc[:, self.rotation_mode].dropna().index:
row = self.loc[index_i, :]
if self.rotation_mode == 'quaternion': if self.rotation_mode == 'quaternion':
raise NameError('Not implemented') raise NameError('Not implemented')
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment