SpecLog 0.0.2__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {speclog-0.0.2 → speclog-0.0.4}/PKG-INFO +1 -1
  2. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/SpecLog.py +4 -4
  3. speclog-0.0.4/SpecLog/config/config.cfg +31 -0
  4. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/device.py +5 -5
  5. speclog-0.0.4/SpecLog/run_logger.pyw +64 -0
  6. speclog-0.0.4/SpecLog/run_monitor.pyw +27 -0
  7. speclog-0.0.4/SpecLog/version.py +1 -0
  8. {speclog-0.0.2 → speclog-0.0.4}/SpecLog.egg-info/PKG-INFO +1 -1
  9. {speclog-0.0.2 → speclog-0.0.4}/SpecLog.egg-info/SOURCES.txt +3 -0
  10. {speclog-0.0.2 → speclog-0.0.4}/pyproject.toml +1 -4
  11. speclog-0.0.2/SpecLog/version.py +0 -1
  12. {speclog-0.0.2 → speclog-0.0.4}/README.md +0 -0
  13. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/SpecLogger.py +0 -0
  14. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/__init__.py +0 -0
  15. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/config/__init__.py +0 -0
  16. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/config/config.py +0 -0
  17. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/debugLog.py +0 -0
  18. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/loggerConfig.py +0 -0
  19. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/monitor.py +0 -0
  20. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/ui/__init__.py +0 -0
  21. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/ui/plotting.py +0 -0
  22. {speclog-0.0.2 → speclog-0.0.4}/SpecLog/ui/plotting.ui +0 -0
  23. {speclog-0.0.2 → speclog-0.0.4}/SpecLog.egg-info/dependency_links.txt +0 -0
  24. {speclog-0.0.2 → speclog-0.0.4}/SpecLog.egg-info/entry_points.txt +0 -0
  25. {speclog-0.0.2 → speclog-0.0.4}/SpecLog.egg-info/requires.txt +0 -0
  26. {speclog-0.0.2 → speclog-0.0.4}/SpecLog.egg-info/top_level.txt +0 -0
  27. {speclog-0.0.2 → speclog-0.0.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SpecLog
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: A Python Package for logging data from instrumentations
5
5
  Author-email: Yen-Chun Huang <yen-chun.huang@bruker.com>
6
6
  License-Expression: MIT
@@ -60,13 +60,13 @@ class SpecLog:
60
60
  if not self.last_query_time or now - self.last_query_time > self.delay:
61
61
  warning_level = 0
62
62
  self._setTimeInDataDictByVariable() # update time
63
- devices_info = (
64
- self.devices.devices_info
63
+ device_info = (
64
+ self.devices.device_info
65
65
  ) # dictionary: {model: {status, config_status, device, id_command}}
66
66
  for name, info in self.commands.items():
67
67
  delimiter = self.device_config[name]["delimiter"]
68
68
  index = self.device_config[name]["index"]
69
- device = devices_info[name]["device"]
69
+ device = device_info[name]["device"]
70
70
  termination = self.device_config[name]["termination"]
71
71
  for variable in info.keys():
72
72
  info[variable]['min'], info[variable]['max'], info[variable]['static']
@@ -143,7 +143,7 @@ class SpecLog:
143
143
  if (
144
144
  address in self.devices.deviceAddresses
145
145
  and address not in self.available_addresses
146
- and not self.devices.devices_info[name]["status"]
146
+ and not self.devices.device_info[name]["status"]
147
147
  ):
148
148
  restart_DEVICE = True
149
149
 
@@ -0,0 +1,31 @@
1
+ [SETTINGS]
2
+ log_interval = 10
3
+ log_folder_location = C:/Users/Public/
4
+ save_file_size_kb = 1024
5
+ limit_hours = 48
6
+
7
+ [F70]
8
+ device_status = True
9
+ address = ADDC_COM_NUMBER
10
+ termination = CR
11
+ id_command = $ID1D629
12
+ index = 1
13
+ delimiter = ,
14
+ helium_discharge_temperature = $TE140B8, alias = He discharge
15
+ water_outlet_temperature = $TE241F8, alias = H2O outlet, max = 45
16
+ water_inlet_temperature = $TE38139, alias = H2O inlet, min = 5, max = 30
17
+ compressor_pressure = $PR171F6, alias = He pressure
18
+ status = $STA3504, alias = Status, bits = 9, bit_static = 301, indicators = ['Compressor Run','*Motor Temperature','*Phase Sequence/Fuse','*Helium Temperature','*Water Temperature','*Water Flow','*Oil Level','*Pressure','Solenoid']
19
+
20
+ [MODEL218E]
21
+ device_status = True
22
+ address = ADDC_COM_NUMBER
23
+ data_bits = 7
24
+ termination = CRLF
25
+ parity = 1
26
+ delimiter = ,
27
+ 1st_stage = KRDG?1, alias = 1st stage, min = 30, max = 50
28
+ 2nd_stage = KRDG?2, alias = 2nd stage, min = 2, max = 5
29
+ magnet_lhs = KRDG?3, alias = Magnet LHS, min = 2, max = 5
30
+ magnet_rhs = KRDG?4, alias = Magnet RHS, min = 2, max = 5
31
+ magnet_switch = KRDG?5, alias = Magnet Switch, min = 2, max = 10
@@ -16,7 +16,7 @@ from .debugLog import *
16
16
 
17
17
  class DEVICE:
18
18
  def __init__(self, config, debug_logger):
19
- self.devices_info = {}
19
+ self.device_info = {}
20
20
  self._getPorts()
21
21
  self.debug_logger = debug_logger
22
22
  self.device_config = config.devices
@@ -71,7 +71,7 @@ class DEVICE:
71
71
  else:
72
72
  device = None
73
73
 
74
- self.devices_info[name] = {
74
+ self.device_info[name] = {
75
75
  "status": status,
76
76
  "config_status": status,
77
77
  "device": device,
@@ -81,13 +81,13 @@ class DEVICE:
81
81
  return True
82
82
 
83
83
  else:
84
- self.devices_info = {}
84
+ self.device_info = {}
85
85
  for name in self.device_config.keys():
86
86
  self._setDevice(name)
87
87
 
88
88
  def checkDeviceStatus(self, name: str = None, init: bool = False):
89
89
  if name:
90
- device_info = self.devices_info[name]
90
+ device_info = self.device_info[name]
91
91
  id_command = device_info["id_command"]
92
92
  device = device_info["device"]
93
93
  termination = device_info["termination"]
@@ -114,7 +114,7 @@ class DEVICE:
114
114
  return False
115
115
 
116
116
  else:
117
- for name in self.devices_info.keys():
117
+ for name in self.device_info.keys():
118
118
  if self.checkDeviceStatus(name):
119
119
  self.debug_logger.info("%s is valid and connected" % name)
120
120
  else:
@@ -0,0 +1,64 @@
1
+ '''
2
+ This is the python program to run logger only
3
+ '''
4
+
5
+ import os
6
+ import traceback
7
+ import ctypes
8
+ import time
9
+ import threading
10
+ from collections import Counter
11
+ from .SpecLog import *
12
+ from .debugLog import *
13
+
14
+
15
+ def popout(level = 0):
16
+ if level == 0:
17
+ return
18
+ elif level == 1:
19
+ ctypes.windll.user32.MessageBoxW(0, 'Warning: System is reaching the limit', "Logger", 1)
20
+ elif level > 2:
21
+ ctypes.windll.user32.MessageBoxW(0, 'Warning: System is error', "Logger", 1)
22
+
23
+ def main_func(config_file = None):
24
+ # last_warning = 0
25
+ debugLogger = debugLog(config_file).logger
26
+ current_exe = os.popen('wmic process get description').read().strip().replace(' ', '').split('\n\n')
27
+ hashDict = Counter(current_exe)
28
+ # thread = threading.Thread(target=popout, args=(0))
29
+ if 'SpecLogger_running.exe' in hashDict and hashDict['SpecLogger_running.exe'] > 1:
30
+ debugLogger.warning('start fail: SpecLogger is running in the background')
31
+ return
32
+ else:
33
+ try:
34
+ log = SpecLog()
35
+ debugLogger.info('SpecLog initialization succeed')
36
+ except Exception as err:
37
+ debugLogger.warning('SpecLog initialization failed')
38
+ debugLogger.error(traceback.format_exc())
39
+ return
40
+ debugLogger.info('SpecLog logging started')
41
+ while(1):
42
+ try:
43
+ log.log()
44
+ # warning = log.warning
45
+ # if last_warning != warning:
46
+ # if warning == 0 and thread.is_alive: # error clean
47
+ # thread.join()
48
+ # elif warning != last_warning: # error changes
49
+ # if thread.is_alive():
50
+ # wd=ctypes.windll.user32.FindWindowA(0,"Logger") # close window
51
+ # ctypes.windll.user32.SendMessageA(wd,0x0010,0,0)
52
+ # thread.join()
53
+ # thread = threading.Thread(target=popout, kwargs = {'level': warning})
54
+ # thread.start()
55
+
56
+ # last_warning = warning
57
+
58
+ except Exception as err:
59
+ debugLogger.warning('logging failed')
60
+ debugLogger.critical(traceback.format_exc())
61
+ return
62
+
63
+ if __name__ == "__main__":
64
+ main_func()
@@ -0,0 +1,27 @@
1
+ '''
2
+ This is the python program to run monitor only
3
+ '''
4
+
5
+ import os
6
+ import sys
7
+ from collections import Counter
8
+ import argparse
9
+ from .monitor import *
10
+
11
+ def main_func():
12
+ parser = argparse.ArgumentParser(prog='specmonitor')
13
+ parser.add_argument('number_of_file', type=int, nargs='?', default = 10,
14
+ help='To select number of files to plot in real-time')
15
+ args = parser.parse_args()
16
+ current_exe = os.popen('wmic process get description').read().strip().replace(' ', '').split('\n\n')
17
+ hashDict = Counter(current_exe)
18
+ if 'specmonitor.exe' in hashDict and hashDict['specmonitor.exe'] > 1:
19
+ exit()
20
+ else:
21
+ app = QApplication(sys.argv)
22
+ window = MainWindow()
23
+ window.show()
24
+ app.exec()
25
+
26
+ if __name__ == "__main__":
27
+ main_func()
@@ -0,0 +1 @@
1
+ __version__ = "0.0.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SpecLog
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: A Python Package for logging data from instrumentations
5
5
  Author-email: Yen-Chun Huang <yen-chun.huang@bruker.com>
6
6
  License-Expression: MIT
@@ -7,6 +7,8 @@ SpecLog/debugLog.py
7
7
  SpecLog/device.py
8
8
  SpecLog/loggerConfig.py
9
9
  SpecLog/monitor.py
10
+ SpecLog/run_logger.pyw
11
+ SpecLog/run_monitor.pyw
10
12
  SpecLog/version.py
11
13
  SpecLog.egg-info/PKG-INFO
12
14
  SpecLog.egg-info/SOURCES.txt
@@ -15,6 +17,7 @@ SpecLog.egg-info/entry_points.txt
15
17
  SpecLog.egg-info/requires.txt
16
18
  SpecLog.egg-info/top_level.txt
17
19
  SpecLog/config/__init__.py
20
+ SpecLog/config/config.cfg
18
21
  SpecLog/config/config.py
19
22
  SpecLog/ui/__init__.py
20
23
  SpecLog/ui/plotting.py
@@ -41,10 +41,7 @@ include-package-data = true
41
41
  include = ["SpecLog", "SpecLog.*"]
42
42
 
43
43
  [tool.setuptools.package-data]
44
- SpecLog = [
45
- "config/command.cfg",
46
- "ui/plotting.ui",
47
- ]
44
+ SpecLog = ["*.pyw", "config/*.cfg", "ui/*.ui"]
48
45
 
49
46
  [tool.setuptools.dynamic]
50
47
  version = { attr = "SpecLog.version.__version__" }
@@ -1 +0,0 @@
1
- __version__ = "0.0.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes