quarchpy 2.1.20.dev3__py2.py3-none-any.whl → 2.1.22__py2.py3-none-any.whl

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 (184) hide show
  1. quarchpy/.idea/.name +1 -1
  2. quarchpy/.idea/modules.xml +1 -0
  3. quarchpy/.idea/quarchpy.iml +4 -1
  4. quarchpy/.idea/workspace.xml +231 -21
  5. quarchpy/__pycache__/__init__.cpython-311.pyc +0 -0
  6. quarchpy/__pycache__/_version.cpython-311.pyc +0 -0
  7. quarchpy/__pycache__/connection.cpython-311.pyc +0 -0
  8. quarchpy/__pycache__/run.cpython-311.pyc +0 -0
  9. quarchpy/_version.py +1 -1
  10. quarchpy/config_files/__pycache__/__init__.cpython-311.pyc +0 -0
  11. quarchpy/config_files/__pycache__/quarch_config_parser.cpython-311.pyc +0 -0
  12. quarchpy/connection_specific/QPS/qis/qis.jar +0 -0
  13. quarchpy/connection_specific/QPS/qis/qis_lib/{CInterface-1.7.8.jar → CInterface-1.8.0.jar} +0 -0
  14. quarchpy/connection_specific/QPS/{qps_lib/QuarchCommon-0.2.9.jar → qis/qis_lib/QuarchCommon-0.2.12.jar} +0 -0
  15. quarchpy/connection_specific/QPS/qis/qis_lib/jmdns-3.5.9.jar +0 -0
  16. quarchpy/connection_specific/QPS/qis/resources/filters/iec_filters.xml +0 -9
  17. quarchpy/connection_specific/QPS/qps.jar +0 -0
  18. quarchpy/connection_specific/QPS/{qis/qis_lib/QuarchCommon-0.2.9.jar → qps_lib/QuarchCommon-0.2.12.jar} +0 -0
  19. quarchpy/connection_specific/QPS/qps_lib/{qis-1.40.jar → qis-1.41.jar} +0 -0
  20. quarchpy/connection_specific/QPS/resources/profiles/3_PHASE_PAM_AC_DEFAULT.scf +90 -0
  21. quarchpy/connection_specific/QPS/resources/profiles/3_PHASE_PAM_AC_FULL.scf +144 -0
  22. quarchpy/connection_specific/QPS/scriptCommands.txt +2 -2
  23. quarchpy/connection_specific/__pycache__/StreamChannels.cpython-311.pyc +0 -0
  24. quarchpy/connection_specific/__pycache__/__init__.cpython-311.pyc +0 -0
  25. quarchpy/connection_specific/__pycache__/connection_QIS.cpython-311.pyc +0 -0
  26. quarchpy/connection_specific/__pycache__/connection_QPS.cpython-311.pyc +0 -0
  27. quarchpy/connection_specific/__pycache__/connection_ReST.cpython-311.pyc +0 -0
  28. quarchpy/connection_specific/__pycache__/connection_Serial.cpython-311.pyc +0 -0
  29. quarchpy/connection_specific/__pycache__/connection_TCP.cpython-311.pyc +0 -0
  30. quarchpy/connection_specific/__pycache__/connection_Telnet.cpython-311.pyc +0 -0
  31. quarchpy/connection_specific/__pycache__/connection_USB.cpython-311.pyc +0 -0
  32. quarchpy/connection_specific/__pycache__/connection_mDNS.cpython-311.pyc +0 -0
  33. quarchpy/connection_specific/connection_QIS.py +8 -3
  34. quarchpy/connection_specific/serial/__pycache__/__init__.cpython-311.pyc +0 -0
  35. quarchpy/connection_specific/serial/__pycache__/rfc2217.cpython-311.pyc +0 -0
  36. quarchpy/connection_specific/serial/__pycache__/rs485.cpython-311.pyc +0 -0
  37. quarchpy/connection_specific/serial/__pycache__/serialcli.cpython-311.pyc +0 -0
  38. quarchpy/connection_specific/serial/__pycache__/serialjava.cpython-311.pyc +0 -0
  39. quarchpy/connection_specific/serial/__pycache__/serialposix.cpython-311.pyc +0 -0
  40. quarchpy/connection_specific/serial/__pycache__/serialutil.cpython-311.pyc +0 -0
  41. quarchpy/connection_specific/serial/__pycache__/serialwin32.cpython-311.pyc +0 -0
  42. quarchpy/connection_specific/serial/__pycache__/win32.cpython-311.pyc +0 -0
  43. quarchpy/connection_specific/serial/threaded/__pycache__/__init__.cpython-311.pyc +0 -0
  44. quarchpy/connection_specific/serial/tools/__pycache__/__init__.cpython-311.pyc +0 -0
  45. quarchpy/connection_specific/serial/tools/__pycache__/hexlify_codec.cpython-311.pyc +0 -0
  46. quarchpy/connection_specific/serial/tools/__pycache__/list_ports.cpython-311.pyc +0 -0
  47. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_common.cpython-311.pyc +0 -0
  48. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_linux.cpython-311.pyc +0 -0
  49. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_osx.cpython-311.pyc +0 -0
  50. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_posix.cpython-311.pyc +0 -0
  51. quarchpy/connection_specific/serial/tools/__pycache__/list_ports_windows.cpython-311.pyc +0 -0
  52. quarchpy/connection_specific/serial/tools/__pycache__/miniterm.cpython-311.pyc +0 -0
  53. quarchpy/connection_specific/serial/urlhandler/__pycache__/__init__.cpython-311.pyc +0 -0
  54. quarchpy/connection_specific/serial/urlhandler/__pycache__/protocol_alt.cpython-311.pyc +0 -0
  55. quarchpy/connection_specific/serial/urlhandler/__pycache__/protocol_hwgrep.cpython-311.pyc +0 -0
  56. quarchpy/connection_specific/serial/urlhandler/__pycache__/protocol_loop.cpython-311.pyc +0 -0
  57. quarchpy/connection_specific/serial/urlhandler/__pycache__/protocol_rfc2217.cpython-311.pyc +0 -0
  58. quarchpy/connection_specific/serial/urlhandler/__pycache__/protocol_socket.cpython-311.pyc +0 -0
  59. quarchpy/connection_specific/serial/urlhandler/__pycache__/protocol_spy.cpython-311.pyc +0 -0
  60. quarchpy/connection_specific/usb_libs/MS32/__pycache__/__init__.cpython-311.pyc +0 -0
  61. quarchpy/connection_specific/usb_libs/MS64/__pycache__/__init__.cpython-311.pyc +0 -0
  62. quarchpy/connection_specific/usb_libs/__pycache__/__init__.cpython-311.pyc +0 -0
  63. quarchpy/connection_specific/usb_libs/__pycache__/libusb1.cpython-311.pyc +0 -0
  64. quarchpy/connection_specific/usb_libs/__pycache__/usb1.cpython-311.pyc +0 -0
  65. quarchpy/debug/__pycache__/SystemTest.cpython-311.pyc +0 -0
  66. quarchpy/debug/__pycache__/__init__.cpython-311.pyc +0 -0
  67. quarchpy/debug/__pycache__/__main__.cpython-311.pyc +0 -0
  68. quarchpy/debug/__pycache__/module_debug.cpython-311.pyc +0 -0
  69. quarchpy/debug/__pycache__/simple_terminal.cpython-311.pyc +0 -0
  70. quarchpy/debug/__pycache__/upgrade_quarchpy.cpython-311.pyc +0 -0
  71. quarchpy/debug/__pycache__/versionCompare.cpython-311.pyc +0 -0
  72. quarchpy/device/__pycache__/__init__.cpython-311.pyc +0 -0
  73. quarchpy/device/__pycache__/device.cpython-311.pyc +0 -0
  74. quarchpy/device/__pycache__/quarchArray.cpython-311.pyc +0 -0
  75. quarchpy/device/__pycache__/quarchPPM.cpython-311.pyc +0 -0
  76. quarchpy/device/__pycache__/quarchQPS.cpython-311.pyc +0 -0
  77. quarchpy/device/__pycache__/scanDevices.cpython-311.pyc +0 -0
  78. quarchpy/device/scanDevices.py +1 -1
  79. quarchpy/disk_test/__pycache__/AbsDiskFinder.cpython-311.pyc +0 -0
  80. quarchpy/disk_test/__pycache__/DiskTargetSelection.cpython-311.pyc +0 -0
  81. quarchpy/disk_test/__pycache__/__init__.cpython-311.pyc +0 -0
  82. quarchpy/disk_test/__pycache__/iometerDiskFinder.cpython-311.pyc +0 -0
  83. quarchpy/docs/CHANGES.rst +10 -0
  84. quarchpy/docs/__pycache__/__init__.cpython-311.pyc +0 -0
  85. quarchpy/docs/__pycache__/conf.cpython-311.pyc +0 -0
  86. quarchpy/docs/_build/doctrees/CHANGES.doctree +0 -0
  87. quarchpy/docs/_build/doctrees/environment.pickle +0 -0
  88. quarchpy/docs/_build/doctrees/index.doctree +0 -0
  89. quarchpy/docs/_build/doctrees/readme.doctree +0 -0
  90. quarchpy/docs/_build/doctrees/source/changelog.doctree +0 -0
  91. quarchpy/docs/_build/doctrees/source/licenses.doctree +0 -0
  92. quarchpy/docs/_build/doctrees/source/modules.doctree +0 -0
  93. quarchpy/docs/_build/doctrees/source/quarchpy.calibration.doctree +0 -0
  94. quarchpy/docs/_build/doctrees/source/quarchpy.config_files.doctree +0 -0
  95. quarchpy/docs/_build/doctrees/source/quarchpy.connection_specific.doctree +0 -0
  96. quarchpy/docs/_build/doctrees/source/quarchpy.debug.doctree +0 -0
  97. quarchpy/docs/_build/doctrees/source/quarchpy.device.doctree +0 -0
  98. quarchpy/docs/_build/doctrees/source/quarchpy.disk_test.doctree +0 -0
  99. quarchpy/docs/_build/doctrees/source/quarchpy.doctree +0 -0
  100. quarchpy/docs/_build/doctrees/source/quarchpy.fio.doctree +0 -0
  101. quarchpy/docs/_build/doctrees/source/quarchpy.iometer.doctree +0 -0
  102. quarchpy/docs/_build/doctrees/source/quarchpy.qis.doctree +0 -0
  103. quarchpy/docs/_build/doctrees/source/quarchpy.qps.doctree +0 -0
  104. quarchpy/docs/_build/doctrees/source/quarchpy.user_interface.doctree +0 -0
  105. quarchpy/docs/_build/doctrees/source/quarchpy.utilities.doctree +0 -0
  106. quarchpy/docs/_build/doctrees/source/readme.doctree +0 -0
  107. quarchpy/docs/_build/html/CHANGES.html +142 -116
  108. quarchpy/docs/_build/html/_sources/CHANGES.rst.txt +20 -1
  109. quarchpy/docs/_build/html/_static/alabaster.css +9 -14
  110. quarchpy/docs/_build/html/_static/basic.css +1 -1
  111. quarchpy/docs/_build/html/_static/pygments.css +1 -1
  112. quarchpy/docs/_build/html/genindex.html +33 -11
  113. quarchpy/docs/_build/html/index.html +65 -62
  114. quarchpy/docs/_build/html/objects.inv +0 -0
  115. quarchpy/docs/_build/html/py-modindex.html +11 -7
  116. quarchpy/docs/_build/html/readme.html +6 -7
  117. quarchpy/docs/_build/html/search.html +6 -7
  118. quarchpy/docs/_build/html/searchindex.js +1 -1
  119. quarchpy/docs/_build/html/source/changelog.html +201 -171
  120. quarchpy/docs/_build/html/source/licenses.html +6 -7
  121. quarchpy/docs/_build/html/source/modules.html +7 -8
  122. quarchpy/docs/_build/html/source/quarchpy.calibration.html +6 -7
  123. quarchpy/docs/_build/html/source/quarchpy.config_files.html +6 -7
  124. quarchpy/docs/_build/html/source/quarchpy.connection_specific.html +9 -8
  125. quarchpy/docs/_build/html/source/quarchpy.debug.html +6 -7
  126. quarchpy/docs/_build/html/source/quarchpy.device.html +81 -12
  127. quarchpy/docs/_build/html/source/quarchpy.disk_test.html +6 -7
  128. quarchpy/docs/_build/html/source/quarchpy.fio.html +34 -9
  129. quarchpy/docs/_build/html/source/quarchpy.html +18 -8
  130. quarchpy/docs/_build/html/source/quarchpy.iometer.html +6 -7
  131. quarchpy/docs/_build/html/source/quarchpy.qis.html +23 -28
  132. quarchpy/docs/_build/html/source/quarchpy.qps.html +8 -9
  133. quarchpy/docs/_build/html/source/quarchpy.user_interface.html +15 -8
  134. quarchpy/docs/_build/html/source/quarchpy.utilities.html +6 -7
  135. quarchpy/docs/_build/html/source/readme.html +6 -7
  136. quarchpy/fio/__pycache__/FIO_interface.cpython-311.pyc +0 -0
  137. quarchpy/fio/__pycache__/__init__.cpython-311.pyc +0 -0
  138. quarchpy/fio/__pycache__/fioDiskFinder.cpython-311.pyc +0 -0
  139. quarchpy/fio/__pycache__/performanceClass.cpython-311.pyc +0 -0
  140. quarchpy/fio/__pycache__/test_performance_class.cpython-311.pyc +0 -0
  141. quarchpy/iometer/__pycache__/__init__.cpython-311.pyc +0 -0
  142. quarchpy/iometer/__pycache__/gen_iometer_template.cpython-311.pyc +0 -0
  143. quarchpy/iometer/__pycache__/iometerFuncs.cpython-311.pyc +0 -0
  144. quarchpy/qis/__pycache__/StreamHeaderInfo.cpython-311.pyc +0 -0
  145. quarchpy/qis/__pycache__/__init__.cpython-311.pyc +0 -0
  146. quarchpy/qis/__pycache__/qisFuncs.cpython-311.pyc +0 -0
  147. quarchpy/qis/qisFuncs.py +4 -3
  148. quarchpy/qps/__pycache__/__init__.cpython-311.pyc +0 -0
  149. quarchpy/qps/__pycache__/qpsFuncs.cpython-311.pyc +0 -0
  150. quarchpy/qps/qpsFuncs.py +3 -1
  151. quarchpy/user_interface/__pycache__/__init__.cpython-311.pyc +0 -0
  152. quarchpy/user_interface/__pycache__/user_interface.cpython-311.pyc +0 -0
  153. quarchpy/user_interface/user_interface.py +17 -1
  154. quarchpy/utilities/__pycache__/BitManipulation.cpython-311.pyc +0 -0
  155. quarchpy/utilities/__pycache__/TestCenter.cpython-311.pyc +0 -0
  156. quarchpy/utilities/__pycache__/TimeValue.cpython-311.pyc +0 -0
  157. quarchpy/utilities/__pycache__/Version.cpython-311.pyc +0 -0
  158. quarchpy/utilities/__pycache__/__init__.cpython-311.pyc +0 -0
  159. {quarchpy-2.1.20.dev3.dist-info → quarchpy-2.1.22.dist-info}/METADATA +11 -1
  160. {quarchpy-2.1.20.dev3.dist-info → quarchpy-2.1.22.dist-info}/RECORD +162 -155
  161. quarchpy/.idea/inspectionProfiles/Project_Default.xml +0 -26
  162. quarchpy/connection_specific/QPS/qis/qis_lib/CInterface-1.7.04.jar +0 -0
  163. quarchpy/connection_specific/QPS/qis/qis_lib/QuarchCommon-0.2.6.jar +0 -0
  164. quarchpy/connection_specific/QPS/qis/qis_lib/commons-csv-1.8.jar +0 -0
  165. quarchpy/connection_specific/QPS/qis/qis_lib/commons-lang3-3.2.1.jar +0 -0
  166. quarchpy/connection_specific/QPS/qis/resources/filters/filters.csv +0 -1004
  167. quarchpy/connection_specific/QPS/qis/resources/filters/iec_filters.xml.bak +0 -26
  168. quarchpy/connection_specific/QPS/qps_lib/QuarchCommon-0.2.6.jar +0 -0
  169. quarchpy/connection_specific/QPS/qps_lib/commons-lang3-3.12.0.jar +0 -0
  170. quarchpy/connection_specific/QPS/qps_lib/jfxtras-labs-8.0-r6.jar +0 -0
  171. quarchpy/connection_specific/QPS/qps_lib/opencsv-5.9.jar +0 -0
  172. quarchpy/connection_specific/QPS/qps_lib/qis-1.39.jar +0 -0
  173. quarchpy/connection_specific/connection_QIS.py.bak +0 -1738
  174. quarchpy/debug/TextScanIP.py +0 -11
  175. quarchpy/device/device.py.bak +0 -504
  176. quarchpy/device/quarchPPM.py.bak +0 -67
  177. quarchpy/device/quarchQPS.py.bak +0 -396
  178. quarchpy/device/scanDevices.py.bak +0 -661
  179. quarchpy/docs/CHANGES.rst.bak +0 -364
  180. quarchpy/qps/qpsFuncs.py.bak +0 -231
  181. quarchpy/user_interface/user_interface.py.bak +0 -749
  182. quarchpy/utilities/TestCenter.py.bak +0 -150
  183. {quarchpy-2.1.20.dev3.dist-info → quarchpy-2.1.22.dist-info}/WHEEL +0 -0
  184. {quarchpy-2.1.20.dev3.dist-info → quarchpy-2.1.22.dist-info}/top_level.txt +0 -0
@@ -1,396 +0,0 @@
1
- from quarchpy.device import quarchDevice
2
- from quarchpy.qps import toQpsTimeStamp
3
- import os, time, datetime, sys, logging
4
-
5
- if sys.version_info[0] < 3:
6
- from StringIO import StringIO
7
- else:
8
- from io import StringIO
9
-
10
- current_milli_time = lambda: int (round (time.time() * 1000))
11
- current_second_time = lambda: int (round (time.time()))
12
-
13
- # Using standard Unix time, milliseconds since the epoch (midnight 1 January 1970 UTC)
14
- # Should avoid issues with time zones and summer time correction but the local and host
15
- # clocks should still be synchronised
16
- def qpsNowStr():
17
- return current_milli_time() # datetime supports microseconds
18
-
19
-
20
- class quarchQPS(quarchDevice):
21
- def __init__(self, quarchDevice):
22
-
23
- self.quarchDevice = quarchDevice
24
- self.ConType = quarchDevice.ConType
25
- self.ConString = quarchDevice.ConString
26
-
27
- self.connectionObj = quarchDevice.connectionObj
28
- self.IP_address = quarchDevice.connectionObj.qps.host
29
- self.port_number = quarchDevice.connectionObj.qps.port
30
-
31
- def startStream(self, directory, unserInput=True):
32
- """
33
- directory - str - desired stream dir
34
- unserInput=True - if a failure occurs userInput=True allows user to rectify problem with user input. set to False if user interaction is not available (automating).
35
- """
36
- time.sleep(1) #TODO remove this sleep once script->QPS timeing issue resolved. This works fine in the meantime
37
- return quarchStream(self.quarchDevice, directory, unserInput)
38
-
39
-
40
-
41
-
42
-
43
- class quarchStream:
44
- def __init__(self, quarchQPS, directory, unserInput=True):
45
- self.connectionObj = quarchQPS.connectionObj
46
- self.IP_address = quarchQPS.connectionObj.qps.host
47
- self.port_number = quarchQPS.connectionObj.qps.port
48
- self.ConString = quarchQPS.ConString
49
- self.ConType = quarchQPS.ConType
50
- time.sleep(1)
51
- response = self.startQPSStream(directory)
52
- if not "fail:" in response.lower():
53
- return
54
- else:
55
- if unserInput is False:
56
- raise Exception(response)
57
- else:
58
- self.failCheck(response)
59
-
60
- def startQPSStream(self, newDirectory):
61
- '''STARTS the stream '''
62
- response = self.connectionObj.qps.sendCmdVerbose("$start stream \"" + str(newDirectory)+"\"")
63
- return response
64
-
65
- def failCheck(self, response):
66
- ''' handles failed starting of stream that requires input from user to fix.'''
67
- while "fail:" in response.lower():
68
- if "Fail: Directory already exists" in response:
69
- print (response)
70
- print("Please enter a new file name:")
71
- if sys.version_info.major==3:
72
- newDir = input()
73
- else:
74
- newDir = raw_input()
75
- response = self.startQPSStream( newDir)
76
- else: # If its a failure we don't know how to handle.
77
- raise Exception(response)
78
- return response
79
-
80
- def get_stats(self, format="df"):
81
- """
82
- Returns the QPS annotation statistics grid information as a pandas dataframe object
83
-
84
- Returns
85
- -------
86
- df = : dataframe
87
- The response text from QPS. If successful "ok. Saving stats to : file_name" otherwise returns the exception thrown
88
- """
89
- command_response = self.connectionObj.qps.sendCmdVerbose("$get stats", timeout=60).strip()
90
- if command_response.startswith("Fail"):
91
- raise Exception(command_response)
92
-
93
- if format == "df":
94
- try:
95
- import warnings
96
- warnings.simplefilter(action='ignore', category=FutureWarning)
97
- if 'pandas' in sys.modules or 'pd' in sys.modules:
98
- logging.debug("Pandas already imported.")
99
- else:
100
- import pandas as pd
101
- pd.set_option('display.max_columns', None)
102
- pd.set_option('display.width', 1024)
103
- except Exception as e:
104
- logging.error(e)
105
- logging.warning("pandas not imported correctly. Continuing")
106
- pass
107
- test_data = StringIO(command_response)
108
- retVal = pd.read_csv(test_data, sep=",", header=[0, 1], error_bad_lines=False)
109
- elif format == "list":
110
- retVal = []
111
- for line in command_response.replace("\r\n","\n").split("\n"):
112
- row = []
113
- for element in line.split(","):
114
- row.append(element)
115
- retVal.append(row)
116
-
117
- return retVal
118
-
119
-
120
- def stats_to_CSV(self, file_name=""):
121
- """
122
- Saves the statistics grid to a csv file
123
-
124
- Parameters
125
- ----------
126
- file-name= : str, optional
127
- The absolute path of the file you would like to save the csv to. If left empty then a filename will be give.
128
- Default location is the path of the executable.
129
- Returns
130
- -------
131
- command_response : str or None
132
-
133
- The response text from QPS. If successful "ok. Saving stats to : file_name" otherwise returns the exception thrown
134
- """
135
- command_response = self.connectionObj.qps.sendCmdVerbose("$stats to csv \""+file_name+"\"", timeout=60)
136
- if command_response.startswith("Fail"):
137
- raise Exception(command_response)
138
- return command_response
139
-
140
- def get_custom_stats_range(self, start_time, end_time):
141
- """
142
- Returns the QPS statistics information over a specific time ignoring any set annotations.
143
-
144
- Parameters
145
- ----------
146
- start_time = : str
147
- The time in seconds you would like the stats to start this can be in integer or string format.
148
- or using the following format to specify daysDhours:minutes:seconds.milliseconds
149
- xxxDxx:xx:xx.xxxx
150
- end_time = : str
151
- The time in seconds you would like the stats to stop this can be in integer or string format
152
- or using the following format to specify daysDhours:minutes:seconds.milliseconds
153
- xxxDxx:xx:xx.xxxx
154
- Returns
155
- -------
156
- df = : dataframe
157
- The response text from QPS. If successful "ok. Saving stats to : file_name" otherwise returns the exception thrown
158
- """
159
- try:
160
- import warnings
161
- warnings.simplefilter(action='ignore', category=FutureWarning)
162
- if 'pandas' in sys.modules or 'pd' in sys.modules:
163
- logging.debug("Pandas already imported.")
164
- else:
165
- import pandas as pd
166
- pd.set_option('max_columns', None)
167
- pd.set_option('display.width', 1024)
168
- except:
169
- logging.warning("pandas not imported correctly")
170
- pass
171
- command_response = self.connectionObj.qps.sendCmdVerbose("$get custom stats range " + str(start_time)+ " " + str(end_time), timeout=60)
172
- if command_response.startswith("Fail"):
173
- raise Exception(command_response)
174
- test_data = StringIO(command_response)
175
- try:
176
- df = pd.read_csv(test_data, sep=",", header=[0,1])
177
- except Exception as e:
178
- logging.error("Unable to create pandas data frame from command response :" + str(command_response))
179
- raise e
180
- return df
181
-
182
- def takeSnapshot(self):
183
- """
184
- Triggers QPS take snapshot function and saves it in the streams directory.
185
- """
186
- command_response = self.connectionObj.qps.sendCmdVerbose("$take snapshot")
187
- if command_response.startswith("Fail"):
188
- raise Exception(command_response)
189
- return(command_response)
190
-
191
- def getStreamState(self):
192
- """
193
- Askes QPS for the stream status.
194
- QPS stream state != Module stream state.
195
- This is different from "rec stream?" cmd to the module as it will return "streaming" when the module is nolonger streaming but QPS is still receiveing stream data from the module.
196
- ei the module has stopped streaming but is emptying the stream buffer.
197
- """
198
- command_response = self.connectionObj.qps.sendCmdVerbose("$stream state")
199
- if command_response.startswith("Fail"):
200
- raise Exception(command_response)
201
- return(command_response)
202
-
203
- def addAnnotation(self, title, annotationTime = 0, extraText="", yPos="", titleColor ="", annotationColor = "", annotationType = "", annotationGroup =""):
204
- """
205
- Adds a custom annotation to stream with given parameters.
206
-
207
- Parameters
208
- ----------
209
- title= : str
210
- The title appears next to the annotation in the stream
211
- extraText= : str, optional
212
- The additional text that can be viewed when selecting the annotation
213
- yPos : str, optional
214
- The percetange of how high up the screen the annotation should appear 0 is the bottom and 100 the top
215
- titleColor : str, optional
216
- The color of the text next to the annotation in hex format 000000 to FFFFFF
217
- annotationColor : str, optional
218
- The color of the annotation marker in hex format 000000 to FFFFFF
219
- annotationGroup : str, optional
220
- The group the annotation belongs to
221
- annotationTime : int, optional
222
- The time in milliseconds after the start of the stream at which the annotation should be placed. 0 will plot the annotation live at the most recent sample
223
-
224
- Returns
225
- -------
226
- command_response : str or None
227
-
228
- The response text from QPS. "ok" if annotation successfully added
229
- """
230
- annotationTime = str(annotationTime)
231
- annotationType = annotationType.lower()
232
- if annotationType == "" or annotationType == "annotation":
233
- annotationType = "annotate"
234
- elif annotationType == "comment":
235
- pass # already in the correct format for command
236
- else:
237
- retString = "Fail annotationType must be 'annotation' or 'comment'"
238
- logging.warning(retString)
239
- return retString
240
-
241
- # If the function has already been passed the XML string to give to QPS
242
- if ("<<" in title.replace(" ", "")):
243
- annotationString = str(title)
244
- else:
245
- annotationString = "<"
246
-
247
- if annotationTime == "0":
248
- # Use current time
249
- annotationTime = qpsNowStr()
250
- elif(annotationTime.startswith("e")):
251
- pass
252
- else:
253
- # Convert timestamp to QPS format
254
- #annotationTime = toQpsTimeStamp(annotationTime)
255
- annotationTime = str(annotationTime)
256
-
257
-
258
- if title != "":
259
- annotationString += "<text>" + str(title) + "</text>"
260
- if extraText != "":
261
- annotationString += "<extraText>" + str(extraText) + "</extraText>"
262
- if yPos != "":
263
- annotationString += "<yPos>" + str(yPos) + "</yPos>"
264
- if titleColor != "":
265
- annotationString += "<textColor>" + str(titleColor) + "</textColor>"
266
- if annotationColor != "":
267
- annotationString += "<color>" + str(annotationColor) + "</color>"
268
- if annotationGroup != "":
269
- annotationString += "<userType>" + str(annotationGroup) + "</userType>"
270
- annotationString += ">"
271
-
272
- # command is sent on newline so \n needs to be chnaged to \\n which is changed back just before printing in qps.
273
- annotationString = annotationString.replace("\n", "\\n")
274
- logging.debug("Time sending to QPS:" + str(annotationTime))
275
- return self.connectionObj.qps.sendCmdVerbose("$" +annotationType+" "+str(annotationTime)+" "+annotationString)
276
-
277
- def addComment(self, title, commentTime = 0, extraText="", yPos="", titleColor ="", commentColor = "", annotationType = "", annotationGroup =""):
278
- #Comments are just annotations that do not affect the statistics grid.
279
- #This function was kept to be backwards compatible and is a simple pass through to add annotation.
280
- if annotationType == "":
281
- annotationType = "comment"
282
- return self.addAnnotation(title = title, annotationTime=commentTime, extraText=extraText, yPos=yPos, titleColor=titleColor, annotationColor=commentColor, annotationType=annotationType, annotationGroup=annotationGroup)
283
-
284
- def saveCSV(self,filePath, linesPerFile=None, cr=None, delimiter=None, timeout=60):
285
- """
286
- Saves the stream to csv file at specified location
287
-
288
- Parameters
289
- ----------
290
- filePath= : str
291
- The file path that ou would like the CSV file saved to.
292
- linesPerFile= : str, optional
293
- The number of lines per CSV file. Can be any int number or "all"
294
- cr : bool, optional
295
- Whether the end of line terminator should include a carriage return.
296
- delimiter : str, optional
297
- The delimiter to be used by the csv file.
298
- timeout : str, otptional
299
- The timeout to wait for a response from QPS
300
-
301
- Returns
302
- -------
303
- command_response : str or None
304
- The response text from QPS. "ok" if command is successful or the stack trace if exception thrown
305
- """
306
- args = ""
307
-
308
- if linesPerFile != None:
309
- args +=" -l" + str(linesPerFile)
310
- if cr !=None:
311
- if cr is True:
312
- args+= " -cyes"
313
- elif cr is False:
314
- args += " -cno"
315
- if delimiter !=None:
316
- args += " -s"+delimiter
317
-
318
- #, filePath, linesPerFile, cr, delimiter
319
- return self.connectionObj.qps.sendCmdVerbose("$save csv \"" + filePath + "\" " + args, timeout=timeout)
320
-
321
- def createChannel(self, channelName, channelGroup, baseUnits, usePrefix):
322
- #Conditions to convert false / true inputs to specification input
323
- if usePrefix == False:
324
- usePrefix = "no"
325
- if usePrefix == True:
326
- usePrefix = "yes"
327
-
328
- return self.connectionObj.qps.sendCmdVerbose("$create channel " + channelName + " " + channelGroup + " " + baseUnits + " " + usePrefix)
329
-
330
- def hideChannel(self, channelSpecifier):
331
- return self.connectionObj.qps.sendCmdVerbose("$hide channel " + channelSpecifier)
332
-
333
- def showChannel(self, channelSpecifier):
334
- return self.connectionObj.qps.sendCmdVerbose("$show channel " + channelSpecifier)
335
-
336
- def myChannels(self):
337
- return self.connectionObj.qps.sendCmdVerbose("$channels")
338
-
339
- def channels(self):
340
- return self.connectionObj.qps.sendCmdVerbose("$channels").splitlines()
341
-
342
- def stopStream(self):
343
- return self.connectionObj.qps.sendCmdVerbose("$stop stream")
344
-
345
- def stopStreamAndAllowBufferToEmpty(self, checkInterval=0.5):
346
- self.stopStream()
347
- streamState = self.getStreamState().lower()
348
- while "running" in streamState:
349
- logging.debug("Stream buffer still emptying: "+ streamState)
350
- time.sleep(checkInterval)
351
- streamState = self.getStreamState().lower()
352
- logging.debug("QPS no longer Streaming: " + streamState)
353
-
354
- def hideAllDefaultChannels(self):
355
-
356
- #TODO query QPS / Device for all channel names and hide all of them
357
- #All Default Channels
358
- self.hideChannel ("3.3v:voltage")
359
- self.hideChannel ("3v3:voltage")
360
- self.hideChannel ("5v:voltage")
361
- self.hideChannel ("12v:voltage")
362
- self.hideChannel ("3v3:current")
363
- self.hideChannel ("3.3v:current")
364
- self.hideChannel ("5v:current")
365
- self.hideChannel ("12v:current")
366
- self.hideChannel ("3v3:power")
367
- self.hideChannel ("3.3v:power")
368
- self.hideChannel ("5v:power")
369
- self.hideChannel ("12v:power")
370
- self.hideChannel ("tot:power")
371
- #Default PAM channels
372
- self.hideChannel ("perst#:digital")
373
- self.hideChannel ("wake#:digital")
374
- self.hideChannel ("lkreq#:digital")
375
- self.hideChannel ("smclk:digital")
376
- self.hideChannel ("smdat:digital")
377
-
378
- #function to add a data point the the stream
379
- #time value will default to current time if none passed
380
- def addDataPoint(self, channelName, groupName, dataValue, dataPointTime=0, timeFormat="unix"):
381
- '''
382
- channelName - str
383
- groupName - str
384
- dataValue - int/float value of the data point
385
- dataPointTime=0 - time of the data point
386
- timeFormat="unix" - the format of the given time
387
- '''
388
- if dataPointTime == None or dataPointTime == 0:
389
- dataPointTime = qpsNowStr()
390
- else:
391
- dataPointTime = toQpsTimeStamp (dataPointTime)
392
-
393
- #print ("printing command: $log " + channelName + " " + groupName + " " + str(dataPointTime) + " " + str(dataValue))
394
- #self.connectionObj.qps.sendCmdVerbose("$log " + channelName + " " + groupName + " " + str(dataPointTime) + " " + str(dataValue))
395
-
396
- self.connectionObj.qps.sendCmdVerbose("$stream data add " + channelName+ " " + groupName+ " " + str(dataPointTime)+ " " + str(dataValue)+ " " + timeFormat)