Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def plot_imu(self, fig = None, plot_num = 1, plot_rows = 2, plot_cols = 2, figsize=None, **kwargs):
if fig is None:
fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(plot_rows, plot_cols, plot_num, title=self.name + ' Gyros')
moveThreshGyro = pysurvive.configf(self.so.contents.ctx, "move-threshold-gyro", pysurvive.SC_GET, 0)
moveThreshAcc = pysurvive.configf(self.so.contents.ctx, "move-threshold-acc", pysurvive.SC_GET, 0)
axes_name = ['X', 'Y', 'Z']
gyros = np.array(self.gyros)
ax.plot([self.imu_times[0],self.imu_times[-1]], [moveThreshGyro] * 2, linewidth=1)
ax.plot(self.imu_times, np.linalg.norm(gyros, axis=1), linewidth=1, label='Norm')
for i in range(3):
ax.plot(self.imu_times, gyros[:, i], linewidth=1, label=axes_name[i])
ax.legend()
ax = fig.add_subplot(plot_rows, plot_cols, plot_num + 1, title=self.name + ' Accels')
ax.plot([self.imu_times[0],self.imu_times[-1]], [moveThreshAcc] * 2, linewidth=1)
ax.plot(self.imu_times[1:], np.linalg.norm(np.diff(self.accels, axis=0), axis=1), linewidth=1)
return 2