diff --git a/scripts/plot-single-job.py b/scripts/plot-single-job.py index 7e561c1..7388374 100755 --- a/scripts/plot-single-job.py +++ b/scripts/plot-single-job.py @@ -6,12 +6,13 @@ from pandas import DataFrame from pandas import Grouper from matplotlib import pyplot -jobs = sys.argv[1:] +jobs = [sys.argv[1]] +prefix = sys.argv[2] -print("Analyzing the jobs: " + str(jobs)) +print("Plotting the job: " + str(jobs)) # Plot the timeseries -def plot(header, row): +def plot(prefix, header, row): x = { h : d for (h, d) in zip(header, row)} jobid = x["jobid"] del x["jobid"] @@ -40,7 +41,7 @@ def plot(header, row): ax[i].set_ylabel(l) pyplot.xlabel("Segment number") - pyplot.savefig("timeseries" + jobid + ".png") + pyplot.savefig(prefix + "timeseries" + jobid + ".png") # Plot first 30 minutes @@ -49,8 +50,9 @@ def plot(header, row): ax[i].set_ylabel(l) pyplot.xlabel("Segment number") - pyplot.savefig("timeseries" + jobid + "-30.png") + pyplot.savefig(prefix + "timeseries" + jobid + "-30.png") +### end plotting function @@ -66,4 +68,4 @@ with open('job-io-datasets/datasets/job_codings.csv') as csv_file: if not row[0].strip() in jobs: continue else: - plot(header, row) + plot(prefix, header, row) diff --git a/scripts/plot.R b/scripts/plot.R index 6e264fa..7aea26b 100755 --- a/scripts/plot.R +++ b/scripts/plot.R @@ -50,6 +50,14 @@ plotJobs = function(jobs){ #print(tbl) md = metadata[metadata$jobid %in% jobs,] print(summary(md)) + + # print the job timeline + r = e[ordered, ] + for (row in 1:length(jobs)) { + prefix = sprintf("%s-%f-%.0f", level, r[row, "similarity"], row) + job = r[row, "jobid"] + system(sprintf("scripts/plot-single-job.py %s %s", job, prefix)) + } } # Store the job ids in a table, each column is one algorithm