aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-06-28 11:36:11 +0200
committerThomas White <taw@physics.org>2019-07-17 09:19:10 +0200
commit80bfa779a5167d53e476bbc54ffaa127a1b91ccb (patch)
treecb86dd4c8bef085bc4c0300ef33bbf6fb3a48828 /scripts
parente187ffe71c39ab26c350b56eddb9212e81ada144 (diff)
scripts/plot-pr: Allow the use of folder names other than "pr-logs"
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/plot-pr15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/plot-pr b/scripts/plot-pr
index 25427cae..ccd925a1 100755
--- a/scripts/plot-pr
+++ b/scripts/plot-pr
@@ -95,14 +95,14 @@ def read_spectrum(filename):
def next_click(w):
global specgraph, crystal
crystal += 20
- specgraph = read_spectrum("pr-logs/specgraph-crystal%i.dat" % crystal)
+ specgraph = read_spectrum("%s/specgraph-crystal%i.dat" % (folder,crystal))
update_graph()
def prev_click(w):
global specgraph, crystal
crystal -= 20
- specgraph = read_spectrum("pr-logs/specgraph-crystal%i.dat" % crystal)
+ specgraph = read_spectrum("%s/specgraph-crystal%i.dat" % (folder,crystal))
update_graph()
@@ -116,8 +116,15 @@ def set_sensible_axes(w):
# Read the pgraph file
pgraph = []
+if len(sys.argv) == 2:
+ folder = sys.argv[1]
+else:
+ folder = "pr-logs"
+
+print("Using folder '%s'" % folder)
+
try:
- fh = open("pr-logs/pgraph.dat", 'r')
+ fh = open("%s/pgraph.dat" % folder, 'r')
except IOError:
print("Failed to read "+filename)
raise IOError
@@ -137,7 +144,7 @@ while True:
# Read the spectrum file
-specgraph = read_spectrum("pr-logs/specgraph-crystal%i.dat" % crystal)
+specgraph = read_spectrum("%s/specgraph-crystal%i.dat" % (folder,crystal))
fig = plt.figure(figsize=(15,6))
fig.subplots_adjust(left=0.05, right=0.65)