# Keithley 6517B Electrometer

class pymeasure.instruments.keithley.Keithley6517B(adapter, name='Keithley 6517B Electrometer/High Resistance Meter', **kwargs)

  Bases: `KeithleyBuffer`, `SCPIMixin`, `Instrument`

  Represents the Keithley 6517B ElectroMeter and provides a high-level interface for interacting with the instrument.

      keithley = Keithley6517B("GPIB::1")

      keithley.apply_voltage()              # Sets up to source current
      keithley.source_voltage_range = 200   # Sets the source voltage
                                            # range to 200 V
      keithley.source_voltage = 20          # Sets the source voltage to 20 V
      keithley.enable_source()              # Enables the source output

      keithley.measure_resistance()         # Sets up to measure resistance

      keithley.ramp_to_voltage(50)          # Ramps the voltage to 50 V
      print(keithley.resistance)            # Prints the resistance in Ohms

      keithley.shutdown()                   # Ramps the voltage to 0 V
                                            # and disables output

  apply_voltage(voltage_range=None)

    Configures the instrument to apply a source voltage, and uses an auto range unless a voltage range is specified.

    Parameters:

      voltage_range – A `voltage_range` value or None (activates auto range)

  auto_range_source()

    Configures the source to use an automatic range.

  property buffer_data

    Get a numpy array of values from the buffer.

  property buffer_points

    An integer property that controls the number of buffer points. This does not represent actual points in the buffer, but the configuration value instead.

  check_errors()

    Read all errors from the instrument.

    Returns:

      List of error entries.

  check_get_errors()

    Check for errors after having gotten a property and log them.

    Called if `check_get_errors=True` is set for that property.

    If you override this method, you may choose to raise an Exception for certain errors.

    Returns:

      List of error entries.

  check_set_errors()

    Check for errors after having set a property and log them.

    Called if `check_set_errors=True` is set for that property.

    If you override this method, you may choose to raise an Exception for certain errors.

    Returns:

      List of error entries.

  clear()

    Clear the instrument status byte.

  property complete

    Get the synchronization bit.

    This property allows synchronization between a controller and a device. The Operation Complete query places an ASCII character 1 into the device’s Output Queue when all pending selected device operations have been finished.

  config_buffer(points=64, delay=0)

    Configures the measurement buffer for a number of points, to be taken with a specified delay.

    Parameters:

      - points – The number of points in the buffer.

      - delay – The delay time in seconds.

  property current

    Reads the current in Amps, if configured for this reading.

  property current_nplc

    A floating point property that controls the number of power line cycles (NPLC) for the DC current measurements, which sets the integration period and measurement speed. Takes values from 0.01 to 10, where 0.1, 1, and 10 are Fast, Medium, and Slow respectively.

  property current_range

    A floating point property that controls the measurement current range in Amps, which can take values between -20 and +20 mA. Auto-range is disabled when this property is set.

  disable_buffer()

    Disables the connection between measurements and the buffer, but does not abort the measurement process.

  disable_source()

    Disables the source of current or voltage depending on the configuration of the instrument.

  enable_source()

    Enables the source of current or voltage depending on the configuration of the instrument.

  static extract_value(result)

    extracts the physical value from a result object returned by the instrument

  property id

    Get the identification of the instrument.

  is_buffer_full()

    Returns True if the buffer is full of measurements.

  measure_current(nplc=1, current=0.000105, auto_range=True)

    Configures the measurement of current.

    Parameters:

      - nplc – Number of power line cycles (NPLC) from 0.01 to 10

      - current – Upper limit of current in Amps, from -21 mA to 21 mA

      - auto_range – Enables auto_range if True, else uses the current_range attribute

  measure_resistance(nplc=1, resistance=210000.0, auto_range=True)

    Configures the measurement of resistance.

    Parameters:

      - nplc – Number of power line cycles (NPLC) from 0.01 to 10

      - resistance – Upper limit of resistance in Ohms, from -210 POhms to 210 POhms

      - auto_range – Enables auto_range if True, else uses the resistance_range attribute

  measure_voltage(nplc=1, voltage=21.0, auto_range=True)

    Configures the measurement of voltage.

    Parameters:

      - nplc – Number of power line cycles (NPLC) from 0.01 to 10

      - voltage – Upper limit of voltage in Volts, from -1000 V to 1000 V

      - auto_range – Enables auto_range if True, else uses the voltage_range attribute

  property next_error

    Get the next error in the queue. If you want to read and log all errors, use `check_errors()` instead.

  property options

    Get the device options installed.

  ramp_to_voltage(target_voltage, steps=30, pause=0.02)

    Ramps to a target voltage from the set voltage value over a certain number of linear steps, each separated by a pause duration.

    Parameters:

      - target_voltage – A voltage in Volts

      - steps – An integer number of steps

      - pause – A pause duration in seconds to wait between steps

  read(**kwargs)

    Read up to (excluding) read_termination or the whole read buffer.

  read_binary_values(**kwargs)

    Read binary values from the device.

  read_bytes(count, **kwargs)

    Read a certain number of bytes from the instrument.

    Parameters:

      - count (int) – Number of bytes to read. A value of -1 indicates to read the whole read buffer.

      - kwargs – Keyword arguments for the adapter.

    Returns bytes:

      Bytes response of the instrument (including termination).

  reset()

    Resets the instrument and clears the queue.

  reset_buffer()

    Resets the buffer.

  property resistance

    Reads the resistance in Ohms, if configured for this reading.

  property resistance_nplc

    A floating point property that controls the number of power line cycles (NPLC) for the 2-wire resistance measurements, which sets the integration period and measurement speed. Takes values from 0.01 to 10, where 0.1, 1, and 10 are Fast, Medium, and Slow respectively.

  property resistance_range

    A floating point property that controls the resistance range in Ohms, which can take values from 0 to 100e18 Ohms. Auto-range is disabled when this property is set.

  shutdown()

    Ensures that the current or voltage is turned to zero and disables the output.

  property source_current_resistance_limit

    Boolean property which enables or disables resistance current limit

  property source_enabled

    Reads a boolean value that is True if the source is enabled.

  property source_voltage

    A floating point property that controls the source voltage in Volts.

  property source_voltage_range

    A floating point property that controls the source voltage range in Volts, which can take values from -1000 to 1000 V. Auto-range is disabled when this property is set.

  start_buffer()

    Starts the buffer.

  property status

    Get the status byte and Master Summary Status bit.

  stop_buffer()

    Aborts the buffering measurement, by stopping the measurement arming and triggering sequence. If possible, a Selected Device Clear (SDC) is used.

  trigger()

    Executes a bus trigger, which can be used when `trigger_on_bus()` is configured.

  trigger_immediately()

    Configures measurements to be taken with the internal trigger at the maximum sampling rate.

  trigger_on_bus()

    Configures the trigger to detect events based on the bus trigger, which can be activated by `trigger()`.

  property voltage

    Reads the voltage in Volts, if configured for this reading.

  property voltage_nplc

    A floating point property that controls the number of power line cycles (NPLC) for the DC voltage measurements, which sets the integration period and measurement speed. Takes values from 0.01 to 10, where 0.1, 1, and 10 are Fast, Medium, and Slow respectively.

  property voltage_range

    A floating point property that controls the measurement voltage range in Volts, which can take values from -1000 to 1000 V. Auto-range is disabled when this property is set.

  wait_for(query_delay=None)

    Wait for some time. Used by ‘ask’ to wait before reading.

    Parameters:

      query_delay – Delay between writing and reading in seconds. None is default delay.

  wait_for_buffer(should_stop=<function KeithleyBuffer.<lambda>>, timeout=60, interval=0.1)

    Blocks the program, waiting for a full buffer. This function returns early if the `should_stop` function returns True or the timeout is reached before the buffer is full.

    Parameters:

      - should_stop – A function that returns True when this function should return early

      - timeout – A time in seconds after which this function should return early

      - interval – A time in seconds for how often to check if the buffer is full

  write(command, **kwargs)

    Write a string command to the instrument appending write_termination.

    Parameters:

      - command – command string to be sent to the instrument

      - kwargs – Keyword arguments for the adapter.

  write_binary_values(command, values, *args, **kwargs)

    Write binary values to the device.

    Parameters:

      - command – Command to send.

      - values – The values to transmit.

      - **kwargs (*args,) – Further arguments to hand to the Adapter.

  write_bytes(content, **kwargs)

    Write the bytes content to the instrument.