-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotPSEClogfile
More file actions
41 lines (34 loc) · 840 Bytes
/
plotPSEClogfile
File metadata and controls
41 lines (34 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
import plot_PSEC4 as plt
import numpy as np
import os
from Tkinter import *
import tkFileDialog
import tkMessageBox
import bokeh.plotting as bkh
## Quickly plot a PSEC log file ##
cwd = os.getcwd()
# Get the data file from a dialogue box and open it. Also store the filename.
root = Tk()
root.withdraw()
root.update()
f = tkFileDialog.askopenfile(mode='rb',
initialfile=cwd,
title='Select a file',
filetypes = (("txt Files", "*.txt"),("all files","*.*")))
root.destroy()
try:
fname = f.name
except:
print("No file selected")
exit()
f.close()
oname = fname
oname = oname.replace('DATA', 'FIGS')+'.html'
p = plt.plot_PSEC(fname, oname)
directory = oname.split('/')[:-1]
directory = '/'.join(directory)
if not os.path.exists(directory):
os.makedirs(directory)
bkh.save(p)
bkh.show(p)