@@ -149,11 +149,11 @@ def estimate(self, data: SingleSensorData, *, sampling_rate_hz: float, **_) -> S
149149 # Add an implicit 0 to the beginning of the acc data
150150 padded_acc = np .pad (acc_data , pad_width = ((1 , 0 ), (0 , 0 )), constant_values = 0 )
151151 velocity = self ._forward_backward_integration (padded_acc )
152- position_xy = cumtrapz (velocity [:, :2 ], axis = 0 , initial = 0 ) / self .sampling_rate_hz
152+ position_xy = cumulative_trapezoid (velocity [:, :2 ], axis = 0 , initial = 0 ) / self .sampling_rate_hz
153153 if self .level_assumption is True :
154154 position_z = self ._forward_backward_integration (velocity [:, [2 ]])
155155 else :
156- position_z = cumtrapz (velocity [:, [2 ]], axis = 0 , initial = 0 ) / self .sampling_rate_hz
156+ position_z = cumulative_trapezoid (velocity [:, [2 ]], axis = 0 , initial = 0 ) / self .sampling_rate_hz
157157 position = np .hstack ((position_xy , position_z ))
158158
159159 self .velocity_ = pd .DataFrame (velocity , columns = GF_VEL )
@@ -171,9 +171,9 @@ def _sigmoid_weight_function(self, n_samples: int) -> np.ndarray:
171171
172172 def _forward_backward_integration (self , data : np .ndarray ) -> np .ndarray :
173173 # TODO: different steepness and turning point for velocity and position?
174- integral_forward = cumtrapz (data , axis = 0 , initial = 0 ) / self .sampling_rate_hz
174+ integral_forward = cumulative_trapezoid (data , axis = 0 , initial = 0 ) / self .sampling_rate_hz
175175 # for backward integration, we flip the signal and inverse the time by using a negative sampling rate.
176- integral_backward = cumtrapz (data [::- 1 ], axis = 0 , initial = 0 ) / - self .sampling_rate_hz
176+ integral_backward = cumulative_trapezoid (data [::- 1 ], axis = 0 , initial = 0 ) / - self .sampling_rate_hz
177177 weights = self ._sigmoid_weight_function (integral_forward .shape [0 ])
178178 combined = (integral_forward .T * (1 - weights ) + integral_backward [::- 1 ].T * weights ).T
179179 return combined
0 commit comments