Add support for plotting boolean values.
Append a "-b" and then a float to plot boolean values as going
between 0 and that value.
For example, a plot definition of:
fridge status zeroed -b 0.5
would plot the zeroed flag as 0 when it's false and 0.5 when it's true.
Change-Id: Ie118d02c2079a92b43756c664a3927ace468eebe
diff --git a/frc971/analysis/plot_action.py b/frc971/analysis/plot_action.py
index f719c97..2f50ffd 100755
--- a/frc971/analysis/plot_action.py
+++ b/frc971/analysis/plot_action.py
@@ -24,6 +24,14 @@
Lines are ignored if they start with a hash mark (i.e. '#').
+ Lines that end with a "-b X" where X is a number then it designates that line
+ as plotting a boolean value. X is the value plotted when the boolean is true.
+ When the boolean is false then the values is plotted as zero. For example,
+ the following boolean value is drawn to toggle between 2.0 and 0 when the
+ boolean is True and False, respectively:
+
+ fridge status zeroed -b 2.0
+
Args:
filename: The name of the file to read the definitions from.
@@ -47,7 +55,7 @@
arg_parser = argparse.ArgumentParser(description='Log Plotter')
arg_parser.add_argument('log_file', metavar='LOG_FILE', type=str, \
help='The file from which to read logs and plot.')
- arg_parser.add_argument('--plot-defs', action='store', type=str, \
+ arg_parser.add_argument('--plot-defs', '-p', action='store', type=str, \
help='Read the items to plot from this file.')
arg_parser.add_argument('--no-binary', '-n', action='store_true', \
help='Don\'t print the binary name in the legend.')