Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dripline/extensions/asteval_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def __init__(self,
'''
Args:
asteval_format_response_string (str): function definition to format response. Default: "def f(response): return response"
*kwargs -> FormatEntity
'''
FormatEntity.__init__(self, **kwargs)
self.asteval_format_response_string = asteval_format_response_string # has to contain a definition "def f(response): ... return value"
Expand All @@ -30,7 +29,7 @@ def __init__(self,

@calibrate()
def on_get(self):
result =FormatEntity.on_get(self)
result = FormatEntity.on_get(self)
raw = result["value_raw"]
processed_result = self.evaluator(f"f('{raw}')")
logger.debug(f"processed_result: {repr(processed_result)}")
Expand Down
2 changes: 1 addition & 1 deletion dripline/extensions/cmd_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ def __init__(self, cmd_str=None, **kwargs):
self.cmd_str = cmd_str

def cmd(self):
logger.debug("Command function was successfully called")
logger.debug("in cmd function")
return self.service.send_to_device([self.cmd_str])
21 changes: 13 additions & 8 deletions dripline/extensions/ethernet_huber_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def bytes_to_ints(value):

class EthernetHuberService(EthernetSCPIService):
'''
A fairly specific subclass of Service for connecting to ethernet-capable thermo fisher devices.
A fairly specific subclass of Service for connecting to ethernet-capable huber devices.
In particular, devices must support a half-duplex serial communication with header information, variable length data-payload and a checksum.
'''
def __init__(self, **kwargs):
Expand Down Expand Up @@ -125,27 +125,32 @@ def __init__(self,
get_str: hexstring of the command, e.g. 20
'''
if get_str is None:
raise ValueError('<get_str is required to __init__ ThermoFisherHexGetEntity instance')
raise ValueError('<get_str is required to __init__ HuberEntity instance')
else:
self.cmd_str = get_str
self.get_str = get_str
self.offset = offset
self.nbytes = nbytes
self.numeric = numeric
Entity.__init__(self, **kwargs)

def convert_to_float(self, hex_str):
val = int(hex_str, 16)
if val > int("7FFF", 16):
val = val - int("FFFF", 16) - 1
return val/100.

@calibrate()
def on_get(self):
# setup cmd here
to_send = [self.cmd_str]
to_send = [self.get_str]
logger.debug(f'Send cmd in hexstr: {to_send[0]}')
result = self.service.send_to_device(to_send)
logger.debug(f'raw result is: {result}')
result = result[self.offset: self.offset+self.nbytes]
if self.numeric:
val = int(result, 16)
if val > int("7FFF", 16):
val = val - int("FFFF", 16) - 1
result = val / 100.
logger.debug("is numeric")
result = self.convert_to_float(result)
logger.debug(f'extracted result is: {result}')
return result

def on_set(self, value):
Expand Down
2 changes: 1 addition & 1 deletion dripline/extensions/pfeiffer_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self,
Args:
parameter (int): number of the parameter as documented in the manual"
datatype (str): one of ["bool_old", "uint", "ureal", "string", "bool", "ushort", "uexpo", "str16", "str8"
unit_address (int): number of the unit address, allwoed range: 1-16
unit_address (int): number of the unit address, allowed range: 1-16
'''
Entity.__init__(self, **kwargs)
self.parameter = parameter
Expand Down