forked from respec/HSPsquared
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HSP2_Driver.py
51 lines (38 loc) · 1.31 KB
/
HSP2_Driver.py
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
42
43
44
45
46
47
import os, sys
# print('in HSP2_Driver')
command_line = ""
# print('arg count ' + str(len(sys.argv)))
if len(sys.argv) >= 2:
# see if anything on command line
command_line = sys.argv[1]
print('command line' + command_line)
# if given UCI, import to h5 file
# if given WDM, import to h5 file
# if given h5, run HSP2
from PyQt5.QtWidgets import QFileDialog, QApplication
application = QApplication(sys.argv)
if command_line == '':
file_filter = "Run HDF5 (*.h5);;" \
"Import UCI to HDF5 (*.uci);;" \
"Import WDM to HDF5 (*.wdm)"
filename, filetype = QFileDialog.getOpenFileName(None, 'HSP2 Open File...', '', file_filter)
else:
filename = command_line
file_ext = filename[-3:]
dir_name = os.path.dirname(filename)
os.chdir(dir_name)
if file_ext.upper() == "UCI":
h5_name = filename[:-3] + "h5"
from HSP2tools.readUCI import readUCI
readUCI(filename, h5_name)
# readUCI('HSPF.uci', 'test.h5')
if file_ext.upper() == "WDM":
h5_name = filename[:-3] + "h5"
from HSP2tools.readWDM import readWDM
readWDM(filename, h5_name)
# readWDM('GRICM.wdm', 'test.h5')
# readWDM('ZUMBROSCEN.WDM', 'test.h5')
if file_ext.upper() == ".H5":
from HSP2.main import main
main(filename, saveall=True, jupyterlab=False)
# main('test.h5', saveall=True)