diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2023-12-22 07:07:48 +0100 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2023-12-22 07:07:48 +0100 |
commit | 4c313e3bc34ed660d68989bd6b538d30a9f442ed (patch) | |
tree | 65c3bcd096234b76e4fb41841139ed4d5ca4fe2f | |
parent | af4d3bc3dae8a42cfd8ceaf31876d2d355369af4 (diff) |
plotter: use logger rather than print for info output
-rwxr-xr-x | lib/plotter.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/plotter.py b/lib/plotter.py index 66daf0c..f698be2 100755 --- a/lib/plotter.py +++ b/lib/plotter.py @@ -1,10 +1,13 @@ #!/usr/bin/env python3 import itertools +import logging import numpy as np import matplotlib.pyplot as plt import re +logger = logging.getLogger(__name__) + def is_state(aggregate, name): """Return true if name is a state and not UNINITIALIZED.""" @@ -147,12 +150,12 @@ def plot_xy( plt.plot(X, Y, "bo", markersize=2) if output: plt.savefig(output) - print(f"plot saved to {output}") + logger.info(f"XY plot saved to {output}") with open("{}.txt".format(output), "w") as f: print("X Y", file=f) for i in range(len(X)): print("{} {}".format(X[i], Y[i]), file=f) - print(f"data saved to {output}.txt") + logger.info(f"XY plot data saved to {output}.txt") if show: plt.show() @@ -275,7 +278,7 @@ def plot_param( if output: plt.savefig(output) - print(f"plot saved to {output}") + logger.info(f"Param plot saved to {output}") if show: plt.show() @@ -432,13 +435,13 @@ def boxplot( if output: plt.savefig(output) - print(f"plot saved to {output}") + logger.info(f"Boxplot saved to {output}") with open("{}.txt".format(output), "w") as f: print("X Y", file=f) for i, data in enumerate(measurements): for value in data: print("{} {}".format(ticks[i], value), file=f) - print(f"data saved to {output}.txt") + logger.info(f"Boxplot data saved to {output}.txt") if show: plt.show() |