diff --git a/navipy/moving/maths.py b/navipy/moving/maths.py index d2d14da2e6a292cdf839eb4a2f1cd18d6d5441cf..3a3c3a9c324f44072a12fd2f7d08bc6ee650f7af 100644 --- a/navipy/moving/maths.py +++ b/navipy/moving/maths.py @@ -41,9 +41,9 @@ def next_pos(motion_vec, move_mode, move_param=None): names=['position', 'orientation']) speed = pd.Series(index=index) - speed['location']['dx'] = motion_vec['location']['dx'] - speed['location']['dy'] = motion_vec['location']['dy'] - speed['location']['dz'] = motion_vec['location']['dz'] + speed.loc[('location', 'dx')] = motion_vec[('location', 'dx')] + speed.loc[('location', 'dy')] = motion_vec[('location', 'dy')] + speed.loc[('location', 'dz')] = motion_vec[('location', 'dz')] # speed = motion_vec.loc[['dx', 'dy', 'dz']] if move_mode == 'on_cubic_grid': # speed in spherical coord @@ -87,7 +87,7 @@ def next_pos(motion_vec, move_mode, move_param=None): # scaling = 1 # <=> dt = 1, user need to scale speed in dt units else: raise ValueError('grid_mode is not supported') - toreturn = motion_vec + toreturn = motion_vec.copy() toreturn.loc[('location', 'x')] += speed['location']['dx'] toreturn.loc[('location', 'y')] += speed['location']['dy'] toreturn.loc[('location', 'z')] += speed['location']['dz']