-
Notifications
You must be signed in to change notification settings - Fork 0
/
runGUI.py
executable file
·73 lines (58 loc) · 2.17 KB
/
runGUI.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
# #!/usr/bin/env python #-m pdb
# import sys
# from IPython.core import ultratb
# sys.excepthook = ultratb.FormattedTB(mode='Verbose',
# color_scheme='Linux', call_pdb=1)
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
import matplotlib as mpl
mpl.rcParams['image.aspect'] = 'auto'
import E200
import argparse
# import h5py as h5
# import logging
import mytools as mt
# import numpy as np
from ButterflyGUI import ButterflyGUI
from analyze_matlab import analyze_matlab
from save_analysis import save_analysis
def runGUI(filename, camname, imgnum, verbose=False, loglevel=0):
# ======================================
# Set up logging
# ======================================
logger = mt.mylogger(filename='runGUI') # noqa
# ======================================
# Load data and run program
# ======================================
data = E200.E200_load_data(filename, local=False)
# Generate or retrieve qt app
app = mt.qt.get_app()
window = ButterflyGUI(
analyzefcn = analyze_matlab ,
savefcn = save_analysis ,
dataset = data ,
camname = camname ,
imgnum = imgnum ,
verbose = verbose
)
# img = np.random.randn(10, 10)
# window = ButterflyGUI(analyze_matlab, image=img)
# window.ui.imageview_mpl.img.image=img
window.show()
app.exec_()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Loads and runs a gui to analyze saved spectrometer data.')
parser.add_argument('-v', '--verbose', action='store_true',
help='enable verbose mode')
parser.add_argument('-l', '--log', default='info', choices=['debug', 'info', 'warning', 'error', 'critical'],
help='increase logging level')
parser.add_argument('file',
nargs=1,
help='file to process')
parser.add_argument('-c', '--camera',
help='camera name')
parser.add_argument('-i', '--imgnum', type=int,
help='image number')
arg = parser.parse_args()
runGUI(arg.file[0], arg.camera, arg.imgnum, verbose=arg.verbose, loglevel=arg.log)