quarchpy.device package¶
Submodules¶
quarchpy.device.device module¶
-
quarchpy.device.device.
checkModuleFormat
(ConString)¶
-
class
quarchpy.device.device.
quarchDevice
(ConString, ConType='PY', timeout='5', forceFind=0)¶ Bases:
object
Allows control over a Quarch device, over a wide range of underlying connection methods. This is the core class used for control of all Quarch products.
-
closeConnection
()¶ Closes the connection to the module, freeing the module for other uses. This should always be called whern you are finished with a device.
-
openConnection
()¶ Opens the connection to the module. This will be open by default on creation of quarchDevice but this allows re-opening if required.
-
resetDevice
(timeout=10)¶ Issues a power-on-reset command to the device. Attempts to recover the connection to the module after reset. Function halts until the timeout is complete or the module is found
- Parameters
timeout (int) – Number of seconds to wait for the module to re-enumerate and become available
- Returns
result – True if the device was found and reconnected, false if it was not and we timed out
- Return type
bool
-
sendAndVerifyCommand
(commandString, responseExpected='OK', exception=True)¶ Sends a command to the device and verifies the response is as expected. This is a simple wrapper of sendCommand and helps write cleaner code in test scripts.
- Parameters
commandString (str, optional) – The text command to send to the device
commandString – The expected text response from the module.
exception (bool, optional) – If True, an exception is raised on mismatch. If False, we just return False
- Returns
result – True if we matched the response, False if we did not
- Return type
bool
- Raises
ValueError – If the response does not match AND the exception parameter is set to True
-
sendBinaryCommand
(cmd)¶
-
sendCommand
(CommandString, expectedResponse=True)¶ Executes a text based command on the device. This is the primary way of controlling a device. The full command set available to use is found in the technical manual for the device.
- Parameters
CommandString (str) – The text based command string to send to the device
- Returns
command_response – The response text from the module. Multiline responses will be seperated with LF. Some commands do not return a response and None will be returned
- Return type
str or None
-
quarchpy.device.quarchArray module¶
-
quarchpy.device.quarchArray.
isThisAnArrayController
(moduleString)¶
-
class
quarchpy.device.quarchArray.
quarchArray
(baseDevice)¶ Bases:
quarchpy.device.device.quarchDevice
-
getSubDevice
(port)¶
-
scanSubModules
()¶
-
-
class
quarchpy.device.quarchArray.
subDevice
(baseDevice, port)¶ Bases:
quarchpy.device.device.quarchDevice
-
sendCommand
(CommandString, expectedResponse=True)¶ Executes a text based command on the device. This is the primary way of controlling a device. The full command set available to use is found in the technical manual for the device.
- Parameters
CommandString (str) – The text based command string to send to the device
- Returns
command_response – The response text from the module. Multiline responses will be seperated with LF. Some commands do not return a response and None will be returned
- Return type
str or None
-
quarchpy.device.quarchPPM module¶
-
class
quarchpy.device.quarchPPM.
quarchPPM
(originObj)¶ Bases:
quarchpy.device.device.quarchDevice
-
setupPowerOutput
()¶
-
startStream
(fileName='streamData.txt', fileMaxMB=2000, streamName='Stream With No Name', streamAverage=None, releaseOnData=False, separator=', ')¶
-
stopStream
()¶
-
streamBufferStatus
()¶
-
streamInterrupt
()¶
-
streamResampleMode
(streamCom)¶
-
streamRunningStatus
()¶
-
waitStop
()¶
-
quarchpy.device.quarchQPS module¶
-
quarchpy.device.quarchQPS.
current_milli_time
()¶
-
quarchpy.device.quarchQPS.
current_second_time
()¶
-
quarchpy.device.quarchQPS.
qpsNowStr
()¶
-
class
quarchpy.device.quarchQPS.
quarchQPS
(quarchDevice)¶ Bases:
quarchpy.device.device.quarchDevice
-
getCanStream
()¶
-
startStream
(directory)¶
-
-
class
quarchpy.device.quarchQPS.
quarchStream
(quarchQPS, directory)¶ Bases:
quarchpy.device.quarchQPS.quarchQPS
-
addAnnotation
(title, annotationTime=0, extraText='', yPos='', titleColor='', annotationColor='', annotationType='', annotationGroup='')¶ Adds a custom annotation to stream with given parameters.
- Parameters
title= (str) – The title appears next to the annotation in the stream
extraText= (str, optional) – The additional text that can be viewed when selecting the annotation
yPos (str, optional) – The percetange of how high up the screen the annotation should appear 0 is the bottom and 100 the top
titleColor (str, optional) – The color of the text next to the annotation in hex format 000000 to FFFFFF
annotationColor (str, optional) – The color of the annotation marker in hex format 000000 to FFFFFF
annotationGroup (str, optional) – The group the annotation belongs to
annotationTime (int, optional) – 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
- Returns
command_response – The response text from QPS. “ok” if annotation successfully added
- Return type
str or None
-
addComment
(title, commentTime=0, extraText='', yPos='', titleColor='', commentColor='', annotationType='', annotationGroup='')¶
-
addDataPoint
(channelName, groupName, dataValue, dataPointTime=0)¶
-
channels
()¶
-
createChannel
(channelName, channelGroup, baseUnits, usePrefix)¶
-
failCheck
(newDirectory)¶
-
hideAllDefaultChannels
()¶
-
hideChannel
(channelSpecifier)¶
-
myChannels
()¶
-
showChannel
(channelSpecifier)¶
-
stopStream
()¶
-
quarchpy.device.scanDevices module¶
-
quarchpy.device.scanDevices.
get_connection_target
(module_string, scan_dictionary=None, connection_preference=None, include_conn_type=True)¶
-
quarchpy.device.scanDevices.
get_user_level_serial_number
(network_modules)¶
-
quarchpy.device.scanDevices.
listDevices
(scanDictionary)¶
-
quarchpy.device.scanDevices.
list_USB
(debuPrint=False)¶
-
quarchpy.device.scanDevices.
list_network
(target_conn='all', debugPring=False, lanTimeout=1, ipAddressLookup=None)¶
-
quarchpy.device.scanDevices.
list_serial
(debuPrint=False)¶
-
quarchpy.device.scanDevices.
lookupDevice
(ipAddressLookup, mySocket, lan_modules)¶
-
quarchpy.device.scanDevices.
mergeDict
(x, y)¶
-
quarchpy.device.scanDevices.
scanDevices
(target_conn='all', lanTimeout=1, scanInArray=True, favouriteOnly=True, filterStr=None, ipAddressLookup=None)¶
-
quarchpy.device.scanDevices.
userSelectDevice
(scanDictionary=None, scanFilterStr=None, favouriteOnly=True, message=None, title=None, nice=False, additionalOptions=None, target_conn='all')¶
Module contents¶
-
class
quarchpy.device.
quarchDevice
(ConString, ConType='PY', timeout='5', forceFind=0)¶ Bases:
object
Allows control over a Quarch device, over a wide range of underlying connection methods. This is the core class used for control of all Quarch products.
-
closeConnection
()¶ Closes the connection to the module, freeing the module for other uses. This should always be called whern you are finished with a device.
-
openConnection
()¶ Opens the connection to the module. This will be open by default on creation of quarchDevice but this allows re-opening if required.
-
resetDevice
(timeout=10)¶ Issues a power-on-reset command to the device. Attempts to recover the connection to the module after reset. Function halts until the timeout is complete or the module is found
- Parameters
timeout (int) – Number of seconds to wait for the module to re-enumerate and become available
- Returns
result – True if the device was found and reconnected, false if it was not and we timed out
- Return type
bool
-
sendAndVerifyCommand
(commandString, responseExpected='OK', exception=True)¶ Sends a command to the device and verifies the response is as expected. This is a simple wrapper of sendCommand and helps write cleaner code in test scripts.
- Parameters
commandString (str, optional) – The text command to send to the device
commandString – The expected text response from the module.
exception (bool, optional) – If True, an exception is raised on mismatch. If False, we just return False
- Returns
result – True if we matched the response, False if we did not
- Return type
bool
- Raises
ValueError – If the response does not match AND the exception parameter is set to True
-
sendBinaryCommand
(cmd)¶
-
sendCommand
(CommandString, expectedResponse=True)¶ Executes a text based command on the device. This is the primary way of controlling a device. The full command set available to use is found in the technical manual for the device.
- Parameters
CommandString (str) – The text based command string to send to the device
- Returns
command_response – The response text from the module. Multiline responses will be seperated with LF. Some commands do not return a response and None will be returned
- Return type
str or None
-
-
class
quarchpy.device.
quarchArray
(baseDevice)¶ Bases:
quarchpy.device.device.quarchDevice
-
getSubDevice
(port)¶
-
scanSubModules
()¶
-
-
class
quarchpy.device.
subDevice
(baseDevice, port)¶ Bases:
quarchpy.device.device.quarchDevice
-
sendCommand
(CommandString, expectedResponse=True)¶ Executes a text based command on the device. This is the primary way of controlling a device. The full command set available to use is found in the technical manual for the device.
- Parameters
CommandString (str) – The text based command string to send to the device
- Returns
command_response – The response text from the module. Multiline responses will be seperated with LF. Some commands do not return a response and None will be returned
- Return type
str or None
-
-
class
quarchpy.device.
quarchPPM
(originObj)¶ Bases:
quarchpy.device.device.quarchDevice
-
setupPowerOutput
()¶
-
startStream
(fileName='streamData.txt', fileMaxMB=2000, streamName='Stream With No Name', streamAverage=None, releaseOnData=False, separator=', ')¶
-
stopStream
()¶
-
streamBufferStatus
()¶
-
streamInterrupt
()¶
-
streamResampleMode
(streamCom)¶
-
streamRunningStatus
()¶
-
waitStop
()¶
-
-
class
quarchpy.device.
quarchQPS
(quarchDevice)¶ Bases:
quarchpy.device.device.quarchDevice
-
getCanStream
()¶
-
startStream
(directory)¶
-
-
class
quarchpy.device.
quarchStream
(quarchQPS, directory)¶ Bases:
quarchpy.device.quarchQPS.quarchQPS
-
addAnnotation
(title, annotationTime=0, extraText='', yPos='', titleColor='', annotationColor='', annotationType='', annotationGroup='')¶ Adds a custom annotation to stream with given parameters.
- Parameters
title= (str) – The title appears next to the annotation in the stream
extraText= (str, optional) – The additional text that can be viewed when selecting the annotation
yPos (str, optional) – The percetange of how high up the screen the annotation should appear 0 is the bottom and 100 the top
titleColor (str, optional) – The color of the text next to the annotation in hex format 000000 to FFFFFF
annotationColor (str, optional) – The color of the annotation marker in hex format 000000 to FFFFFF
annotationGroup (str, optional) – The group the annotation belongs to
annotationTime (int, optional) – 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
- Returns
command_response – The response text from QPS. “ok” if annotation successfully added
- Return type
str or None
-
addComment
(title, commentTime=0, extraText='', yPos='', titleColor='', commentColor='', annotationType='', annotationGroup='')¶
-
addDataPoint
(channelName, groupName, dataValue, dataPointTime=0)¶
-
channels
()¶
-
createChannel
(channelName, channelGroup, baseUnits, usePrefix)¶
-
failCheck
(newDirectory)¶
-
hideAllDefaultChannels
()¶
-
hideChannel
(channelSpecifier)¶
-
myChannels
()¶
-
showChannel
(channelSpecifier)¶
-
stopStream
()¶
-
-
quarchpy.device.
qpsNowStr
()¶
-
quarchpy.device.
scanDevices
(target_conn='all', lanTimeout=1, scanInArray=True, favouriteOnly=True, filterStr=None, ipAddressLookup=None)¶
-
quarchpy.device.
listDevices
(scanDictionary)¶
-
quarchpy.device.
userSelectDevice
(scanDictionary=None, scanFilterStr=None, favouriteOnly=True, message=None, title=None, nice=False, additionalOptions=None, target_conn='all')¶
-
quarchpy.device.
get_connection_target
(module_string, scan_dictionary=None, connection_preference=None, include_conn_type=True)¶