# Keysight DSOX1102G Oscilloscope

class pymeasure.instruments.keysight.KeysightDSOX1102G(adapter, **kwargs)

  Bases: `Instrument`

  Represents the Keysight DSOX1102G Oscilloscope interface for interacting with the instrument.

  Refer to the Keysight DSOX1102G Oscilloscope Programmer’s Guide for further details about using the lower-level methods to interact directly with the scope.

      scope = KeysightDSOX1102G(resource)
      scope.autoscale()
      ch1_data_array, ch1_preamble = scope.download_data(source="channel1", points=2000)
      # ...
      scope.shutdown()

  Known issues:

  - The digitize command will be completed before the operation is. May lead to VI_ERROR_TMO (timeout) occuring when sending commands immediately after digitize. Current fix: if deemed necessary, add delay between digitize and follow-up command to scope.

  property acquisition_mode

    A string parameter that sets the acquisition mode. Can be “realtime” or “segmented”.

  property acquisition_type

    A string parameter that sets the type of data acquisition. Can be “normal”, “average”, “hresolution”, or “peak”.

  ask(command)

    Writes the command to the instrument through the adapter and returns the read response.

    Parameters:

      command – command string to be sent to the instrument

  autoscale()

    Autoscale displayed channels.

  check_errors()

    Read all errors from the instrument.

  clear()

    Clears the instrument status byte

  clear_status()

    Clear device status.

  static control(get_command, set_command, docs, validator=<function Instrument.<lambda>>, values=(), map_values=False, get_process=<function Instrument.<lambda>>, set_process=<function Instrument.<lambda>>, check_set_errors=False, check_get_errors=False, **kwargs)

    Returns a property for the class based on the supplied commands. This property may be set and read from the instrument.

    Parameters:

      - get_command – A string command that asks for the value

      - set_command – A string command that writes the value

      - docs – A docstring that will be included in the documentation

      - validator – A function that takes both a value and a group of valid values and returns a valid value, while it otherwise raises an exception

      - values – A list, tuple, range, or dictionary of valid values, that can be used as to map values if `map_values` is True.

      - map_values – A boolean flag that determines if the values should be interpreted as a map

      - get_process – A function that take a value and allows processing before value mapping, returning the processed value

      - set_process – A function that takes a value and allows processing before value mapping, returning the processed value

      - check_set_errors – Toggles checking errors after setting

      - check_get_errors – Toggles checking errors after getting

  default_setup()

    Default setup, some user settings (like preferences) remain unchanged.

  digitize(source: str)

    Acquire waveforms according to the settings of the :ACQuire commands. Ensure a delay between the digitize operation and further commands, as timeout may be reached before digitize has completed. :param source: “channel1”, “channel2”, “function”, “math”, “fft”, “abus”, or “ext”.

  download_data(source, points=62500)

    Get data from specified source of oscilloscope. Returned objects are a np.ndarray of data values (no temporal axis) and a dict of the waveform preamble, which can be used to build the corresponding time values for all data points.

    Multimeter will be stopped for proper acquisition.

    Parameters:

      - source – measurement source, can be “channel1”, “channel2”, “function”, “fft”, “wmemory1”, “wmemory2”, or “ext”.

      - points – integer number of points to acquire. Note that oscilloscope may return less points than specified, this is not an issue of this library. Can be 100, 250, 500, 1000, 2000, 5000, 10000, 20000, 50000, or 62500.

    Return data_ndarray, waveform_preamble_dict:

      see waveform_preamble property for dict format.

  download_image(format_='png', color_palette='color')

    Get image of oscilloscope screen in bytearray of specified file format.

    Parameters:

      - format – “bmp”, “bmp8bit”, or “png”

      - color_palette – “color” or “grayscale”

  factory_reset()

    Factory default setup, no user settings remain unchanged.

  property id

    Requests and returns the identification of the instrument.

  static measurement(get_command, docs, values=(), map_values=None, get_process=<function Instrument.<lambda>>, command_process=<function Instrument.<lambda>>, check_get_errors=False, **kwargs)

    Returns a property for the class based on the supplied commands. This is a measurement quantity that may only be read from the instrument, not set.

    Parameters:

      - get_command – A string command that asks for the value

      - docs – A docstring that will be included in the documentation

      - values – A list, tuple, range, or dictionary of valid values, that can be used as to map values if `map_values` is True.

      - map_values – A boolean flag that determines if the values should be interpreted as a map

      - get_process – A function that take a value and allows processing before value mapping, returning the processed value

      - command_process – A function that take a command and allows processing before executing the command, for both getting and setting

      - check_get_errors – Toggles checking errors after getting

  read()

    Reads from the instrument through the adapter and returns the response.

  reset()

    Resets the instrument.

  run()

    Starts repetitive acquisitions. This is the same as pressing the Run key on the front panel.

  static setting(set_command, docs, validator=<function Instrument.<lambda>>, values=(), map_values=False, set_process=<function Instrument.<lambda>>, check_set_errors=False, **kwargs)

    Returns a property for the class based on the supplied commands. This property may be set, but raises an exception when being read from the instrument.

    Parameters:

      - set_command – A string command that writes the value

      - docs – A docstring that will be included in the documentation

      - validator – A function that takes both a value and a group of valid values and returns a valid value, while it otherwise raises an exception

      - values – A list, tuple, range, or dictionary of valid values, that can be used as to map values if `map_values` is True.

      - map_values – A boolean flag that determines if the values should be interpreted as a map

      - set_process – A function that takes a value and allows processing before value mapping, returning the processed value

      - check_set_errors – Toggles checking errors after setting

  shutdown()

    Brings the instrument to a safe and stable state

  single()

    Causes the instrument to acquire a single trigger of data. This is the same as pressing the Single key on the front panel.

  stop()

    Stops the acquisition. This is the same as pressing the Stop key on the front panel.

  property system_setup

    A string parameter that sets up the oscilloscope. Must be in IEEE 488.2 format. It is recommended to only set a string previously obtained from this command.

  property timebase

    Read timebase setup as a dict containing the following keys: - “REF”: position on screen of timebase reference (str) - “MAIN:RANG”: full-scale timebase range (float) - “POS”: interval between trigger and reference point (float) - “MODE”: mode (str)

  property timebase_mode

    A string parameter that sets the current time base. Can be “main”, “window”, “xy”, or “roll”.

  property timebase_offset

    A float parameter that sets the time interval in seconds between the trigger event and the reference position (at center of screen by default).

  property timebase_range

    A float parameter that sets the full-scale horizontal time in seconds for the main window.

  property timebase_scale

    A float parameter that sets the horizontal scale (units per division) in seconds for the main window.

  timebase_setup(mode=None, offset=None, horizontal_range=None, scale=None)

    Set up timebase. Unspecified parameters are not modified. Modifying a single parameter might impact other parameters. Refer to oscilloscope documentation and make multiple consecutive calls to channel_setup if needed.

    Parameters:

      - mode – Timebase mode, can be “main”, “window”, “xy”, or “roll”.

      - offset – Offset in seconds between trigger and center of screen.

      - horizontal_range – Full-scale range in seconds.

      - scale – Units-per-division in seconds.

  values(command, **kwargs)

    Reads a set of values from the instrument through the adapter, passing on any key-word arguments.

  property waveform_data

    Get the binary block of sampled data points transmitted using the IEEE 488.2 arbitrary block data format.

  property waveform_format

    A string parameter that controls how the data is formatted when sent from the oscilloscope. Can be “ascii”, “word” or “byte”. Words are transmitted in big endian by default.

  property waveform_points

    An integer parameter that sets the number of waveform points to be transferred with the waveform_data method. Can be any of the following values: 100, 250, 500, 1000, 2 000, 5 000, 10 000, 20 000, 50 000, 62 500.

    Note that the oscilloscope may provide less than the specified nb of points.

  property waveform_points_mode

    A string parameter that sets the data record to be transferred with the waveform_data method. Can be “normal”, “maximum”, or “raw”.

  property waveform_preamble

    Get preamble information for the selected waveform source as a dict with the following keys: - “format”: byte, word, or ascii (str) - “type”: normal, peak detect, or average (str) - “points”: nb of data points transferred (int) - “count”: always 1 (int) - “xincrement”: time difference between data points (float) - “xorigin”: first data point in memory (float) - “xreference”: data point associated with xorigin (int) - “yincrement”: voltage difference between data points (float) - “yorigin”: voltage at center of screen (float) - “yreference”: data point associated with yorigin (int)

  property waveform_source

    A string parameter that selects the analog channel, function, or reference waveform to be used as the source for the waveform methods. Can be “channel1”, “channel2”, “function”, “fft”, “wmemory1”, “wmemory2”, or “ext”.

  write(command)

    Writes the command to the instrument through the adapter.

    Parameters:

      command – command string to be sent to the instrument