From a126c91d6f625a6413d42d50d186fbc9424b7022 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 26 Jan 2016 13:19:25 -0800 Subject: [PATCH] Skeleton with interactive plotting --- python/gtsam_examples/ImuFactorExample.py | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 python/gtsam_examples/ImuFactorExample.py diff --git a/python/gtsam_examples/ImuFactorExample.py b/python/gtsam_examples/ImuFactorExample.py new file mode 100644 index 000000000..04a7a0661 --- /dev/null +++ b/python/gtsam_examples/ImuFactorExample.py @@ -0,0 +1,34 @@ +""" +A script validating the ImuFactor prediction and inference. +""" + +from __future__ import print_function +import matplotlib.pyplot as plt +import numpy as np + +class ImuFactorExample(object): + + def __init__(self): + plt.figure(1) + plt.ion() + + def plot(self): + times = np.arange(0, 10, 0.1) + shape = len(times), 1 + labels = list('xyz') + colors = list('rgb') + plt.clf() + for row, (label, color) in enumerate(zip(labels, colors)): + plt.subplot(3, 1, row) + imu = np.random.randn(len(times), 1) + plt.plot(times, imu, color=color) +# plt.axis([tmin, tmax, min,max]) + plt.xlabel(label) + plt.pause(0.1) + + def run(self): + for i in range(100): + self.plot() + +if __name__ == '__main__': + ImuFactorExample().run()