tfix output files, add simple output visualization script - slidergrid - grid of elastic sliders on a frictional surface
(HTM) git clone git://src.adamsgaard.dk/slidergrid
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ff88f8d48e99c57f52f22471765a1bd9ad2e00fc
(DIR) parent 44ac43e2f25e201fcc9f6ee771ffc4de2819ba7a
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Thu, 17 Mar 2016 11:00:28 -0700
fix output files, add simple output visualization script
Diffstat:
A plot_output.py | 60 +++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/plot_output.py b/plot_output.py
t@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+import sys
+import os
+import numpy as np
+import matplotlib.pyplot as plt
+
+VERSION = '0.1-beta'
+
+
+def print_usage(argv0):
+ print('usage: ' + argv0 + ' [OPTIONS] <FOLDER>')
+ print('where FOLDER is an output folder placed in this directory')
+ print('options:')
+ print(' -h, --help \tshow this information')
+ print(' -v, --version \tshow version information')
+
+
+def print_version(argv0):
+ print(argv0 + ' ' + VERSION)
+ print('author: Anders Damsgaard, adamsgaard@ucsd.edu')
+ print('web: https://github.com/anders-dc/slidergrid')
+ print('Licensed under the GNU Public License v3, see LICENSE for details')
+
+
+class sgvis:
+
+ def __init__(self, folder):
+ self.folder = folder
+
+ def read_sliders(self, filename):
+ self.filename = filename
+ self.sliders = np.loadtxt(self.folder + '/' + self.filename)
+
+ def plot_sliders(self):
+ plt.plot(self.sliders[:, 0], self.sliders[:, 1], '+')
+ outfile = self.folder + '/' + self.filename + '.png'
+ print(outfile)
+ plt.savefig(outfile)
+
+ def plot_all_sliders(self):
+ for filename in os.listdir(self.folder):
+ if 'sliders' in filename:
+ self.read_sliders(filename)
+ self.plot_sliders()
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print_usage(sys.argv[0])
+ exit()
+
+ if sys.argv[1] == '-h' or sys.argv[1] == '--help':
+ print_usage(sys.argv[0])
+ exit()
+
+ if sys.argv[1] == '-v' or sys.argv[1] == '--version':
+ print_version(sys.argv[0])
+ exit()
+
+ sgvis = sgvis(sys.argv[1])
+ sgvis.plot_all_sliders()