Skip to content
Snippets Groups Projects
Commit 27b49d10 authored by Georges Da Costa's avatar Georges Da Costa
Browse files

Adds commands *list_plot* and *csv_plot*

parent e8c842c3
No related branches found
No related tags found
No related merge requests found
import os
import pandas as pd
import matplotlib.pyplot as plt
import sys
def read_host_csv(prefix, hostname, startTime, basename, fullname, archive_fid=None):
fullpath= '%s_%s/%s_%s_%s' % (basename, prefix, hostname, fullname, startTime)
......@@ -39,3 +41,20 @@ def write_run_csv(prefix, hostname, startTime, basename, fullname, hostlist, dat
def write_bundle_csv(prefix, bundle, data, target_directory):
for index, row in bundle.iterrows():
write_run_csv(prefix, row.hostname, row.startTime, row.basename, row.fullname, row.hostlist, data[index], target_directory)
def show_csv(filename, norm=False):
filename = sys.argv[-1]
a = pd.read_csv(filename, sep = " ")
a['#timestamp'] = a['#timestamp']-a['#timestamp'][0]
if norm:
tmp = (a/a.max())
tmp['#timestamp'] = a['#timestamp']
a = tmp
a.plot(x='#timestamp')
plt.show(block=True)
def show_csv_main():
filename = sys.argv[-1]
norm = len(sys.argv) == 3
show_csv(filename, norm)
import os
import sys
import json
import pandas as pd
import matplotlib.pyplot as plt
## Power
def read_run_list(prefix, hostname, startTime, basename, fullname, hostlist=None, archive_fid=None):
......@@ -55,3 +57,20 @@ def write_bundle_list(prefix, bundle, data, target_directory):
for index, row in bundle.iterrows():
write_run_list(prefix, row.hostname, row.startTime, row.basename, row.fullname, row.hostlist, data[index], target_directory)
def show_list(filename):
with open(filename) as f_id:
data = json.load(f_id)
for name, timestamps, power in data:
plt.plot([t-timestamps[0] for t in timestamps],
power, label=name)
plt.legend()
plt.show(block=True)
def show_list_main():
filename = sys.argv[-1]
show_list(filename)
......@@ -27,6 +27,8 @@ setuptools.setup(
entry_points={
'console_scripts': [
'remove_watermark = expetator.remove_watermark:main',
'csv_plot = expetator.monitoring_csv:show_csv_main',
'list_plot = expetator.monitoring_list:show_list_main',
]
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment