Skip to content

device ¤

Functions:

Name Description
read

read from the device

write

write to the device

read(device: BaseDriver, quantity: str, channel: str = 'CH1', **kwds) -> Any ¤

read from the device

Parameters:

Name Type Description Default
device _type_

device handler

required
quantity str

hardware attribute, e.g., Waveform/Power/Offset

required
channel int

channel string. Defaults to 'CH1'.

'CH1'

Returns:

Name Type Description
Any Any

result from the device

Source code in quark/runtime/device.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def read(device: BaseDriver, quantity: str, channel: str = 'CH1', **kwds) -> Any:
    """read from the device

    Args:
        device (_type_): device handler
        quantity (str): hardware attribute, e.g., Waveform/Power/Offset
        channel (int, optional): channel string. Defaults to 'CH1'.

    Returns:
        Any: result from the device
    """
    chstr = channel[2:]
    ch = int(chstr) if chstr.isdigit() else chstr
    return device.getValue(quantity, ch=ch, **kwds)

write(device: BaseDriver, quantity: str, value: Any, channel: str = 'CH1', **kwds) ¤

write to the device

Parameters:

Name Type Description Default
device _type_

device handler

required
quantity str

hardware attribute, e.g., Waveform/Power/Offset

required
value Any

value to be written

required
channel int

channel string. Defaults to 'CH1'.

'CH1'
Source code in quark/runtime/device.py
44
45
46
47
48
49
50
51
52
53
54
55
def write(device: BaseDriver, quantity: str, value: Any, channel: str = 'CH1', **kwds):
    """write to the device

    Args:
        device (_type_): device handler
        quantity (str): hardware attribute, e.g., Waveform/Power/Offset
        value (Any): value to be written
        channel (int, optional): channel string. Defaults to 'CH1'.
    """
    chstr = channel[2:]
    ch = int(chstr) if chstr.isdigit() else chstr
    return device.setValue(quantity, value, ch=ch, **kwds)