Skip to content

VERTICAL_AXIS_DS1074Z

Download Flojoy Studio to try this app
Change the vertical axis display for the DS1074Z oscilloscope. Both the scale and offset can be changed. The scale sets the size of one section. The full window is 12 times the scale. The offset and scale setting will be rounded up to the nearest available setting by the DS1074Z. If 'query_set' is set to query the trigger settings will be queried and left unchanged. Requires a CONNECTION_DS1074Z block at the start of the app to connect with the instrument. The VISA address will then be listed under 'connection'. This block should also work with compatible DS1000Z oscilloscopes Params: connection : VisaConnection The VISA address (requires the CONNECTION_DS1074Z block). query_set : select: "query" or "set" the trigger settings. channel : select Which channel to set or query. offset : float Set the vertical axis offset. scale : float Set the vertical axis scale. Returns: out : String Summary of the vertical axis settings.
Python Code
from flojoy import flojoy, DataContainer, String, VisaConnection
from typing import Optional, Literal


@flojoy(inject_connection=True)
def VERTICAL_AXIS_DS1074Z(
    connection: VisaConnection,
    query_set: Literal["query", "set"] = "query",
    channel: Literal["ch1", "ch2", "ch3", "ch4"] = "ch1",
    offset: float = 0,
    scale: float = 1e-3,
    default: Optional[DataContainer] = None,
) -> String:
    """Change the vertical axis display for the DS1074Z oscilloscope.

    Both the scale and offset can be changed. The scale sets the size
    of one section. The full window is 12 times the scale. The offset and scale
    setting will be rounded up to the nearest available setting by the DS1074Z.

    If 'query_set' is set to query the trigger settings will be queried and
    left unchanged.

    Requires a CONNECTION_DS1074Z block at the start of the app to connect with
    the instrument. The VISA address will then be listed under 'connection'.

    This block should also work with compatible DS1000Z oscilloscopes

    Parameters
    ----------
    connection: VisaConnection
        The VISA address (requires the CONNECTION_DS1074Z block).
    query_set: select:
        "query" or "set" the trigger settings.
    channel: select
        Which channel to set or query.
    offset: float
        Set the vertical axis offset.
    scale: float
        Set the vertical axis scale.

    Returns
    -------
    String
        Summary of the vertical axis settings.
    """

    rigol = connection.get_handle()

    match channel:
        case "ch1":
            channel = "CHANnel1"
        case "ch2":
            channel = "CHANnel2"
        case "ch3":
            channel = "CHANnel3"
        case "ch4":
            channel = "CHANnel4"

    match query_set:
        case "query":
            unit = rigol.ask_raw(f":{channel}:UNITs?")

            s = "Offset: "
            s += str(rigol.ask_raw(f":{channel}:OFFSet?"))
            s += f"{unit}; "

            s += "Scale: "
            s += str(rigol.ask_raw(f":{channel}:SCALe?"))
            s += unit

        case "set":
            rigol.write_raw(f":{channel}:SCALe {scale}")
            rigol.write_raw(f":{channel}:OFFSet {offset}")
            unit = rigol.ask_raw(f":{channel}:UNITs?")

            s = "Offset: "
            s += str(offset)
            s += f"{unit}; "

            s += "Scale: "
            s += str(scale)
            s += unit

    return String(s=s)

Find this Flojoy Block on GitHub

Videos

Control DS1000Z oscilloscope with Flojoy

Example App

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map