NextGenPumpBase
- class py_hplc.pump_base.NextGenPumpBase(device: Union[serial.serialutil.SerialBase, str], logger: Optional[logging.Logger] = None)[source]
Serial port wrapper for MX-class Teledyne pumps.
- command(command: str) str[source]
Sends the passed string to the pump as bytes.
- Parameters
command (str) – The message to be sent as bytes
- Raises
PumpError – An exception describing what went wrong. In this case, the pump
reponded with an error code. –
- Returns
A dictionary containing at least a “response” key with the pump’s response
- Return type
dict[str, Any]
- open() None[source]
Opens the serial port associated with the pump.
Raises: SerialException: An exception describing what went wrong. In this case, we failed to open the serial port.
- read() str[source]
Reads a single message from the pump.
- Returns
The pump’s response, or an empty string if no response is given.
- Return type
str
- write(msg: str, delay: float = 0.015) str[source]
Write a command to the pump.
A response will be returned after at least (2 * delay) seconds. Delay defaults to 0.015 s per pump documentation. If we fail to get a “OK” response, we will wait 0.1 s before attempting again, up to 3 attempts.
Returns the pump’s response string.
- Raises
PumpError – An exception describing what went wrong. In this case, we
couldn't get a response. –
- Parameters
msg (str) – The message to be sent
delay (float, optional) – A float in seconds. Defaults to 0.015.
- Returns
the pump’s decoded response string
- Return type
str
- property is_open: bool
Returns a boolean representing if the internal serial port is open.