-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwindow_with_logging.py
40 lines (32 loc) · 1.22 KB
/
window_with_logging.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
import os
from argparse import ArgumentParser
import logging
from PyQt5.QtWidgets import QApplication
from pynta.model.experiment.nanoparticle_tracking.np_tracking import NPTracking
from pynta.util.log import get_logger
from pynta.view.main import MainWindow
def main():
logger = get_logger() # 'nanoparticle_tracking.model.experiment.nanoparticle_tracking.saver'
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
parser = ArgumentParser(description='Start the pyNTA software')
parser.add_argument("-c", dest="config_file", required=False,
help="Path to the configuration file")
args = parser.parse_args()
if args.config_file is None:
config_file = os.path.join(BASE_DIR, 'config', 'nanocet.yml')
else:
config_file = args.config_file
exp = NPTracking(config_file)
exp.initialize_camera()
app = QApplication([])
window = MainWindow(exp)
window.show()
app.exec()
if __name__ == '__main__':
main()